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;
38 : G4VFastSimulationModel(modelName, envelope), theParSet(parSet) {
49 theRegion =
const_cast<const G4Region*
>(envelope);
66 return &particleType == G4PionMinus::PionMinusDefinition() || &particleType == G4PionPlus::PionPlusDefinition() ||
67 &particleType == G4KaonMinus::KaonMinusDefinition() || &particleType == G4KaonPlus::KaonPlusDefinition() ||
68 &particleType == G4AntiProton::AntiProtonDefinition() || &particleType == G4Proton::ProtonDefinition();
87 G4TouchableHistory* touch = (G4TouchableHistory*)(fastTrack.GetPrimaryTrack()->GetTouchable());
88 G4VPhysicalVolume* pCurrentVolume = touch->GetVolume();
89 if (pCurrentVolume ==
nullptr) {
93 G4LogicalVolume* lv = pCurrentVolume->GetLogicalVolume();
112 fastStep.KillPrimaryTrack();
113 fastStep.ProposePrimaryTrackPathLength(0.0);
116 G4ParticleDefinition*
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
119 if (particleType == G4KaonMinus::KaonMinusDefinition())
121 else if (particleType == G4KaonPlus::KaonPlusDefinition())
123 else if (particleType == G4AntiProton::AntiProtonDefinition())
125 else if (particleType == G4Proton::ProtonDefinition())
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;
147 theGflashStep->SetTrack(const_cast<G4Track*>(fastTrack.GetPrimaryTrack()));
149 const_cast<G4VProcess*>(fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
151 G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
153 std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
154 std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
156 for (; spotIter != spotIterEnd; spotIter++) {
168 G4VPhysicalVolume* aCurrentVolume =
theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
169 if (aCurrentVolume ==
nullptr) {
173 G4LogicalVolume* lv = aCurrentVolume->GetLogicalVolume();
178 theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
179 G4VSensitiveDetector* aSensitive =
theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
181 if (aSensitive ==
nullptr)
184 G4String nameCalor = aCurrentVolume->GetName();
185 nameCalor.assign(nameCalor, 0, 2);
186 G4double samplingWeight = 1.0;
187 if (nameCalor ==
"HB") {
189 }
else if (nameCalor ==
"HE" || nameCalor ==
"HT") {
192 theGflashStep->SetTotalEnergyDeposit(spotIter->getEnergy() * samplingWeight);
199 theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
201 theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
208 G4StepPoint* preStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint();
209 G4StepPoint* postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
211 G4String procName = postStep->GetProcessDefinedStep()->GetProcessName();
212 G4ParticleDefinition*
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
216 if ((particleType == G4PionPlus::PionPlusDefinition() && procName ==
"WrappedPionPlusInelastic") ||
217 (particleType == G4PionMinus::PionMinusDefinition() && procName ==
"WrappedPionMinusInelastic") ||
218 (particleType == G4KaonPlus::KaonPlusDefinition() && procName ==
"WrappedKaonPlusInelastic") ||
219 (particleType == G4KaonMinus::KaonMinusDefinition() && procName ==
"WrappedKaonMinusInelastic") ||
220 (particleType == G4AntiProton::AntiProtonDefinition() && procName ==
"WrappedAntiProtonInelastic") ||
221 (particleType == G4Proton::ProtonDefinition() && procName ==
"WrappedProtonInelastic")) {
225 const G4TrackVector* fSecondaryVector = fastTrack.GetPrimaryTrack()->GetStep()->GetSecondary();
226 G4double leadingEnergy = 0.0;
232 for (
unsigned int isec = 0; isec < fSecondaryVector->size(); isec++) {
233 G4Track* fSecondaryTrack = (*fSecondaryVector)[isec];
234 G4double secondaryEnergy = fSecondaryTrack->GetKineticEnergy();
236 if (secondaryEnergy > leadingEnergy) {
237 leadingEnergy = secondaryEnergy;
261 G4bool isExcluded =
false;
266 G4double
eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity();
267 if (std::fabs(eta) > 1.392 && std::fabs(eta) < 1.566) {
269 edm::LogInfo(
"SimG4CoreApplication") <<
"GFlashHadronShowerModel: excluding region of eta = " <<
eta;
273 G4StepPoint* postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
276 G4double distOut = 9999.0;
299 if (isExcluded && verbosity > 0) {
301 <<
"GFlashHadronShowerModel: skipping kCalor = " << kCalor <<
" DistanceToOut " << distOut <<
" from (" 302 << (postStep->GetPosition()).getRho() / cm <<
":" << (postStep->GetPosition()).getZ() / cm
303 <<
") of KE = " << 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)