CMS 3D CMS Logo

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

#include <CaloTrkProcessing.h>

Inheritance diagram for CaloTrkProcessing:
SensitiveCaloDetector Observer< const BeginOfEvent * > Observer< const G4Step * > SensitiveDetector

Classes

struct  Detector
 

Public Member Functions

 CaloTrkProcessing (const std::string &aSDname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *)
 
void clearHits () override
 
void EndOfEvent (G4HCofThisEvent *) override
 
void fillHits (edm::PCaloHitContainer &, const std::string &) override
 
void Initialize (G4HCofThisEvent *) override
 
bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
uint32_t setDetUnitId (const G4Step *step) override
 
 ~CaloTrkProcessing () override
 
- Public Member Functions inherited from SensitiveCaloDetector
virtual void reset ()
 
 SensitiveCaloDetector (const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
void EndOfEvent (G4HCofThisEvent *eventHC) override
 
const std::vector< std::string > & getNames () const
 
void Initialize (G4HCofThisEvent *eventHC) override
 
bool isCaloSD () const
 
 SensitiveDetector (const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &, edm::ParameterSet const &p, bool calo)
 
 ~SensitiveDetector () override
 
- Public Member Functions inherited from Observer< const BeginOfEvent * >
 Observer ()
 
void slotForUpdate (const BeginOfEvent * iT)
 
virtual ~Observer ()
 
- Public Member Functions inherited from Observer< const G4Step * >
 Observer ()
 
void slotForUpdate (const G4Step * iT)
 
virtual ~Observer ()
 

Private Member Functions

void detectorLevel (const G4VTouchable *, int &, int *, G4String *) const
 
int detLevels (const G4VTouchable *) const
 
G4LogicalVolume * detLV (const G4VTouchable *, int) const
 
int isItCalo (const G4VTouchable *, const std::vector< Detector > &)
 
int isItInside (const G4VTouchable *, int, int)
 
void update (const BeginOfEvent *evt) override
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *) override
 This routine will be called when the appropriate signal arrives. More...
 

Private Attributes

std::vector< Detectordetectors_
 
bool doFineCalo_
 
double eMin_
 
double eMinFine_
 
std::vector< DetectorfineDetectors_
 
int lastTrackID_
 
bool putHistory_
 
bool testBeam_
 

Additional Inherited Members

- Protected Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 
- Protected Member Functions inherited from SensitiveDetector
TrackInformationcmsTrackInformation (const G4Track *aTrack)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point) const
 
Local3DPoint FinalStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint InitialStepPosition (const G4Step *step, coordinates) const
 
Local3DPoint LocalPostStepPosition (const G4Step *step) const
 
Local3DPoint LocalPreStepPosition (const G4Step *step) const
 
void NaNTrap (const G4Step *step) const
 
void setNames (const std::vector< std::string > &)
 

Detailed Description

Definition at line 24 of file CaloTrkProcessing.h.

Constructor & Destructor Documentation

◆ CaloTrkProcessing()

CaloTrkProcessing::CaloTrkProcessing ( const std::string &  aSDname,
const edm::EventSetup es,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager  
)

Definition at line 25 of file CaloTrkProcessing.cc.

30  : SensitiveCaloDetector(name, es, clg, p), lastTrackID_(-1) {
31  //Initialise the parameter set
32  bool dd4hep = p.getParameter<bool>("g4GeometryDD4hepSource");
33  int addlevel = dd4hep ? 1 : 0;
34  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("CaloTrkProcessing");
35  testBeam_ = m_p.getParameter<bool>("TestBeam");
36  eMin_ = m_p.getParameter<double>("EminTrack") * CLHEP::MeV;
37  putHistory_ = m_p.getParameter<bool>("PutHistory");
38  doFineCalo_ = m_p.getParameter<bool>("DoFineCalo");
39  eMinFine_ = m_p.getParameter<double>("EminFineTrack") * CLHEP::MeV;
40  std::vector<std::string> fineNames = m_p.getParameter<std::vector<std::string> >("FineCaloNames");
41  std::vector<int> fineLevels = m_p.getParameter<std::vector<int> >("FineCaloLevels");
42  std::vector<int> useFines = m_p.getParameter<std::vector<int> >("UseFineCalo");
43  for (auto& level : fineLevels)
44  level += addlevel;
45 
46  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Initialised with TestBeam = " << testBeam_ << " Emin = " << eMin_
47  << " Flags " << putHistory_ << " (History), " << doFineCalo_ << " (Special Calorimeter)";
48  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Have a possibility of " << fineNames.size()
49  << " fine calorimeters of which " << useFines.size() << " are selected";
50  for (unsigned int k = 0; k < fineNames.size(); ++k)
51  edm::LogVerbatim("CaloSim") << "[" << k << "] " << fineNames[k] << " at " << fineLevels[k];
52  std::ostringstream st1;
53  for (unsigned int k = 0; k < useFines.size(); ++k)
54  st1 << " [" << k << "] " << useFines[k] << ":" << fineNames[useFines[k]];
55  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing used calorimeters" << st1.str();
56 
57  // Get pointer to CaloSimulationParameters
59  es.get<HcalParametersRcd>().get(csps);
60  if (csps.isValid()) {
61  const CaloSimulationParameters* csp = csps.product();
62 #ifdef EDM_ML_DEBUG
63  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: " << csp->caloNames_.size() << " entries for caloNames:";
64  for (unsigned int i = 0; i < csp->caloNames_.size(); i++)
65  edm::LogVerbatim("CaloSim") << " (" << i << ") " << csp->caloNames_[i];
66  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: " << csp->levels_.size() << " entries for levels:";
67  for (unsigned int i = 0; i < csp->levels_.size(); i++)
68  edm::LogVerbatim("CaloSim") << " (" << i << ") " << (csp->levels_[i] + addlevel);
69  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: " << csp->neighbours_.size() << " entries for neighbours:";
70  for (unsigned int i = 0; i < csp->neighbours_.size(); i++)
71  edm::LogVerbatim("CaloSim") << " (" << i << ") " << csp->neighbours_[i];
72  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: " << csp->insideNames_.size() << " entries for insideNames:";
73  for (unsigned int i = 0; i < csp->insideNames_.size(); i++)
74  edm::LogVerbatim("CaloSim") << " (" << i << ") " << csp->insideNames_[i];
75  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: " << csp->insideLevel_.size() << " entries for insideLevel:";
76  for (unsigned int i = 0; i < csp->insideLevel_.size(); i++)
77  edm::LogVerbatim("CaloSim") << " (" << i << ") " << (csp->insideLevel_[i] + addlevel);
78 #endif
79 
80  if (csp->caloNames_.size() < csp->neighbours_.size()) {
81  edm::LogError("CaloSim") << "CaloTrkProcessing: # of Calorimeter bins " << csp->caloNames_.size()
82  << " does not match with " << csp->neighbours_.size() << " ==> illegal ";
83  throw cms::Exception("Unknown", "CaloTrkProcessing")
84  << "Calorimeter array size does not match with size of neighbours\n";
85  }
86 
87  const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
88  std::vector<G4LogicalVolume*>::const_iterator lvcite;
89  int istart = 0;
90  for (unsigned int i = 0; i < csp->caloNames_.size(); i++) {
91  G4LogicalVolume* lv = nullptr;
92  G4String name(csp->caloNames_[i]);
93  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
94  G4String namx(static_cast<std::string>(dd4hep::dd::noNamespace((*lvcite)->GetName())));
95  if (namx == name) {
96  lv = (*lvcite);
97  break;
98  }
99  }
100  if (lv != nullptr) {
102  detector.name = name;
103  detector.lv = lv;
104  detector.level = (csp->levels_[i] + addlevel);
105  if (istart + csp->neighbours_[i] > static_cast<int>(csp->insideNames_.size())) {
106  edm::LogError("CaloSim") << "CaloTrkProcessing: # of InsideNames bins " << csp->insideNames_.size()
107  << " too few compaerd to " << istart + csp->neighbours_[i]
108  << " requested ==> illegal ";
109  throw cms::Exception("Unknown", "CaloTrkProcessing")
110  << "InsideNames array size does not match with list of neighbours\n";
111  }
112  std::vector<std::string> inside;
113  std::vector<G4LogicalVolume*> insideLV;
114  std::vector<int> insideLevels;
115  for (int k = 0; k < csp->neighbours_[i]; k++) {
116  lv = nullptr;
117  name = static_cast<G4String>(csp->insideNames_[istart + k]);
118  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
119  G4String namx(static_cast<std::string>(dd4hep::dd::noNamespace((*lvcite)->GetName())));
120  if (namx == name) {
121  lv = (*lvcite);
122  break;
123  }
124  }
125  inside.push_back(name);
126  insideLV.push_back(lv);
127  insideLevels.push_back(csp->insideLevel_[istart + k] + addlevel);
128  }
129  detector.fromDets = inside;
130  detector.fromDetL = insideLV;
131  detector.fromLevels = insideLevels;
132  detectors_.emplace_back(detector);
133  }
134  istart += csp->neighbours_[i];
135  }
136 
137  for (unsigned int i = 0; i < useFines.size(); i++) {
138  G4LogicalVolume* lv = nullptr;
139  G4String name = static_cast<G4String>(fineNames[useFines[i]]);
140  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
141  G4String namx(static_cast<std::string>(dd4hep::dd::noNamespace((*lvcite)->GetName())));
142  if (namx == name) {
143  lv = (*lvcite);
144  break;
145  }
146  }
147  if (lv != nullptr) {
149  detector.name = name;
150  detector.lv = lv;
151  detector.level = fineLevels[useFines[i]];
152  detector.fromDets.clear();
153  detector.fromDetL.clear();
154  detector.fromLevels.clear();
155  fineDetectors_.emplace_back(detector);
156  }
157  }
158  } else {
159  edm::LogError("CaloSim") << "CaloTrkProcessing: Cannot find CaloSimulationParameters";
160  throw cms::Exception("Unknown", "CaloTrkProcessing") << "Cannot find CaloSimulationParameters\n";
161  }
162 
163  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: with " << detectors_.size() << " calorimetric volumes";
164  for (unsigned int i = 0; i < detectors_.size(); i++) {
165  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Calorimeter volume " << i << " " << detectors_[i].name << " LV "
166  << detectors_[i].lv << " at level " << detectors_[i].level << " with "
167  << detectors_[i].fromDets.size() << " neighbours";
168  for (unsigned int k = 0; k < detectors_[i].fromDets.size(); k++)
169  edm::LogVerbatim("CaloSim") << " Element " << k << " " << detectors_[i].fromDets[k] << " LV "
170  << detectors_[i].fromDetL[k] << " at level " << detectors_[i].fromLevels[k];
171  }
172 
173  doFineCalo_ = doFineCalo_ && !(fineDetectors_.empty());
174  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: with " << fineDetectors_.size() << " special calorimetric volumes";
175  for (unsigned int i = 0; i < detectors_.size(); i++)
176  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Calorimeter volume " << i << " " << detectors_[i].name << " LV "
177  << detectors_[i].lv << " at level " << detectors_[i].level;
178 }

References CaloSimulationParameters::caloNames_, hgcalTestNeighbor_cfi::detector, detectors_, doFineCalo_, eMin_, eMinFine_, Exception, fineDetectors_, edm::EventSetup::get(), get, edm::ParameterSet::getParameter(), mps_fire::i, CaloSimulationParameters::insideLevel_, CaloSimulationParameters::insideNames_, edm::ESHandleBase::isValid(), dqmdumpme::k, personalPlayback::level, CaloSimulationParameters::levels_, MeV, Skims_PA_cff::name, CaloSimulationParameters::neighbours_, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), putHistory_, and testBeam_.

◆ ~CaloTrkProcessing()

CaloTrkProcessing::~CaloTrkProcessing ( )
override

Definition at line 180 of file CaloTrkProcessing.cc.

180 {}

Member Function Documentation

◆ clearHits()

void CaloTrkProcessing::clearHits ( )
inlineoverridevirtual

Implements SensitiveDetector.

Definition at line 35 of file CaloTrkProcessing.h.

35 {}

◆ detectorLevel()

void CaloTrkProcessing::detectorLevel ( const G4VTouchable *  touch,
int &  level,
int *  copyno,
G4String *  name 
) const
private

Definition at line 416 of file CaloTrkProcessing.cc.

416  {
417  static const std::string unknown("Unknown");
418  //Get name and copy numbers
419  if (level > 0) {
420  for (int ii = 0; ii < level; ii++) {
421  int i = level - ii - 1;
422  G4VPhysicalVolume* pv = touch->GetVolume(i);
423  if (pv != nullptr)
424  name[ii] = pv->GetName();
425  else
426  name[ii] = unknown;
427  copyno[ii] = touch->GetReplicaNumber(i);
428  }
429  }
430 #ifdef EDM_ML_DEBUG
431  edm::LogVerbatim("CaloSimX") << "CaloTrkProcessing::detectorLevel "
432  << " with " << level << ":" << detLevels(touch) << " levels";
433  for (int ii = 0; ii < level; ii++)
434  edm::LogVerbatim("CaloSimX") << "[" << ii << "] " << name[ii] << ":" << copyno[ii];
435 #endif
436 }

References detLevels(), mps_fire::i, cuy::ii, personalPlayback::level, Skims_PA_cff::name, MetAnalyzer::pv(), AlCaHLTBitMon_QueryRunRegistry::string, and susybsm::HSCParticleType::unknown.

Referenced by isItCalo(), and isItInside().

◆ detLevels()

int CaloTrkProcessing::detLevels ( const G4VTouchable *  touch) const
private

Definition at line 395 of file CaloTrkProcessing.cc.

395  {
396  //Return number of levels
397  if (touch)
398  return ((touch->GetHistoryDepth()) + 1);
399  else
400  return 0;
401 }

Referenced by detectorLevel(), isItCalo(), and isItInside().

◆ detLV()

G4LogicalVolume * CaloTrkProcessing::detLV ( const G4VTouchable *  touch,
int  currentlevel 
) const
private

Definition at line 403 of file CaloTrkProcessing.cc.

403  {
404  G4LogicalVolume* lv = nullptr;
405  if (touch) {
406  int level = ((touch->GetHistoryDepth()) + 1);
407  if (level > 0 && level >= currentlevel) {
408  int ii = level - currentlevel;
409  lv = touch->GetVolume(ii)->GetLogicalVolume();
410  return lv;
411  }
412  }
413  return lv;
414 }

References cuy::ii, and personalPlayback::level.

Referenced by isItCalo(), and isItInside().

◆ EndOfEvent()

void CaloTrkProcessing::EndOfEvent ( G4HCofThisEvent *  )
inlineoverride

Definition at line 38 of file CaloTrkProcessing.h.

38 {}

◆ fillHits()

void CaloTrkProcessing::fillHits ( edm::PCaloHitContainer ,
const std::string &   
)
inlineoverridevirtual

Implements SensitiveCaloDetector.

Definition at line 39 of file CaloTrkProcessing.h.

39 {}

◆ Initialize()

void CaloTrkProcessing::Initialize ( G4HCofThisEvent *  )
inlineoverride

Definition at line 34 of file CaloTrkProcessing.h.

34 {}

◆ isItCalo()

int CaloTrkProcessing::isItCalo ( const G4VTouchable *  touch,
const std::vector< Detector > &  detectors 
)
private

Definition at line 305 of file CaloTrkProcessing.cc.

305  {
306  int lastLevel = -1;
307  G4LogicalVolume* lv = nullptr;
308  for (unsigned int it = 0; it < detectors.size(); it++) {
309  if (lastLevel != detectors[it].level) {
310  lastLevel = detectors[it].level;
311  lv = detLV(touch, lastLevel);
312 #ifdef EDM_ML_DEBUG
313  std::string name1 = "Unknown";
314  if (lv != 0)
315  name1 = lv->GetName();
316  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: volume " << name1 << " at Level " << lastLevel;
317  int levels = detLevels(touch);
318  if (levels > 0) {
319  G4String name2[20];
320  int copyno2[20];
321  detectorLevel(touch, levels, copyno2, name2);
322  for (int i2 = 0; i2 < levels; i2++)
323  edm::LogVerbatim("CaloSim") << " " << i2 << " " << name2[i2] << " " << copyno2[i2];
324  }
325 #endif
326  }
327  bool ok = (lv == detectors[it].lv);
328  if (ok)
329  return it;
330  }
331  return -1;
332 }

References detectorLevel(), MuonGeometrySanityCheck_cfi::detectors(), detLevels(), detLV(), testProducerWithPsetDescEmpty_cfi::i2, personalPlayback::level, jets_cff::levels, hfnoseParametersInitialization_cfi::name2, convertSQLiteXML::ok, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by update().

◆ isItInside()

int CaloTrkProcessing::isItInside ( const G4VTouchable *  touch,
int  idcal,
int  idin 
)
private

Definition at line 334 of file CaloTrkProcessing.cc.

334  {
335  int lastLevel = -1;
336  G4LogicalVolume* lv = nullptr;
337  int id1, id2;
338  if (idcal < 0) {
339  id1 = 0;
340  id2 = static_cast<int>(detectors_.size());
341  } else {
342  id1 = idcal;
343  id2 = id1 + 1;
344  }
345  for (int it1 = id1; it1 < id2; it1++) {
346  if (idin < 0) {
347  for (unsigned int it2 = 0; it2 < detectors_[it1].fromDets.size(); it2++) {
348  if (lastLevel != detectors_[it1].fromLevels[it2]) {
349  lastLevel = detectors_[it1].fromLevels[it2];
350  lv = detLV(touch, lastLevel);
351 #ifdef EDM_ML_DEBUG
352  std::string name1 = "Unknown";
353  if (lv != 0)
354  name1 = lv->GetName();
355  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: volume " << name1 << " at Level " << lastLevel;
356  int levels = detLevels(touch);
357  if (levels > 0) {
358  G4String name2[20];
359  int copyno2[20];
360  detectorLevel(touch, levels, copyno2, name2);
361  for (int i2 = 0; i2 < levels; i2++)
362  edm::LogVerbatim("CaloSim") << " " << i2 << " " << name2[i2] << " " << copyno2[i2];
363  }
364 #endif
365  }
366  bool ok = (lv == detectors_[it1].fromDetL[it2]);
367  if (ok)
368  return it2;
369  }
370  } else {
371  lastLevel = detectors_[it1].fromLevels[idin];
372  lv = detLV(touch, lastLevel);
373 #ifdef EDM_ML_DEBUG
374  std::string name1 = "Unknown";
375  if (lv != 0)
376  name1 = lv->GetName();
377  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: volume " << name1 << " at Level " << lastLevel;
378  int levels = detLevels(touch);
379  if (levels > 0) {
380  G4String name2[20];
381  int copyno2[20];
382  detectorLevel(touch, levels, copyno2, name2);
383  for (int i2 = 0; i2 < levels; i2++)
384  edm::LogVerbatim("CaloSim") << " " << i2 << " " << name2[i2] << " " << copyno2[i2];
385  }
386 #endif
387  bool ok = (lv == detectors_[it1].fromDetL[idin]);
388  if (ok)
389  return idin;
390  }
391  }
392  return -1;
393 }

References detectorLevel(), detectors_, detLevels(), detLV(), testProducerWithPsetDescEmpty_cfi::i2, globals_cff::id1, globals_cff::id2, jets_cff::levels, hfnoseParametersInitialization_cfi::name2, convertSQLiteXML::ok, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by update().

◆ ProcessHits()

bool CaloTrkProcessing::ProcessHits ( G4Step *  ,
G4TouchableHistory *   
)
inlineoverridevirtual

Implements SensitiveDetector.

Definition at line 36 of file CaloTrkProcessing.h.

36 { return true; }

◆ setDetUnitId()

uint32_t CaloTrkProcessing::setDetUnitId ( const G4Step *  step)
inlineoverridevirtual

Implements SensitiveDetector.

Definition at line 37 of file CaloTrkProcessing.h.

37 { return 0; }

◆ update() [1/2]

void CaloTrkProcessing::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 182 of file CaloTrkProcessing.cc.

182 { lastTrackID_ = -1; }

References lastTrackID_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

◆ update() [2/2]

void CaloTrkProcessing::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 184 of file CaloTrkProcessing.cc.

184  {
185  // define if you are at the surface of CALO
186 
187  G4Track* theTrack = aStep->GetTrack();
188  int id = theTrack->GetTrackID();
189 
190  TrackInformation* trkInfo = dynamic_cast<TrackInformation*>(theTrack->GetUserInformation());
191 
192  if (trkInfo == nullptr) {
193  edm::LogError("CaloSim") << "CaloTrkProcessing: No trk info !!!! abort ";
194  throw cms::Exception("Unknown", "CaloTrkProcessing") << "cannot get trkInfo for Track " << id << "\n";
195  }
196 
197  if (doFineCalo_) {
198  // Boundary-crossing logic
199  int prestepLV = isItCalo(aStep->GetPreStepPoint()->GetTouchable(), fineDetectors_);
200  int poststepLV = isItCalo(aStep->GetPostStepPoint()->GetTouchable(), fineDetectors_);
201  if (prestepLV < 0 && poststepLV >= 0
202  // Allow back-scattering and filter it out later; ensure consistency during the SIM step
203  // && std::abs(theTrack->GetStep()->GetPreStepPoint()->GetPosition().z()) < std::abs(theTrack->GetPosition().z())
204  ) {
205 #ifdef EDM_ML_DEBUG
206  edm::LogVerbatim("DoFineCalo") << "Entered fine volume " << poststepLV << ":"
207  << " Track " << id << " pdgid=" << theTrack->GetDefinition()->GetPDGEncoding()
208  << " prestepLV=" << prestepLV << " poststepLV=" << poststepLV
209  << " GetKineticEnergy[GeV]=" << theTrack->GetKineticEnergy() / CLHEP::GeV
210  << " GetVertexKineticEnergy[GeV]="
211  << theTrack->GetVertexKineticEnergy() / CLHEP::GeV << " prestepPosition[cm]=("
212  << theTrack->GetStep()->GetPreStepPoint()->GetPosition().x() / CLHEP::cm << ","
213  << theTrack->GetStep()->GetPreStepPoint()->GetPosition().y() / CLHEP::cm << ","
214  << theTrack->GetStep()->GetPreStepPoint()->GetPosition().z() / CLHEP::cm << ")"
215  << " poststepPosition[cm]=("
216  << theTrack->GetStep()->GetPostStepPoint()->GetPosition().x() / CLHEP::cm << ","
217  << theTrack->GetStep()->GetPostStepPoint()->GetPosition().y() / CLHEP::cm << ","
218  << theTrack->GetStep()->GetPostStepPoint()->GetPosition().z() / CLHEP::cm << ")"
219  << " position[cm]=(" << theTrack->GetPosition().x() / CLHEP::cm << ","
220  << theTrack->GetPosition().y() / CLHEP::cm << ","
221  << theTrack->GetPosition().z() / CLHEP::cm << ")"
222  << " vertex_position[cm]=(" << theTrack->GetVertexPosition().x() / CLHEP::cm << ","
223  << theTrack->GetVertexPosition().y() / CLHEP::cm << ","
224  << theTrack->GetVertexPosition().z() / CLHEP::cm << ")";
225 #endif
226  trkInfo->setCrossedBoundary(theTrack);
227  }
228 #ifdef EDM_ML_DEBUG
229  else if (prestepLV >= 0 && poststepLV < 0) {
230  edm::LogVerbatim("DoFineCalo") << "Exited fine volume " << prestepLV << ":"
231  << " Track " << id
232  << " GetKineticEnergy[GeV]=" << theTrack->GetKineticEnergy() / CLHEP::GeV
233  << " GetVertexKineticEnergy[GeV]="
234  << theTrack->GetVertexKineticEnergy() / CLHEP::GeV << " prestepPosition[cm]=("
235  << theTrack->GetStep()->GetPreStepPoint()->GetPosition().x() / CLHEP::cm << ","
236  << theTrack->GetStep()->GetPreStepPoint()->GetPosition().y() / CLHEP::cm << ","
237  << theTrack->GetStep()->GetPreStepPoint()->GetPosition().z() / CLHEP::cm << ")"
238  << " poststepPosition[cm]=("
239  << theTrack->GetStep()->GetPostStepPoint()->GetPosition().x() / CLHEP::cm << ","
240  << theTrack->GetStep()->GetPostStepPoint()->GetPosition().y() / CLHEP::cm << ","
241  << theTrack->GetStep()->GetPostStepPoint()->GetPosition().z() / CLHEP::cm << ")";
242  }
243 #endif
244  }
245 
246  if (testBeam_) {
247  if (trkInfo->getIDonCaloSurface() == 0) {
248 #ifdef EDM_ML_DEBUG
249  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing set IDonCaloSurface to " << id << " at step Number "
250  << theTrack->GetCurrentStepNumber();
251 #endif
252  trkInfo->setIDonCaloSurface(id, 0, 0, theTrack->GetDefinition()->GetPDGEncoding(), theTrack->GetMomentum().mag());
253  lastTrackID_ = id;
254  if (theTrack->GetKineticEnergy() / CLHEP::MeV > eMin_)
255  trkInfo->putInHistory();
256  }
257  } else {
258  if (putHistory_) {
259  trkInfo->putInHistory();
260  // trkInfo->setAncestor();
261  }
262 #ifdef EDM_ML_DEBUG
263  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing Entered for " << id << " at stepNumber "
264  << theTrack->GetCurrentStepNumber() << " IDonCaloSur.. "
265  << trkInfo->getIDonCaloSurface() << " CaloCheck " << trkInfo->caloIDChecked();
266 #endif
267  if (trkInfo->getIDonCaloSurface() != 0) {
268  if (trkInfo->caloIDChecked() == false) {
269  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
270  const G4VTouchable* post_touch = postStepPoint->GetTouchable();
271 
272  if (isItInside(post_touch, trkInfo->getIDCaloVolume(), trkInfo->getIDLastVolume()) > 0) {
273  trkInfo->setIDonCaloSurface(0, -1, -1, 0, 0);
274  } else {
275  trkInfo->setCaloIDChecked(true);
276  }
277  }
278  } else {
279  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
280  const G4VTouchable* post_touch = postStepPoint->GetTouchable();
281  int ical = isItCalo(post_touch, detectors_);
282  if (ical >= 0) {
283  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
284  const G4VTouchable* pre_touch = preStepPoint->GetTouchable();
285  int inside = isItInside(pre_touch, ical, -1);
286  if (inside >= 0 || (theTrack->GetCurrentStepNumber() == 1)) {
287  trkInfo->setIDonCaloSurface(
288  id, ical, inside, theTrack->GetDefinition()->GetPDGEncoding(), theTrack->GetMomentum().mag());
289  trkInfo->setCaloIDChecked(true);
290  trkInfo->setCrossedBoundary(theTrack);
291  lastTrackID_ = id;
292  if (theTrack->GetKineticEnergy() / CLHEP::MeV > eMin_)
293  trkInfo->putInHistory();
294 #ifdef EDM_ML_DEBUG
295  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: set ID on Calo " << ical << " surface (Inside " << inside
296  << ") to " << id << " of a Track with Kinetic Energy "
297  << theTrack->GetKineticEnergy() / CLHEP::MeV << " MeV";
298 #endif
299  }
300  }
301  }
302  }
303 }

References TrackInformation::caloIDChecked(), detectors_, doFineCalo_, eMin_, Exception, fineDetectors_, TrackInformation::getIDCaloVolume(), TrackInformation::getIDLastVolume(), TrackInformation::getIDonCaloSurface(), GeV, triggerObjects_cff::id, isItCalo(), isItInside(), lastTrackID_, MeV, putHistory_, TrackInformation::putInHistory(), TrackInformation::setCaloIDChecked(), TrackInformation::setCrossedBoundary(), TrackInformation::setIDonCaloSurface(), and testBeam_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

Member Data Documentation

◆ detectors_

std::vector<Detector> CaloTrkProcessing::detectors_
private

Definition at line 65 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), isItInside(), and update().

◆ doFineCalo_

bool CaloTrkProcessing::doFineCalo_
private

Definition at line 62 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().

◆ eMin_

double CaloTrkProcessing::eMin_
private

Definition at line 63 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().

◆ eMinFine_

double CaloTrkProcessing::eMinFine_
private

Definition at line 63 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing().

◆ fineDetectors_

std::vector<Detector> CaloTrkProcessing::fineDetectors_
private

Definition at line 65 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().

◆ lastTrackID_

int CaloTrkProcessing::lastTrackID_
private

Definition at line 64 of file CaloTrkProcessing.h.

Referenced by update().

◆ putHistory_

bool CaloTrkProcessing::putHistory_
private

Definition at line 62 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().

◆ testBeam_

bool CaloTrkProcessing::testBeam_
private

Definition at line 62 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().

CaloTrkProcessing::eMin_
double eMin_
Definition: CaloTrkProcessing.h:63
personalPlayback.level
level
Definition: personalPlayback.py:22
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
MuonGeometrySanityCheck_cfi.detectors
def detectors(dt=True, csc=True, me42=False, chambers=True, superlayers=False, layers=False)
Definition: MuonGeometrySanityCheck_cfi.py:13
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
mps_fire.i
i
Definition: mps_fire.py:428
CaloSimulationParameters
Definition: CaloSimulationParameters.h:6
TrackInformation::getIDonCaloSurface
int getIDonCaloSurface() const
Definition: TrackInformation.h:43
TrackInformation::getIDLastVolume
int getIDLastVolume() const
Definition: TrackInformation.h:52
CaloSimulationParameters::neighbours_
std::vector< int > neighbours_
Definition: CaloSimulationParameters.h:13
CaloSimulationParameters::insideLevel_
std::vector< int > insideLevel_
Definition: CaloSimulationParameters.h:15
CaloTrkProcessing::detectorLevel
void detectorLevel(const G4VTouchable *, int &, int *, G4String *) const
Definition: CaloTrkProcessing.cc:416
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
globals_cff.id1
id1
Definition: globals_cff.py:33
TrackInformation::setIDonCaloSurface
void setIDonCaloSurface(int id, int ical, int last, int pdgID, double p)
Definition: TrackInformation.h:44
CaloSimulationParameters::levels_
std::vector< int > levels_
Definition: CaloSimulationParameters.h:12
MeV
const double MeV
HcalParametersRcd
Definition: HcalParametersRcd.h:8
TrackInformation::putInHistory
void putInHistory()
Definition: TrackInformation.h:37
TrackInformation::setCaloIDChecked
void setCaloIDChecked(bool f)
Definition: TrackInformation.h:54
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
CaloTrkProcessing::putHistory_
bool putHistory_
Definition: CaloTrkProcessing.h:62
CaloTrkProcessing::lastTrackID_
int lastTrackID_
Definition: CaloTrkProcessing.h:64
CaloTrkProcessing::doFineCalo_
bool doFineCalo_
Definition: CaloTrkProcessing.h:62
CaloTrkProcessing::isItInside
int isItInside(const G4VTouchable *, int, int)
Definition: CaloTrkProcessing.cc:334
SensitiveCaloDetector::SensitiveCaloDetector
SensitiveCaloDetector(const std::string &iname, const edm::EventSetup &es, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
Definition: SensitiveCaloDetector.h:12
CaloSimulationParameters::caloNames_
std::vector< std::string > caloNames_
Definition: CaloSimulationParameters.h:11
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
CaloTrkProcessing::detLevels
int detLevels(const G4VTouchable *) const
Definition: CaloTrkProcessing.cc:395
CaloTrkProcessing::detLV
G4LogicalVolume * detLV(const G4VTouchable *, int) const
Definition: CaloTrkProcessing.cc:403
edm::ESHandle
Definition: DTSurvey.h:22
dqmdumpme.k
k
Definition: dqmdumpme.py:60
CaloTrkProcessing::fineDetectors_
std::vector< Detector > fineDetectors_
Definition: CaloTrkProcessing.h:65
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackInformation::getIDCaloVolume
int getIDCaloVolume() const
Definition: TrackInformation.h:51
edm::ParameterSet
Definition: ParameterSet.h:47
GeV
const double GeV
Definition: MathUtil.h:16
TrackInformation::setCrossedBoundary
void setCrossedBoundary(const G4Track *track)
Definition: TrackInformation.h:61
TrackInformation
Definition: TrackInformation.h:12
MetAnalyzer.pv
def pv(vc)
Definition: MetAnalyzer.py:7
CaloTrkProcessing::eMinFine_
double eMinFine_
Definition: CaloTrkProcessing.h:63
CaloSimulationParameters::insideNames_
std::vector< std::string > insideNames_
Definition: CaloSimulationParameters.h:14
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
get
#define get
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
CaloTrkProcessing::Detector
Definition: CaloTrkProcessing.h:42
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
dd4hep
Definition: DDPlugins.h:8
Exception
Definition: hltDiff.cc:245
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
hgcalTestNeighbor_cfi.detector
detector
Definition: hgcalTestNeighbor_cfi.py:6
CaloTrkProcessing::isItCalo
int isItCalo(const G4VTouchable *, const std::vector< Detector > &)
Definition: CaloTrkProcessing.cc:305
TrackInformation::caloIDChecked
bool caloIDChecked() const
Definition: TrackInformation.h:53
CaloTrkProcessing::detectors_
std::vector< Detector > detectors_
Definition: CaloTrkProcessing.h:65
globals_cff.id2
id2
Definition: globals_cff.py:34
hfnoseParametersInitialization_cfi.name2
name2
Definition: hfnoseParametersInitialization_cfi.py:8
edm::Log
Definition: MessageLogger.h:70
cuy.ii
ii
Definition: cuy.py:590
jets_cff.levels
levels
Definition: jets_cff.py:21
CaloTrkProcessing::testBeam_
bool testBeam_
Definition: CaloTrkProcessing.h:62
susybsm::HSCParticleType::unknown
Definition: HSCParticle.h:20