Detector.h
Go to the documentation of this file.
1 
2 class Detector{
3 
4 public:
5 
7  ~Detector();
8 
9  std::string name() { return fName; }
10  std::string Name();
12  unsigned int NCells() { return fNCells; }
13  unsigned int NPlanes() { return fNPlanes; }
14  unsigned int NDiblocks() { return fNDiblocks; }
15  float HalfW() { return fHalfW; }
16 
17  unsigned int CellToModule(int cell);
18 
19  bool IsTB(){ return fName=="tb"; }
20  bool IsND(){ return fName=="nd"; }
21  bool IsFD(){ return fName=="fd"; }
22 
23  std::map< std::string, uint32_t > EndOfPeriodMap(){ return fEndOfPeriodMap; }
24  std::map< std::string, uint32_t > EndOfEpochMap() { return fEndOfEpochMap; }
25 
26 private:
29  unsigned int fNCells;
30  unsigned int fNPlanes;
31  unsigned int fNDiblocks;
32  float fHalfW;
33 
34  void SetEndOfPeriodMap();
35  std::map< std::string, uint32_t > fEndOfPeriodMap;
36  std::map< std::string, uint32_t > fEndOfEpochMap;
37 
38 };
39 
40 
41 //^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
43 : fName(detname)
44 {
45  if ( detname=="nd" ){
46  fFullName="Near Detector";
47  fHalfW = 200;
48  fNCells = 96; // 3 modules of 32 cells
49  fNPlanes = 192;
50  fNDiblocks = 4;
51  }
52  else if( detname=="fd" ){
53  fFullName="Far Detector";
54  fHalfW = 800;
55  fNCells = 384; // 12 modules of 32 cells
56  fNPlanes = 896;
57  fNDiblocks = 14;
58  }
59  else if( detname=="tb" ){
60  fFullName="Testbeam Detector";
61  fHalfW = 150;
62  fNCells = 64;
63  fNPlanes = 63;
64  fNDiblocks = 2; //3 if the different FEBs need to be taken into account.
65  }
66  else{
67  std::cout << "Unrecognized detector: " << detname << std::endl;
68  std::abort();
69  }
71 }
72 
73 
74 //^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
75 unsigned int Detector::CellToModule( int cell )
76 {
77  unsigned int module = (unsigned int)(cell) % 32;
78  if( (Name()=="nd" && module > 2 ) ||
79  (Name()=="fd" && module > 11) ){
80  std::cout << "Invalid module for " << FullName()
81  << ": " << module << std::endl;
82  std::abort();
83  }
84  return module;
85 }
86 
87 
88 //^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
90 {
91  if (fName=="nd"){ return "ND";}
92  else if(fName=="fd"){ return "FD";}
93  else if(fName=="tb"){ return "TB";}
94  else return "";
95 }
96 
97 
98 //^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
100 {
101  fEndOfPeriodMap["2"] = 1444656758;
102  fEndOfPeriodMap["3"] = 1467229500;
103  fEndOfPeriodMap["4"] = 1479081600;
104  fEndOfPeriodMap["5"] = 1487548800;
105  fEndOfPeriodMap["6"] = 1510059600;
106  fEndOfPeriodMap["7"] = 1530835200;
107  fEndOfPeriodMap["7"] = 1540015200;
108  fEndOfPeriodMap["8"] = 1551139200;
109 
110  fEndOfEpochMap["2a"] = 1426291199;
111  fEndOfEpochMap["2b"] = 1431734399;
112  fEndOfEpochMap["2c"] = 1433756400;
113  fEndOfEpochMap["2d"] = 1435968060;
114  fEndOfEpochMap["2e"] = 1444656758;
115  fEndOfEpochMap["3a"] = 1445600160;
116  fEndOfEpochMap["3b"] = 1447804800;
117  fEndOfEpochMap["3c"] = 1453248000;
118  fEndOfEpochMap["3d"] = 1462175700;
119  fEndOfEpochMap["3e"] = 1467229500;
120  fEndOfEpochMap["4a"] = 1469795700;
121  fEndOfEpochMap["4b"] = 1478822400;
122  fEndOfEpochMap["4c"] = 1479081600;
123  fEndOfEpochMap["5a"] = 1484006400;
124  fEndOfEpochMap["5b"] = 1487548800;
125  fEndOfEpochMap["6a"] = 1499428860;
126  fEndOfEpochMap["6b"] = 1510059600;
127  fEndOfEpochMap["7a"] = 1514764800;
128  fEndOfEpochMap["7b"] = 1521504000;
129  fEndOfEpochMap["7c"] = 1523318400;
130  fEndOfEpochMap["7d"] = 1530835200;
131  fEndOfEpochMap["7e"] = 1540015200;
132  fEndOfEpochMap["8a"] = 1540166400;
133  fEndOfEpochMap["8b"] = 1551139200;
134  fEndOfEpochMap["8b"] = 1551139200;
135  fEndOfEpochMap["9a"] = 1572478302;
136 }
std::string Name()
Definition: Detector.h:89
void SetEndOfPeriodMap()
Definition: Detector.h:99
unsigned int NCells()
Definition: Detector.h:12
std::map< std::string, uint32_t > fEndOfEpochMap
Definition: Detector.h:36
unsigned int CellToModule(int cell)
Definition: Detector.h:75
std::string fFullName
Definition: Detector.h:28
std::map< std::string, uint32_t > EndOfPeriodMap()
Definition: Detector.h:23
unsigned int fNDiblocks
Definition: Detector.h:31
bool IsTB()
Definition: Detector.h:19
std::map< std::string, uint32_t > EndOfEpochMap()
Definition: Detector.h:24
bool IsFD()
Definition: Detector.h:21
std::string fName
Definition: Detector.h:27
float HalfW()
Definition: Detector.h:15
float fHalfW
Definition: Detector.h:32
Detector(std::string detname)
Definition: Detector.h:42
std::string name()
Definition: Detector.h:9
OStream cout
Definition: OStream.cxx:6
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
unsigned int NPlanes()
Definition: Detector.h:13
bool IsND()
Definition: Detector.h:20
std::map< std::string, uint32_t > fEndOfPeriodMap
Definition: Detector.h:35
unsigned int fNPlanes
Definition: Detector.h:30
unsigned int NDiblocks()
Definition: Detector.h:14
unsigned int fNCells
Definition: Detector.h:29
std::string FullName()
Definition: Detector.h:11