13 int Hodo2Road(
const int h1,
const int h2,
const int h3,
const int h4,
const int tb)
15 if (h1 * h2 * h3 * h4 * tb == 0)
return 0;
16 int road = (h1-1)*16*16*16 + (h2-1)*16*16 + (h3-1)*16 + h4;
17 return (tb > 0 ? +1 : -1) * road;
21 void Road2Hodo(
const int road,
int& h1,
int& h2,
int& h3,
int& h4,
int& tb)
24 h1 = h2 = h3 = h4 = tb = 0;
27 int rr = abs(road) - 1;
28 h1 = 1 + (rr/16/16/16);
29 h2 = 1 + (rr/16/16 ) %16;
30 h3 = 1 + (rr/16 ) %16;
32 tb = road>0 ? +1 : -1;
38 int h1, h2, h3, h4, tb;
50 int h1, h2, h3, h4, tb;
66 memset(list_ele_id, 0,
sizeof(list_ele_id));
70 if (name[0] !=
'H')
continue;
74 }
else if (name[2] ==
'B') {
80 int station = (name[1] -
'0');
81 if (list_ele_id[station] != 0)
return 0;
84 return Hodo2Road(list_ele_id[1], list_ele_id[2], list_ele_id[3], list_ele_id[4], tb);
109 for (
auto it1 = hv_h1t->begin(); it1 != hv_h1t->end(); it1++) {
110 for (
auto it2 = hv_h2t->begin(); it2 != hv_h2t->end(); it2++) {
111 for (
auto it3 = hv_h3t->begin(); it3 != hv_h3t->end(); it3++) {
112 for (
auto it4 = hv_h4t->begin(); it4 != hv_h4t->end(); it4++) {
114 (*it1)->get_element_id(),
115 (*it2)->get_element_id(),
116 (*it3)->get_element_id(),
117 (*it4)->get_element_id(), +1);
118 if (
rs->PosTop()->FindRoad(road)) pos_top->push_back(road);
119 if (
rs->NegTop()->FindRoad(road)) neg_top->push_back(road);
124 pos_top->erase(std::unique(pos_top->begin(), pos_top->end()), pos_top->end());
125 neg_top->erase(std::unique(neg_top->begin(), neg_top->end()), neg_top->end());
133 for (
auto it1 = hv_h1b->begin(); it1 != hv_h1b->end(); it1++) {
134 for (
auto it2 = hv_h2b->begin(); it2 != hv_h2b->end(); it2++) {
135 for (
auto it3 = hv_h3b->begin(); it3 != hv_h3b->end(); it3++) {
136 for (
auto it4 = hv_h4b->begin(); it4 != hv_h4b->end(); it4++) {
138 (*it1)->get_element_id(),
139 (*it2)->get_element_id(),
140 (*it3)->get_element_id(),
141 (*it4)->get_element_id(), -1);
142 if (
rs->PosBot()->FindRoad(road)) pos_bot->push_back(road);
143 if (
rs->NegBot()->FindRoad(road)) neg_bot->push_back(road);
148 pos_bot->erase(std::unique(pos_bot->begin(), pos_bot->end()), pos_bot->end());
149 neg_bot->erase(std::unique(neg_bot->begin(), neg_bot->end()), neg_bot->end());
static GeomSvc * instance()
singlton instance
std::string getDetectorName(const int &detectorID) const
An SQ interface class to hold a list of SQHit objects.
std::vector< SQHit * >::const_iterator ConstIter
virtual ConstIter end() const =0
virtual ConstIter begin() const =0
An SQ interface class to hold one detector hit.
virtual short get_element_id() const
Return the element ID of this hit.
virtual short get_detector_id() const
Return the detector ID of this hit.
Class to handle the trigger roadset.
SQHitVector * FindFirstHits(const SQHitVector *vec_in, const std::string det_name, const bool in_time=false)
Extract a set of first hits that are of the given detector (det_name), where "first" means the earlie...
SQHitVector * FindHits(const SQHitVector *vec_in, const std::string det_name, const bool in_time=false)
Extract a set of hits that are of the given detector (det_name).
int FlipRoadLeftRight(const int road)
Flip the given road ID in the left-right direction.
void Road2Hodo(const int road, int &h1, int &h2, int &h3, int &h4, int &tb)
Convert a roadset ID to a set of hodo IDs.
void FindFiredRoads(const SQHitVector *vec, const TrigRoadset *rs, const bool in_time, std::vector< int > *pos_top, std::vector< int > *pos_bot, std::vector< int > *neg_top, std::vector< int > *neg_bot)
Find all fired roads enabled in rs, by taking all hit combinations from vec.
int Hodo2Road(const int h1, const int h2, const int h3, const int h4, const int tb)
Convert a set of hodo IDs to a roadset ID.
int FlipRoadTopBottom(const int road)
Flip the given road ID in the top-bottom direction.
int ExtractRoadID(const SQHitVector *vec)
Find a unique road in the given list of SQHits.