CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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, 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, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
 
- Public Member Functions inherited from SensitiveDetector
virtual void AssignSD (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, 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,
SensitiveDetectorCatalog clg,
edm::ParameterSet const &  p,
const SimTrackManager manager 
)

Definition at line 26 of file CaloTrkProcessing.cc.

References DDFilteredView::addFilter(), detectors, eMin, DDSpecificsFilter::equals, edm::hlt::Exception, alcazmumu_cfi::filter, DDFilteredView::firstChild(), CaloTrkProcessing::Detector::fromDetL, CaloTrkProcessing::Detector::fromDets, CaloTrkProcessing::Detector::fromLevels, SensitiveDetector::getNames(), getNumbers(), edm::ParameterSet::getParameter(), i, gen::k, CaloTrkProcessing::Detector::level, LogDebug, CaloTrkProcessing::Detector::lv, DDFilteredView::mergedSpecifics(), MeV, SensitiveDetector::name, CaloTrkProcessing::Detector::name, contentValuesFiles::number, putHistory, DDSpecificsFilter::setCriteria(), testBeam, and relativeConstraints::value.

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  DDValue ddv(attribute,name,0);
49  DDFilteredView fv(cpv);
50  fv.addFilter(filter);
51  fv.firstChild();
52  DDsvalues_type sv(fv.mergedSpecifics());
53 
54  G4String value = "Calorimeter";
55  std::vector<std::string> caloNames = getNames (value, sv);
56 #ifdef DebugLog
57  LogDebug("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
58  for (unsigned int i=0; i<caloNames.size(); i++)
59  LogDebug("CaloSim") << " (" << i << ") " << caloNames[i];
60 #endif
61 
62  value = "Levels";
63  std::vector<double> levels = getNumbers (value, sv);
64 #ifdef DebugLog
65  LogDebug("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
66  for (unsigned int i=0; i<levels.size(); i++)
67  LogDebug("CaloSim") << " (" << i << ") " << levels[i];
68 #endif
69 
70  value = "Neighbours";
71  std::vector<double> neighbours = getNumbers (value, sv);
72 #ifdef DebugLog
73  LogDebug("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
74  for (unsigned int i=0; i<neighbours.size(); i++)
75  LogDebug("CaloSim") << " (" << i << ") " << neighbours[i];
76 #endif
77 
78  value = "Inside";
79  std::vector<std::string> insideNames = getNames (value, sv);
80 #ifdef DebugLog
81  LogDebug("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
82  for (unsigned int i=0; i<insideNames.size(); i++)
83  LogDebug("CaloSim") << " (" << i << ") " << insideNames[i];
84 #endif
85 
86  value = "InsideLevel";
87  std::vector<double> insideLevel = getNumbers (value, sv);
88 #ifdef DebugLog
89  LogDebug("CaloSim") << "CaloTrkProcessing: Names for " << value << ":";
90  for (unsigned int i=0; i<insideLevel.size(); i++)
91  LogDebug("CaloSim") << " (" << i << ") " << insideLevel[i];
92 #endif
93 
94  if (caloNames.size() < neighbours.size()) {
95  edm::LogError("CaloSim") << "CaloTrkProcessing: # of Calorimeter bins "
96  << caloNames.size() << " does not match with "
97  << neighbours.size() << " ==> illegal ";
98  throw cms::Exception("Unknown", "CaloTrkProcessing")
99  << "Calorimeter array size does not match with size of neighbours\n";
100  }
101 
102  const G4LogicalVolumeStore * lvs = G4LogicalVolumeStore::GetInstance();
103  std::vector<G4LogicalVolume *>::const_iterator lvcite;
104  int istart = 0;
105  for (unsigned int i=0; i<caloNames.size(); i++) {
106  G4LogicalVolume* lv = 0;
107  G4String name = caloNames[i];
108  int number = static_cast<int>(neighbours[i]);
109  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) {
110  if ((*lvcite)->GetName() == name) {
111  lv = (*lvcite);
112  break;
113  }
114  }
115  if (lv != 0) {
117  detector.name = name;
118  detector.lv = lv;
119  detector.level = static_cast<int>(levels[i]);
120  if (istart+number > (int)(insideNames.size())) {
121  edm::LogError("CaloSim") << "CaloTrkProcessing: # of InsideNames bins "
122  << insideNames.size() <<" too few compaerd to "
123  << istart+number << " requested ==> illegal ";
124  throw cms::Exception("Unknown", "CaloTrkProcessing")
125  << "InsideNames array size does not match with list of neighbours\n";
126  }
127  std::vector<std::string> inside;
128  std::vector<G4LogicalVolume*> insideLV;
129  std::vector<int> insideLevels;
130  for (int k = 0; k < number; k++) {
131  lv = 0;
132  name = insideNames[istart+k];
133  for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++)
134  if ((*lvcite)->GetName() == name) {
135  lv = (*lvcite);
136  break;
137  }
138  inside.push_back(name);
139  insideLV.push_back(lv);
140  insideLevels.push_back(static_cast<int>(insideLevel[istart+k]));
141  }
142  detector.fromDets = inside;
143  detector.fromDetL = insideLV;
144  detector.fromLevels = insideLevels;
145  detectors.push_back(detector);
146  }
147  istart += number;
148  }
149 
150  edm::LogInfo("CaloSim") << "CaloTrkProcessing: with " << detectors.size()
151  << " calorimetric volumes";
152  for (unsigned int i=0; i<detectors.size(); i++) {
153  edm::LogInfo("CaloSim") << "CaloTrkProcessing: Calorimeter volume " << i
154  << " " << detectors[i].name << " LV "
155  << detectors[i].lv << " at level "
156  << detectors[i].level << " with "
157  << detectors[i].fromDets.size() << " neighbours";
158  for (unsigned int k=0; k<detectors[i].fromDets.size(); k++)
159  edm::LogInfo("CaloSim") << " Element " << k << " "
160  << detectors[i].fromDets[k] << " LV "
161  << detectors[i].fromDetL[k] << " at level "
162  << detectors[i].fromLevels[k];
163  }
164 }
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
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:19
std::vector< double > getNumbers(G4String, const DDsvalues_type &)
std::vector< G4LogicalVolume * > fromDetL
virtual std::vector< std::string > getNames()
std::vector< std::string > fromDets
int k[5][pyjets_maxn]
SensitiveCaloDetector(std::string &iname, const DDCompactView &cpv, SensitiveDetectorCatalog &clg, edm::ParameterSet const &p)
void setCriteria(const DDValue &nameVal, comp_op, log_op l=AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:285
const SimTrackManager * m_trackManager
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:37
CaloTrkProcessing::~CaloTrkProcessing ( )
virtual

Definition at line 166 of file CaloTrkProcessing.cc.

166  {
167  edm::LogInfo("CaloSim") << "CaloTrkProcessing: Deleted";
168 }

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 419 of file CaloTrkProcessing.cc.

References i, cuy::ii, testEve_cfg::level, AlCaHLTBitMon_QueryRunRegistry::string, and susybsm::HSCParticleType::unknown.

Referenced by isItCalo(), and isItInside().

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

Definition at line 395 of file CaloTrkProcessing.cc.

Referenced by isItCalo(), and isItInside().

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

Definition at line 404 of file CaloTrkProcessing.cc.

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

Referenced by isItCalo(), and isItInside().

405  {
406 
407  G4LogicalVolume* lv=0;
408  if (touch) {
409  int level = ((touch->GetHistoryDepth())+1);
410  if (level > 0 && level >= currentlevel) {
411  int ii = level - currentlevel;
412  lv = touch->GetVolume(ii)->GetLogicalVolume();
413  return lv;
414  }
415  }
416  return lv;
417 }
int ii
Definition: cuy.py:588
tuple level
Definition: testEve_cfg.py:34
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.

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

Definition at line 254 of file CaloTrkProcessing.cc.

References DDfetch(), edm::hlt::Exception, LogDebug, DDValue::strings(), and relativeConstraints::value.

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

Definition at line 283 of file CaloTrkProcessing.cc.

References DDfetch(), DDValue::doubles(), edm::hlt::Exception, LogDebug, and relativeConstraints::value.

Referenced by CaloTrkProcessing().

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

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

Referenced by update().

311  {
312 
313  int lastLevel = -1;
314  G4LogicalVolume* lv=0;
315  for (unsigned int it=0; it < detectors.size(); it++) {
316  if (lastLevel != detectors[it].level) {
317  lastLevel = detectors[it].level;
318  lv = detLV(touch, lastLevel);
319 #ifdef DebugLog
320  std::string name1 = "Unknown";
321  if (lv != 0) name1 = lv->GetName();
322  LogDebug("CaloSim") << "CaloTrkProcessing: volume " << name1
323  << " at Level " << lastLevel;
324  int levels = detLevels(touch);
325  if (levels > 0) {
326  G4String name2[20]; int copyno2[20];
327  detectorLevel(touch, levels, copyno2, name2);
328  for (int i2=0; i2<levels; i2++)
329  LogDebug("CaloSim") << " " << i2 << " " << name2[i2] << " "
330  << copyno2[i2];
331  }
332 #endif
333  }
334  bool ok = (lv == detectors[it].lv);
335  if (ok) return it;
336  }
337  return -1;
338 }
#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
tuple level
Definition: testEve_cfg.py:34
int CaloTrkProcessing::isItInside ( const G4VTouchable *  touch,
int  idcal,
int  idin 
)
private

Definition at line 340 of file CaloTrkProcessing.cc.

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

Referenced by update().

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

References lastTrackID.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

170  {
171  lastTrackID = -1;
172 }
void CaloTrkProcessing::update ( const G4Step *  )
privatevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const G4Step * >.

Definition at line 174 of file CaloTrkProcessing.cc.

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

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

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