QwAnalysis
QwTypes.h
Go to the documentation of this file.
1 #ifndef QWTYPES_H
2 #define QWTYPES_H
3 
4 // C and C++ headers
5 #include <map>
6 #include <iostream>
7 
8 // ROOT basic types
9 #include <Rtypes.h>
10 class TString;
11 
12 // Qweak headers
13 #include "QwUnits.h"
14 
15 // Enumerator types for regions and directions
21 };
22 inline std::ostream& operator<< (std::ostream& stream, const EQwRegionID& i) {
23  stream << "?123TCS#"[i]; return stream;
24 }
25 typedef std::map < char, EQwRegionID > QwRegionMap;
27 {
28  QwRegionMap map;
29  map['?'] = kRegionIDNull;
30  map['1'] = kRegionID1;
31  map['2'] = kRegionID2;
32  map['3'] = kRegionID3;
33  map['T'] = kRegionIDTrig;
34  map['C'] = kRegionIDCer;
35  map['S'] = kRegionIDScanner;
36  return map;
37 }
39 
40 
48 };
49 inline std::ostream& operator<< (std::ostream& stream, const EQwDirectionID& i) {
50  stream << "?xyuvrfLR#"[i]; return stream;
51 }
52 typedef std::map < char, EQwDirectionID > QwDirectionMap;
54 {
55  QwDirectionMap map;
56  map['?'] = kDirectionNull;
57  map['x'] = kDirectionX;
58  map['y'] = kDirectionY;
59  map['u'] = kDirectionU;
60  map['v'] = kDirectionV;
61  map['r'] = kDirectionR;
62  map['f'] = kDirectionPhi;
63  map['L'] = kDirectionLeft;
64  map['R'] = kDirectionRight;
65  return map;
66 }
68 
69 // Currently up and down are considered two packages.
75 };
76 // NOTE: Packages will be defined with respect to the *fixed magnet octants*.
77 // This means that after a rotation of 45 deg from the vertical position,
78 // one package will be identified as kPackageUpLeft (name?), and the other
79 // package as kPackageDownRight. (wdc, based on discussion with pking)
80 inline std::ostream& operator<< (std::ostream& stream, const EQwDetectorPackage& i) {
81  stream << "?12#"[i]; return stream;
82 }
83 typedef std::map < char, EQwDetectorPackage > QwPackageMap;
85 {
86  QwPackageMap map;
87  map['?'] = kPackageNull;
88  map['1'] = kPackage1;
89  map['2'] = kPackage2;
90  return map;
91 }
93 
95  kTypeNull = 0,
96  kTypeSciFiber, // Scintillating Fiber detector
97  kTypeDriftHDC, // HDC Drift chamber
98  kTypeDriftVDC, // VDC Drift chamber
99  kTypeTrigscint, // Trigger scintillator
100  kTypeCerenkov, // Cerenkov detector
101  kTypeScanner, // Focal plane scanner
103 };
104 inline std::ostream& operator<< (std::ostream& stream, const EQwDetectorType& i) {
105  stream << "?fhvtcs#"[i]; return stream;
106 }
107 typedef std::map < char, EQwDetectorType > QwTypeMap;
109 {
110  QwTypeMap map;
111  map['?'] = kTypeNull;
112  map['f'] = kTypeSciFiber;
113  map['h'] = kTypeDriftHDC;
114  map['v'] = kTypeDriftVDC;
115  map['t'] = kTypeTrigscint;
116  map['c'] = kTypeCerenkov;
117  map['s'] = kTypeScanner;
118  return map;
119 }
121 
122 // Enumerator type for the instrument type, used in subsystems that have to
123 // distinguish between various detector types.
125  kQwUnknownPMT = 0, // Unknown PMT type
126  kQwIntegrationPMT, // Integration PMT
127  kQwScalerPMT, // Scaler PMT
128  kQwCombinedPMT, // Combined PMT
129  kNumInstrumentTypes // This should be the last enum; it provides the number of know types.
130 };
131 
144  kBeamDevTypes // This should be the last enum; it provides the number of know types.
145 };
146 
147 // Enumerator type for the electronics module type
155 };
156 
157 //Beamline device errorflags
158 static const UInt_t kErrorFlag_VQWK_Sat = 0x01; // in Decimal 1 to identify a VQWK is saturating
159 static const UInt_t kErrorFlag_sample = 0x2; // in Decimal 2 for sample size check
160 static const UInt_t kErrorFlag_SW_HW = 0x4; // in Decimal 4 HW_sum==SW_sum check
161 static const UInt_t kErrorFlag_Sequence = 0x8; // in Decimal 8 sequence number check
162 static const UInt_t kErrorFlag_SameHW = 0x10; // in Decimal 16 check to see ADC returning same HW value
163 static const UInt_t kErrorFlag_ZeroHW = 0x20; // in Decimal 32 check to see ADC returning zero
164 static const UInt_t kErrorFlag_EventCut_L = 0x40; // in Decimal 64 check to see ADC failed lower limit of the event cut
165 static const UInt_t kErrorFlag_EventCut_U = 0x80; // in Decimal 128 check to see ADC failed upper limit of the event cut
166 
167 static const UInt_t kBCMErrorFlag = 0x100; // in Decimal 256 to identify the single event cut is failed for a BCM (regular or combo)
168 static const UInt_t kErrorFlag_BlinderFail = 0x200;// in Decimal 512 to identify the blinder flag
169 static const UInt_t kBPMErrorFlag = 0x400; // in Decimal 1024 to identify the single event cut is failed for a BPM (Stripline or cavity or comboBPM)
170 static const UInt_t kPMTErrorFlag = 0x800; // in Decimal 2048 to identify the single event cut is failed for a PMT (Combined or regular)
171 static const UInt_t kBModFFBErrorFlag = 0x1000; // in Decimal 4096 (2^12) to identify the FFB OFF periods for Energy modulation
172 static const UInt_t kBModErrorFlag = 0x8000; // in Decimal 32768 (2^15) to identify the single event cut is failed for a BMod channel
173 static const UInt_t kEventCutMode3 = 0x10000; // in Decimal 65536 to identify the mode 3 where we only flag event cut failed events
174 static const UInt_t kBeamStabilityError= 0x10000000;//in Decimal 2^28(268435456) to identify the a stability cut
175 static const UInt_t kBeamTripError= 0x8000000;// in Decimal 2^27(134217728) to identify the an event within a beam trip range set by ring parameters
176 static const UInt_t kGlobalCut = 0x4000000;// in Decimal 2^26 to identify the single event cut is a global cut
177 static const UInt_t kLocalCut = 0x2000000;// in Decimal 2^25 to identify the single event cut is a local cut
178 static const UInt_t kStabilityCut = 0x1000000;// in Decimal 2^24 (16777216) to identify the single event cut is a stability cut. NOT IN USE CURRENTLY
179 static const UInt_t kPreserveError = 0x2FF;//when AND-ed with this it will only keep HW errors and blinder
180 
181 //To generate the error code based on global/local and stability cut value
182 UInt_t GetGlobalErrorFlag(TString evtype,Int_t evMode,Double_t stabilitycut);
183 
184 
187 
190 
191 static const UInt_t kInvalidSubelementIndex = 999999;
192 
193 //=======
194 // Enumerator increments
195 inline EQwRegionID& operator++ (EQwRegionID &region, int) {
196  return region = EQwRegionID(region + 1);
197 }
198 inline EQwDirectionID& operator++ (EQwDirectionID &direction, int) {
199  return direction = EQwDirectionID(direction + 1);
200 }
202  return package = EQwDetectorPackage(package + 1);
203 }
205  return type = EQwDetectorType(type + 1);
206 }
207 
208 
209 /// Helicity enumerator (don't use this as a signed int)
214 };
215 /// Use the static map kMapHelicity to get the helicity sign
216 /// e.g.: kMapHelicity[kHelicityPositive] will return +1
217 typedef std::map < EQwHelicity, int > QwHelicityMap;
218 inline QwHelicityMap CreateHelicityMap()
219 {
220  QwHelicityMap map;
221  map[kHelicityUndefined] = 0;
222  map[kHelicityPositive] = +1;
223  map[kHelicityNegative] = -1;
224  return map;
225 }
226 static const QwHelicityMap kMapHelicity = CreateHelicityMap();
227 
228 
229 ///
230 /// \ingroup QwAnalysis
232 {
233  public:
237 
238  QwDetectorID(const EQwRegionID region,
239  const EQwDetectorPackage package,
240  const Int_t octant,
241  const Int_t plane,
242  const EQwDirectionID direction,
243  const Int_t wire)
244  : fRegion(region),fPackage(package),fOctant(octant),
245  fPlane(plane),fDirection(direction),fElement(wire) { };
246 
247  public:
248  EQwRegionID fRegion; ///< region 1, 2, 3, triggg. scint or cerenkov
249  EQwDetectorPackage fPackage; ///< which arm of the rotator or octant number
250  Int_t fOctant; ///< octant of this detector
251  Int_t fPlane; ///< R or theta index for R1; plane index for R2 & R3
252  EQwDirectionID fDirection; ///< direction of the wire plane X,Y,U,V etc - Rakitha (10/23/2008)
253  Int_t fElement; ///< trace number for R1; wire number for R2 & R3; PMT number for others
254 
255  friend std::ostream& operator<<(std::ostream& os, const QwDetectorID &detectorID) {
256  os << " Region ";
257  os << detectorID.fRegion;
258  os << " Package ";
259  os << detectorID.fPackage;
260  os << " Octant ";
261  os << detectorID.fOctant;
262  os << " Plane ";
263  os << detectorID.fPlane;
264  os << " Direction";
265  os <<detectorID.fDirection;
266  os << " fElement ";
267  os << detectorID.fElement;
268 
269  return os;
270  }
271 };
272 
273 
274 
275 ///
276 /// \ingroup QwAnalysis
278 {
279  public:
281  QwElectronicsID(const int slot,const int chan):fModule(slot),fChannel(chan){};
282 
283  public:
284  int fModule; //F1TDC slot number or module number
285  int fChannel; //channel number
286 };
287 
288 
289 ///
290 /// \ingroup QwAnalysis
292  public:
294  QwDelayLineID(const int backplane, const int linenumber, const int side):fBackPlane(backplane),fLineNumber(linenumber),fSide(side){};
295 
296  Int_t fBackPlane;
297  Int_t fLineNumber;
298  Int_t fSide;
299 };
300 
301 /// Double Wien configuration
308 };
309 std::string WienModeName(EQwWienMode type);
310 EQwWienMode WienModeIndex(TString name);
311 
312 /// Definitions for beam parameter quantities; use these types rather than
313 /// the raw "QwVQWK_Channel" to allow for future specification.
314 class QwVQWK_Channel;
319 
320 #endif
class QwVQWK_Channel QwBeamPosition
Definition: QwTypes.h:316
static const UInt_t kBCMErrorFlag
Definition: QwTypes.h:167
static const UInt_t kErrorFlag_SW_HW
Definition: QwTypes.h:160
static const UInt_t kErrorFlag_ZeroHW
Definition: QwTypes.h:163
static const UInt_t kLocalCut
Definition: QwTypes.h:177
EQwPMTInstrumentType GetQwPMTInstrumentType(TString name)
Definition: QwTypes.cc:11
static const UInt_t kBModErrorFlag
Definition: QwTypes.h:172
QwHelicityMap CreateHelicityMap()
Definition: QwTypes.h:218
std::ostream & operator<<(std::ostream &out, const QwColor &color)
Output stream operator which uses the enum-to-escape-code mapping.
Definition: QwColor.h:153
EQwBeamInstrumentType GetQwBeamInstrumentType(TString name)
Definition: QwTypes.cc:29
EQwDetectorPackage fPackage
which arm of the rotator or octant number
Definition: QwTypes.h:249
static const UInt_t kErrorFlag_sample
Definition: QwTypes.h:159
EQwDirectionID fDirection
direction of the wire plane X,Y,U,V etc - Rakitha (10/23/2008)
Definition: QwTypes.h:252
static const QwDirectionMap kQwDirectionMap
Definition: QwTypes.h:67
QwPackageMap CreatePackageMap()
Definition: QwTypes.h:84
static const UInt_t kErrorFlag_BlinderFail
Definition: QwTypes.h:168
static const UInt_t kErrorFlag_SameHW
Definition: QwTypes.h:162
EQwPMTInstrumentType
Definition: QwTypes.h:124
EQwRegionID & operator++(EQwRegionID &region, int)
Definition: QwTypes.h:195
QwDirectionMap CreateDirectionMap()
Definition: QwTypes.h:53
EQwWienMode
Double Wien configuration.
Definition: QwTypes.h:302
EQwRegionID fRegion
region 1, 2, 3, triggg. scint or cerenkov
Definition: QwTypes.h:245
TString GetQwBeamInstrumentTypeName(EQwBeamInstrumentType type)
Definition: QwTypes.cc:95
EQwDetectorPackage
Definition: QwTypes.h:70
TString GetQwPMTInstrumentTypeName(EQwPMTInstrumentType type)
Definition: QwTypes.cc:76
static const UInt_t kInvalidSubelementIndex
Definition: QwTypes.h:191
Int_t fElement
trace number for R1; wire number for R2 &amp; R3; PMT number for others
Definition: QwTypes.h:253
EQwDetectorType
Definition: QwTypes.h:94
EQwRegionID
Definition: QwTypes.h:16
static const QwPackageMap kQwPackageMap
Definition: QwTypes.h:92
QwDetectorID(const EQwRegionID region, const EQwDetectorPackage package, const Int_t octant, const Int_t plane, const EQwDirectionID direction, const Int_t wire)
Definition: QwTypes.h:238
std::map< char, EQwDetectorType > QwTypeMap
Definition: QwTypes.h:107
static const UInt_t kErrorFlag_Sequence
Definition: QwTypes.h:161
class QwVQWK_Channel QwBeamCharge
Definition: QwTypes.h:315
QwDetectorID()
Definition: QwTypes.h:234
Int_t fSide
Definition: QwTypes.h:298
class QwVQWK_Channel QwBeamAngle
Definition: QwTypes.h:317
static const UInt_t kBeamTripError
Definition: QwTypes.h:175
Int_t fPlane
R or theta index for R1; plane index for R2 &amp; R3.
Definition: QwTypes.h:251
std::map< char, EQwRegionID > QwRegionMap
Definition: QwTypes.h:25
static const UInt_t kPreserveError
Definition: QwTypes.h:179
QwDelayLineID(const int backplane, const int linenumber, const int side)
Definition: QwTypes.h:294
EQwModuleType
Definition: QwTypes.h:148
static const UInt_t kBeamStabilityError
Definition: QwTypes.h:174
friend std::ostream & operator<<(std::ostream &os, const QwDetectorID &detectorID)
Definition: QwTypes.h:255
std::map< char, EQwDetectorPackage > QwPackageMap
Definition: QwTypes.h:83
std::map< EQwHelicity, int > QwHelicityMap
Definition: QwTypes.h:217
Int_t fLineNumber
Definition: QwTypes.h:297
Int_t fOctant
octant of this detector
Definition: QwTypes.h:250
static const UInt_t kPMTErrorFlag
Definition: QwTypes.h:170
EQwHelicity
Helicity enumerator (don&#39;t use this as a signed int)
Definition: QwTypes.h:210
static const UInt_t kEventCutMode3
Definition: QwTypes.h:173
static const QwHelicityMap kMapHelicity
Definition: QwTypes.h:226
static const UInt_t kErrorFlag_EventCut_L
Definition: QwTypes.h:164
static const UInt_t kGlobalCut
Definition: QwTypes.h:176
EQwDirectionID
Definition: QwTypes.h:41
static const UInt_t kBModFFBErrorFlag
Definition: QwTypes.h:171
static const QwRegionMap kQwRegionMap
Definition: QwTypes.h:38
EQwWienMode WienModeIndex(TString name)
Definition: QwTypes.cc:151
static const UInt_t kBPMErrorFlag
Definition: QwTypes.h:169
Int_t fBackPlane
Definition: QwTypes.h:294
EQwBeamInstrumentType
Definition: QwTypes.h:132
class QwVQWK_Channel QwBeamEnergy
Definition: QwTypes.h:318
std::map< char, EQwDirectionID > QwDirectionMap
Definition: QwTypes.h:52
QwTypeMap CreateTypeMap()
Definition: QwTypes.h:108
static const UInt_t kStabilityCut
Definition: QwTypes.h:178
static const UInt_t kErrorFlag_VQWK_Sat
Definition: QwTypes.h:158
QwElectronicsID(const int slot, const int chan)
Definition: QwTypes.h:281
static const UInt_t kErrorFlag_EventCut_U
Definition: QwTypes.h:165
static const QwTypeMap kQwTypeMap
Definition: QwTypes.h:120
std::string WienModeName(EQwWienMode type)
Definition: QwTypes.cc:145
QwRegionMap CreateRegionMap()
Definition: QwTypes.h:26
UInt_t GetGlobalErrorFlag(TString evtype, Int_t evMode, Double_t stabilitycut)
Definition: QwTypes.cc:127