QwAnalysis
QwTypes.cc
Go to the documentation of this file.
1 #include "QwTypes.h"
2 #include "TString.h"
3 
4 /**
5  * Determine the EQwPMTInstrumentType value corresponding to a
6  * text name of the type, as used in the channel map files.
7  * The text comparison is not case sensitive.
8  * @param name Text name of an instrument type, such as "IntegrationPMT"
9  * @return EQwPMTInstrumentType value corresponding to the name
10  */
12  // The name is passed by value because we will
13  // change it to lower case.
14  name.ToLower();
15  EQwPMTInstrumentType result;
16  result = kQwUnknownPMT;
17  if (name=="integrationpmt"){
18  result = kQwIntegrationPMT;
19  } else if (name=="scalerpmt"){
20  result = kQwScalerPMT;
21  }
22  else if (name=="combinationpmt"){
23  result = kQwCombinedPMT;
24  }
25  return result;
26 }
27 
28 
30  // The name is passed by value because we will
31  // change it to lower case.
32  name.ToLower();
33  EQwBeamInstrumentType result;
34  result = kQwUnknownDeviceType;
35  if (name=="bpmstripline"){
36  result = kQwBPMStripline;
37  }
38  else if (name=="bcm"){
39  result = kQwBCM;
40  }
41  else if (name=="combinedbcm"){
42  result = kQwCombinedBCM;
43  }
44  else if (name=="combinedbpm"){
45  result = kQwCombinedBPM;
46  }
47  else if (name=="energycalculator"){
48  result = kQwEnergyCalculator;
49  }
50  else if (name=="halomonitor"){
51  result = kQwHaloMonitor;
52  }
53  else if (name=="bpmcavity"){
54  result = kQwBPMCavity;
55  }
56  else if (name=="qpd"){
57  result = kQwQPD;
58  }
59  else if (name=="lineararray"){
60  result = kQwLinearArray;
61  }
62  else if (name=="clock") {
63  result = kQwClock;
64  }
65  return result;
66 }
67 
68 
69 /**
70  * Get the text name of a EQwPMTInstrumentType, as it would be
71  * used in the channel map files.
72  * @param type EQwPMTInstrumentType value for which the name should be
73  * returned, such as kQwPMTIntegrationPMT
74  * @return Text name corresponding to the type
75  */
77  TString result;
78  result = "UnknownPMT";
79  if (type==kQwIntegrationPMT){
80  result = "IntegrationPMT";
81  result.ToLower();
82  }
83  else if (type==kQwScalerPMT){
84  result = "ScalerPMT";
85  result.ToLower();
86  }
87  else if (type==kQwCombinedPMT){
88  result = "CombinationPMT";
89  result.ToLower();
90  }
91  return result;
92 }
93 
94 
96  TString result;
97  result = "kQwUnknownDeviceType";
98  if (type==kQwBPMStripline){
99  result = "bpmstripline";
100  }
101  else if (type==kQwBCM){
102  result = "bcm";
103  }
104  else if (type==kQwQPD){
105  result = "qpd";
106  }
107  else if (type==kQwLinearArray){
108  result = "lineararray";
109  }
110  else if (type==kQwCombinedBCM){
111  result = "combinedbcm";
112  }
113  else if (type==kQwCombinedBPM){
114  result = "combinedbpm";
115  }
116  else if (type==kQwEnergyCalculator){
117  result = "energycalculator";
118  }
119  else if (type==kQwHaloMonitor){
120  result = "halomonitor";
121  }
122  else if (type==kQwBPMCavity)
123  result = "bpmcavity";
124  return result;
125 }
126 
127 UInt_t GetGlobalErrorFlag(TString evtype,Int_t evMode,Double_t stabilitycut){
128  UInt_t evntMode;
129  if (evMode==3)
130  evntMode=kEventCutMode3;
131  else
132  evntMode=0;
133  if (evtype=="g" && stabilitycut>0)
134  return (kGlobalCut|kStabilityCut|evntMode);
135  else if (evtype=="g" && stabilitycut<=0)
136  return (kGlobalCut|evntMode);
137  else if (evtype=="l" && stabilitycut>0)
138  return (kLocalCut|evntMode|kStabilityCut);
139  else if (evtype=="l" && stabilitycut<=0)
140  return (kLocalCut|evntMode);
141 
142  return 0;
143 }
144 
145 std::string WienModeName(EQwWienMode type){
146  const std::string wienname[5] = {"Indeterminate", "Forward", "Backward",
147  "Vertical", "Horizontal"};
148  return wienname[type];
149 };
150 
153  if (name=="Forward"){
154  retval = kWienForward;
155  } else if (name=="Backward"){
156  retval = kWienBackward;
157  } else if (name=="Vertical"){
158  retval = kWienVertTrans;
159  } else if (name=="Horizontal"){
160  retval = kWienHorizTrans;
161  }
162  return retval;
163 }
static const UInt_t kLocalCut
Definition: QwTypes.h:177
EQwPMTInstrumentType GetQwPMTInstrumentType(TString name)
Definition: QwTypes.cc:11
EQwBeamInstrumentType GetQwBeamInstrumentType(TString name)
Definition: QwTypes.cc:29
EQwPMTInstrumentType
Definition: QwTypes.h:124
EQwWienMode
Double Wien configuration.
Definition: QwTypes.h:302
TString GetQwBeamInstrumentTypeName(EQwBeamInstrumentType type)
Definition: QwTypes.cc:95
TString GetQwPMTInstrumentTypeName(EQwPMTInstrumentType type)
Definition: QwTypes.cc:76
static const UInt_t kEventCutMode3
Definition: QwTypes.h:173
static const UInt_t kGlobalCut
Definition: QwTypes.h:176
EQwWienMode WienModeIndex(TString name)
Definition: QwTypes.cc:151
EQwBeamInstrumentType
Definition: QwTypes.h:132
static const UInt_t kStabilityCut
Definition: QwTypes.h:178
std::string WienModeName(EQwWienMode type)
Definition: QwTypes.cc:145
UInt_t GetGlobalErrorFlag(TString evtype, Int_t evMode, Double_t stabilitycut)
Definition: QwTypes.cc:127