CMS 3D CMS Logo

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

#include <TreatSecondary.h>

Public Member Functions

void initTrack (const G4Track *trk)
 
const TreatSecondaryoperator= (const TreatSecondary &)=delete
 
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)
 
 TreatSecondary (const TreatSecondary &)=delete
 
virtual ~TreatSecondary ()
 

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() [1/2]

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

Definition at line 17 of file TreatSecondary.cc.

References killAfter, minDeltaE, AlCaHLTBitMon_ParallelJobs::p, typeEnumerator, and verbosity.

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

◆ TreatSecondary() [2/2]

TreatSecondary::TreatSecondary ( const TreatSecondary )
delete

◆ ~TreatSecondary()

TreatSecondary::~TreatSecondary ( )
virtual

Definition at line 30 of file TreatSecondary.cc.

References typeEnumerator.

30  {
31  if (typeEnumerator)
32  delete typeEnumerator;
33 }
G4ProcessTypeEnumerator * typeEnumerator

Member Function Documentation

◆ initTrack()

void TreatSecondary::initTrack ( const G4Track *  trk)

Definition at line 35 of file TreatSecondary.cc.

References eTrack, LogDebug, nHad, and nsecL.

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

35  {
36  step = 0;
37  nsecL = 0;
38  nHad = 0;
39  eTrack = thTk->GetKineticEnergy() / MeV;
40  LogDebug("CheckSecondary") << "TreatSecondary::initTrack:Track: " << thTk->GetTrackID()
41  << " Type: " << thTk->GetDefinition()->GetParticleName() << " KE "
42  << thTk->GetKineticEnergy() / GeV << " GeV p " << thTk->GetMomentum().mag() / GeV
43  << " GeV daughter of particle " << thTk->GetParentID();
44 }
step
Definition: StallMonitor.cc:98
#define LogDebug(id)

◆ operator=()

const TreatSecondary& TreatSecondary::operator= ( const TreatSecondary )
delete

◆ tracks()

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 46 of file TreatSecondary.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, CosmicGenFilterHelix_cfi::charges, EgHLTOffHistBins_cfi::deltaE, eTrack, mps_fire::i, createfilelist::int, LogDebug, Skims_PA_cff::name, nHad, nsecL, createTree::pp, ValidateTausOnZEEFastSim_cff::proc, G4ProcessTypeEnumerator::processG4Name(), G4ProcessTypeEnumerator::processIdLong(), fileinputsource_cfi::sec, typeEnumerator, and verbosity.

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

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

Member Data Documentation

◆ eTrack

double TreatSecondary::eTrack
private

Definition at line 29 of file TreatSecondary.h.

Referenced by initTrack(), and tracks().

◆ killAfter

int TreatSecondary::killAfter
private

Definition at line 28 of file TreatSecondary.h.

Referenced by TreatSecondary().

◆ minDeltaE

double TreatSecondary::minDeltaE
private

Definition at line 29 of file TreatSecondary.h.

Referenced by TreatSecondary().

◆ minSec

int TreatSecondary::minSec
private

Definition at line 28 of file TreatSecondary.h.

◆ nHad

int TreatSecondary::nHad
private

Definition at line 31 of file TreatSecondary.h.

Referenced by initTrack(), and tracks().

◆ nsecL

int TreatSecondary::nsecL
private

Definition at line 31 of file TreatSecondary.h.

Referenced by initTrack(), and tracks().

◆ step

int TreatSecondary::step
private

Definition at line 31 of file TreatSecondary.h.

◆ typeEnumerator

G4ProcessTypeEnumerator* TreatSecondary::typeEnumerator
private

Definition at line 30 of file TreatSecondary.h.

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

◆ verbosity

int TreatSecondary::verbosity
private

Definition at line 28 of file TreatSecondary.h.

Referenced by tracks(), and TreatSecondary().