CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
GflashHadronShowerModel Class Reference

#include <GflashHadronShowerModel.h>

Inheritance diagram for GflashHadronShowerModel:

Public Member Functions

void DoIt (const G4FastTrack &, G4FastStep &) override
 
 GflashHadronShowerModel (G4String modelName, G4Region *envelope, const edm::ParameterSet &parSet)
 
G4bool IsApplicable (const G4ParticleDefinition &) override
 
G4bool ModelTrigger (const G4FastTrack &) override
 
 ~GflashHadronShowerModel () override
 

Private Member Functions

G4bool excludeDetectorRegion (const G4FastTrack &fastTrack)
 
G4bool isFirstInelasticInteraction (const G4FastTrack &fastTrack)
 
void makeHits (const G4FastTrack &fastTrack)
 
void updateGflashStep (const G4ThreeVector &position, G4double time)
 

Private Attributes

GflashAntiProtonShowerProfiletheAntiProtonProfile
 
G4Navigator * theGflashNavigator
 
G4Step * theGflashStep
 
G4TouchableHandle theGflashTouchableHandle
 
GflashHistogramtheHisto
 
GflashKaonMinusShowerProfiletheKaonMinusProfile
 
GflashKaonPlusShowerProfiletheKaonPlusProfile
 
edm::ParameterSet theParSet
 
GflashPiKShowerProfilethePiKProfile
 
GflashHadronShowerProfiletheProfile
 
GflashProtonShowerProfiletheProtonProfile
 
G4bool theWatcherOn
 

Detailed Description

Definition at line 19 of file GflashHadronShowerModel.h.

Constructor & Destructor Documentation

◆ GflashHadronShowerModel()

GflashHadronShowerModel::GflashHadronShowerModel ( G4String  modelName,
G4Region *  envelope,
const edm::ParameterSet parSet 
)

Definition at line 34 of file GflashHadronShowerModel.cc.

References edm::ParameterSet::getParameter(), GflashHistogram::instance(), theAntiProtonProfile, theGflashNavigator, theGflashStep, theGflashTouchableHandle, theHisto, theKaonMinusProfile, theKaonPlusProfile, thePiKProfile, theProfile, theProtonProfile, and theWatcherOn.

37  : G4VFastSimulationModel(modelName, envelope), theParSet(parSet) {
38  theWatcherOn = parSet.getParameter<bool>("watcherOn");
39 
47 
48  theGflashStep = new G4Step();
49  theGflashTouchableHandle = new G4TouchableHistory();
50  theGflashNavigator = new G4Navigator();
51 }
static GflashHistogram * instance()
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
GflashKaonMinusShowerProfile * theKaonMinusProfile
GflashAntiProtonShowerProfile * theAntiProtonProfile
GflashHadronShowerProfile * theProfile
G4TouchableHandle theGflashTouchableHandle
GflashKaonPlusShowerProfile * theKaonPlusProfile
GflashPiKShowerProfile * thePiKProfile
GflashProtonShowerProfile * theProtonProfile

◆ ~GflashHadronShowerModel()

GflashHadronShowerModel::~GflashHadronShowerModel ( )
override

Definition at line 53 of file GflashHadronShowerModel.cc.

References theGflashStep, and theProfile.

53  {
54  delete theProfile;
55  delete theGflashStep;
56 }
GflashHadronShowerProfile * theProfile

Member Function Documentation

◆ DoIt()

void GflashHadronShowerModel::DoIt ( const G4FastTrack &  fastTrack,
G4FastStep &  fastStep 
)
override

Definition at line 94 of file GflashHadronShowerModel.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, HBHEDarkening_cff::energy, Gflash::findShowerType(), GflashHadronShowerProfile::hadronicParameterization(), GflashHadronShowerProfile::initialize(), GflashHadronShowerProfile::loadParameters(), makeHits(), WZElectronSkims53X_cff::particleType, position, theAntiProtonProfile, theKaonMinusProfile, theKaonPlusProfile, thePiKProfile, theProfile, and theProtonProfile.

94  {
95  // kill the particle
96  fastStep.KillPrimaryTrack();
97  fastStep.ProposePrimaryTrackPathLength(0.0);
98 
99  // parameterize energy depostion by the particle type
100  G4ParticleDefinition *particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
101 
103  if (particleType == G4KaonMinus::KaonMinusDefinition())
105  else if (particleType == G4KaonPlus::KaonPlusDefinition())
107  else if (particleType == G4AntiProton::AntiProtonDefinition())
109  else if (particleType == G4Proton::ProtonDefinition())
111 
112  // input variables for GflashHadronShowerProfile
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;
118  G4int showerType = Gflash::findShowerType(position);
119 
120  theProfile->initialize(showerType, energy, globalTime, charge, position, momentum);
123 
124  // make hits
125  makeHits(fastTrack);
126 }
GflashKaonMinusShowerProfile * theKaonMinusProfile
GflashAntiProtonShowerProfile * theAntiProtonProfile
void makeHits(const G4FastTrack &fastTrack)
GflashHadronShowerProfile * theProfile
int findShowerType(const Gflash3Vector &position)
static int position[264][3]
Definition: ReadPGInfo.cc:289
GflashKaonPlusShowerProfile * theKaonPlusProfile
GflashPiKShowerProfile * thePiKProfile
GflashProtonShowerProfile * theProtonProfile
void initialize(int showerType, double energy, double globalTime, double charge, Gflash3Vector &position, Gflash3Vector &momentum)

◆ excludeDetectorRegion()

G4bool GflashHadronShowerModel::excludeDetectorRegion ( const G4FastTrack &  fastTrack)
private

Definition at line 234 of file GflashHadronShowerModel.cc.

References PVValHelper::eta, Gflash::EtaMin, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, Gflash::getCalorimeterNumber(), edm::ParameterSet::getUntrackedParameter(), Gflash::kENCA, Gflash::kHB, Gflash::kHE, Gflash::MinDistanceToOut, Gflash::Rmax, theParSet, verbosity, Gflash::Zmax, and Gflash::Zmin.

Referenced by ModelTrigger().

234  {
235  const double invcm = 1.0 / CLHEP::cm;
236  G4bool isExcluded = false;
237  int verbosity = theParSet.getUntrackedParameter<int>("Verbosity");
238 
239  // exclude regions where geometry are complicated
240  //+- one supermodule around the EB/EE boundary: 1.479 +- 0.0174*5
241  G4double eta = fastTrack.GetPrimaryTrack()->GetPosition().pseudoRapidity();
242  if (std::fabs(eta) > 1.392 && std::fabs(eta) < 1.566) {
243  if (verbosity > 0) {
244  edm::LogVerbatim("SimGeneralGFlash") << "GflashHadronShowerModel: excluding region of eta = " << eta;
245  }
246  return true;
247  } else {
248  const G4StepPoint *postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
249 
250  Gflash::CalorimeterNumber kCalor = Gflash::getCalorimeterNumber(postStep->GetPosition() * invcm);
251  G4double distOut = 9999.0;
252 
253  // exclude the region where the shower starting point is inside the
254  // preshower
255  if (std::fabs(eta) > Gflash::EtaMin[Gflash::kENCA] &&
256  std::fabs((postStep->GetPosition()).getZ() / CLHEP::cm) < Gflash::Zmin[Gflash::kENCA]) {
257  return true;
258  }
259 
260  //<---the shower starting point is always inside envelopes
261  //@@@exclude the region where the shower starting point is too close to the
262  // end of the hadronic envelopes (may need to be optimized further!)
263  //@@@if we extend parameterization including Magnet/HO, we need to change
264  // this strategy
265  if (kCalor == Gflash::kHB) {
266  distOut = Gflash::Rmax[Gflash::kHB] - postStep->GetPosition().getRho() * invcm;
267  if (distOut < Gflash::MinDistanceToOut)
268  isExcluded = true;
269  } else if (kCalor == Gflash::kHE) {
270  distOut = Gflash::Zmax[Gflash::kHE] - std::fabs(postStep->GetPosition().getZ() * invcm);
271  if (distOut < Gflash::MinDistanceToOut)
272  isExcluded = true;
273  }
274 
275  //@@@remove this print statement later
276  if (isExcluded && verbosity > 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;
280  }
281  }
282 
283  return isExcluded;
284 }
Log< level::Info, true > LogVerbatim
const double MinDistanceToOut
const double Zmax[kNumberCalorimeter]
T getUntrackedParameter(std::string const &, T const &) const
CalorimeterNumber getCalorimeterNumber(const Gflash3Vector &position)
const double EtaMin[kNumberCalorimeter]
const int verbosity
const double Zmin[kNumberCalorimeter]
const double Rmax[kNumberCalorimeter]

◆ IsApplicable()

G4bool GflashHadronShowerModel::IsApplicable ( const G4ParticleDefinition &  particleType)
override

Definition at line 58 of file GflashHadronShowerModel.cc.

References WZElectronSkims53X_cff::particleType.

58  {
59  return &particleType == G4PionMinus::PionMinusDefinition() || &particleType == G4PionPlus::PionPlusDefinition() ||
60  &particleType == G4KaonMinus::KaonMinusDefinition() || &particleType == G4KaonPlus::KaonPlusDefinition() ||
61  &particleType == G4AntiProton::AntiProtonDefinition() || &particleType == G4Proton::ProtonDefinition();
62 }

◆ isFirstInelasticInteraction()

G4bool GflashHadronShowerModel::isFirstInelasticInteraction ( const G4FastTrack &  fastTrack)
private

Definition at line 177 of file GflashHadronShowerModel.cc.

References GflashHistogram::deltaStep, GflashHistogram::energyLoss, GflashHistogram::energyRatio, GflashHistogram::getStoreFlag(), l1ctLayer1_patternWriters_cff::isec, cuy::isFirst, GflashHistogram::kineticEnergy, WZElectronSkims53X_cff::particleType, GflashHistogram::postStepPosition, GflashHistogram::preStepPosition, Gflash::QuasiElasticLike, and theHisto.

Referenced by ModelTrigger().

177  {
178  G4bool isFirst = false;
179 
180  G4StepPoint *preStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPreStepPoint();
181  G4StepPoint *postStep = fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint();
182 
183  G4String procName = postStep->GetProcessDefinedStep()->GetProcessName();
184  G4ParticleDefinition *particleType = fastTrack.GetPrimaryTrack()->GetDefinition();
185 
186  //@@@ this part is still temporary and the cut for the variable ratio should
187  // be optimized later
188 
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")) {
195  // skip to the second interaction if the first inelastic is a quasi-elastic
196  // like interaction
197  //@@@ the cut may be optimized later
198 
199  const G4TrackVector *fSecondaryVector = fastTrack.GetPrimaryTrack()->GetStep()->GetSecondary();
200  G4double leadingEnergy = 0.0;
201 
202  // loop over 'all' secondaries including those produced by continuous
203  // processes.
204  //@@@may require an additional condition only for hadron interaction with
205  // the process name, but it will not change the result anyway
206 
207  for (unsigned int isec = 0; isec < fSecondaryVector->size(); isec++) {
208  G4Track *fSecondaryTrack = (*fSecondaryVector)[isec];
209  G4double secondaryEnergy = fSecondaryTrack->GetKineticEnergy();
210 
211  if (secondaryEnergy > leadingEnergy) {
212  leadingEnergy = secondaryEnergy;
213  }
214  }
215 
216  if ((preStep->GetTotalEnergy() != 0) && (leadingEnergy / preStep->GetTotalEnergy() < Gflash::QuasiElasticLike))
217  isFirst = true;
218 
219  // Fill debugging histograms and check information on secondaries -
220  // remove after final implimentation
221 
222  if (theHisto->getStoreFlag()) {
223  theHisto->preStepPosition->Fill(preStep->GetPosition().getRho() / cm);
224  theHisto->postStepPosition->Fill(postStep->GetPosition().getRho() / cm);
225  theHisto->deltaStep->Fill((postStep->GetPosition() - preStep->GetPosition()).getRho() / cm);
226  theHisto->kineticEnergy->Fill(fastTrack.GetPrimaryTrack()->GetKineticEnergy() / GeV);
227  theHisto->energyLoss->Fill(fabs(fastTrack.GetPrimaryTrack()->GetStep()->GetDeltaEnergy() / GeV));
228  theHisto->energyRatio->Fill(leadingEnergy / preStep->GetTotalEnergy());
229  }
230  }
231  return isFirst;
232 }
isFirst
Definition: cuy.py:418
const double QuasiElasticLike

◆ makeHits()

void GflashHadronShowerModel::makeHits ( const G4FastTrack &  fastTrack)
private

Definition at line 128 of file GflashHadronShowerModel.cc.

References GflashHadronShowerProfile::getGflashHitList(), Gflash::scaleSensitiveHB, Gflash::scaleSensitiveHE, theGflashNavigator, theGflashStep, theGflashTouchableHandle, theProfile, and updateGflashStep().

Referenced by DoIt().

128  {
129  std::vector<GflashHit> &gflashHitList = theProfile->getGflashHitList();
130 
131  theGflashStep->SetTrack(const_cast<G4Track *>(fastTrack.GetPrimaryTrack()));
132  theGflashStep->GetPostStepPoint()->SetProcessDefinedStep(
133  const_cast<G4VProcess *>(fastTrack.GetPrimaryTrack()->GetStep()->GetPostStepPoint()->GetProcessDefinedStep()));
134  theGflashNavigator->SetWorldVolume(
135  G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume());
136 
137  for (auto &hit : gflashHitList) {
138  theGflashNavigator->LocateGlobalPointAndUpdateTouchableHandle(
139  hit.getPosition(), G4ThreeVector(0, 0, 0), theGflashTouchableHandle, false);
140  updateGflashStep(hit.getPosition(), hit.getTime());
141 
142  const G4VPhysicalVolume *aCurrentVolume = theGflashStep->GetPreStepPoint()->GetPhysicalVolume();
143  if (aCurrentVolume == nullptr)
144  continue;
145 
146  const G4LogicalVolume *lv = aCurrentVolume->GetLogicalVolume();
147  if (lv->GetRegion()->GetName() != "CaloRegion")
148  continue;
149 
150  theGflashStep->GetPreStepPoint()->SetSensitiveDetector(aCurrentVolume->GetLogicalVolume()->GetSensitiveDetector());
151  G4VSensitiveDetector *aSensitive = theGflashStep->GetPreStepPoint()->GetSensitiveDetector();
152 
153  if (aSensitive == nullptr)
154  continue;
155 
156  G4String nameCalor = aCurrentVolume->GetName();
157  nameCalor.assign(nameCalor, 0, 2);
158  G4double samplingWeight = 1.0;
159  if (nameCalor == "HB") {
160  samplingWeight = Gflash::scaleSensitiveHB;
161  } else if (nameCalor == "HE" || nameCalor == "HT") {
162  samplingWeight = Gflash::scaleSensitiveHE;
163  }
164  theGflashStep->SetTotalEnergyDeposit(hit.getEnergy() * samplingWeight);
165 
166  aSensitive->Hit(theGflashStep);
167  }
168 }
void updateGflashStep(const G4ThreeVector &position, G4double time)
GflashHadronShowerProfile * theProfile
G4TouchableHandle theGflashTouchableHandle
const double scaleSensitiveHE
std::vector< GflashHit > & getGflashHitList()
const double scaleSensitiveHB

◆ ModelTrigger()

G4bool GflashHadronShowerModel::ModelTrigger ( const G4FastTrack &  fastTrack)
override

Definition at line 64 of file GflashHadronShowerModel.cc.

References Gflash::energyCutOff, excludeDetectorRegion(), and isFirstInelasticInteraction().

64  {
65  // ModelTrigger returns false for Gflash Hadronic Shower Model if it is not
66  // tested from the corresponding wrapper process, GflashHadronWrapperProcess.
67  // Temporarily the track status is set to fPostponeToNextEvent at the wrapper
68  // process before ModelTrigger is really tested for the second time through
69  // PostStepGPIL of enviaged parameterization processes. The better
70  // implmentation may be using via G4VUserTrackInformation of each track, which
71  // requires to modify a geant source code of stepping (G4SteppingManager2)
72 
73  G4bool trigger = false;
74 
75  // mininum energy cutoff to parameterize
76  if (fastTrack.GetPrimaryTrack()->GetKineticEnergy() < Gflash::energyCutOff * CLHEP::GeV)
77  return trigger;
78 
79  // check whether this is called from the normal GPIL or the wrapper process
80  // GPIL
81  if (fastTrack.GetPrimaryTrack()->GetTrackStatus() == fPostponeToNextEvent) {
82  // Shower pameterization start at the first inelastic interaction point
83  G4bool isInelastic = isFirstInelasticInteraction(fastTrack);
84 
85  // Other conditions
86  if (isInelastic) {
87  trigger = (!excludeDetectorRegion(fastTrack));
88  }
89  }
90 
91  return trigger;
92 }
const double energyCutOff
G4bool isFirstInelasticInteraction(const G4FastTrack &fastTrack)
G4bool excludeDetectorRegion(const G4FastTrack &fastTrack)

◆ updateGflashStep()

void GflashHadronShowerModel::updateGflashStep ( const G4ThreeVector &  position,
G4double  time 
)
private

Definition at line 170 of file GflashHadronShowerModel.cc.

References theGflashStep, and theGflashTouchableHandle.

Referenced by makeHits().

170  {
171  theGflashStep->GetPostStepPoint()->SetGlobalTime(timeGlobal);
172  theGflashStep->GetPreStepPoint()->SetPosition(spotPosition);
173  theGflashStep->GetPostStepPoint()->SetPosition(spotPosition);
174  theGflashStep->GetPreStepPoint()->SetTouchableHandle(theGflashTouchableHandle);
175 }
G4TouchableHandle theGflashTouchableHandle

Member Data Documentation

◆ theAntiProtonProfile

GflashAntiProtonShowerProfile* GflashHadronShowerModel::theAntiProtonProfile
private

Definition at line 49 of file GflashHadronShowerModel.h.

Referenced by DoIt(), and GflashHadronShowerModel().

◆ theGflashNavigator

G4Navigator* GflashHadronShowerModel::theGflashNavigator
private

Definition at line 52 of file GflashHadronShowerModel.h.

Referenced by GflashHadronShowerModel(), and makeHits().

◆ theGflashStep

G4Step* GflashHadronShowerModel::theGflashStep
private

◆ theGflashTouchableHandle

G4TouchableHandle GflashHadronShowerModel::theGflashTouchableHandle
private

Definition at line 53 of file GflashHadronShowerModel.h.

Referenced by GflashHadronShowerModel(), makeHits(), and updateGflashStep().

◆ theHisto

GflashHistogram* GflashHadronShowerModel::theHisto
private

◆ theKaonMinusProfile

GflashKaonMinusShowerProfile* GflashHadronShowerModel::theKaonMinusProfile
private

Definition at line 47 of file GflashHadronShowerModel.h.

Referenced by DoIt(), and GflashHadronShowerModel().

◆ theKaonPlusProfile

GflashKaonPlusShowerProfile* GflashHadronShowerModel::theKaonPlusProfile
private

Definition at line 46 of file GflashHadronShowerModel.h.

Referenced by DoIt(), and GflashHadronShowerModel().

◆ theParSet

edm::ParameterSet GflashHadronShowerModel::theParSet
private

Definition at line 43 of file GflashHadronShowerModel.h.

Referenced by excludeDetectorRegion().

◆ thePiKProfile

GflashPiKShowerProfile* GflashHadronShowerModel::thePiKProfile
private

Definition at line 45 of file GflashHadronShowerModel.h.

Referenced by DoIt(), and GflashHadronShowerModel().

◆ theProfile

GflashHadronShowerProfile* GflashHadronShowerModel::theProfile
private

◆ theProtonProfile

GflashProtonShowerProfile* GflashHadronShowerModel::theProtonProfile
private

Definition at line 48 of file GflashHadronShowerModel.h.

Referenced by DoIt(), and GflashHadronShowerModel().

◆ theWatcherOn

G4bool GflashHadronShowerModel::theWatcherOn
private

Definition at line 42 of file GflashHadronShowerModel.h.

Referenced by GflashHadronShowerModel().