15 #include "G4EventManager.hh"
16 #include "G4FastSimulationManager.hh"
17 #include "G4TouchableHandle.hh"
18 #include "G4TransportationManager.hh"
19 #include "G4VPhysicalVolume.hh"
20 #include "G4VSensitiveDetector.hh"
22 #include "G4AntiProton.hh"
23 #include "G4KaonMinus.hh"
24 #include "G4KaonPlus.hh"
25 #include "G4PionMinus.hh"
26 #include "G4PionPlus.hh"
27 #include "G4Proton.hh"
28 #include "G4VProcess.hh"
32 using namespace CLHEP;
37 : G4VFastSimulationModel(
modelName, envelope), theParSet(parSet) {
83 if (fastTrack.GetPrimaryTrack()->GetTrackStatus() == fPostponeToNextEvent) {
98 fastStep.KillPrimaryTrack();
99 fastStep.ProposePrimaryTrackPathLength(0.0);
102 G4ParticleDefinition *
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
107 else if (
particleType == G4KaonPlus::KaonPlusDefinition())
109 else if (
particleType == G4AntiProton::AntiProtonDefinition())
115 G4double
energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy() /
GeV;
116 G4double globalTime = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
117 G4double
charge = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
118 G4ThreeVector
position = fastTrack.GetPrimaryTrack()->GetPosition() / cm;
119 G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum() /
GeV;
133 theGflashStep->SetTrack(const_cast<G4Track *>(fastTrack.GetPrimaryTrack()));
135 const_cast<G4VProcess *>(fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
137 G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
139 std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
140 std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
142 for (; spotIter != spotIterEnd; spotIter++) {
147 G4VPhysicalVolume *aCurrentVolume =
theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
148 if (aCurrentVolume ==
nullptr)
151 G4LogicalVolume *lv = aCurrentVolume->GetLogicalVolume();
152 if (lv->GetRegion()->GetName() !=
"CaloRegion")
155 theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
156 G4VSensitiveDetector *aSensitive =
theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
158 if (aSensitive ==
nullptr)
161 G4String nameCalor = aCurrentVolume->GetName();
162 nameCalor.assign(nameCalor, 0, 2);
163 G4double samplingWeight = 1.0;
164 if (nameCalor ==
"HB") {
166 }
else if (nameCalor ==
"HE" || nameCalor ==
"HT") {
169 theGflashStep->SetTotalEnergyDeposit(spotIter->getEnergy() * samplingWeight);
176 theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
178 theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
185 G4StepPoint *preStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint();
186 G4StepPoint *postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
188 G4String procName = postStep->GetProcessDefinedStep()->GetProcessName();
189 G4ParticleDefinition *
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
194 if ((
particleType == G4PionPlus::PionPlusDefinition() && procName ==
"WrappedPionPlusInelastic") ||
195 (
particleType == G4PionMinus::PionMinusDefinition() && procName ==
"WrappedPionMinusInelastic") ||
196 (
particleType == G4KaonPlus::KaonPlusDefinition() && procName ==
"WrappedKaonPlusInelastic") ||
197 (
particleType == G4KaonMinus::KaonMinusDefinition() && procName ==
"WrappedKaonMinusInelastic") ||
198 (
particleType == G4AntiProton::AntiProtonDefinition() && procName ==
"WrappedAntiProtonInelastic") ||
199 (
particleType == G4Proton::ProtonDefinition() && procName ==
"WrappedProtonInelastic")) {
204 const G4TrackVector *fSecondaryVector = fastTrack.GetPrimaryTrack()->GetStep()->GetSecondary();
205 G4double leadingEnergy = 0.0;
212 for (
unsigned int isec = 0; isec < fSecondaryVector->size(); isec++) {
213 G4Track *fSecondaryTrack = (*fSecondaryVector)[isec];
214 G4double secondaryEnergy = fSecondaryTrack->GetKineticEnergy();
216 if (secondaryEnergy > leadingEnergy) {
217 leadingEnergy = secondaryEnergy;
230 theHisto->
deltaStep->Fill((postStep->GetPosition() - preStep->GetPosition()).getRho() / cm);
240 G4bool isExcluded =
false;
245 G4double
eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity();
246 if (std::fabs(
eta) > 1.392 && std::fabs(
eta) < 1.566) {
248 edm::LogInfo(
"SimGeneralGFlash") <<
"GflashHadronShowerModel: excluding region of eta = " <<
eta;
252 G4StepPoint *postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
255 G4double distOut = 9999.0;
281 std::cout <<
"GflashHadronShowerModel: skipping kCalor = " << kCalor <<
" DistanceToOut " << distOut <<
" from ("
282 << (postStep->GetPosition()).getRho() / cm <<
":" << (postStep->GetPosition()).getZ() / cm
283 <<
") of KE = " << fastTrack.GetPrimaryTrack()->GetKineticEnergy() /
GeV << std::endl;