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) {
81 if (fastTrack.GetPrimaryTrack()->GetTrackStatus() == fPostponeToNextEvent) {
96 fastStep.KillPrimaryTrack();
97 fastStep.ProposePrimaryTrackPathLength(0.0);
100 G4ParticleDefinition *
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
105 else if (
particleType == G4KaonPlus::KaonPlusDefinition())
107 else if (
particleType == G4AntiProton::AntiProtonDefinition())
113 G4double
energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy() / GeV;
114 G4double globalTime = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
115 G4double
charge = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
116 G4ThreeVector
position = fastTrack.GetPrimaryTrack()->GetPosition() / cm;
117 G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum() / GeV;
131 theGflashStep->SetTrack(const_cast<G4Track *>(fastTrack.GetPrimaryTrack()));
133 const_cast<G4VProcess *>(fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
135 G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
137 for (
auto &
hit : gflashHitList) {
142 const G4VPhysicalVolume *aCurrentVolume =
theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
143 if (aCurrentVolume ==
nullptr)
146 const G4LogicalVolume *lv = aCurrentVolume->GetLogicalVolume();
147 if (lv->GetRegion()->GetName() !=
"CaloRegion")
150 theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
151 G4VSensitiveDetector *aSensitive =
theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
153 if (aSensitive ==
nullptr)
156 G4String nameCalor = aCurrentVolume->GetName();
157 nameCalor.assign(nameCalor, 0, 2);
158 G4double samplingWeight = 1.0;
159 if (nameCalor ==
"HB") {
161 }
else if (nameCalor ==
"HE" || nameCalor ==
"HT") {
171 theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
173 theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
180 G4StepPoint *preStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint();
181 G4StepPoint *postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
183 G4String procName = postStep->GetProcessDefinedStep()->GetProcessName();
184 G4ParticleDefinition *
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
189 if ((
particleType == G4PionPlus::PionPlusDefinition() && procName ==
"WrappedPionPlusInelastic") ||
190 (
particleType == G4PionMinus::PionMinusDefinition() && procName ==
"WrappedPionMinusInelastic") ||
191 (
particleType == G4KaonPlus::KaonPlusDefinition() && procName ==
"WrappedKaonPlusInelastic") ||
192 (
particleType == G4KaonMinus::KaonMinusDefinition() && procName ==
"WrappedKaonMinusInelastic") ||
193 (
particleType == G4AntiProton::AntiProtonDefinition() && procName ==
"WrappedAntiProtonInelastic") ||
194 (
particleType == G4Proton::ProtonDefinition() && procName ==
"WrappedProtonInelastic")) {
199 const G4TrackVector *fSecondaryVector = fastTrack.GetPrimaryTrack()->GetStep()->GetSecondary();
200 G4double leadingEnergy = 0.0;
207 for (
unsigned int isec = 0;
isec < fSecondaryVector->size();
isec++) {
208 G4Track *fSecondaryTrack = (*fSecondaryVector)[
isec];
209 G4double secondaryEnergy = fSecondaryTrack->GetKineticEnergy();
211 if (secondaryEnergy > leadingEnergy) {
212 leadingEnergy = secondaryEnergy;
225 theHisto->
deltaStep->Fill((postStep->GetPosition() - preStep->GetPosition()).getRho() / cm);
227 theHisto->
energyLoss->Fill(fabs(fastTrack.GetPrimaryTrack()->GetStep()->GetDeltaEnergy() / GeV));
235 const double invcm = 1.0 / CLHEP::cm;
236 G4bool isExcluded =
false;
241 G4double
eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity();
242 if (std::fabs(
eta) > 1.392 && std::fabs(
eta) < 1.566) {
244 edm::LogVerbatim(
"SimGeneralGFlash") <<
"GflashHadronShowerModel: excluding region of eta = " <<
eta;
248 const G4StepPoint *postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
251 G4double distOut = 9999.0;
277 G4cout <<
"GflashHadronShowerModel: skipping kCalor = " << kCalor <<
" DistanceToOut " << distOut <<
" from (" 278 << (postStep->GetPosition()).getRho() * invcm <<
":" << (postStep->GetPosition()).getZ() * invcm
279 <<
") of KE = " << fastTrack.GetPrimaryTrack()->GetKineticEnergy() / CLHEP::GeV << G4endl;
Log< level::Info, true > LogVerbatim
const double MinDistanceToOut
static GflashHistogram * instance()
T getParameter(std::string const &) const
const double Zmax[kNumberCalorimeter]
GflashKaonMinusShowerProfile * theKaonMinusProfile
GflashAntiProtonShowerProfile * theAntiProtonProfile
G4bool ModelTrigger(const G4FastTrack &) override
~GflashHadronShowerModel() override
void updateGflashStep(const G4ThreeVector &position, G4double time)
void makeHits(const G4FastTrack &fastTrack)
G4Navigator * theGflashNavigator
G4bool IsApplicable(const G4ParticleDefinition &) override
T getUntrackedParameter(std::string const &, T const &) const
GflashHadronShowerProfile * theProfile
CalorimeterNumber getCalorimeterNumber(const Gflash3Vector &position)
virtual void loadParameters()
const double energyCutOff
void DoIt(const G4FastTrack &, G4FastStep &) override
const double EtaMin[kNumberCalorimeter]
int findShowerType(const Gflash3Vector &position)
G4TouchableHandle theGflashTouchableHandle
void hadronicParameterization()
G4bool isFirstInelasticInteraction(const G4FastTrack &fastTrack)
const double Zmin[kNumberCalorimeter]
const double QuasiElasticLike
const double scaleSensitiveHE
G4bool excludeDetectorRegion(const G4FastTrack &fastTrack)
GflashHistogram * theHisto
static int position[264][3]
GflashKaonPlusShowerProfile * theKaonPlusProfile
edm::ParameterSet theParSet
GflashPiKShowerProfile * thePiKProfile
std::vector< GflashHit > & getGflashHitList()
GflashProtonShowerProfile * theProtonProfile
const double Rmax[kNumberCalorimeter]
const double scaleSensitiveHB
void initialize(int showerType, double energy, double globalTime, double charge, Gflash3Vector &position, Gflash3Vector &momentum)
GflashHadronShowerModel(G4String modelName, G4Region *envelope, const edm::ParameterSet &parSet)