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