DAQConventions.h
Go to the documentation of this file.
1 /**
2  * A bunch of simple, static functions to return DAQ conventions
3  *
4  * @author Jonathan Paley
5  * @version $Id: DAQConventions.h,v 1.12 2013/02/07 20:20:53 jpaley Exp $
6  */
7 
8 #ifndef NOVADAQCONVENTIONS_H
9 #define NOVADAQCONVENTIONS_H
10 
11 #include <string>
12 #include <iostream>
13 #include <fstream>
14 #include <stdint.h>
15 
16 namespace novadaq
17 {
18  namespace cnv {
19 
20  enum RunType {
26  };
27 
28  enum DetId {
30  kNEARDET, //!< Near Detector in the NuMI cavern
31  kFARDET, //!< Far Detector at Ash River, MN
32  kNDOS, //!< Prototype Near Detector on the surface at FNAL
37  };
38 
39  enum SubDetId {
46  };
47 
48  class RunInfo {
49  public:
50  static std::string GetType(int rt) {
51  switch (rt) {
52  case kTestRun:
53  return std::string("Test");
54  case kCommissioningRun:
55  return std::string("Commissioning");
56  case kPedestalRun:
57  return std::string("Pedestal");
58  case kProductionRun:
59  return std::string("Production");
60  default:
61  break;
62  }
63  return std::string("");
64  }
65 
66  static int GetRunId(std::string rid) {
67  if (rid == "Test") return kTestRun;
68  if (rid == "Commissioning") return kCommissioningRun;
69  if (rid == "Pedestal") return kPedestalRun;
70  if (rid == "Production") return kProductionRun;
71  return -1;
72  }
73 
74  static bool RunIdOk(std::string rid) {
75  return (RunInfo::GetRunId(rid) >= 0);
76  }
77 
78  static bool RunTypeOk(int rt) {
79  return (RunInfo::GetType(rt) != "");
80  }
81 
82  };
83 
84  class DetInfo {
85  public:
86  static std::string GetName(int id) {
87  switch (id) {
88  case kNEARDET:
89  return std::string("NearDet");
90  case kFARDET:
91  return std::string("FarDet");
92  case kNDOS:
93  return std::string("NDOS");
94  case kNDSBTEST:
95  return std::string("NDSBTest");
96  case kTESTBEAM:
97  return std::string("TestBeam");
98  case kFCCDAQ:
99  return std::string("FCCDAQ");
100  case kUNKNOWN_DET:
101  default:
102  break;
103  }
104  return std::string("Unknown");
105  }
106 
107  static int GetId(std::string name) {
108  if (name == "NearDet") return kNEARDET;
109  if (name == "FarDet") return kFARDET;
110  if (name == "NDOS") return kNDOS;
111  if (name == "NDSBTest") return kNDSBTEST;
112  if (name == "TestBeam") return kTESTBEAM;
113  if (name == "FCCDAQ") return kFCCDAQ;
114  return kUNKNOWN_DET;
115  }
116 
117  static bool DetIdOk(int id) {
118  return (DetInfo::GetName(id) != "Unknown");
119  }
120 
121  static bool DetNameOk(std::string name) {
122  return (DetInfo::GetId(name) != kUNKNOWN_DET);
123  }
124  };
125 
126  class SubDetInfo {
127  public:
128  static std::string GetName(int id) {
129  switch (id) {
130  case k2Block_2x2:
131  return std::string("_2Block_2x2");
132  case k3Block_2x2:
133  return std::string("_3Block_2x2");
134  case k2Block_1x1:
135  return std::string("_2Block_1x1");
136  case k3Block_1x1:
137  return std::string("_3Block_1x1");
138  case kUNKNOWN_SUBDET:
139  default:
140  break;
141  }
142  return std::string("Unknown");
143  }
144 
145  static int GetId(std::string name) {
146  if (name == "_2Block_2x2") return k2Block_2x2;
147  if (name == "_3Block_2x2") return k3Block_2x2;
148  if (name == "_2Block_1x1") return k2Block_1x1;
149  if (name == "_3Block_1x1") return k3Block_1x1;
150  return kUNKNOWN_SUBDET;
151  }
152 
153  };
154 
155  }
156 }
157 
158 #endif // NOVADAQCONVENTIONS_H
static std::string GetName(int id)
const XML_Char * name
Definition: expat.h:151
Far Detector at Ash River, MN.
static int GetId(std::string name)
Prototype Near Detector on the surface at FNAL.
static bool DetIdOk(int id)
Near Detector in the NuMI cavern.
static int GetRunId(std::string rid)
static int GetId(std::string name)
static std::string GetName(int id)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
static std::string GetType(int rt)
static bool RunTypeOk(int rt)
static bool RunIdOk(std::string rid)
static bool DetNameOk(std::string name)