CMS 3D CMS Logo

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

#include <TreatSecondary.h>

Public Member Functions

void initTrack (const G4Track *trk)
 
std::vector< math::XYZTLorentzVectortracks (const G4Step *step, std::string &procName, int &procID, bool &intr, double &deltaE, std::vector< int > &charges)
 
 TreatSecondary (const edm::ParameterSet &p)
 
virtual ~TreatSecondary ()
 

Private Member Functions

const TreatSecondaryoperator= (const TreatSecondary &)=delete
 
 TreatSecondary (const TreatSecondary &)=delete
 

Private Attributes

double eTrack
 
int killAfter
 
double minDeltaE
 
int minSec
 
int nHad
 
int nsecL
 
int step
 
G4ProcessTypeEnumeratortypeEnumerator
 
int verbosity
 

Detailed Description

Definition at line 16 of file TreatSecondary.h.

Constructor & Destructor Documentation

TreatSecondary::TreatSecondary ( const edm::ParameterSet p)

Definition at line 17 of file TreatSecondary.cc.

References edm::ParameterSet::getUntrackedParameter(), killAfter, MeV, minDeltaE, typeEnumerator, and verbosity.

17  : typeEnumerator(nullptr) {
18 
19  verbosity = p.getUntrackedParameter<int>("Verbosity",0);
20  killAfter = p.getUntrackedParameter<int>("KillAfter", -1);
21  minDeltaE = p.getUntrackedParameter<double>("MinimumDeltaE", 10.0)*MeV;
22 
23  edm::LogInfo("CheckSecondary") << "Instantiate CheckSecondary with Flag"
24  << " for Killing track after "<< killAfter
25  << " hadronic interactions\nDefine inelastic"
26  << " if > 1 seondary or change in KE > "
27  << minDeltaE << " MeV\n";
28 
30 }
T getUntrackedParameter(std::string const &, T const &) const
G4ProcessTypeEnumerator * typeEnumerator
const double MeV
TreatSecondary::~TreatSecondary ( )
virtual

Definition at line 32 of file TreatSecondary.cc.

References typeEnumerator.

32  {
33  if (typeEnumerator) delete typeEnumerator;
34 }
G4ProcessTypeEnumerator * typeEnumerator
TreatSecondary::TreatSecondary ( const TreatSecondary )
privatedelete

Member Function Documentation

void TreatSecondary::initTrack ( const G4Track *  trk)

Definition at line 36 of file TreatSecondary.cc.

References eTrack, GeV, LogDebug, MeV, nHad, and nsecL.

Referenced by StoreSecondary::update(), and CheckSecondary::update().

36  {
37 
38  step = 0;
39  nsecL = 0;
40  nHad = 0;
41  eTrack = thTk->GetKineticEnergy()/MeV;
42  LogDebug("CheckSecondary") << "TreatSecondary::initTrack:Track: "
43  << thTk->GetTrackID() << " Type: "
44  << thTk->GetDefinition()->GetParticleName()
45  << " KE " << thTk->GetKineticEnergy()/GeV
46  << " GeV p " << thTk->GetMomentum().mag()/GeV
47  << " GeV daughter of particle "
48  << thTk->GetParentID();
49 }
#define LogDebug(id)
const double GeV
Definition: MathUtil.h:16
const double MeV
step
const TreatSecondary& TreatSecondary::operator= ( const TreatSecondary )
privatedelete
std::vector< math::XYZTLorentzVector > TreatSecondary::tracks ( const G4Step *  step,
std::string &  procName,
int &  procID,
bool &  intr,
double &  deltaE,
std::vector< int > &  charges 
)

Definition at line 51 of file TreatSecondary.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, eTrack, GeV, mps_fire::i, createfilelist::int, LogDebug, MeV, nHad, nsecL, createTree::pp, proc, G4ProcessTypeEnumerator::processG4Name(), G4ProcessTypeEnumerator::processIdLong(), typeEnumerator, and verbosity.

Referenced by StoreSecondary::update(), and CheckSecondary::update().

56  {
57 
58  step++;
59  procid = -1;
60  name = "Unknown";
61  hadrInt = false;
62  deltaE = 0;
63  std::vector<math::XYZTLorentzVector> secondaries;
64  charges.clear();
65 
66  if (aStep != nullptr) {
67  const G4TrackVector* tkV = aStep->GetSecondary();
68  G4Track* thTk = aStep->GetTrack();
69  const G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
70  const G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
71  double eTrackNew = thTk->GetKineticEnergy()/MeV;
72  deltaE = eTrack-eTrackNew;
73  eTrack = eTrackNew;
74  if (tkV != nullptr && postStepPoint != nullptr) {
75  int nsc = (*tkV).size();
76  const G4VProcess* proc = postStepPoint->GetProcessDefinedStep();
77  if (proc != nullptr) {
78  G4ProcessType type = proc->GetProcessType();
79  procid = typeEnumerator->processIdLong(proc);
80  name = proc->GetProcessName();
81  int sec = nsc - nsecL;
82  LogDebug("CheckSecondary") << sec << " secondaries in step "
83  << thTk->GetCurrentStepNumber()
84  << " of track " << thTk->GetTrackID()
85  << " from " << name << " of type "
86  << type << " ID " << procid << " ("
87  << typeEnumerator->processG4Name(procid)
88  << ")";
89 
90  // hadronic interaction
91  if(procid >= 121 && procid <= 151) {
92  LogDebug("CheckSecondary") << "Hadronic Interaction " << nHad
93  << " of Type " << procid << " with "
94  << sec << " secondaries from process "
95  << proc->GetProcessName() << " Delta E "
96  << deltaE << " Flag " << hadrInt;
97  math::XYZTLorentzVector secondary;
98  for (int i=nsecL; i<nsc; ++i) {
99  G4Track* tk = (*tkV)[i];
100  G4ThreeVector pp = tk->GetMomentum();
101  double ee = tk->GetTotalEnergy();
102  secondary = math::XYZTLorentzVector(pp.x(),pp.y(),pp.z(),ee);
103  secondaries.push_back(secondary);
104  int charge = (int)(tk->GetDefinition()->GetPDGCharge());
105  charges.push_back(charge);
106  }
107  if (verbosity > 0) {
108  for (int i=nsecL; i<nsc; i++) {
109  G4Track* tk = (*tkV)[i];
110  LogDebug("CheckSecondary") << "Secondary: " << sec << " ID "
111  << tk->GetTrackID() << " Status "
112  << tk->GetTrackStatus() << " Particle "
113  << tk->GetDefinition()->GetParticleName()
114  << " Position " << tk->GetPosition()
115  << " KE " << tk->GetKineticEnergy()
116  << " Time " << tk->GetGlobalTime();
117  }
118  }
119  }
120  nsecL = nsc;
121  }
122  }
123  if (verbosity > 1) {
124  LogDebug("CheckSecondary") << "Track: " << thTk->GetTrackID()
125  << " Status " << thTk->GetTrackStatus()
126  << " Particle "
127  << thTk->GetDefinition()->GetParticleName()
128  << " at " << preStepPoint->GetPosition()
129  << " Step: " << step << " KE "
130  << thTk->GetKineticEnergy()/GeV << " GeV; p "
131  << thTk->GetMomentum().mag()/GeV
132  << " GeV/c; Step Length "
133  << aStep->GetStepLength()<< " Energy Deposit "
134  << aStep->GetTotalEnergyDeposit()/MeV
135  << " MeV; Interaction " << hadrInt;
136  }
137  }
138  return secondaries;
139 }
#define LogDebug(id)
type
Definition: HCALResponse.h:21
const double GeV
Definition: MathUtil.h:16
TrainProcessor *const proc
Definition: MVATrainer.cc:101
G4ProcessTypeEnumerator * typeEnumerator
const double MeV
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
int processIdLong(const G4VProcess *p)
step

Member Data Documentation

double TreatSecondary::eTrack
private

Definition at line 35 of file TreatSecondary.h.

Referenced by initTrack(), and tracks().

int TreatSecondary::killAfter
private

Definition at line 34 of file TreatSecondary.h.

Referenced by TreatSecondary().

double TreatSecondary::minDeltaE
private

Definition at line 35 of file TreatSecondary.h.

Referenced by TreatSecondary().

int TreatSecondary::minSec
private

Definition at line 34 of file TreatSecondary.h.

int TreatSecondary::nHad
private

Definition at line 37 of file TreatSecondary.h.

Referenced by initTrack(), and tracks().

int TreatSecondary::nsecL
private

Definition at line 37 of file TreatSecondary.h.

Referenced by initTrack(), and tracks().

int TreatSecondary::step
private

Definition at line 37 of file TreatSecondary.h.

G4ProcessTypeEnumerator* TreatSecondary::typeEnumerator
private

Definition at line 36 of file TreatSecondary.h.

Referenced by tracks(), TreatSecondary(), and ~TreatSecondary().

int TreatSecondary::verbosity
private

Definition at line 34 of file TreatSecondary.h.

Referenced by tracks(), and TreatSecondary().