Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UtilTrigger.cc
Go to the documentation of this file.
1 #include <cmath>
2 using namespace std;
3 namespace UtilTrigger {
4 
6 
9 int Hodo2Road(const int h1, const int h2, const int h3, const int h4, const int tb)
10 {
11  return ((h1-1)*16*16*16 + (h2-1)*16*16 + (h3-1)*16 + (h4-1)) * (tb>0?+1:-1);
12 }
13 
15 void Road2Hodo(const int road, int& h1, int& h2, int& h3, int& h4, int& tb)
16 {
17  int rr = abs(road) - 1;
18  h1 = 1 + rr/16/16/16;
19  h2 = 1 + (rr/16/16)%16;
20  h3 = 1 + (rr/16) %16;
21  h4 = 1 + rr %16;
22  tb = road>0 ? +1 : -1;
23 }
24 
25 }; // End of "namespace UtilTrigger"
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.
Definition: UtilTrigger.cc:9
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.
Definition: UtilTrigger.cc:15