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 (G4String aSDname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *)
 
virtual void clearHits ()
 
virtual void EndOfEvent (G4HCofThisEvent *)
 
void fillHits (edm::PCaloHitContainer &, std::string)
 
virtual void Initialize (G4HCofThisEvent *)
 
virtual bool ProcessHits (G4Step *, G4TouchableHistory *)
 
virtual uint32_t setDetUnitId (G4Step *step)
 
virtual ~CaloTrkProcessing ()
 
- Public Member Functions inherited from SensitiveCaloDetector
 SensitiveCaloDetector (std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (const std::string &vname)
 
Local3DPoint ConvertToLocal3DPoint (const G4ThreeVector &point)
 
Local3DPoint FinalStepPosition (G4Step *s, coordinates)
 
virtual std::vector< std::string > getNames ()
 
Local3DPoint InitialStepPosition (G4Step *s, coordinates)
 
std::string nameOfSD ()
 
void NaNTrap (G4Step *step)
 
void Register ()
 
 SensitiveDetector (std::string &iname, const DDCompactView &cpv, const SensitiveDetectorCatalog &, edm::ParameterSet const &p)
 
virtual ~SensitiveDetector ()
 
- 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)
 This routine will be called when the appropriate signal arrives. More...
 
void update (const G4Step *)
 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

- Public Types inherited from SensitiveDetector
enum  coordinates { WorldCoordinates, LocalCoordinates }
 

Detailed Description

Definition at line 22 of file CaloTrkProcessing.h.

Constructor & Destructor Documentation

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

Definition at line 26 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, jetCorrFactors_cfi::levels, LogDebug, CaloTrkProcessing::Detector::lv, DDFilteredView::mergedSpecifics(), MeV, SensitiveDetector::name, CaloTrkProcessing::Detector::name, putHistory, and testBeam.

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

Definition at line 163 of file CaloTrkProcessing.cc.

163  {
164  edm::LogInfo("CaloSim") << "CaloTrkProcessing: Deleted";
165 }

Member Function Documentation

virtual void CaloTrkProcessing::clearHits ( )
inlinevirtual

Implements SensitiveDetector.

Definition at line 33 of file CaloTrkProcessing.h.

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

Definition at line 416 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().

417  {
418 
419  static const std::string unknown("Unknown");
420  //Get name and copy numbers
421  if (level > 0) {
422  for (int ii = 0; ii < level; ii++) {
423  int i = level - ii - 1;
424  G4VPhysicalVolume* pv = touch->GetVolume(i);
425  if (pv != 0)
426  name[ii] = pv->GetName();
427  else
428  name[ii] = unknown;
429  copyno[ii] = touch->GetReplicaNumber(i);
430  }
431  }
432 }
def pv(vc)
Definition: MetAnalyzer.py:6
ii
Definition: cuy.py:588
int CaloTrkProcessing::detLevels ( const G4VTouchable *  touch) const
private

Definition at line 392 of file CaloTrkProcessing.cc.

Referenced by isItCalo(), and isItInside().

392  {
393 
394  //Return number of levels
395  if (touch)
396  return ((touch->GetHistoryDepth())+1);
397  else
398  return 0;
399 }
G4LogicalVolume * CaloTrkProcessing::detLV ( const G4VTouchable *  touch,
int  currentlevel 
) const
private

Definition at line 401 of file CaloTrkProcessing.cc.

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

Referenced by isItCalo(), and isItInside().

402  {
403 
404  G4LogicalVolume* lv=0;
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 }
ii
Definition: cuy.py:588
virtual void CaloTrkProcessing::EndOfEvent ( G4HCofThisEvent *  )
inlinevirtual

Reimplemented from SensitiveDetector.

Definition at line 38 of file CaloTrkProcessing.h.

38 {}
void CaloTrkProcessing::fillHits ( edm::PCaloHitContainer ,
std::string   
)
inlinevirtual

Implements SensitiveCaloDetector.

Definition at line 39 of file CaloTrkProcessing.h.

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

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

Definition at line 251 of file CaloTrkProcessing.cc.

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

252  {
253 
254 #ifdef DebugLog
255  LogDebug("CaloSim") << "CaloTrkProcessing::getNames called for " << str;
256 #endif
257  DDValue value(str);
258  if (DDfetch(&sv,value)) {
259 #ifdef DebugLog
260  LogDebug("CaloSim") << value;
261 #endif
262  const std::vector<std::string> & fvec = value.strings();
263  int nval = fvec.size();
264  if (nval < 1) {
265 
266  edm::LogError("CaloSim") << "CaloTrkProcessing: # of " << str
267  << " bins " << nval << " < 1 ==> illegal ";
268  throw cms::Exception("Unknown", "CaloTrkProcessing")
269  << "nval < 2 for array " << str << "\n";
270  }
271 
272  return fvec;
273  } else {
274  edm::LogError("CaloSim") << "CaloTrkProcessing: cannot get array " << str ;
275  throw cms::Exception("Unknown", "CaloTrkProcessing")
276  << "cannot get array " << str << "\n";
277  }
278 }
#define LogDebug(id)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80
Definition: value.py:1
std::vector< double > CaloTrkProcessing::getNumbers ( G4String  str,
const DDsvalues_type sv 
)
private

Definition at line 280 of file CaloTrkProcessing.cc.

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

Referenced by CaloTrkProcessing(), and fillHits().

281  {
282 
283 #ifdef DebugLog
284  LogDebug("CaloSim") << "CaloTrkProcessing::getNumbers called for " << str;
285 #endif
286  DDValue value(str);
287  if (DDfetch(&sv,value)) {
288 #ifdef DebugLog
289  LogDebug("CaloSim") << value;
290 #endif
291  const std::vector<double> & fvec = value.doubles();
292  int nval = fvec.size();
293  if (nval < 1) {
294  edm::LogError("CaloSim") << "CaloTrkProcessing: # of " << str
295  << " bins " << nval << " < 1 ==> illegal ";
296  throw cms::Exception("Unknown", "CaloTrkProcessing")
297  << "nval < 2 for array " << str << "\n";
298  }
299 
300  return fvec;
301  } else {
302  edm::LogError("CaloSim") << "CaloTrkProcessing: cannot get array " << str ;
303  throw cms::Exception("Unknown", "CaloTrkProcessing")
304  << "cannot get array " << str << "\n";
305  }
306 }
#define LogDebug(id)
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80
Definition: value.py:1
virtual void CaloTrkProcessing::Initialize ( G4HCofThisEvent *  )
inlinevirtual

Reimplemented from SensitiveDetector.

Definition at line 32 of file CaloTrkProcessing.h.

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

Definition at line 308 of file CaloTrkProcessing.cc.

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

Referenced by fillHits(), and update().

308  {
309 
310  int lastLevel = -1;
311  G4LogicalVolume* lv=0;
312  for (unsigned int it=0; it < detectors.size(); it++) {
313  if (lastLevel != detectors[it].level) {
314  lastLevel = detectors[it].level;
315  lv = detLV(touch, lastLevel);
316 #ifdef DebugLog
317  std::string name1 = "Unknown";
318  if (lv != 0) name1 = lv->GetName();
319  LogDebug("CaloSim") << "CaloTrkProcessing: volume " << name1
320  << " at Level " << lastLevel;
321  int levels = detLevels(touch);
322  if (levels > 0) {
323  G4String name2[20]; int copyno2[20];
324  detectorLevel(touch, levels, copyno2, name2);
325  for (int i2=0; i2<levels; i2++)
326  LogDebug("CaloSim") << " " << i2 << " " << name2[i2] << " "
327  << copyno2[i2];
328  }
329 #endif
330  }
331  bool ok = (lv == detectors[it].lv);
332  if (ok) return it;
333  }
334  return -1;
335 }
#define LogDebug(id)
G4LogicalVolume * detLV(const G4VTouchable *, int) const
int detLevels(const G4VTouchable *) const
void detectorLevel(const G4VTouchable *, int &, int *, G4String *) const
std::vector< Detector > detectors
levels
correction levels
int CaloTrkProcessing::isItInside ( const G4VTouchable *  touch,
int  idcal,
int  idin 
)
private

Definition at line 337 of file CaloTrkProcessing.cc.

References detectorLevel(), detectors, detLevels(), detLV(), jetCorrFactors_cfi::levels, LogDebug, convertSQLiteXML::ok, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fillHits(), and update().

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

Implements SensitiveDetector.

Definition at line 34 of file CaloTrkProcessing.h.

34  {
35  return true;
36  }
virtual uint32_t CaloTrkProcessing::setDetUnitId ( G4Step *  step)
inlinevirtual

Implements SensitiveDetector.

Definition at line 37 of file CaloTrkProcessing.h.

37 {return 0;}
void CaloTrkProcessing::update ( const BeginOfEvent )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfEvent * >.

Definition at line 167 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().

167  {
168  lastTrackID = -1;
169 }
void CaloTrkProcessing::update ( const G4Step *  )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 171 of file CaloTrkProcessing.cc.

References TrackInformation::caloIDChecked(), eMin, Exception, TrackInformation::getIDCaloVolume(), TrackInformation::getIDLastVolume(), TrackInformation::getIDonCaloSurface(), hcalTTPDigis_cfi::id, isItCalo(), isItInside(), lastTrackID, LogDebug, 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().

171  {
172 
173  // define if you are at the surface of CALO
174 
175  G4Track* theTrack = aStep->GetTrack();
176  int id = theTrack->GetTrackID();
177 
178  TrackInformation* trkInfo = dynamic_cast<TrackInformation*>
179  (theTrack->GetUserInformation());
180 
181  if (trkInfo == 0) {
182  edm::LogError("CaloSim") << "CaloTrkProcessing: No trk info !!!! abort ";
183  throw cms::Exception("Unknown", "CaloTrkProcessing")
184  << "cannot get trkInfo for Track " << id << "\n";
185  }
186 
187  if (testBeam) {
188  if (trkInfo->getIDonCaloSurface() == 0) {
189 #ifdef DebugLog
190  LogDebug("CaloSim") << "CaloTrkProcessing set IDonCaloSurface to " << id
191  << " at step Number "
192  << theTrack->GetCurrentStepNumber();
193 #endif
194  trkInfo->setIDonCaloSurface(id,0,0,
195  theTrack->GetDefinition()->GetPDGEncoding(),
196  theTrack->GetMomentum().mag());
197  lastTrackID = id;
198  if (theTrack->GetKineticEnergy()/MeV > eMin)
199  trkInfo->putInHistory();
200  }
201  } else {
202  if (putHistory) {
203  trkInfo->putInHistory();
204  // trkInfo->setAncestor();
205  }
206 #ifdef DebugLog
207  LogDebug("CaloSim") << "CaloTrkProcessing Entered for " << id
208  << " at stepNumber "<< theTrack->GetCurrentStepNumber()
209  << " IDonCaloSur.. " << trkInfo->getIDonCaloSurface()
210  << " CaloCheck " << trkInfo->caloIDChecked();
211 #endif
212  if (trkInfo->getIDonCaloSurface() != 0) {
213  if (trkInfo->caloIDChecked() == false) {
214  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
215  const G4VTouchable* post_touch = postStepPoint->GetTouchable();
216 
217  if (isItInside(post_touch, trkInfo->getIDCaloVolume(),
218  trkInfo->getIDLastVolume()) > 0) {
219  trkInfo->setIDonCaloSurface(0, -1, -1, 0, 0);
220  } else {
221  trkInfo->setCaloIDChecked(true);
222  }
223  }
224  } else {
225  G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
226  const G4VTouchable* post_touch = postStepPoint->GetTouchable();
227  int ical = isItCalo(post_touch);
228  if (ical >= 0) {
229  G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
230  const G4VTouchable* pre_touch = preStepPoint->GetTouchable();
231  int inside = isItInside(pre_touch, ical, -1);
232  if (inside >= 0 || (theTrack->GetCurrentStepNumber()==1)) {
233  trkInfo->setIDonCaloSurface(id,ical,inside,
234  theTrack->GetDefinition()->GetPDGEncoding(),
235  theTrack->GetMomentum().mag());
236  trkInfo->setCaloIDChecked(true);
237  lastTrackID = id;
238  if (theTrack->GetKineticEnergy()/MeV > eMin) trkInfo->putInHistory();
239 #ifdef DebugLog
240  LogDebug("CaloSim") <<"CaloTrkProcessing: set ID on Calo " << ical
241  << " surface (Inside " << inside << ") to "
242  << id << " of a Track with Kinetic Energy "
243  << theTrack->GetKineticEnergy()/MeV << " MeV";
244 #endif
245  }
246  }
247  }
248  }
249 }
#define LogDebug(id)
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 70 of file CaloTrkProcessing.h.

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

double CaloTrkProcessing::eMin
private

Definition at line 68 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().

int CaloTrkProcessing::lastTrackID
private

Definition at line 69 of file CaloTrkProcessing.h.

Referenced by update().

const SimTrackManager* CaloTrkProcessing::m_trackManager
private

Definition at line 71 of file CaloTrkProcessing.h.

bool CaloTrkProcessing::putHistory
private

Definition at line 67 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().

bool CaloTrkProcessing::testBeam
private

Definition at line 67 of file CaloTrkProcessing.h.

Referenced by CaloTrkProcessing(), and update().