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 DDCompactView &cpv, 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 DDCompactView &cpv, 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 DDCompactView &cpv, 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
 
std::vector< std::string > getNames (G4String, const DDsvalues_type &)
 
std::vector< double > getNumbers (G4String, const DDsvalues_type &)
 
int isItCalo (const G4VTouchable *)
 
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
 
double eMin
 
int lastTrackID
 
const SimTrackManagerm_trackManager
 
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 23 of file CaloTrkProcessing.h.

Constructor & Destructor Documentation

CaloTrkProcessing::CaloTrkProcessing ( const std::string &  aSDname,
const DDCompactView cpv,
const SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 25 of file CaloTrkProcessing.cc.

References gamEcalExtractorBlocks_cff::detector, detectors, eMin, Exception, ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), CaloTrkProcessing::Detector::fromDetL, CaloTrkProcessing::Detector::fromDets, CaloTrkProcessing::Detector::fromLevels, SensitiveDetector::getNames(), getNumbers(), edm::ParameterSet::getParameter(), mps_fire::i, gen::k, CaloTrkProcessing::Detector::level, jets_cff::levels, CaloTrkProcessing::Detector::lv, DDFilteredView::mergedSpecifics(), MeV, dataset::name, CaloTrkProcessing::Detector::name, putHistory, pfDeepBoostedJetPreprocessParams_cfi::sv, and testBeam.

30  : SensitiveCaloDetector(name, cpv, clg, p), lastTrackID(-1), m_trackManager(manager) {
31  //Initialise the parameter set
32  edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("CaloTrkProcessing");
33  testBeam = m_p.getParameter<bool>("TestBeam");
34  eMin = m_p.getParameter<double>("EminTrack") * MeV;
35  putHistory = m_p.getParameter<bool>("PutHistory");
36 
37  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Initailised with TestBeam = " << testBeam << " Emin = " << eMin
38  << " MeV and"
39  << " History flag " << putHistory;
40 
41  //Get the names
42  G4String attribute = "ReadOutName";
44  DDFilteredView fv(cpv, filter);
45  fv.firstChild();
46  DDsvalues_type sv(fv.mergedSpecifics());
47 
48  G4String value = "Calorimeter";
49  std::vector<std::string> caloNames = getNames(value, sv);
50 #ifdef EDM_ML_DEBUG
51  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
52  for (unsigned int i = 0; i < caloNames.size(); i++)
53  edm::LogVerbatim("CaloSim") << " (" << i << ") " << caloNames[i];
54 #endif
55 
56  value = "Levels";
57  std::vector<double> levels = getNumbers(value, sv);
58 #ifdef EDM_ML_DEBUG
59  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
60  for (unsigned int i = 0; i < levels.size(); i++)
61  edm::LogVerbatim("CaloSim") << " (" << i << ") " << levels[i];
62 #endif
63 
64  value = "Neighbours";
65  std::vector<double> neighbours = getNumbers(value, sv);
66 #ifdef EDM_ML_DEBUG
67  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
68  for (unsigned int i = 0; i < neighbours.size(); i++)
69  edm::LogVerbatim("CaloSim") << " (" << i << ") " << neighbours[i];
70 #endif
71 
72  value = "Inside";
73  std::vector<std::string> insideNames = getNames(value, sv);
74 #ifdef EDM_ML_DEBUG
75  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
76  for (unsigned int i = 0; i < insideNames.size(); i++)
77  edm::LogVerbatim("CaloSim") << " (" << i << ") " << insideNames[i];
78 #endif
79 
80  value = "InsideLevel";
81  std::vector<double> insideLevel = getNumbers(value, sv);
82 #ifdef EDM_ML_DEBUG
83  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
84  for (unsigned int i = 0; i < insideLevel.size(); i++)
85  edm::LogVerbatim("CaloSim") << " (" << i << ") " << insideLevel[i];
86 #endif
87 
88  if (caloNames.size() < neighbours.size()) {
89  edm::LogError("CaloSim") << "CaloTrkProcessing: # of Calorimeter bins " << caloNames.size()
90  << " does not match with " << neighbours.size() << " ==> illegal ";
91  throw cms::Exception("Unknown", "CaloTrkProcessing")
92  << "Calorimeter array size does not match with size of neighbours\n";
93  }
94 
95  const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance();
96  std::vector<G4LogicalVolume*>::const_iterator lvcite;
97  int istart = 0;
98  for (unsigned int i = 0; i < caloNames.size(); i++) {
99  G4LogicalVolume* lv = nullptr;
100  G4String name = caloNames[i];
101  int number = static_cast<int>(neighbours[i]);
102  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
103  if ((*lvcite)->GetName() == name) {
104  lv = (*lvcite);
105  break;
106  }
107  }
108  if (lv != nullptr) {
110  detector.name = name;
111  detector.lv = lv;
112  detector.level = static_cast<int>(levels[i]);
113  if (istart + number > (int)(insideNames.size())) {
114  edm::LogError("CaloSim") << "CaloTrkProcessing: # of InsideNames bins " << insideNames.size()
115  << " too few compaerd to " << istart + number << " requested ==> illegal ";
116  throw cms::Exception("Unknown", "CaloTrkProcessing")
117  << "InsideNames array size does not match with list of neighbours\n";
118  }
119  std::vector<std::string> inside;
120  std::vector<G4LogicalVolume*> insideLV;
121  std::vector<int> insideLevels;
122  for (int k = 0; k < number; k++) {
123  lv = nullptr;
124  name = insideNames[istart + k];
125  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
126  if ((*lvcite)->GetName() == name) {
127  lv = (*lvcite);
128  break;
129  }
130  inside.push_back(name);
131  insideLV.push_back(lv);
132  insideLevels.push_back(static_cast<int>(insideLevel[istart + k]));
133  }
134  detector.fromDets = inside;
135  detector.fromDetL = insideLV;
136  detector.fromLevels = insideLevels;
137  detectors.push_back(detector);
138  }
139  istart += number;
140  }
141 
142  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: with " << detectors.size() << " calorimetric volumes";
143  for (unsigned int i = 0; i < detectors.size(); i++) {
144  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Calorimeter volume " << i << " " << detectors[i].name << " LV "
145  << detectors[i].lv << " at level " << detectors[i].level << " with "
146  << detectors[i].fromDets.size() << " neighbours";
147  for (unsigned int k = 0; k < detectors[i].fromDets.size(); k++)
148  edm::LogVerbatim("CaloSim") << " Element " << k << " " << detectors[i].fromDets[k] << " LV "
149  << detectors[i].fromDetL[k] << " at level " << detectors[i].fromLevels[k];
150  }
151 }
T getParameter(std::string const &) const
SensitiveCaloDetector(const std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
const double MeV
const std::vector< std::string > & getNames() const
std::vector< int > fromLevels
std::vector< Detector > detectors
std::vector< double > getNumbers(G4String, const DDsvalues_type &)
std::vector< G4LogicalVolume * > fromDetL
Definition: value.py:1
std::vector< std::string > fromDets
int k[5][pyjets_maxn]
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
const SimTrackManager * m_trackManager
CaloTrkProcessing::~CaloTrkProcessing ( )
override

Definition at line 153 of file CaloTrkProcessing.cc.

153 { edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: Deleted"; }

Member Function Documentation

void CaloTrkProcessing::clearHits ( )
inlineoverridevirtual

Implements SensitiveDetector.

Definition at line 34 of file CaloTrkProcessing.h.

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

Definition at line 385 of file CaloTrkProcessing.cc.

References mps_fire::i, cuy::ii, hcalDigis_cfi::level, MetAnalyzer::pv(), AlCaHLTBitMon_QueryRunRegistry::string, and susybsm::HSCParticleType::unknown.

Referenced by isItCalo(), and isItInside().

385  {
386  static const std::string unknown("Unknown");
387  //Get name and copy numbers
388  if (level > 0) {
389  for (int ii = 0; ii < level; ii++) {
390  int i = level - ii - 1;
391  G4VPhysicalVolume* pv = touch->GetVolume(i);
392  if (pv != nullptr)
393  name[ii] = pv->GetName();
394  else
395  name[ii] = unknown;
396  copyno[ii] = touch->GetReplicaNumber(i);
397  }
398  }
399 }
def pv(vc)
Definition: MetAnalyzer.py:7
ii
Definition: cuy.py:590
int CaloTrkProcessing::detLevels ( const G4VTouchable *  touch) const
private

Definition at line 364 of file CaloTrkProcessing.cc.

Referenced by isItCalo(), and isItInside().

364  {
365  //Return number of levels
366  if (touch)
367  return ((touch->GetHistoryDepth()) + 1);
368  else
369  return 0;
370 }
G4LogicalVolume * CaloTrkProcessing::detLV ( const G4VTouchable *  touch,
int  currentlevel 
) const
private

Definition at line 372 of file CaloTrkProcessing.cc.

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

Referenced by isItCalo(), and isItInside().

372  {
373  G4LogicalVolume* lv = nullptr;
374  if (touch) {
375  int level = ((touch->GetHistoryDepth()) + 1);
376  if (level > 0 && level >= currentlevel) {
377  int ii = level - currentlevel;
378  lv = touch->GetVolume(ii)->GetLogicalVolume();
379  return lv;
380  }
381  }
382  return lv;
383 }
ii
Definition: cuy.py:590
void CaloTrkProcessing::EndOfEvent ( G4HCofThisEvent *  )
inlineoverride

Definition at line 37 of file CaloTrkProcessing.h.

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

Implements SensitiveCaloDetector.

Definition at line 38 of file CaloTrkProcessing.h.

References SensitiveDetector::getNames(), getNumbers(), isItCalo(), isItInside(), and update().

38 {}
std::vector< std::string > CaloTrkProcessing::getNames ( G4String  str,
const DDsvalues_type sv 
)
private

Definition at line 228 of file CaloTrkProcessing.cc.

References DDfetch(), Exception, str, DDValue::strings(), and relativeConstraints::value.

228  {
229 #ifdef EDM_ML_DEBUG
230  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing::getNames called for " << str;
231 #endif
232  DDValue value(str);
233  if (DDfetch(&sv, value)) {
234 #ifdef EDM_ML_DEBUG
235  edm::LogVerbatim("CaloSim") << value;
236 #endif
237  const std::vector<std::string>& fvec = value.strings();
238  int nval = fvec.size();
239  if (nval < 1) {
240  edm::LogError("CaloSim") << "CaloTrkProcessing: # of " << str << " bins " << nval << " < 1 ==> illegal ";
241  throw cms::Exception("Unknown", "CaloTrkProcessing") << "nval < 2 for array " << str << "\n";
242  }
243 
244  return fvec;
245  } else {
246  edm::LogError("CaloSim") << "CaloTrkProcessing: cannot get array " << str;
247  throw cms::Exception("Unknown", "CaloTrkProcessing") << "cannot get array " << str << "\n";
248  }
249 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
#define str(s)
std::vector< double > CaloTrkProcessing::getNumbers ( G4String  str,
const DDsvalues_type sv 
)
private

Definition at line 251 of file CaloTrkProcessing.cc.

References DDfetch(), DDValue::doubles(), Exception, str, and relativeConstraints::value.

Referenced by CaloTrkProcessing(), and fillHits().

251  {
252 #ifdef EDM_ML_DEBUG
253  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing::getNumbers called for " << str;
254 #endif
255  DDValue value(str);
256  if (DDfetch(&sv, value)) {
257 #ifdef EDM_ML_DEBUG
258  edm::LogVerbatim("CaloSim") << value;
259 #endif
260  const std::vector<double>& fvec = value.doubles();
261  int nval = fvec.size();
262  if (nval < 1) {
263  edm::LogError("CaloSim") << "CaloTrkProcessing: # of " << str << " bins " << nval << " < 1 ==> illegal ";
264  throw cms::Exception("Unknown", "CaloTrkProcessing") << "nval < 2 for array " << str << "\n";
265  }
266 
267  return fvec;
268  } else {
269  edm::LogError("CaloSim") << "CaloTrkProcessing: cannot get array " << str;
270  throw cms::Exception("Unknown", "CaloTrkProcessing") << "cannot get array " << str << "\n";
271  }
272 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
#define str(s)
void CaloTrkProcessing::Initialize ( G4HCofThisEvent *  )
inlineoverride

Definition at line 33 of file CaloTrkProcessing.h.

33 {}
int CaloTrkProcessing::isItCalo ( const G4VTouchable *  touch)
private

Definition at line 274 of file CaloTrkProcessing.cc.

References detectorLevel(), detectors, detLevels(), detLV(), hcalDigis_cfi::level, jets_cff::levels, convertSQLiteXML::ok, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fillHits(), and update().

274  {
275  int lastLevel = -1;
276  G4LogicalVolume* lv = nullptr;
277  for (unsigned int it = 0; it < detectors.size(); it++) {
278  if (lastLevel != detectors[it].level) {
279  lastLevel = detectors[it].level;
280  lv = detLV(touch, lastLevel);
281 #ifdef EDM_ML_DEBUG
282  std::string name1 = "Unknown";
283  if (lv != 0)
284  name1 = lv->GetName();
285  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: volume " << name1 << " at Level " << lastLevel;
286  int levels = detLevels(touch);
287  if (levels > 0) {
288  G4String name2[20];
289  int copyno2[20];
290  detectorLevel(touch, levels, copyno2, name2);
291  for (int i2 = 0; i2 < levels; i2++)
292  edm::LogVerbatim("CaloSim") << " " << i2 << " " << name2[i2] << " " << copyno2[i2];
293  }
294 #endif
295  }
296  bool ok = (lv == detectors[it].lv);
297  if (ok)
298  return it;
299  }
300  return -1;
301 }
G4LogicalVolume * detLV(const G4VTouchable *, int) const
int detLevels(const G4VTouchable *) const
void detectorLevel(const G4VTouchable *, int &, int *, G4String *) const
std::vector< Detector > detectors
int CaloTrkProcessing::isItInside ( const G4VTouchable *  touch,
int  idcal,
int  idin 
)
private

Definition at line 303 of file CaloTrkProcessing.cc.

References detectorLevel(), detectors, detLevels(), detLV(), globals_cff::id1, globals_cff::id2, jets_cff::levels, convertSQLiteXML::ok, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fillHits(), and update().

303  {
304  int lastLevel = -1;
305  G4LogicalVolume* lv = nullptr;
306  int id1, id2;
307  if (idcal < 0) {
308  id1 = 0;
309  id2 = static_cast<int>(detectors.size());
310  } else {
311  id1 = idcal;
312  id2 = id1 + 1;
313  }
314  for (int it1 = id1; it1 < id2; it1++) {
315  if (idin < 0) {
316  for (unsigned int it2 = 0; it2 < detectors[it1].fromDets.size(); it2++) {
317  if (lastLevel != detectors[it1].fromLevels[it2]) {
318  lastLevel = detectors[it1].fromLevels[it2];
319  lv = detLV(touch, lastLevel);
320 #ifdef EDM_ML_DEBUG
321  std::string name1 = "Unknown";
322  if (lv != 0)
323  name1 = lv->GetName();
324  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: volume " << name1 << " at Level " << lastLevel;
325  int levels = detLevels(touch);
326  if (levels > 0) {
327  G4String name2[20];
328  int copyno2[20];
329  detectorLevel(touch, levels, copyno2, name2);
330  for (int i2 = 0; i2 < levels; i2++)
331  edm::LogVerbatim("CaloSim") << " " << i2 << " " << name2[i2] << " " << copyno2[i2];
332  }
333 #endif
334  }
335  bool ok = (lv == detectors[it1].fromDetL[it2]);
336  if (ok)
337  return it2;
338  }
339  } else {
340  lastLevel = detectors[it1].fromLevels[idin];
341  lv = detLV(touch, lastLevel);
342 #ifdef EDM_ML_DEBUG
343  std::string name1 = "Unknown";
344  if (lv != 0)
345  name1 = lv->GetName();
346  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: volume " << name1 << " at Level " << lastLevel;
347  int levels = detLevels(touch);
348  if (levels > 0) {
349  G4String name2[20];
350  int copyno2[20];
351  detectorLevel(touch, levels, copyno2, name2);
352  for (int i2 = 0; i2 < levels; i2++)
353  edm::LogVerbatim("CaloSim") << " " << i2 << " " << name2[i2] << " " << copyno2[i2];
354  }
355 #endif
356  bool ok = (lv == detectors[it1].fromDetL[idin]);
357  if (ok)
358  return idin;
359  }
360  }
361  return -1;
362 }
G4LogicalVolume * detLV(const G4VTouchable *, int) const
int detLevels(const G4VTouchable *) const
void detectorLevel(const G4VTouchable *, int &, int *, G4String *) const
std::vector< Detector > detectors
bool CaloTrkProcessing::ProcessHits ( G4Step *  ,
G4TouchableHistory *   
)
inlineoverridevirtual

Implements SensitiveDetector.

Definition at line 35 of file CaloTrkProcessing.h.

35 { return true; }
uint32_t CaloTrkProcessing::setDetUnitId ( const G4Step *  step)
inlineoverridevirtual

Implements SensitiveDetector.

Definition at line 36 of file CaloTrkProcessing.h.

36 { return 0; }
void CaloTrkProcessing::update ( const BeginOfEvent )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 155 of file CaloTrkProcessing.cc.

References lastTrackID.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), fillHits(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

155 { lastTrackID = -1; }
void CaloTrkProcessing::update ( const G4Step *  )
overrideprivatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 157 of file CaloTrkProcessing.cc.

References TrackInformation::caloIDChecked(), eMin, Exception, TrackInformation::getIDCaloVolume(), TrackInformation::getIDLastVolume(), TrackInformation::getIDonCaloSurface(), triggerObjects_cff::id, isItCalo(), isItInside(), lastTrackID, MeV, putHistory, TrackInformation::putInHistory(), TrackInformation::setCaloIDChecked(), TrackInformation::setIDonCaloSurface(), and testBeam.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

157  {
158  // define if you are at the surface of CALO
159 
160  G4Track* theTrack = aStep->GetTrack();
161  int id = theTrack->GetTrackID();
162 
163  TrackInformation* trkInfo = dynamic_cast<TrackInformation*>(theTrack->GetUserInformation());
164 
165  if (trkInfo == nullptr) {
166  edm::LogError("CaloSim") << "CaloTrkProcessing: No trk info !!!! abort ";
167  throw cms::Exception("Unknown", "CaloTrkProcessing") << "cannot get trkInfo for Track " << id << "\n";
168  }
169 
170  if (testBeam) {
171  if (trkInfo->getIDonCaloSurface() == 0) {
172 #ifdef EDM_ML_DEBUG
173  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing set IDonCaloSurface to " << id << " at step Number "
174  << theTrack->GetCurrentStepNumber();
175 #endif
176  trkInfo->setIDonCaloSurface(id, 0, 0, theTrack->GetDefinition()->GetPDGEncoding(), theTrack->GetMomentum().mag());
177  lastTrackID = id;
178  if (theTrack->GetKineticEnergy() / MeV > eMin)
179  trkInfo->putInHistory();
180  }
181  } else {
182  if (putHistory) {
183  trkInfo->putInHistory();
184  // trkInfo->setAncestor();
185  }
186 #ifdef EDM_ML_DEBUG
187  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing Entered for " << id << " at stepNumber "
188  << theTrack->GetCurrentStepNumber() << " IDonCaloSur.. "
189  << trkInfo->getIDonCaloSurface() << " CaloCheck " << trkInfo->caloIDChecked();
190 #endif
191  if (trkInfo->getIDonCaloSurface() != 0) {
192  if (trkInfo->caloIDChecked() == false) {
193  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
194  const G4VTouchable* post_touch = postStepPoint->GetTouchable();
195 
196  if (isItInside(post_touch, trkInfo->getIDCaloVolume(), trkInfo->getIDLastVolume()) > 0) {
197  trkInfo->setIDonCaloSurface(0, -1, -1, 0, 0);
198  } else {
199  trkInfo->setCaloIDChecked(true);
200  }
201  }
202  } else {
203  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
204  const G4VTouchable* post_touch = postStepPoint->GetTouchable();
205  int ical = isItCalo(post_touch);
206  if (ical >= 0) {
207  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
208  const G4VTouchable* pre_touch = preStepPoint->GetTouchable();
209  int inside = isItInside(pre_touch, ical, -1);
210  if (inside >= 0 || (theTrack->GetCurrentStepNumber() == 1)) {
211  trkInfo->setIDonCaloSurface(
212  id, ical, inside, theTrack->GetDefinition()->GetPDGEncoding(), theTrack->GetMomentum().mag());
213  trkInfo->setCaloIDChecked(true);
214  lastTrackID = id;
215  if (theTrack->GetKineticEnergy() / MeV > eMin)
216  trkInfo->putInHistory();
217 #ifdef EDM_ML_DEBUG
218  edm::LogVerbatim("CaloSim") << "CaloTrkProcessing: set ID on Calo " << ical << " surface (Inside " << inside
219  << ") to " << id << " of a Track with Kinetic Energy "
220  << theTrack->GetKineticEnergy() / MeV << " MeV";
221 #endif
222  }
223  }
224  }
225  }
226 }
int getIDonCaloSurface() const
int isItCalo(const G4VTouchable *)
const double MeV
int getIDCaloVolume() const
int isItInside(const G4VTouchable *, int, int)
int getIDLastVolume() const
bool caloIDChecked() const
void setCaloIDChecked(bool f)
void setIDonCaloSurface(int id, int ical, int last, int pdgID, double p)

Member Data Documentation

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

Definition at line 66 of file CaloTrkProcessing.h.

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

double CaloTrkProcessing::eMin
private

Definition at line 64 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().

int CaloTrkProcessing::lastTrackID
private

Definition at line 65 of file CaloTrkProcessing.h.

Referenced by update().

const SimTrackManager* CaloTrkProcessing::m_trackManager
private

Definition at line 67 of file CaloTrkProcessing.h.

bool CaloTrkProcessing::putHistory
private

Definition at line 63 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().

bool CaloTrkProcessing::testBeam
private

Definition at line 63 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().