Import Geant4 11.3.0.beta source tree
This commit is contained in:
@@ -28,31 +28,29 @@
|
||||
/// \brief Implementation of the Par01ActionInitialization class
|
||||
|
||||
#include "Par01ActionInitialization.hh"
|
||||
#include "Par01PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "Par01PrimaryGeneratorAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01ActionInitialization::Par01ActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
{}
|
||||
Par01ActionInitialization::Par01ActionInitialization() : G4VUserActionInitialization() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01ActionInitialization::~Par01ActionInitialization()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
}
|
||||
void Par01ActionInitialization::BuildForMaster() const {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01ActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new Par01PrimaryGeneratorAction);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
|
||||
#include "Par01CalorimeterHit.hh"
|
||||
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4ThreadLocal G4Allocator<Par01CalorimeterHit>* Par01CalorimeterHitAllocator=nullptr;
|
||||
G4ThreadLocal G4Allocator<Par01CalorimeterHit>* Par01CalorimeterHitAllocator = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -48,42 +48,44 @@ Par01CalorimeterHit::Par01CalorimeterHit()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01CalorimeterHit::Par01CalorimeterHit(G4LogicalVolume* logVol)
|
||||
:fLogV(logVol)
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01CalorimeterHit::~Par01CalorimeterHit()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01CalorimeterHit::Par01CalorimeterHit(const Par01CalorimeterHit &right)
|
||||
: G4VHit()
|
||||
Par01CalorimeterHit::Par01CalorimeterHit(G4LogicalVolume* logVol) : fLogV(logVol)
|
||||
{
|
||||
fEdep = right.fEdep;
|
||||
fPosition = right.fPosition;
|
||||
fRot = right.fRot;
|
||||
fLogV = right.fLogV;
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const Par01CalorimeterHit& Par01CalorimeterHit::operator=(const Par01CalorimeterHit &right)
|
||||
Par01CalorimeterHit::~Par01CalorimeterHit()
|
||||
{
|
||||
fEdep = right.fEdep;
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01CalorimeterHit::Par01CalorimeterHit(const Par01CalorimeterHit& right) : G4VHit()
|
||||
{
|
||||
fEdep = right.fEdep;
|
||||
fPosition = right.fPosition;
|
||||
fRot = right.fRot;
|
||||
fLogV = right.fLogV;
|
||||
fRot = right.fRot;
|
||||
fLogV = right.fLogV;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const Par01CalorimeterHit& Par01CalorimeterHit::operator=(const Par01CalorimeterHit& right)
|
||||
{
|
||||
fEdep = right.fEdep;
|
||||
fPosition = right.fPosition;
|
||||
fRot = right.fRot;
|
||||
fLogV = right.fLogV;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool Par01CalorimeterHit::operator==(const Par01CalorimeterHit &right) const
|
||||
G4bool Par01CalorimeterHit::operator==(const Par01CalorimeterHit& right) const
|
||||
{
|
||||
return (this==&right) ? true : false;
|
||||
return (this == &right) ? true : false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -91,24 +93,19 @@ G4bool Par01CalorimeterHit::operator==(const Par01CalorimeterHit &right) const
|
||||
void Par01CalorimeterHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Transform3D trans(fRot,fPosition);
|
||||
if (pVVisManager) {
|
||||
G4Transform3D trans(fRot, fPosition);
|
||||
G4VisAttributes attribs;
|
||||
const G4VisAttributes* pVA = fLogV->GetVisAttributes();
|
||||
if(pVA) attribs = *pVA;
|
||||
G4Colour colour(1.,0.,0.);
|
||||
if (pVA) attribs = *pVA;
|
||||
G4Colour colour(1., 0., 0.);
|
||||
attribs.SetColour(colour);
|
||||
attribs.SetForceWireframe(false);
|
||||
attribs.SetForceSolid(true);
|
||||
pVVisManager->Draw(*fLogV,attribs,trans);
|
||||
pVVisManager->Draw(*fLogV, attribs, trans);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01CalorimeterHit::Print()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Par01CalorimeterHit::Print() {}
|
||||
|
||||
@@ -30,26 +30,23 @@
|
||||
//
|
||||
|
||||
#include "Par01CalorimeterSD.hh"
|
||||
|
||||
#include "Par01CalorimeterHit.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01CalorimeterSD::Par01CalorimeterSD( G4String name,
|
||||
G4int nCells,
|
||||
G4String colName )
|
||||
: G4VSensitiveDetector(name),
|
||||
fNumberOfCells(nCells),
|
||||
fHCID(-1)
|
||||
Par01CalorimeterSD::Par01CalorimeterSD(G4String name, G4int nCells, G4String colName)
|
||||
: G4VSensitiveDetector(name), fNumberOfCells(nCells), fHCID(-1)
|
||||
{
|
||||
G4String HCname;
|
||||
collectionName.insert(HCname=colName);
|
||||
collectionName.insert(HCname = colName);
|
||||
fCellID = new G4int[fNumberOfCells];
|
||||
}
|
||||
|
||||
@@ -57,19 +54,17 @@ Par01CalorimeterSD::Par01CalorimeterSD( G4String name,
|
||||
|
||||
Par01CalorimeterSD::~Par01CalorimeterSD()
|
||||
{
|
||||
delete [] fCellID;
|
||||
delete[] fCellID;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01CalorimeterSD::Initialize(G4HCofThisEvent*)
|
||||
{
|
||||
fCalCollection = new Par01CalorimeterHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
for(G4int j=0;j<fNumberOfCells;j++)
|
||||
{
|
||||
fCellID[j] = -1;
|
||||
}
|
||||
fCalCollection = new Par01CalorimeterHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
for (G4int j = 0; j < fNumberOfCells; j++) {
|
||||
fCellID[j] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -77,59 +72,53 @@ void Par01CalorimeterSD::Initialize(G4HCofThisEvent*)
|
||||
G4bool Par01CalorimeterSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
if(edep<=0.) return false;
|
||||
|
||||
auto hist = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
|
||||
if (edep <= 0.) return false;
|
||||
|
||||
auto hist = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
|
||||
const G4VPhysicalVolume* physVol = hist->GetVolume();
|
||||
G4int copyID = hist->GetReplicaNumber();
|
||||
|
||||
if(fCellID[copyID]==-1)
|
||||
{
|
||||
Par01CalorimeterHit* calHit =
|
||||
new Par01CalorimeterHit(physVol->GetLogicalVolume());
|
||||
calHit->SetEdep( edep );
|
||||
G4AffineTransform aTrans = hist->GetHistory()->GetTopTransform();
|
||||
aTrans.Invert();
|
||||
calHit->SetPos(aTrans.NetTranslation());
|
||||
calHit->SetRot(aTrans.NetRotation());
|
||||
G4int icell = fCalCollection->insert( calHit );
|
||||
fCellID[copyID] = icell - 1;
|
||||
if(verboseLevel>0)
|
||||
{ G4cout << " New Calorimeter Hit on CellID " << copyID << G4endl; }
|
||||
|
||||
if (fCellID[copyID] == -1) {
|
||||
Par01CalorimeterHit* calHit = new Par01CalorimeterHit(physVol->GetLogicalVolume());
|
||||
calHit->SetEdep(edep);
|
||||
G4AffineTransform aTrans = hist->GetHistory()->GetTopTransform();
|
||||
aTrans.Invert();
|
||||
calHit->SetPos(aTrans.NetTranslation());
|
||||
calHit->SetRot(aTrans.NetRotation());
|
||||
G4int icell = fCalCollection->insert(calHit);
|
||||
fCellID[copyID] = icell - 1;
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << " New Calorimeter Hit on CellID " << copyID << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*fCalCollection)[fCellID[copyID]]->AddEdep( edep );
|
||||
if(verboseLevel>0)
|
||||
{ G4cout << " Energy added to CellID " << copyID << G4endl; }
|
||||
}
|
||||
else {
|
||||
(*fCalCollection)[fCellID[copyID]]->AddEdep(edep);
|
||||
if (verboseLevel > 0) {
|
||||
G4cout << " Energy added to CellID " << copyID << G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01CalorimeterSD::EndOfEvent(G4HCofThisEvent*HCE)
|
||||
void Par01CalorimeterSD::EndOfEvent(G4HCofThisEvent* HCE)
|
||||
{
|
||||
if(fHCID<0)
|
||||
{ fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
|
||||
HCE->AddHitsCollection( fHCID, fCalCollection );
|
||||
if (fHCID < 0) {
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
}
|
||||
HCE->AddHitsCollection(fHCID, fCalCollection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01CalorimeterSD::clear()
|
||||
{
|
||||
}
|
||||
void Par01CalorimeterSD::clear() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01CalorimeterSD::DrawAll()
|
||||
{
|
||||
}
|
||||
void Par01CalorimeterSD::DrawAll() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01CalorimeterSD::PrintAll()
|
||||
{
|
||||
}
|
||||
void Par01CalorimeterSD::PrintAll() {}
|
||||
|
||||
@@ -29,135 +29,122 @@
|
||||
//
|
||||
//
|
||||
#include "Par01DetectorConstruction.hh"
|
||||
|
||||
#include "Par01CalorimeterSD.hh"
|
||||
#include "Par01EMShowerModel.hh"
|
||||
#include "Par01PiModel.hh"
|
||||
|
||||
#include "G4Box.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4ElementTable.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4MaterialTable.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4ElementTable.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4ProductionCuts.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01DetectorConstruction::Par01DetectorConstruction()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01DetectorConstruction::~Par01DetectorConstruction()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* Par01DetectorConstruction::Construct()
|
||||
{
|
||||
G4cout << "\nPar01DetectorConstruction....\n" << G4endl;
|
||||
|
||||
|
||||
//--------- Material definition ---------
|
||||
// Get nist material manager
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
|
||||
// Build materials
|
||||
G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* csi = nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
|
||||
G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* csi = nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
|
||||
G4Material* helium = nistManager->FindOrBuildMaterial("G4_He");
|
||||
G4Material* iron = nistManager->FindOrBuildMaterial("G4_Fe");
|
||||
G4Material* iron = nistManager->FindOrBuildMaterial("G4_Fe");
|
||||
|
||||
|
||||
//--------- G4VSolid, G4LogicalVolume, G4VPhysicalVolume ---------
|
||||
|
||||
|
||||
//--------------
|
||||
// World:
|
||||
//--------------
|
||||
G4Box *WorldBox= new G4Box("WorldBox",400*cm, 400*cm, 400*cm);
|
||||
G4LogicalVolume *WorldLog=new G4LogicalVolume(WorldBox,air,
|
||||
"WorldLogical", 0, 0, 0);
|
||||
G4PVPlacement *WorldPhys=new G4PVPlacement(0,G4ThreeVector(),
|
||||
"WorldPhysical",
|
||||
WorldLog,
|
||||
0,false,0);
|
||||
G4Box* WorldBox = new G4Box("WorldBox", 400 * cm, 400 * cm, 400 * cm);
|
||||
G4LogicalVolume* WorldLog = new G4LogicalVolume(WorldBox, air, "WorldLogical", 0, 0, 0);
|
||||
G4PVPlacement* WorldPhys =
|
||||
new G4PVPlacement(0, G4ThreeVector(), "WorldPhysical", WorldLog, 0, false, 0);
|
||||
// Size of detectors:
|
||||
G4double detectSize = 125*cm;
|
||||
|
||||
G4double detectSize = 125 * cm;
|
||||
|
||||
//-----------------------------
|
||||
// "Drift Chamber":
|
||||
// Not used in parameterisation.
|
||||
//-----------------------------
|
||||
// -- Logical volume:
|
||||
G4Box *driftChamberBox
|
||||
= new G4Box("DriftChamberSolid", detectSize, detectSize, 40*cm);
|
||||
G4LogicalVolume *driftChamberLog
|
||||
= new G4LogicalVolume(driftChamberBox,helium,
|
||||
"DriftChamberLogical", 0, 0, 0);
|
||||
G4Box* driftChamberBox = new G4Box("DriftChamberSolid", detectSize, detectSize, 40 * cm);
|
||||
G4LogicalVolume* driftChamberLog =
|
||||
new G4LogicalVolume(driftChamberBox, helium, "DriftChamberLogical", 0, 0, 0);
|
||||
// -- Placement:
|
||||
// G4PVPlacement *driftChamberPhys =
|
||||
new G4PVPlacement(0,G4ThreeVector(0., 0., 50*cm),
|
||||
"DriftChamberPhysical",
|
||||
driftChamberLog,
|
||||
WorldPhys,false,0);
|
||||
|
||||
new G4PVPlacement(0, G4ThreeVector(0., 0., 50 * cm), "DriftChamberPhysical", driftChamberLog,
|
||||
WorldPhys, false, 0);
|
||||
|
||||
//--------------------------
|
||||
// "Calorimeter": used in
|
||||
// parameterisation below
|
||||
//--------------------------
|
||||
// -- Logical volume:
|
||||
G4Box *calorimeterBox
|
||||
= new G4Box("CalorimeterSolid", detectSize, detectSize, 20*cm);
|
||||
G4LogicalVolume *calorimeterLog = new G4LogicalVolume(calorimeterBox,air,
|
||||
"CalorimeterLogical", 0, 0, 0);
|
||||
G4Box* calorimeterBox = new G4Box("CalorimeterSolid", detectSize, detectSize, 20 * cm);
|
||||
G4LogicalVolume* calorimeterLog =
|
||||
new G4LogicalVolume(calorimeterBox, air, "CalorimeterLogical", 0, 0, 0);
|
||||
// -- Placement:
|
||||
G4PVPlacement *calorimeterPhys = new G4PVPlacement(0,G4ThreeVector(0., 0., 120*cm),
|
||||
"CalorimeterPhysical",
|
||||
calorimeterLog,
|
||||
WorldPhys,false,0);
|
||||
|
||||
G4PVPlacement* calorimeterPhys = new G4PVPlacement(
|
||||
0, G4ThreeVector(0., 0., 120 * cm), "CalorimeterPhysical", calorimeterLog, WorldPhys, false, 0);
|
||||
|
||||
//--------------------------------------
|
||||
// The calorimeter is filled with
|
||||
// crystals:
|
||||
//--------------------------------------
|
||||
// -- Logical volume:
|
||||
G4double CrystalX = 2.5*cm;
|
||||
G4double CrystalX = 2.5 * cm;
|
||||
G4double CrystalY = CrystalX;
|
||||
G4double CrystalZ = 20*cm;
|
||||
G4Box *CrystalSolid = new G4Box("CrystalSolid", CrystalX, CrystalY, CrystalZ);
|
||||
fCrystalLog = new G4LogicalVolume(CrystalSolid,csi,
|
||||
"CrystalLogical", 0, 0, 0);
|
||||
|
||||
G4String tName1("Crystal"); // Allow all target physicals to share
|
||||
G4double CrystalZ = 20 * cm;
|
||||
G4Box* CrystalSolid = new G4Box("CrystalSolid", CrystalX, CrystalY, CrystalZ);
|
||||
fCrystalLog = new G4LogicalVolume(CrystalSolid, csi, "CrystalLogical", 0, 0, 0);
|
||||
|
||||
G4String tName1("Crystal"); // Allow all target physicals to share
|
||||
// same name (delayed copy)
|
||||
|
||||
|
||||
// -- and placements inside the calorimeter:
|
||||
G4int copyNo=0;
|
||||
G4int copyNo = 0;
|
||||
G4double xTlate, yTlate;
|
||||
fnX = 48;
|
||||
fnY = 48;
|
||||
for (G4int j = 0; j < fnY; j++)
|
||||
{
|
||||
yTlate = -detectSize + 3*CrystalY + j*2*CrystalY;
|
||||
for (G4int i = 0; i < fnX; i++)
|
||||
{
|
||||
xTlate = -detectSize + 3*CrystalX + i*2*CrystalX;
|
||||
new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0*cm),
|
||||
tName1,
|
||||
fCrystalLog,
|
||||
calorimeterPhys,false,copyNo++);
|
||||
}
|
||||
for (G4int j = 0; j < fnY; j++) {
|
||||
yTlate = -detectSize + 3 * CrystalY + j * 2 * CrystalY;
|
||||
for (G4int i = 0; i < fnX; i++) {
|
||||
xTlate = -detectSize + 3 * CrystalX + i * 2 * CrystalX;
|
||||
new G4PVPlacement(0, G4ThreeVector(xTlate, yTlate, 0 * cm), tName1, fCrystalLog,
|
||||
calorimeterPhys, false, copyNo++);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------
|
||||
// "Hadron Calorimeter": used
|
||||
@@ -165,97 +152,85 @@ G4VPhysicalVolume* Par01DetectorConstruction::Construct()
|
||||
// a parallel geometry
|
||||
//--------------------------
|
||||
// -- Logical volume:
|
||||
G4Box *hadCaloBox
|
||||
= new G4Box("HadCaloSolid", detectSize, detectSize, 50*cm);
|
||||
G4LogicalVolume *hadCaloLog = new G4LogicalVolume(hadCaloBox,air,
|
||||
"HadCaloLogical", 0, 0, 0);
|
||||
G4Box* hadCaloBox = new G4Box("HadCaloSolid", detectSize, detectSize, 50 * cm);
|
||||
G4LogicalVolume* hadCaloLog = new G4LogicalVolume(hadCaloBox, air, "HadCaloLogical", 0, 0, 0);
|
||||
// -- Placement:
|
||||
G4PVPlacement *hadCaloPhys = new G4PVPlacement(0,G4ThreeVector(0., 0., 200*cm),
|
||||
"HadCaloPhysical",
|
||||
hadCaloLog,
|
||||
WorldPhys,false,0);
|
||||
|
||||
G4PVPlacement* hadCaloPhys = new G4PVPlacement(
|
||||
0, G4ThreeVector(0., 0., 200 * cm), "HadCaloPhysical", hadCaloLog, WorldPhys, false, 0);
|
||||
|
||||
//--------------------------------------
|
||||
// The calorimeter is filled with
|
||||
// towers:
|
||||
//--------------------------------------
|
||||
// -- Logical volume:
|
||||
G4double TowerX = 5*cm;
|
||||
G4double TowerX = 5 * cm;
|
||||
G4double TowerY = TowerX;
|
||||
G4double TowerZ = 45*cm;
|
||||
G4Box *TowerSolid = new G4Box("TowerSolid", TowerX, TowerY, TowerZ);
|
||||
fTowerLog = new G4LogicalVolume(TowerSolid,iron,
|
||||
"TowerLogical", 0, 0, 0);
|
||||
|
||||
G4double TowerZ = 45 * cm;
|
||||
G4Box* TowerSolid = new G4Box("TowerSolid", TowerX, TowerY, TowerZ);
|
||||
fTowerLog = new G4LogicalVolume(TowerSolid, iron, "TowerLogical", 0, 0, 0);
|
||||
|
||||
G4String tName2("Tower");
|
||||
|
||||
|
||||
// -- and placements inside the calorimeter:
|
||||
copyNo=0;
|
||||
copyNo = 0;
|
||||
fnXhad = 23;
|
||||
fnYhad = 23;
|
||||
for (G4int jj = 0; jj < fnYhad; jj++)
|
||||
{
|
||||
yTlate = -detectSize + 3*TowerY + jj*2*TowerY;
|
||||
for (G4int i = 0; i < fnXhad; i++)
|
||||
{
|
||||
xTlate = -detectSize + 3*TowerX + i*2*TowerX;
|
||||
new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0*cm),
|
||||
tName2,
|
||||
fTowerLog,
|
||||
hadCaloPhys,false,copyNo++);
|
||||
}
|
||||
for (G4int jj = 0; jj < fnYhad; jj++) {
|
||||
yTlate = -detectSize + 3 * TowerY + jj * 2 * TowerY;
|
||||
for (G4int i = 0; i < fnXhad; i++) {
|
||||
xTlate = -detectSize + 3 * TowerX + i * 2 * TowerX;
|
||||
new G4PVPlacement(0, G4ThreeVector(xTlate, yTlate, 0 * cm), tName2, fTowerLog, hadCaloPhys,
|
||||
false, copyNo++);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// -- Makes the calorimeterLog volume becoming a G4Region:
|
||||
G4Region* caloRegion = new G4Region("EM_calo_region");
|
||||
caloRegion->AddRootLogicalVolume(calorimeterLog);
|
||||
std::vector<double> cuts;
|
||||
cuts.push_back(1.0*mm);cuts.push_back(1.0*mm);cuts.push_back(1.0*mm);cuts.push_back(1.0*mm);
|
||||
caloRegion->SetProductionCuts(new G4ProductionCuts());
|
||||
caloRegion->GetProductionCuts()->SetProductionCuts(cuts);
|
||||
}
|
||||
|
||||
// Makes had. calo a region to:
|
||||
G4Region* hadRegion = new G4Region("HAD_calo_region");
|
||||
hadRegion->AddRootLogicalVolume(hadCaloLog);
|
||||
cuts.clear();
|
||||
cuts.push_back(1.0*cm);cuts.push_back(1.0*cm);cuts.push_back(1.0*cm);cuts.push_back(1.0*cm);
|
||||
hadRegion->SetProductionCuts(new G4ProductionCuts());
|
||||
hadRegion->GetProductionCuts()->SetProductionCuts(cuts);
|
||||
// -- Makes the calorimeterLog volume becoming a G4Region:
|
||||
G4Region* caloRegion = new G4Region("EM_calo_region");
|
||||
caloRegion->AddRootLogicalVolume(calorimeterLog);
|
||||
std::vector<double> cuts;
|
||||
cuts.push_back(1.0 * mm);
|
||||
cuts.push_back(1.0 * mm);
|
||||
cuts.push_back(1.0 * mm);
|
||||
cuts.push_back(1.0 * mm);
|
||||
caloRegion->SetProductionCuts(new G4ProductionCuts());
|
||||
caloRegion->GetProductionCuts()->SetProductionCuts(cuts);
|
||||
|
||||
// Makes had. calo a region to:
|
||||
G4Region* hadRegion = new G4Region("HAD_calo_region");
|
||||
hadRegion->AddRootLogicalVolume(hadCaloLog);
|
||||
cuts.clear();
|
||||
cuts.push_back(1.0 * cm);
|
||||
cuts.push_back(1.0 * cm);
|
||||
cuts.push_back(1.0 * cm);
|
||||
cuts.push_back(1.0 * cm);
|
||||
hadRegion->SetProductionCuts(new G4ProductionCuts());
|
||||
hadRegion->GetProductionCuts()->SetProductionCuts(cuts);
|
||||
|
||||
//--------- Visualization attributes -------------------------------
|
||||
WorldLog->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
|
||||
auto driftchamberTubeVisAtt
|
||||
= new G4VisAttributes(G4Colour(0.0,1.0,0.0));
|
||||
auto driftchamberTubeVisAtt = new G4VisAttributes(G4Colour(0.0, 1.0, 0.0));
|
||||
driftchamberTubeVisAtt->SetForceWireframe(true);
|
||||
driftChamberLog->SetVisAttributes(driftchamberTubeVisAtt);
|
||||
|
||||
auto calorimeterBoxVisAtt
|
||||
= new G4VisAttributes(G4Colour(0.0,0.0,1.0));
|
||||
|
||||
auto calorimeterBoxVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0));
|
||||
calorimeterBoxVisAtt->SetForceWireframe(true);
|
||||
calorimeterLog->SetVisAttributes(calorimeterBoxVisAtt);
|
||||
|
||||
auto crystalVisAtt
|
||||
= new G4VisAttributes(G4Colour(1.0,0.0,0.0));
|
||||
|
||||
auto crystalVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0));
|
||||
crystalVisAtt->SetForceWireframe(true);
|
||||
fCrystalLog->SetVisAttributes(crystalVisAtt);
|
||||
|
||||
auto hadCaloBoxVisAtt
|
||||
= new G4VisAttributes(G4Colour(1.0,0.0,1.0));
|
||||
auto hadCaloBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 1.0));
|
||||
hadCaloBoxVisAtt->SetForceWireframe(true);
|
||||
hadCaloLog->SetVisAttributes(hadCaloBoxVisAtt);
|
||||
|
||||
auto towerVisAtt
|
||||
= new G4VisAttributes(G4Colour(0.5,0.0,1.0));
|
||||
|
||||
auto towerVisAtt = new G4VisAttributes(G4Colour(0.5, 0.0, 1.0));
|
||||
towerVisAtt->SetForceWireframe(true);
|
||||
fTowerLog->SetVisAttributes(towerVisAtt);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
//-----------------------
|
||||
// Returns the pointer to
|
||||
// the physical world:
|
||||
@@ -270,23 +245,21 @@ void Par01DetectorConstruction::ConstructSDandField()
|
||||
//--------- Sensitive detector -------------------------------------
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
G4String calorimeterSDname = "Par01/Calorimeter";
|
||||
Par01CalorimeterSD* CalorimeterSD = new Par01CalorimeterSD( calorimeterSDname,
|
||||
fnX*fnY,
|
||||
"CalCollection" );
|
||||
SDman->AddNewDetector( CalorimeterSD );
|
||||
fCrystalLog->SetSensitiveDetector(CalorimeterSD);
|
||||
|
||||
Par01CalorimeterSD* CalorimeterSD =
|
||||
new Par01CalorimeterSD(calorimeterSDname, fnX * fnY, "CalCollection");
|
||||
SDman->AddNewDetector(CalorimeterSD);
|
||||
fCrystalLog->SetSensitiveDetector(CalorimeterSD);
|
||||
|
||||
G4String hadCalorimeterSDname = "Par01/HadronCalorimeter";
|
||||
Par01CalorimeterSD* HadCalorimeterSD = new Par01CalorimeterSD( hadCalorimeterSDname,
|
||||
fnXhad*fnYhad,
|
||||
"HadCollection" );
|
||||
SDman->AddNewDetector( HadCalorimeterSD );
|
||||
fTowerLog->SetSensitiveDetector(HadCalorimeterSD);
|
||||
|
||||
Par01CalorimeterSD* HadCalorimeterSD =
|
||||
new Par01CalorimeterSD(hadCalorimeterSDname, fnXhad * fnYhad, "HadCollection");
|
||||
SDman->AddNewDetector(HadCalorimeterSD);
|
||||
fTowerLog->SetSensitiveDetector(HadCalorimeterSD);
|
||||
|
||||
// --------------- fast simulation ----------------------------
|
||||
G4RegionStore* regionStore = G4RegionStore::GetInstance();
|
||||
|
||||
|
||||
G4Region* caloRegion = regionStore->GetRegion("EM_calo_region");
|
||||
// builds a model and sets it to the envelope of the calorimeter:
|
||||
new Par01EMShowerModel("emShowerModel",caloRegion);
|
||||
new Par01EMShowerModel("emShowerModel", caloRegion);
|
||||
}
|
||||
|
||||
@@ -29,46 +29,45 @@
|
||||
//
|
||||
//
|
||||
#include "Par01EMShowerModel.hh"
|
||||
|
||||
#include "Par01EnergySpot.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4Positron.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4TouchableHandle.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01EMShowerModel::Par01EMShowerModel(G4String modelName, G4Region* envelope)
|
||||
: G4VFastSimulationModel(modelName, envelope)
|
||||
: G4VFastSimulationModel(modelName, envelope)
|
||||
{
|
||||
fFakeStep = new G4Step();
|
||||
fFakePreStepPoint = fFakeStep->GetPreStepPoint();
|
||||
fFakeStep = new G4Step();
|
||||
fFakePreStepPoint = fFakeStep->GetPreStepPoint();
|
||||
fFakePostStepPoint = fFakeStep->GetPostStepPoint();
|
||||
fTouchableHandle = new G4TouchableHistory();
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
fCsI = nullptr;
|
||||
fTouchableHandle = new G4TouchableHistory();
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
fCsI = nullptr;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01EMShowerModel::Par01EMShowerModel(G4String modelName)
|
||||
: G4VFastSimulationModel(modelName)
|
||||
Par01EMShowerModel::Par01EMShowerModel(G4String modelName) : G4VFastSimulationModel(modelName)
|
||||
{
|
||||
fFakeStep = new G4Step();
|
||||
fFakePreStepPoint = fFakeStep->GetPreStepPoint();
|
||||
fFakeStep = new G4Step();
|
||||
fFakePreStepPoint = fFakeStep->GetPreStepPoint();
|
||||
fFakePostStepPoint = fFakeStep->GetPostStepPoint();
|
||||
fTouchableHandle = new G4TouchableHistory();
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
fCsI = nullptr;
|
||||
fTouchableHandle = new G4TouchableHistory();
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
fCsI = nullptr;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -83,10 +82,9 @@ Par01EMShowerModel::~Par01EMShowerModel()
|
||||
|
||||
G4bool Par01EMShowerModel::IsApplicable(const G4ParticleDefinition& particleType)
|
||||
{
|
||||
return
|
||||
&particleType == G4Electron::ElectronDefinition() ||
|
||||
&particleType == G4Positron::PositronDefinition() ||
|
||||
&particleType == G4Gamma::GammaDefinition();
|
||||
return &particleType == G4Electron::ElectronDefinition()
|
||||
|| &particleType == G4Positron::PositronDefinition()
|
||||
|| &particleType == G4Gamma::GammaDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -94,13 +92,12 @@ G4bool Par01EMShowerModel::IsApplicable(const G4ParticleDefinition& particleType
|
||||
G4bool Par01EMShowerModel::ModelTrigger(const G4FastTrack& fastTrack)
|
||||
{
|
||||
// Applies the parameterisation above 100 MeV:
|
||||
return fastTrack.GetPrimaryTrack()->GetKineticEnergy() > 100*MeV;
|
||||
return fastTrack.GetPrimaryTrack()->GetKineticEnergy() > 100 * MeV;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01EMShowerModel::DoIt(const G4FastTrack& fastTrack,
|
||||
G4FastStep& fastStep)
|
||||
void Par01EMShowerModel::DoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep)
|
||||
{
|
||||
// Kill the parameterised particle:
|
||||
fastStep.KillPrimaryTrack();
|
||||
@@ -109,10 +106,9 @@ void Par01EMShowerModel::DoIt(const G4FastTrack& fastTrack,
|
||||
|
||||
// split into "energy spots" energy according to the shower shape:
|
||||
Explode(fastTrack);
|
||||
|
||||
|
||||
// and put those energy spots into the crystals:
|
||||
BuildDetectorResponse();
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -125,24 +121,26 @@ void Par01EMShowerModel::Explode(const G4FastTrack& fastTrack)
|
||||
|
||||
// Reduced quantities:
|
||||
// -- critical energy in CsI:
|
||||
G4double Ec = 800*MeV/(54. + 1.2); // 54 = mean Z of CsI
|
||||
G4double Ec = 800 * MeV / (54. + 1.2); // 54 = mean Z of CsI
|
||||
G4double Energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
|
||||
G4double y = Energy/Ec;
|
||||
G4double y = Energy / Ec;
|
||||
|
||||
// compute value of parameter "a" of longitudinal profile, b assumed = 0.5
|
||||
G4double a, tmax, b(0.5), C;
|
||||
if (fastTrack.GetPrimaryTrack()->GetDefinition() == G4Gamma::GammaDefinition()) C = 0.5;
|
||||
else C = -0.5;
|
||||
if (fastTrack.GetPrimaryTrack()->GetDefinition() == G4Gamma::GammaDefinition())
|
||||
C = 0.5;
|
||||
else
|
||||
C = -0.5;
|
||||
tmax = 1.0 * (std::log(y) + C);
|
||||
a = 1.0 + b*tmax;
|
||||
a = 1.0 + b * tmax;
|
||||
|
||||
// t : reduced quantity = z/X0:
|
||||
G4double t, bt;
|
||||
if ( fCsI == nullptr ) fCsI = G4NistManager::Instance()->FindOrBuildMaterial("G4_CESIUM_IODIDE");
|
||||
G4double X0 = fCsI->GetRadlen();
|
||||
G4double t, bt;
|
||||
if (fCsI == nullptr) fCsI = G4NistManager::Instance()->FindOrBuildMaterial("G4_CESIUM_IODIDE");
|
||||
G4double X0 = fCsI->GetRadlen();
|
||||
// Moliere radius:
|
||||
G4double Es = 21*MeV;
|
||||
G4double Rm = X0*Es/Ec;
|
||||
G4double Es = 21 * MeV;
|
||||
G4double Rm = X0 * Es / Ec;
|
||||
|
||||
// axis of the shower, in global reference frame:
|
||||
G4ThreeVector xShower, yShower, zShower;
|
||||
@@ -153,41 +151,40 @@ void Par01EMShowerModel::Explode(const G4FastTrack& fastTrack)
|
||||
G4ThreeVector sShower = fastTrack.GetPrimaryTrack()->GetPosition();
|
||||
|
||||
// We shoot 100 spots of energy:
|
||||
G4int nSpots = 100;
|
||||
G4double deposit = Energy/double(nSpots);
|
||||
G4int nSpots = 100;
|
||||
G4double deposit = Energy / double(nSpots);
|
||||
Par01EnergySpot eSpot;
|
||||
eSpot.SetEnergy(deposit);
|
||||
G4ThreeVector ePoint;
|
||||
G4double z, r, phi;
|
||||
|
||||
feSpotList.clear();
|
||||
for (int i = 0; i < nSpots; i++)
|
||||
{
|
||||
// Longitudinal profile:
|
||||
// -- shoot z according to Gamma distribution:
|
||||
bt = G4RandGamma::shoot(a,1.0);
|
||||
t = bt/b;
|
||||
z = t*X0;
|
||||
|
||||
// transverse profile:
|
||||
// we set 90% of energy in one Rm,
|
||||
// the rest between 1 and 3.5 Rm:
|
||||
G4double xr = G4UniformRand();
|
||||
if (xr < 0.9) r = xr/0.9*Rm;
|
||||
else r = ((xr - 0.9)/0.1*2.5 + 1.0)*Rm;
|
||||
phi = G4UniformRand()*twopi;
|
||||
for (int i = 0; i < nSpots; i++) {
|
||||
// Longitudinal profile:
|
||||
// -- shoot z according to Gamma distribution:
|
||||
bt = G4RandGamma::shoot(a, 1.0);
|
||||
t = bt / b;
|
||||
z = t * X0;
|
||||
|
||||
// build the position:
|
||||
ePoint = sShower +
|
||||
z*zShower +
|
||||
r*std::cos(phi)*xShower + r*std::sin(phi)*yShower;
|
||||
|
||||
// and the energy spot:
|
||||
eSpot.SetPosition(ePoint);
|
||||
// transverse profile:
|
||||
// we set 90% of energy in one Rm,
|
||||
// the rest between 1 and 3.5 Rm:
|
||||
G4double xr = G4UniformRand();
|
||||
if (xr < 0.9)
|
||||
r = xr / 0.9 * Rm;
|
||||
else
|
||||
r = ((xr - 0.9) / 0.1 * 2.5 + 1.0) * Rm;
|
||||
phi = G4UniformRand() * twopi;
|
||||
|
||||
// Records the eSpot:
|
||||
feSpotList.push_back(eSpot);
|
||||
}
|
||||
// build the position:
|
||||
ePoint = sShower + z * zShower + r * std::cos(phi) * xShower + r * std::sin(phi) * yShower;
|
||||
|
||||
// and the energy spot:
|
||||
eSpot.SetPosition(ePoint);
|
||||
|
||||
// Records the eSpot:
|
||||
feSpotList.push_back(eSpot);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -195,21 +192,20 @@ void Par01EMShowerModel::Explode(const G4FastTrack& fastTrack)
|
||||
void Par01EMShowerModel::BuildDetectorResponse()
|
||||
{
|
||||
// Does the assignation of the energy spots to the sensitive volumes:
|
||||
for (size_t i = 0; i < feSpotList.size(); i++)
|
||||
{
|
||||
// Draw the energy spot:
|
||||
// feSpotList[i].Draw();
|
||||
// feSpotList[i].Print();
|
||||
|
||||
// "converts" the energy spot into the fake
|
||||
// G4Step to pass to sensitive detector:
|
||||
AssignSpotAndCallHit(feSpotList[i]);
|
||||
}
|
||||
for (size_t i = 0; i < feSpotList.size(); i++) {
|
||||
// Draw the energy spot:
|
||||
// feSpotList[i].Draw();
|
||||
// feSpotList[i].Print();
|
||||
|
||||
// "converts" the energy spot into the fake
|
||||
// G4Step to pass to sensitive detector:
|
||||
AssignSpotAndCallHit(feSpotList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01EMShowerModel::AssignSpotAndCallHit(const Par01EnergySpot &eSpot)
|
||||
void Par01EMShowerModel::AssignSpotAndCallHit(const Par01EnergySpot& eSpot)
|
||||
{
|
||||
//
|
||||
// "converts" the energy spot into the fake
|
||||
@@ -221,47 +217,36 @@ void Par01EMShowerModel::AssignSpotAndCallHit(const Par01EnergySpot &eSpot)
|
||||
// call sensitive part: taken/adapted from the stepping:
|
||||
// Send G4Step information to Hit/Dig if the volume is sensitive
|
||||
//
|
||||
G4VPhysicalVolume* pCurrentVolume =
|
||||
fFakeStep->GetPreStepPoint()->GetPhysicalVolume();
|
||||
G4VPhysicalVolume* pCurrentVolume = fFakeStep->GetPreStepPoint()->GetPhysicalVolume();
|
||||
G4VSensitiveDetector* pSensitive;
|
||||
|
||||
if( pCurrentVolume != nullptr )
|
||||
{
|
||||
pSensitive = pCurrentVolume->GetLogicalVolume()->
|
||||
GetSensitiveDetector();
|
||||
if( pSensitive != nullptr )
|
||||
{
|
||||
pSensitive->Hit(fFakeStep);
|
||||
}
|
||||
|
||||
if (pCurrentVolume != nullptr) {
|
||||
pSensitive = pCurrentVolume->GetLogicalVolume()->GetSensitiveDetector();
|
||||
if (pSensitive != nullptr) {
|
||||
pSensitive->Hit(fFakeStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01EMShowerModel::FillFakeStep(const Par01EnergySpot &eSpot)
|
||||
void Par01EMShowerModel::FillFakeStep(const Par01EnergySpot& eSpot)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// find in which volume the spot is.
|
||||
//-----------------------------------------------------------
|
||||
if (!fNaviSetup)
|
||||
{
|
||||
fpNavigator->
|
||||
SetWorldVolume(G4TransportationManager::GetTransportationManager()->
|
||||
GetNavigatorForTracking()->GetWorldVolume());
|
||||
fpNavigator->
|
||||
LocateGlobalPointAndUpdateTouchableHandle(eSpot.GetPosition(),
|
||||
G4ThreeVector(0.,0.,0.),
|
||||
fTouchableHandle,
|
||||
false);
|
||||
fNaviSetup = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fpNavigator->
|
||||
LocateGlobalPointAndUpdateTouchableHandle(eSpot.GetPosition(),
|
||||
G4ThreeVector(0.,0.,0.),
|
||||
fTouchableHandle);
|
||||
}
|
||||
if (!fNaviSetup) {
|
||||
fpNavigator->SetWorldVolume(G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->GetWorldVolume());
|
||||
fpNavigator->LocateGlobalPointAndUpdateTouchableHandle(
|
||||
eSpot.GetPosition(), G4ThreeVector(0., 0., 0.), fTouchableHandle, false);
|
||||
fNaviSetup = true;
|
||||
}
|
||||
else {
|
||||
fpNavigator->LocateGlobalPointAndUpdateTouchableHandle(
|
||||
eSpot.GetPosition(), G4ThreeVector(0., 0., 0.), fTouchableHandle);
|
||||
}
|
||||
//--------------------------------------
|
||||
// Fills attribute of the G4Step needed
|
||||
// by our sensitive detector:
|
||||
|
||||
@@ -30,17 +30,19 @@
|
||||
//
|
||||
#include "Par01EnergySpot.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01EnergySpot::Par01EnergySpot()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -53,45 +55,46 @@ Par01EnergySpot::Par01EnergySpot(const G4ThreeVector& point, G4double E)
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01EnergySpot::~Par01EnergySpot()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01EnergySpot::Draw(G4Colour *color)
|
||||
void Par01EnergySpot::Draw(G4Colour* color)
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if (pVVisManager)
|
||||
{
|
||||
G4Polyline polyline;
|
||||
G4Colour colour(1.,.5,.5);
|
||||
if (color != nullptr) colour = *color;
|
||||
polyline.SetVisAttributes(colour);
|
||||
G4ThreeVector pp(fPoint);
|
||||
// Draw a "home made" marker:
|
||||
// Will be better by using a real Marker:
|
||||
pp.setZ(pp.z()+1*cm);
|
||||
polyline.push_back(pp);
|
||||
pp.setZ(pp.z()-2*cm);
|
||||
polyline.push_back(pp);
|
||||
pp = fPoint;
|
||||
polyline.push_back(pp);
|
||||
pp.setX(pp.x()+1*cm);
|
||||
polyline.push_back(pp);
|
||||
pp.setX(pp.x()-2*cm);
|
||||
polyline.push_back(pp);
|
||||
pp = fPoint;
|
||||
polyline.push_back(pp);
|
||||
pp.setY(pp.y()+1*cm);
|
||||
polyline.push_back(pp);
|
||||
pp.setY(pp.y()-2*cm);
|
||||
polyline.push_back(pp);
|
||||
pVVisManager -> Draw(polyline);
|
||||
}
|
||||
if (pVVisManager) {
|
||||
G4Polyline polyline;
|
||||
G4Colour colour(1., .5, .5);
|
||||
if (color != nullptr) colour = *color;
|
||||
polyline.SetVisAttributes(colour);
|
||||
G4ThreeVector pp(fPoint);
|
||||
// Draw a "home made" marker:
|
||||
// Will be better by using a real Marker:
|
||||
pp.setZ(pp.z() + 1 * cm);
|
||||
polyline.push_back(pp);
|
||||
pp.setZ(pp.z() - 2 * cm);
|
||||
polyline.push_back(pp);
|
||||
pp = fPoint;
|
||||
polyline.push_back(pp);
|
||||
pp.setX(pp.x() + 1 * cm);
|
||||
polyline.push_back(pp);
|
||||
pp.setX(pp.x() - 2 * cm);
|
||||
polyline.push_back(pp);
|
||||
pp = fPoint;
|
||||
polyline.push_back(pp);
|
||||
pp.setY(pp.y() + 1 * cm);
|
||||
polyline.push_back(pp);
|
||||
pp.setY(pp.y() - 2 * cm);
|
||||
polyline.push_back(pp);
|
||||
pVVisManager->Draw(polyline);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01EnergySpot::Print()
|
||||
{
|
||||
G4cout << " Par01EnergySpot {E = " << fEnergy << "; Position = " << fPoint << " }"<< G4endl;
|
||||
G4cout << " Par01EnergySpot {E = " << fEnergy << "; Position = " << fPoint << " }" << G4endl;
|
||||
}
|
||||
|
||||
@@ -28,28 +28,32 @@
|
||||
//
|
||||
//
|
||||
#include "Par01ParallelWorldForPion.hh"
|
||||
|
||||
#include "Par01PionShowerModel.hh"
|
||||
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Region.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01ParallelWorldForPion::Par01ParallelWorldForPion(G4String worldName)
|
||||
: G4VUserParallelWorld(worldName)
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01ParallelWorldForPion::~Par01ParallelWorldForPion()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -57,48 +61,42 @@ void Par01ParallelWorldForPion::Construct()
|
||||
{
|
||||
// -- Get nist material manager
|
||||
G4NistManager* nistManager = G4NistManager::Instance();
|
||||
|
||||
|
||||
// Build materials
|
||||
G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
|
||||
|
||||
|
||||
// -------------------------------
|
||||
// Build parallel/ghost geometry:
|
||||
// -------------------------------
|
||||
|
||||
|
||||
// -- Obtain clone of mass geometry world from GetWorld() base class utility:
|
||||
G4VPhysicalVolume* ghostWorld = GetWorld();
|
||||
// -- Why needed ? No default ?
|
||||
ghostWorld->GetLogicalVolume()->SetMaterial(air);
|
||||
G4Region* parallelWorldRegion = new G4Region("ParallelWorldRegion");
|
||||
parallelWorldRegion->AddRootLogicalVolume(ghostWorld->GetLogicalVolume());
|
||||
|
||||
|
||||
// -- Create box for encompassing Elec.+Had. calorimeters together:
|
||||
G4double detectSize = 125*cm;
|
||||
G4Box *ghostBox
|
||||
= new G4Box("GhostBox", detectSize+5*cm, detectSize+5*cm, 80*cm);
|
||||
G4double detectSize = 125 * cm;
|
||||
G4Box* ghostBox = new G4Box("GhostBox", detectSize + 5 * cm, detectSize + 5 * cm, 80 * cm);
|
||||
// -- Build the subsequent logical volume:
|
||||
G4LogicalVolume* ghostLogical
|
||||
= new G4LogicalVolume(ghostBox,
|
||||
air, // -- no material : IMPOSSIBLE !!!
|
||||
"GhostLogical",
|
||||
0, 0, 0);
|
||||
G4LogicalVolume* ghostLogical = new G4LogicalVolume(ghostBox,
|
||||
air, // -- no material : IMPOSSIBLE !!!
|
||||
"GhostLogical", 0, 0, 0);
|
||||
// -- And place this logical volume in the parallel geometry:
|
||||
new G4PVPlacement(0,G4ThreeVector(0., 0., 175*cm),
|
||||
"GhostPhysical",
|
||||
ghostLogical,
|
||||
ghostWorld,false,0);
|
||||
|
||||
new G4PVPlacement(0, G4ThreeVector(0., 0., 175 * cm), "GhostPhysical", ghostLogical, ghostWorld,
|
||||
false, 0);
|
||||
|
||||
// -----------------------
|
||||
// Setup fast simulation:
|
||||
// -----------------------
|
||||
|
||||
|
||||
// -- Make Elec+Had logical volume becoming a region:
|
||||
G4cout << "Declaring region..." << G4endl;
|
||||
G4Region* ghostRegion = new G4Region("GhostCalorimeterRegion");
|
||||
G4cout << "... region declared. Setting it the ghostLogical volume..." << G4endl;
|
||||
ghostRegion->AddRootLogicalVolume(ghostLogical);
|
||||
G4cout << "... succes.\n" << G4endl;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -106,9 +104,8 @@ void Par01ParallelWorldForPion::Construct()
|
||||
void Par01ParallelWorldForPion::ConstructSD()
|
||||
{
|
||||
G4RegionStore* regionStore = G4RegionStore::GetInstance();
|
||||
|
||||
|
||||
G4Region* ghostRegion = regionStore->GetRegion("GhostCalorimeterRegion");
|
||||
// -- Attach fast simulation model (create the G4FastSimulationManager if needed):
|
||||
new Par01PionShowerModel("ghostPionShowerModel",ghostRegion);
|
||||
|
||||
new Par01PionShowerModel("ghostPionShowerModel", ghostRegion);
|
||||
}
|
||||
|
||||
@@ -30,76 +30,76 @@
|
||||
//
|
||||
#include "Par01PiModel.hh"
|
||||
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4PionMinus.hh"
|
||||
#include "G4PionPlus.hh"
|
||||
#include "G4Gamma.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01PiModel::Par01PiModel(G4Region *anEnvelope) :
|
||||
G4VFastSimulationModel("Par01PiModel",anEnvelope)
|
||||
{;}
|
||||
Par01PiModel::Par01PiModel(G4Region* anEnvelope)
|
||||
: G4VFastSimulationModel("Par01PiModel", anEnvelope)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01PiModel::~Par01PiModel()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool Par01PiModel::IsApplicable(const G4ParticleDefinition& particleType)
|
||||
{
|
||||
return
|
||||
&particleType == G4PionMinus::PionMinusDefinition() ||
|
||||
&particleType == G4PionPlus::PionPlusDefinition();
|
||||
return &particleType == G4PionMinus::PionMinusDefinition()
|
||||
|| &particleType == G4PionPlus::PionPlusDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool Par01PiModel::ModelTrigger(const G4FastTrack& fastTrack) {
|
||||
G4bool Par01PiModel::ModelTrigger(const G4FastTrack& fastTrack)
|
||||
{
|
||||
//-------------------------------------------------------------
|
||||
// UserTrigger() method: method which has to decide if
|
||||
// the parameterisation has to be applied.
|
||||
// Here ModelTrigger() asks the user (ie you) a 0/1 answer.
|
||||
//
|
||||
// Note that quantities like the local/global position/direction etc..
|
||||
// are available at this level via the fastTrack parameter (allowing
|
||||
// are available at this level via the fastTrack parameter (allowing
|
||||
// to check distance from boundaries, see below to allow the decision)
|
||||
//--------------------------------------------------------------
|
||||
G4cout << "\nPar01PiModel::ModelTrigger() called:" << G4endl;
|
||||
G4cout << "--------------------------------" << G4endl;
|
||||
G4cout << "(particle is a " << fastTrack.GetPrimaryTrack()->
|
||||
GetDefinition()->GetParticleName() << " )\n" << G4endl;
|
||||
G4cout << "--------------------------------" << G4endl;
|
||||
G4cout << "(particle is a " << fastTrack.GetPrimaryTrack()->GetDefinition()->GetParticleName()
|
||||
<< " )\n"
|
||||
<< G4endl;
|
||||
|
||||
// -- Examples of available informations:
|
||||
|
||||
// -- position:
|
||||
G4cout << " Track position: " <<
|
||||
fastTrack.GetPrimaryTrack()->GetPosition() << "(global coord.)" <<
|
||||
fastTrack.GetPrimaryTrackLocalPosition() << "(in envelope coord.)"
|
||||
<< G4endl;
|
||||
G4cout << " Track position: " << fastTrack.GetPrimaryTrack()->GetPosition()
|
||||
<< "(global coord.)" << fastTrack.GetPrimaryTrackLocalPosition() << "(in envelope coord.)"
|
||||
<< G4endl;
|
||||
|
||||
// -- direction:
|
||||
G4cout << " Track direction:" <<
|
||||
fastTrack.GetPrimaryTrack()->GetMomentum().unit() <<
|
||||
"(global coord.)" <<
|
||||
fastTrack.GetPrimaryTrackLocalDirection() << "(in envelope coord.)" <<
|
||||
G4endl;
|
||||
G4cout << " Track direction:" << fastTrack.GetPrimaryTrack()->GetMomentum().unit()
|
||||
<< "(global coord.)" << fastTrack.GetPrimaryTrackLocalDirection() << "(in envelope coord.)"
|
||||
<< G4endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01PiModel::DoIt(const G4FastTrack& fastTrack,
|
||||
G4FastStep& fastStep)
|
||||
//--------------------------------------------------------
|
||||
//
|
||||
// User method to code the parameterisation properly said.
|
||||
//
|
||||
//--------------------------------------------------------
|
||||
void Par01PiModel::DoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep)
|
||||
//--------------------------------------------------------
|
||||
//
|
||||
// User method to code the parameterisation properly said.
|
||||
//
|
||||
//--------------------------------------------------------
|
||||
{
|
||||
|
||||
//------------------------------------------------
|
||||
// The primary track continues along its direction.
|
||||
// One secondary (a photon) is added:
|
||||
@@ -113,48 +113,43 @@ void Par01PiModel::DoIt(const G4FastTrack& fastTrack,
|
||||
//------------------------------
|
||||
G4ThreeVector position;
|
||||
G4double distance;
|
||||
distance = fastTrack.GetEnvelopeSolid()->
|
||||
DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
|
||||
fastTrack.GetPrimaryTrackLocalDirection());
|
||||
position = fastTrack.GetPrimaryTrackLocalPosition() +
|
||||
distance*fastTrack.GetPrimaryTrackLocalDirection();
|
||||
|
||||
distance = fastTrack.GetEnvelopeSolid()->DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
|
||||
fastTrack.GetPrimaryTrackLocalDirection());
|
||||
position =
|
||||
fastTrack.GetPrimaryTrackLocalPosition() + distance * fastTrack.GetPrimaryTrackLocalDirection();
|
||||
|
||||
// -- set final position:
|
||||
fastStep.ProposePrimaryTrackFinalPosition(position);
|
||||
|
||||
|
||||
//---------------------------
|
||||
// Secondary:
|
||||
// Adds one "secondary":
|
||||
//---------------------------
|
||||
// -- First, user has to say how many secondaries will be created:
|
||||
fastStep.SetNumberOfSecondaryTracks(1);
|
||||
|
||||
|
||||
//------------------------
|
||||
// -- Build the secondary:
|
||||
//------------------------
|
||||
// -- direction:
|
||||
G4ParticleMomentum direction(fastTrack.GetPrimaryTrackLocalDirection());
|
||||
direction.setZ(direction.z()*0.5);
|
||||
direction.setY(direction.y()+direction.z()*0.1);
|
||||
direction = direction.unit(); // necessary ?
|
||||
|
||||
direction.setZ(direction.z() * 0.5);
|
||||
direction.setY(direction.y() + direction.z() * 0.1);
|
||||
direction = direction.unit(); // necessary ?
|
||||
|
||||
// -- dynamics (Note that many constructors exists for G4DynamicParticle
|
||||
// -- see prototype/particle+matter/particles/management/include/G4DynamicParticle.hh)
|
||||
G4DynamicParticle dynamique(G4Gamma::GammaDefinition(),
|
||||
direction,
|
||||
fastTrack.GetPrimaryTrack()->
|
||||
GetKineticEnergy()/2.);
|
||||
G4DynamicParticle dynamique(G4Gamma::GammaDefinition(), direction,
|
||||
fastTrack.GetPrimaryTrack()->GetKineticEnergy() / 2.);
|
||||
// -- position:
|
||||
G4double Dist;
|
||||
Dist = fastTrack.GetEnvelopeSolid()->
|
||||
DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
|
||||
direction);
|
||||
Dist = fastTrack.GetEnvelopeSolid()->DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
|
||||
direction);
|
||||
G4ThreeVector posi;
|
||||
posi = fastTrack.GetPrimaryTrackLocalPosition() + Dist*direction;
|
||||
|
||||
posi = fastTrack.GetPrimaryTrackLocalPosition() + Dist * direction;
|
||||
|
||||
//------------------------------------
|
||||
//-- Creation of the secondary Track:
|
||||
//------------------------------------
|
||||
fastStep.CreateSecondaryTrack(dynamique, posi,
|
||||
fastTrack.GetPrimaryTrack()->GetGlobalTime());
|
||||
fastStep.CreateSecondaryTrack(dynamique, posi, fastTrack.GetPrimaryTrack()->GetGlobalTime());
|
||||
}
|
||||
|
||||
@@ -29,44 +29,42 @@
|
||||
//
|
||||
//
|
||||
#include "Par01PionShowerModel.hh"
|
||||
|
||||
#include "Par01EnergySpot.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4PionMinus.hh"
|
||||
#include "G4PionPlus.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
|
||||
#include "G4Colour.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4PionMinus.hh"
|
||||
#include "G4PionPlus.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01PionShowerModel::Par01PionShowerModel(G4String modelName, G4Region* envelope)
|
||||
: G4VFastSimulationModel(modelName, envelope)
|
||||
: G4VFastSimulationModel(modelName, envelope)
|
||||
{
|
||||
fFakeStep = new G4Step();
|
||||
fFakePreStepPoint = fFakeStep->GetPreStepPoint();
|
||||
fFakeStep = new G4Step();
|
||||
fFakePreStepPoint = fFakeStep->GetPreStepPoint();
|
||||
fFakePostStepPoint = fFakeStep->GetPostStepPoint();
|
||||
fTouchableHandle = new G4TouchableHistory();
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
fTouchableHandle = new G4TouchableHistory();
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Par01PionShowerModel::Par01PionShowerModel(G4String modelName)
|
||||
: G4VFastSimulationModel(modelName)
|
||||
Par01PionShowerModel::Par01PionShowerModel(G4String modelName) : G4VFastSimulationModel(modelName)
|
||||
{
|
||||
fFakeStep = new G4Step();
|
||||
fFakePreStepPoint = fFakeStep->GetPreStepPoint();
|
||||
fFakeStep = new G4Step();
|
||||
fFakePreStepPoint = fFakeStep->GetPreStepPoint();
|
||||
fFakePostStepPoint = fFakeStep->GetPostStepPoint();
|
||||
fTouchableHandle = new G4TouchableHistory();
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
fTouchableHandle = new G4TouchableHistory();
|
||||
fpNavigator = new G4Navigator();
|
||||
fNaviSetup = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -81,9 +79,8 @@ Par01PionShowerModel::~Par01PionShowerModel()
|
||||
|
||||
G4bool Par01PionShowerModel::IsApplicable(const G4ParticleDefinition& particleType)
|
||||
{
|
||||
return
|
||||
&particleType == G4PionMinus::PionMinusDefinition() ||
|
||||
&particleType == G4PionPlus::PionPlusDefinition();
|
||||
return &particleType == G4PionMinus::PionMinusDefinition()
|
||||
|| &particleType == G4PionPlus::PionPlusDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -97,8 +94,7 @@ G4bool Par01PionShowerModel::ModelTrigger(const G4FastTrack&)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01PionShowerModel::DoIt(const G4FastTrack& fastTrack,
|
||||
G4FastStep& fastStep)
|
||||
void Par01PionShowerModel::DoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep)
|
||||
{
|
||||
// G4cout << "Par01PionShowerModel::DoIt" << G4endl;
|
||||
|
||||
@@ -109,7 +105,7 @@ void Par01PionShowerModel::DoIt(const G4FastTrack& fastTrack,
|
||||
|
||||
// split into "energy spots" energy according to the shower shape:
|
||||
Explode(fastTrack);
|
||||
|
||||
|
||||
// and put those energy spots into the crystals:
|
||||
BuildDetectorResponse();
|
||||
}
|
||||
@@ -126,25 +122,23 @@ void Par01PionShowerModel::Explode(const G4FastTrack& fastTrack)
|
||||
// center of the shower, we put at the middle of the ghost:
|
||||
G4ThreeVector showerCenter;
|
||||
G4double distOut;
|
||||
distOut = fastTrack.GetEnvelopeSolid()->
|
||||
DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
|
||||
fastTrack.GetPrimaryTrackLocalDirection());
|
||||
showerCenter = fastTrack.GetPrimaryTrackLocalPosition() +
|
||||
(distOut/2.)*fastTrack.GetPrimaryTrackLocalDirection();
|
||||
distOut = fastTrack.GetEnvelopeSolid()->DistanceToOut(fastTrack.GetPrimaryTrackLocalPosition(),
|
||||
fastTrack.GetPrimaryTrackLocalDirection());
|
||||
showerCenter = fastTrack.GetPrimaryTrackLocalPosition()
|
||||
+ (distOut / 2.) * fastTrack.GetPrimaryTrackLocalDirection();
|
||||
|
||||
showerCenter = fastTrack.GetInverseAffineTransformation()->
|
||||
TransformPoint(showerCenter);
|
||||
showerCenter = fastTrack.GetInverseAffineTransformation()->TransformPoint(showerCenter);
|
||||
|
||||
// axis of the shower, in global reference frame:
|
||||
G4ThreeVector xShower, yShower, zShower;
|
||||
zShower = fastTrack.GetPrimaryTrack()->GetMomentumDirection();
|
||||
xShower = zShower.orthogonal();
|
||||
yShower = zShower.cross(xShower);
|
||||
|
||||
|
||||
// shoot the energy spots:
|
||||
G4double Energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
|
||||
G4int nSpot = 50;
|
||||
G4double deposit = Energy/double(nSpot);
|
||||
G4double deposit = Energy / double(nSpot);
|
||||
Par01EnergySpot eSpot;
|
||||
eSpot.SetEnergy(deposit);
|
||||
G4ThreeVector ePoint;
|
||||
@@ -153,17 +147,14 @@ void Par01PionShowerModel::Explode(const G4FastTrack& fastTrack)
|
||||
feSpotList.clear();
|
||||
|
||||
G4double z, r, phi;
|
||||
for (int i = 0; i < nSpot; i++)
|
||||
{
|
||||
z = G4RandGauss::shoot(0,20*cm);
|
||||
r = G4RandGauss::shoot(0,10*cm);
|
||||
phi = G4UniformRand()*twopi;
|
||||
ePoint = showerCenter +
|
||||
z*zShower +
|
||||
r*std::cos(phi)*xShower + r*std::sin(phi)*yShower;
|
||||
eSpot.SetPosition(ePoint);
|
||||
feSpotList.push_back(eSpot);
|
||||
}
|
||||
for (int i = 0; i < nSpot; i++) {
|
||||
z = G4RandGauss::shoot(0, 20 * cm);
|
||||
r = G4RandGauss::shoot(0, 10 * cm);
|
||||
phi = G4UniformRand() * twopi;
|
||||
ePoint = showerCenter + z * zShower + r * std::cos(phi) * xShower + r * std::sin(phi) * yShower;
|
||||
eSpot.SetPosition(ePoint);
|
||||
feSpotList.push_back(eSpot);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -171,22 +162,21 @@ void Par01PionShowerModel::Explode(const G4FastTrack& fastTrack)
|
||||
void Par01PionShowerModel::BuildDetectorResponse()
|
||||
{
|
||||
// Does the assignation of the energy spots to the sensitive volumes:
|
||||
for (size_t i = 0; i < feSpotList.size(); i++)
|
||||
{
|
||||
// Draw the energy spot:
|
||||
// G4Colour red(1.,0.,0.);
|
||||
// feSpotList[i].Draw(&red);
|
||||
// feSpotList[i].Print();
|
||||
|
||||
// "converts" the energy spot into the fake
|
||||
// G4Step to pass to sensitive detector:
|
||||
AssignSpotAndCallHit(feSpotList[i]);
|
||||
}
|
||||
for (size_t i = 0; i < feSpotList.size(); i++) {
|
||||
// Draw the energy spot:
|
||||
// G4Colour red(1.,0.,0.);
|
||||
// feSpotList[i].Draw(&red);
|
||||
// feSpotList[i].Print();
|
||||
|
||||
// "converts" the energy spot into the fake
|
||||
// G4Step to pass to sensitive detector:
|
||||
AssignSpotAndCallHit(feSpotList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01PionShowerModel::AssignSpotAndCallHit(const Par01EnergySpot &eSpot)
|
||||
void Par01PionShowerModel::AssignSpotAndCallHit(const Par01EnergySpot& eSpot)
|
||||
{
|
||||
//
|
||||
// "converts" the energy spot into the fake
|
||||
@@ -198,47 +188,36 @@ void Par01PionShowerModel::AssignSpotAndCallHit(const Par01EnergySpot &eSpot)
|
||||
// call sensitive part: taken/adapted from the stepping:
|
||||
// Send G4Step information to Hit/Dig if the volume is sensitive
|
||||
//
|
||||
G4VPhysicalVolume* pCurrentVolume =
|
||||
fFakeStep->GetPreStepPoint()->GetPhysicalVolume();
|
||||
G4VPhysicalVolume* pCurrentVolume = fFakeStep->GetPreStepPoint()->GetPhysicalVolume();
|
||||
G4VSensitiveDetector* pSensitive;
|
||||
|
||||
if( pCurrentVolume != nullptr )
|
||||
{
|
||||
pSensitive = pCurrentVolume->GetLogicalVolume()->
|
||||
GetSensitiveDetector();
|
||||
if( pSensitive != nullptr )
|
||||
{
|
||||
pSensitive->Hit(fFakeStep);
|
||||
}
|
||||
|
||||
if (pCurrentVolume != nullptr) {
|
||||
pSensitive = pCurrentVolume->GetLogicalVolume()->GetSensitiveDetector();
|
||||
if (pSensitive != nullptr) {
|
||||
pSensitive->Hit(fFakeStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void Par01PionShowerModel::FillFakeStep(const Par01EnergySpot &eSpot)
|
||||
void Par01PionShowerModel::FillFakeStep(const Par01EnergySpot& eSpot)
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// find in which volume the spot is.
|
||||
//-----------------------------------------------------------
|
||||
if (!fNaviSetup)
|
||||
{
|
||||
fpNavigator->
|
||||
SetWorldVolume(G4TransportationManager::GetTransportationManager()->
|
||||
GetNavigatorForTracking()->GetWorldVolume());
|
||||
fpNavigator->
|
||||
LocateGlobalPointAndUpdateTouchableHandle(eSpot.GetPosition(),
|
||||
G4ThreeVector(0.,0.,0.),
|
||||
fTouchableHandle,
|
||||
false);
|
||||
fNaviSetup = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
fpNavigator->
|
||||
LocateGlobalPointAndUpdateTouchableHandle(eSpot.GetPosition(),
|
||||
G4ThreeVector(0.,0.,0.),
|
||||
fTouchableHandle);
|
||||
}
|
||||
if (!fNaviSetup) {
|
||||
fpNavigator->SetWorldVolume(G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking()
|
||||
->GetWorldVolume());
|
||||
fpNavigator->LocateGlobalPointAndUpdateTouchableHandle(
|
||||
eSpot.GetPosition(), G4ThreeVector(0., 0., 0.), fTouchableHandle, false);
|
||||
fNaviSetup = true;
|
||||
}
|
||||
else {
|
||||
fpNavigator->LocateGlobalPointAndUpdateTouchableHandle(
|
||||
eSpot.GetPosition(), G4ThreeVector(0., 0., 0.), fTouchableHandle);
|
||||
}
|
||||
//--------------------------------------
|
||||
// Fills attribute of the G4Step needed
|
||||
// by our sensitive detector:
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
#include "Par01PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -47,13 +47,12 @@ Par01PrimaryGeneratorAction::Par01PrimaryGeneratorAction()
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName="geantino");
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "geantino");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));
|
||||
fParticleGun->SetParticleEnergy(100.*GeV);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm,-300.*cm,0.*cm));
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 1., 0.));
|
||||
fParticleGun->SetParticleEnergy(100. * GeV);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0. * cm, -300. * cm, 0. * cm));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -75,5 +74,4 @@ void Par01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
G4ParticleGun* Par01PrimaryGeneratorAction::GetParticleGun()
|
||||
{
|
||||
return fParticleGun;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user