35 SQHitVector* hit_vec = findNode::getClass<SQHitVector>(topNode,
"SQHitVector");
36 SQHitVector* trig_hit_vec = findNode::getClass<SQHitVector>(topNode,
"SQTriggerHitVector");
39 MergeHits(trig_hit_vec);
45 return m_and_mode ? MergeHitsAnd(vec_in) : MergeHitsOr(vec_in);
48 short CalibMergeH4::FindMergedId(
const short id)
50 if (
id == 0)
return 0;
53 if (name.substr(0, 2) !=
"H4")
return 0;
54 string name2 = (name[2] ==
'T' || name[2] ==
'B') ? name.substr(0, 3) : name.substr(0, 5);
55 if (name2 == name)
return 0;
61 for (
unsigned int ih = 0; ih < vec_in->
size(); ih++) {
64 if (det_new == 0)
continue;
78 typedef tuple<short, short, short> MergedGroup_t;
79 typedef map<short, SQHitVector*> MapVec_t;
80 typedef map<MergedGroup_t, MapVec_t> MapMapVec_t;
81 MapMapVec_t map_map_vec;
88 for (
int ih = vec_in->
size() - 1; ih >= 0; ih--) {
91 short det_new = FindMergedId(det_org);
92 if (det_new == 0)
continue;
94 if (map_vec->find(det_org) == map_vec->end()) {
95 (*map_vec)[det_org] = vec_in->
Clone();
96 map_vec->
at(det_org)->clear();
98 map_vec->at(det_org)->push_back(hit);
99 if (m_remove_mode) vec_in->
erase(ih);
103 for (MapMapVec_t::iterator it = map_map_vec.begin(); it != map_map_vec.end(); it++) {
104 short det_new = std::get<0>(it->first);
105 MapVec_t* map_vec = &it->second;
106 int n_det = map_vec->size();
111 for (MapVec_t::iterator it2 = map_vec->begin(); it2 != map_vec->end(); it2++) {
117 if (! hit_push) hit_push = hit;
123 }
else if (n_det > 2) {
124 cerr <<
"CalibMergeH4::MergeHitsAnd(): Unexpectedly found " << map_vec->size() <<
" detectors per merged detector." << endl;
127 for (MapVec_t::iterator it2 = map_vec->begin(); it2 != map_vec->end(); it2++) {
std::string getDetectorName(const int &detectorID) const
virtual void set_tdc_time(const float a)
An SQ interface class to hold one detector hit.
virtual ConstIter end() const
virtual void set_detector_id(const short a)
virtual SQHit * Clone() const
virtual size_t erase(const size_t idkey)
virtual SQHitVector * Clone() const
int process_event(PHCompositeNode *topNode)
std::vector< SQHit * >::iterator Iter
virtual const SQHit * at(const size_t idkey) const
virtual short get_detector_id() const
Return the detector ID of this hit.
virtual void push_back(const SQHit *hit)
virtual float get_tdc_time() const
Return the TDC time (nsec) of this hit.
int InitRun(PHCompositeNode *topNode)
CalibMergeH4(const std::string &name="CalibMergeH4")
An SQ interface class to hold a list of SQHit objects.
int Init(PHCompositeNode *topNode)
static GeomSvc * instance()
singlton instance
virtual size_t size() const
int getDetectorID(const std::string &detectorName) const
Get the plane position.
int End(PHCompositeNode *topNode)
Called at the end of all processing.
virtual short get_level() const
Return the trigger level of this hit. Meaningful only if this hit is of V1495 TDC.
virtual short get_element_id() const
Return the element ID of this hit.
virtual ConstIter begin() const