16 #include "G4FastSimulationManager.hh" 17 #include "G4TransportationManager.hh" 18 #include "G4TouchableHandle.hh" 19 #include "G4VSensitiveDetector.hh" 20 #include "G4VPhysicalVolume.hh" 21 #include "G4EventManager.hh" 23 #include "G4PionMinus.hh" 24 #include "G4PionPlus.hh" 25 #include "G4KaonMinus.hh" 26 #include "G4KaonPlus.hh" 27 #include "G4Proton.hh" 28 #include "G4AntiProton.hh" 29 #include "G4VProcess.hh" 33 using namespace CLHEP;
37 : G4VFastSimulationModel(modelName, envelope), theParSet(parSet)
49 theRegion =
const_cast<const G4Region*
>(envelope);
70 &particleType == G4PionMinus::PionMinusDefinition() ||
71 &particleType == G4PionPlus::PionPlusDefinition() ||
72 &particleType == G4KaonMinus::KaonMinusDefinition() ||
73 &particleType == G4KaonPlus::KaonPlusDefinition() ||
74 &particleType == G4AntiProton::AntiProtonDefinition() ||
75 &particleType == G4Proton::ProtonDefinition() ;
94 G4TouchableHistory* touch =
95 (G4TouchableHistory*)(fastTrack.GetPrimaryTrack()->GetTouchable());
96 G4VPhysicalVolume* pCurrentVolume = touch->GetVolume();
97 if( pCurrentVolume ==
nullptr) {
return false; }
99 G4LogicalVolume* lv = pCurrentVolume->GetLogicalVolume();
100 if(lv->GetRegion() !=
theRegion) {
return false; }
116 fastStep.KillPrimaryTrack();
117 fastStep.ProposePrimaryTrackPathLength(0.0);
120 G4ParticleDefinition*
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
129 G4double
energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy()/
GeV;
130 G4double globalTime = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
131 G4double
charge = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
132 G4ThreeVector
position = fastTrack.GetPrimaryTrack()->GetPosition()/cm;
133 G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum()/
GeV;
149 theGflashStep->SetTrack(const_cast<G4Track*>(fastTrack.GetPrimaryTrack()));
150 theGflashStep->GetPostStepPoint()->SetProcessDefinedStep(const_cast<G4VProcess*>
151 (fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
152 theGflashNavigator->SetWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
154 std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
155 std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
157 for( ; spotIter != spotIterEnd; spotIter++){
159 theGflashNavigator->LocateGlobalPointAndUpdateTouchableHandle(spotIter->getPosition(),
160 G4ThreeVector(0,0,0),
168 (
SteppingAction*) G4EventManager::GetEventManager()->GetUserSteppingAction();
172 G4VPhysicalVolume* aCurrentVolume =
theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
173 if( aCurrentVolume ==
nullptr ) {
continue; }
175 G4LogicalVolume* lv = aCurrentVolume->GetLogicalVolume();
176 if(lv->GetRegion() !=
theRegion) {
continue; }
178 theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
179 G4VSensitiveDetector* aSensitive =
theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
181 if( aSensitive ==
nullptr )
continue;
183 G4String nameCalor = aCurrentVolume->GetName();
184 nameCalor.assign(nameCalor,0,2);
185 G4double samplingWeight = 1.0;
186 if(nameCalor ==
"HB" ) {
189 else if(nameCalor==
"HE" || nameCalor ==
"HT") {
192 theGflashStep->SetTotalEnergyDeposit(spotIter->getEnergy()*samplingWeight);
201 theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
203 theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
211 G4StepPoint* preStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint();
212 G4StepPoint* postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
214 G4String procName = postStep->GetProcessDefinedStep()->GetProcessName();
215 G4ParticleDefinition*
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
219 if((particleType == G4PionPlus::PionPlusDefinition() && procName ==
"WrappedPionPlusInelastic") ||
220 (particleType == G4PionMinus::PionMinusDefinition() && procName ==
"WrappedPionMinusInelastic") ||
221 (particleType == G4KaonPlus::KaonPlusDefinition() && procName ==
"WrappedKaonPlusInelastic") ||
222 (particleType == G4KaonMinus::KaonMinusDefinition() && procName ==
"WrappedKaonMinusInelastic") ||
223 (particleType == G4AntiProton::AntiProtonDefinition() && procName ==
"WrappedAntiProtonInelastic") ||
224 (particleType == G4Proton::ProtonDefinition() && procName ==
"WrappedProtonInelastic")) {
229 const G4TrackVector* fSecondaryVector = fastTrack.GetPrimaryTrack()->GetStep()->GetSecondary();
230 G4double leadingEnergy = 0.0;
236 for (
unsigned int isec = 0 ; isec < fSecondaryVector->size() ; isec++) {
237 G4Track* fSecondaryTrack = (*fSecondaryVector)[isec];
238 G4double secondaryEnergy = fSecondaryTrack->GetKineticEnergy();
240 if(secondaryEnergy > leadingEnergy ) {
241 leadingEnergy = secondaryEnergy;
245 if((preStep->GetTotalEnergy()!=0) &&
266 G4bool isExcluded=
false;
271 G4double
eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity() ;
272 if(std::fabs(eta) > 1.392 && std::fabs(eta) < 1.566) {
275 <<
"GFlashHadronShowerModel: excluding region of eta = " <<
eta;
280 G4StepPoint* postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
283 G4double distOut = 9999.0;
305 if(isExcluded && verbosity > 0) {
307 <<
"GFlashHadronShowerModel: skipping kCalor = " << kCalor <<
308 " DistanceToOut " << distOut <<
" from (" << (postStep->GetPosition()).getRho()/cm <<
309 ":" << (postStep->GetPosition()).getZ()/cm <<
") of KE = " 310 << fastTrack.GetPrimaryTrack()->GetKineticEnergy()/
GeV;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const double MinDistanceToOut
GFlashHadronShowerModel(G4String modelName, G4Region *envelope, const edm::ParameterSet &parSet)
GflashPiKShowerProfile * thePiKProfile
const double Zmax[kNumberCalorimeter]
~GFlashHadronShowerModel() override
SimActivityRegistry::G4StepSignal m_g4StepSignal
G4bool IsApplicable(const G4ParticleDefinition &) override
GflashKaonMinusShowerProfile * theKaonMinusProfile
const G4Region * theRegion
G4TouchableHandle theGflashTouchableHandle
G4bool ModelTrigger(const G4FastTrack &) override
GflashKaonPlusShowerProfile * theKaonPlusProfile
CalorimeterNumber getCalorimeterNumber(const Gflash3Vector &position)
edm::ParameterSet theParSet
virtual void loadParameters()
GflashAntiProtonShowerProfile * theAntiProtonProfile
G4Navigator * theGflashNavigator
G4bool excludeDetectorRegion(const G4FastTrack &fastTrack)
const double energyCutOff
GflashHadronShowerProfile * theProfile
const double EtaMin[kNumberCalorimeter]
void makeHits(const G4FastTrack &fastTrack)
GflashProtonShowerProfile * theProtonProfile
void updateGflashStep(const G4ThreeVector &position, G4double time)
int findShowerType(const Gflash3Vector &position)
void hadronicParameterization()
const double Zmin[kNumberCalorimeter]
const double QuasiElasticLike
const double scaleSensitiveHE
void DoIt(const G4FastTrack &, G4FastStep &) override
G4bool isFirstInelasticInteraction(const G4FastTrack &fastTrack)
static int position[264][3]
std::vector< GflashHit > & getGflashHitList()
const double Rmax[kNumberCalorimeter]
const double scaleSensitiveHB
void initialize(int showerType, double energy, double globalTime, double charge, Gflash3Vector &position, Gflash3Vector &momentum)