1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
#ifndef CalibCalorimetry_EcalLaserAnalyzer_ME_h
#define CalibCalorimetry_EcalLaserAnalyzer_ME_h
#include <vector>
#include <map>
#include <string>
#include "TString.h"
class MEChannel;
class ME {
public:
// ECAL regions
enum EcalRegion { iEEM = 0, iEBM, iEBP, iEEP, iSizeE };
enum EcalUnit { iEcalRegion = 0, iSector, iLMRegion, iLMModule, iSuperCrystal, iCrystal, iSizeG };
enum EcalElec { iElectronicChannel = iSizeG, iHVChannel, iLVChannel, iSizeU };
// ECAL region from Laser Monitoring Region
static int ecalRegion(int ilmr);
static bool isBarrel(int ilmr);
// Laser Monitoring Region from dcc and side
static int lmr(int idcc, int iside);
// ECAL Region, Sector, dcc and side from Laser Monitoring Region
static void regionAndSector(int ilmr, int& ireg, int& isect, int& idcc, int& iside);
// dcc and side from the laser monitoring region
static std::pair<int, int> dccAndSide(int ilmr);
// get trees of channels
static MEChannel* regTree(int ireg);
static MEChannel* lmrTree(int ilmr);
static const bool useElectronicNumbering;
typedef int DCCid;
typedef int LMRid;
typedef int LMMid;
typedef int PNid;
enum PN { iPNA = 0, iPNB };
static std::pair<ME::DCCid, ME::PNid> pn(ME::LMRid ilmr, ME::LMMid ilmmod, ME::PN ipn);
static std::pair<ME::DCCid, ME::DCCid> memFromLmr(ME::LMRid ilmr);
static std::vector<ME::LMMid> lmmodFromLmr(ME::LMRid ilmr);
static std::vector<ME::DCCid> memFromDcc(ME::DCCid idcc);
static std::vector<ME::LMMid> lmmodFromDcc(ME::DCCid idcc);
static std::vector<int> apdRefChannels(ME::LMMid ilmmod, ME::LMRid ilmr);
// ECAL Region names
static const TString region[iSizeE];
// unit names
static const TString granularity[iSizeG];
// Super-Module name from Laser Monitoring Region
static TString smNameFromDcc(int idcc);
static TString smName(int ilmr);
// Super-Module name from ECAL Region and Super-Module
static TString smName(int ireg, int ism);
enum RunType { iLaser = 0, iTestPulse, iSizeT };
enum Color { iBlue = 0, iGreen, iRed, iIRed, iLED1, iLED2, iSizeC };
enum Gain { iVfeGain12 = 1, iVfeGain6, iVfeGain1, iSizeVfeGain };
enum PNGain { iPnGain1 = 0, iPnGain16, iSizePnGain };
typedef unsigned long Time;
typedef unsigned long long TimeStamp;
static const TimeStamp kLowMask;
typedef struct {
std::string rundir;
int dcc;
int side;
int run;
int lb;
int events;
TimeStamp ts_beg;
TimeStamp ts_end;
} Header;
typedef struct {
int type;
int wavelength;
int power;
int filter;
int delay;
int mgpagain;
int memgain;
} Settings;
// Database tables
enum {
iLmfLaserRun,
iLmfLaserConfig,
iLmfLaserPulse,
iLmfLaserPrim,
iLmfLaserPnPrim,
iLmfTestPulseRun,
iLmfTestPulseConfig,
iLmfTestPulsePrim,
iLmfTestPulsePnPrim,
iSizeLmf
};
// Laser primitive variables (table LmfLaserPrim)
enum {
iAPD_FLAG,
iAPD_MEAN,
iAPD_RMS,
iAPD_M3,
iAPD_OVER_PNA_MEAN,
iAPD_OVER_PNA_RMS,
iAPD_OVER_PNA_M3,
iAPD_OVER_PNB_MEAN,
iAPD_OVER_PNB_RMS,
iAPD_OVER_PNB_M3,
iAPD_OVER_PN_MEAN,
iAPD_OVER_PN_RMS,
iAPD_OVER_PN_M3,
iAPD_SHAPE_COR,
iAPD_ALPHA,
iAPD_BETA,
iAPD_TIME_MEAN,
iAPD_TIME_RMS,
iAPD_TIME_M3,
iAPD_TIME_NEVT,
iSizeAPD
};
static const TString APDPrimVar[iSizeAPD];
// PN primitive variables (table LmfLaserPnPrim)
enum { iPN_FLAG, iPN_MEAN, iPN_RMS, iPN_M3, iPNA_OVER_PNB_MEAN, iPNA_OVER_PNB_RMS, iPNA_OVER_PNB_M3, iSizePN };
static const TString PNPrimVar[iSizePN];
// MATAQ Primitive variables (table iLmfLaserPulse)
enum { iMTQ_FIT_METHOD, iMTQ_AMPL, iMTQ_TIME, iMTQ_RISE, iMTQ_FWHM, iMTQ_FW20, iMTQ_FW80, iMTQ_SLIDING, iSizeMTQ };
static const TString MTQPrimVar[iSizeMTQ];
// TP-APD Primitive variables (table iLmfTestPulsePrim)
enum { iTPAPD_FLAG, iTPAPD_MEAN, iTPAPD_RMS, iTPAPD_M3, iTPAPD_NEVT, iSizeTPAPD };
static const TString TPAPDPrimVar[iSizeTPAPD];
// TP-PN Primitive variables (table iLmfTestPulsePnPrim)
enum { iTPPN_GAIN, iTPPN_MEAN, iTPPN_RMS, iTPPN_M3, iSizeTPPN };
static const TString TPPNPrimVar[iSizeTPPN];
// Time functions
enum TUnit { iDay, iHour, iMinute, iSecond, iSizeTU };
static std::vector<Time> timeDiff(Time t1, Time t2, short int& sign);
static float timeDiff(Time t1, Time t0, int tunit = iHour);
static Time time(float dt, Time t0, int tunit = iHour);
static Time time_low(TimeStamp t);
static Time time_high(TimeStamp t);
static const TString type[iSizeT];
static const TString color[iSizeC];
// get file names
static TString path(); // MusEcal main working directory
static TString primPath(int lmr); // where the primitives are
static TString lmdataPath(int lmr); // where the LM data are
static TString rootFileName(ME::Header header, ME::Settings settings);
static TString runListName(int lmr, int type, int color);
virtual ~ME() {}
static std::vector<MEChannel*> _trees;
//GHM ClassDef(ME,0) // ME -- MusEcal name space
};
#endif
|