Class Reference for E1039 Core & Analysis Software
CalibHitElementPos.cc
Go to the documentation of this file.
1 #include <iomanip>
4 #include <phool/PHNodeIterator.h>
5 #include <phool/PHIODataNode.h>
6 #include <phool/getClass.h>
7 #include <geom_svc/GeomSvc.h>
8 #include "CalibHitElementPos.h"
9 using namespace std;
10 
12  : SubsysReco(name)
13  , m_cal_hit (true)
14  , m_cal_tr_hit(true)
15  , m_vec_hit (0)
16  , m_vec_trhit (0)
17 {
18  ;
19 }
20 
22 {
23  ;
24 }
25 
27 {
29 }
30 
32 {
33  if (m_cal_hit) {
34  m_vec_hit = findNode::getClass<SQHitVector>(topNode, "SQHitVector");
35  if (!m_vec_hit) return Fun4AllReturnCodes::ABORTEVENT;
36  }
37  if (m_cal_tr_hit) {
38  m_vec_trhit = findNode::getClass<SQHitVector>(topNode, "SQTriggerHitVector");
39  if (!m_vec_trhit) return Fun4AllReturnCodes::ABORTEVENT;
40  }
42 }
43 
45 {
46  if (Verbosity() > 10) cout << "CalibHitElementPos::process_event()"<< endl;
47  GeomSvc* geom = GeomSvc::instance();
48  if (m_cal_hit) {
49  for (SQHitVector::Iter it = m_vec_hit->begin(); it != m_vec_hit->end(); it++) {
50  SQHit* hit = *it;
51  if (Verbosity() > 10) cout << " hit " << hit->get_detector_id() << " " << hit->get_element_id() << endl;
52  if (hit->get_detector_id() <= 0 || hit->get_detector_id() >= 1000) continue; // temporary solution to avoid a seg fault on strange hits.
53  hit->set_pos(geom->getMeasurement(hit->get_detector_id(), hit->get_element_id()));
54  }
55  }
56  if (m_cal_tr_hit) {
57  for (SQHitVector::Iter it = m_vec_trhit->begin(); it != m_vec_trhit->end(); it++) {
58  SQHit* hit = *it;
59  if (Verbosity() > 10) cout << " trig hit " << hit->get_detector_id() << " " << hit->get_element_id() << endl;
60  if (hit->get_detector_id() <= 0 || hit->get_detector_id() >= 1000) continue; // temporary solution to avoid a seg fault on strange hits.
61  hit->set_pos(geom->getMeasurement(hit->get_detector_id(), hit->get_element_id()));
62  }
63  }
65 }
66 
68 {
70 }
int process_event(PHCompositeNode *topNode)
CalibHitElementPos(const std::string &name="CalibHitElementPos")
int Init(PHCompositeNode *topNode)
int InitRun(PHCompositeNode *topNode)
int End(PHCompositeNode *topNode)
Called at the end of all processing.
virtual int Verbosity() const
Gets the verbosity of this module.
Definition: Fun4AllBase.h:64
User interface class about the geometry of detector planes.
Definition: GeomSvc.h:164
static GeomSvc * instance()
singlton instance
Definition: GeomSvc.cxx:212
void getMeasurement(int detectorID, int elementID, double &measurement, double &dmeasurement)
Convert the detectorID and elementID to the actual hit position.
Definition: GeomSvc.cxx:651
virtual ConstIter end() const =0
virtual ConstIter begin() const =0
std::vector< SQHit * >::iterator Iter
Definition: SQHitVector.h:38
An SQ interface class to hold one detector hit.
Definition: SQHit.h:20
virtual void set_pos(const float a)
Definition: SQHit.h:61
virtual short get_element_id() const
Return the element ID of this hit.
Definition: SQHit.h:45
virtual short get_detector_id() const
Return the detector ID of this hit.
Definition: SQHit.h:42