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) {
48 theRegion =
reinterpret_cast<G4Region*
>(envelope);
86 const G4VPhysicalVolume* pCurrentVolume = fastTrack.GetPrimaryTrack()->GetTouchable()->GetVolume();
87 if (pCurrentVolume ==
nullptr) {
91 const G4LogicalVolume* lv = pCurrentVolume->GetLogicalVolume();
100 fastStep.KillPrimaryTrack();
101 fastStep.ProposePrimaryTrackPathLength(0.0);
104 G4ParticleDefinition*
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
109 else if (
particleType == G4KaonPlus::KaonPlusDefinition())
111 else if (
particleType == G4AntiProton::AntiProtonDefinition())
117 G4double
energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy() / GeV;
118 G4double globalTime = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetGlobalTime();
119 G4double
charge = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint()->GetCharge();
120 G4ThreeVector
position = fastTrack.GetPrimaryTrack()->GetPosition() / cm;
121 G4ThreeVector momentum = fastTrack.GetPrimaryTrack()->GetMomentum() / GeV;
135 theGflashStep->SetTrack(const_cast<G4Track*>(fastTrack.GetPrimaryTrack()));
137 const_cast<G4VProcess*>(fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
139 G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
141 std::vector<GflashHit>::const_iterator spotIter = gflashHitList.begin();
142 std::vector<GflashHit>::const_iterator spotIterEnd = gflashHitList.end();
144 for (; spotIter != spotIterEnd; spotIter++) {
156 G4VPhysicalVolume* aCurrentVolume =
theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
157 if (aCurrentVolume ==
nullptr) {
161 G4LogicalVolume* lv = aCurrentVolume->GetLogicalVolume();
166 theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
167 G4VSensitiveDetector* aSensitive =
theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
169 if (aSensitive ==
nullptr)
173 nameCalor.assign(nameCalor, 0, 2);
174 G4double samplingWeight = 1.0;
175 if (nameCalor ==
"HB") {
177 }
else if (nameCalor ==
"HE" || nameCalor ==
"HT") {
180 theGflashStep->SetTotalEnergyDeposit(spotIter->getEnergy() * samplingWeight);
187 theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
189 theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
196 G4StepPoint* preStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint();
197 G4StepPoint* postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
199 G4String procName = postStep->GetProcessDefinedStep()->GetProcessName();
200 G4ParticleDefinition*
particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
204 if ((
particleType == G4PionPlus::PionPlusDefinition() && procName ==
"WrappedPionPlusInelastic") ||
205 (
particleType == G4PionMinus::PionMinusDefinition() && procName ==
"WrappedPionMinusInelastic") ||
206 (
particleType == G4KaonPlus::KaonPlusDefinition() && procName ==
"WrappedKaonPlusInelastic") ||
207 (
particleType == G4KaonMinus::KaonMinusDefinition() && procName ==
"WrappedKaonMinusInelastic") ||
208 (
particleType == G4AntiProton::AntiProtonDefinition() && procName ==
"WrappedAntiProtonInelastic") ||
209 (
particleType == G4Proton::ProtonDefinition() && procName ==
"WrappedProtonInelastic")) {
213 const G4TrackVector* fSecondaryVector = fastTrack.GetPrimaryTrack()->GetStep()->GetSecondary();
214 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;
236 const double invcm = 1.0 / CLHEP::cm;
237 G4bool isExcluded =
false;
242 G4double
eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity();
243 if (std::fabs(
eta) > 1.392 && std::fabs(
eta) < 1.566) {
245 edm::LogVerbatim(
"SimG4CoreApplication") <<
"GFlashHadronShowerModel: excluding region of eta = " <<
eta;
249 G4StepPoint* postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
252 G4double distOut = 9999.0;
277 <<
"GFlashHadronShowerModel: skipping kCalor = " << kCalor <<
" DistanceToOut " << distOut <<
" from (" 278 << (postStep->GetPosition()).getRho() * invcm <<
":" << (postStep->GetPosition()).getZ() * invcm
279 <<
") 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()
std::string noNameSpace(const std::string &name)
const double Rmax[kNumberCalorimeter]
const double scaleSensitiveHB
void initialize(int showerType, double energy, double globalTime, double charge, Gflash3Vector &position, Gflash3Vector &momentum)