15 #include "G4FastSimulationManager.hh" 16 #include "G4TransportationManager.hh" 17 #include "G4TouchableHandle.hh" 18 #include "G4VSensitiveDetector.hh" 19 #include "G4VPhysicalVolume.hh" 20 #include "G4EventManager.hh" 22 #include "G4PionMinus.hh" 23 #include "G4PionPlus.hh" 24 #include "G4KaonMinus.hh" 25 #include "G4KaonPlus.hh" 26 #include "G4Proton.hh" 27 #include "G4AntiProton.hh" 28 #include "G4VProcess.hh" 32 using namespace CLHEP;
37 : G4VFastSimulationModel(
modelName, envelope), theParSet(parSet) {
47 theRegion =
reinterpret_cast<G4Region*
>(envelope);
85 const G4VPhysicalVolume* pCurrentVolume = fastTrack.GetPrimaryTrack()->GetTouchable()->GetVolume();
86 if (pCurrentVolume ==
nullptr) {
90 const G4LogicalVolume* lv = pCurrentVolume->GetLogicalVolume();
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) {
160 G4LogicalVolume* lv = aCurrentVolume->GetLogicalVolume();
165 theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
166 G4VSensitiveDetector* aSensitive =
theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
168 if (aSensitive ==
nullptr)
171 G4String nameCalor = aCurrentVolume->GetName();
172 nameCalor.assign(nameCalor, 0, 2);
173 G4double samplingWeight = 1.0;
174 if (nameCalor ==
"HB") {
176 }
else if (nameCalor ==
"HE" || nameCalor ==
"HT") {
179 theGflashStep->SetTotalEnergyDeposit(spotIter->getEnergy() * samplingWeight);
186 theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
188 theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
195 G4StepPoint* preStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint();
196 G4StepPoint* postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
198 G4String procName = postStep->GetProcessDefinedStep()->GetProcessName();
199 G4ParticleDefinition*
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
203 if ((
particleType == G4PionPlus::PionPlusDefinition() && procName ==
"WrappedPionPlusInelastic") ||
204 (
particleType == G4PionMinus::PionMinusDefinition() && procName ==
"WrappedPionMinusInelastic") ||
205 (
particleType == G4KaonPlus::KaonPlusDefinition() && procName ==
"WrappedKaonPlusInelastic") ||
206 (
particleType == G4KaonMinus::KaonMinusDefinition() && procName ==
"WrappedKaonMinusInelastic") ||
207 (
particleType == G4AntiProton::AntiProtonDefinition() && procName ==
"WrappedAntiProtonInelastic") ||
208 (
particleType == G4Proton::ProtonDefinition() && procName ==
"WrappedProtonInelastic")) {
212 const G4TrackVector* fSecondaryVector = fastTrack.GetPrimaryTrack()->GetStep()->GetSecondary();
213 G4double leadingEnergy = 0.0;
219 for (
unsigned int isec = 0; isec < fSecondaryVector->size(); isec++) {
220 G4Track* fSecondaryTrack = (*fSecondaryVector)[isec];
221 G4double secondaryEnergy = fSecondaryTrack->GetKineticEnergy();
223 if (secondaryEnergy > leadingEnergy) {
224 leadingEnergy = secondaryEnergy;
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(
"SimG4CoreApplication") <<
"GFlashHadronShowerModel: excluding region of eta = " <<
eta;
248 G4StepPoint* postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
251 G4double distOut = 9999.0;
276 <<
"GFlashHadronShowerModel: skipping kCalor = " << kCalor <<
" DistanceToOut " << distOut <<
" from (" 277 << (postStep->GetPosition()).getRho() * invcm <<
":" << (postStep->GetPosition()).getZ() * invcm
278 <<
") of KE = " << fastTrack.GetPrimaryTrack()->GetKineticEnergy() / CLHEP::GeV;
Log< level::Info, true > LogVerbatim
const double MinDistanceToOut
GFlashHadronShowerModel(G4String modelName, G4Region *envelope, const edm::ParameterSet &parSet)
T getParameter(std::string const &) const
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
T getUntrackedParameter(std::string const &, T const &) const
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)