16 #include "G4EventManager.hh"
17 #include "G4FastSimulationManager.hh"
18 #include "G4TouchableHandle.hh"
19 #include "G4TransportationManager.hh"
20 #include "G4VPhysicalVolume.hh"
21 #include "G4VSensitiveDetector.hh"
23 #include "G4AntiProton.hh"
24 #include "G4KaonMinus.hh"
25 #include "G4KaonPlus.hh"
26 #include "G4PionMinus.hh"
27 #include "G4PionPlus.hh"
28 #include "G4Proton.hh"
29 #include "G4VProcess.hh"
33 using namespace CLHEP;
38 : G4VFastSimulationModel(
modelName, envelope), theParSet(parSet) {
84 if (fastTrack.GetPrimaryTrack()->GetTrackStatus() == fPostponeToNextEvent) {
99 fastStep.KillPrimaryTrack();
100 fastStep.ProposePrimaryTrackPathLength(0.0);
103 G4ParticleDefinition *
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
108 else if (
particleType == G4KaonPlus::KaonPlusDefinition())
110 else if (
particleType == G4AntiProton::AntiProtonDefinition())
116 G4double
energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy() /
GeV;
117 G4double globalTime = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
118 G4double
charge = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
119 G4ThreeVector
position = fastTrack.GetPrimaryTrack()->GetPosition() / cm;
120 G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum() /
GeV;
134 theGflashStep->SetTrack(const_cast<G4Track *>(fastTrack.GetPrimaryTrack()));
136 const_cast<G4VProcess *>(fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
138 G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
140 std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
141 std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
143 for (; spotIter != spotIterEnd; spotIter++) {
155 G4VPhysicalVolume *aCurrentVolume =
theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
156 if (aCurrentVolume ==
nullptr)
159 G4LogicalVolume *lv = aCurrentVolume->GetLogicalVolume();
160 if (lv->GetRegion()->GetName() !=
"CaloRegion")
163 theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
164 G4VSensitiveDetector *aSensitive =
theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
166 if (aSensitive ==
nullptr)
169 G4String nameCalor = aCurrentVolume->GetName();
170 nameCalor.assign(nameCalor, 0, 2);
171 G4double samplingWeight = 1.0;
172 if (nameCalor ==
"HB") {
174 }
else if (nameCalor ==
"HE" || nameCalor ==
"HT") {
177 theGflashStep->SetTotalEnergyDeposit(spotIter->getEnergy() * samplingWeight);
184 theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
186 theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
193 G4StepPoint *preStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint();
194 G4StepPoint *postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
196 G4String procName = postStep->GetProcessDefinedStep()->GetProcessName();
197 G4ParticleDefinition *
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
202 if ((
particleType == G4PionPlus::PionPlusDefinition() && procName ==
"WrappedPionPlusInelastic") ||
203 (
particleType == G4PionMinus::PionMinusDefinition() && procName ==
"WrappedPionMinusInelastic") ||
204 (
particleType == G4KaonPlus::KaonPlusDefinition() && procName ==
"WrappedKaonPlusInelastic") ||
205 (
particleType == G4KaonMinus::KaonMinusDefinition() && procName ==
"WrappedKaonMinusInelastic") ||
206 (
particleType == G4AntiProton::AntiProtonDefinition() && procName ==
"WrappedAntiProtonInelastic") ||
207 (
particleType == G4Proton::ProtonDefinition() && procName ==
"WrappedProtonInelastic")) {
212 const G4TrackVector *fSecondaryVector = fastTrack.GetPrimaryTrack()->GetStep()->GetSecondary();
213 G4double leadingEnergy = 0.0;
220 for (
unsigned int isec = 0; isec < fSecondaryVector->size(); isec++) {
221 G4Track *fSecondaryTrack = (*fSecondaryVector)[isec];
222 G4double secondaryEnergy = fSecondaryTrack->GetKineticEnergy();
224 if (secondaryEnergy > leadingEnergy) {
225 leadingEnergy = secondaryEnergy;
238 theHisto->
deltaStep->Fill((postStep->GetPosition() - preStep->GetPosition()).getRho() / cm);
248 G4bool isExcluded =
false;
253 G4double
eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity();
254 if (std::fabs(
eta) > 1.392 && std::fabs(
eta) < 1.566) {
256 edm::LogInfo(
"SimGeneralGFlash") <<
"GflashHadronShowerModel: excluding region of eta = " <<
eta;
260 G4StepPoint *postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
263 G4double distOut = 9999.0;
289 std::cout <<
"GflashHadronShowerModel: skipping kCalor = " << kCalor <<
" DistanceToOut " << distOut <<
" from ("
290 << (postStep->GetPosition()).getRho() / cm <<
":" << (postStep->GetPosition()).getZ() / cm
291 <<
") of KE = " << fastTrack.GetPrimaryTrack()->GetKineticEnergy() /
GeV << std::endl;