CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MELaserPrim.h
Go to the documentation of this file.
1 #ifndef MELaserPrim_hh
2 #define MELaserPrim_hh
3 
4 #include <iostream>
5 #include <fstream>
6 #include <vector>
7 #include <map>
8 
9 #include <TROOT.h>
10 #include <TChain.h>
11 #include <TH2I.h>
12 #include <TH2F.h>
13 #include <TFile.h>
14 #include <TString.h>
15 
16 #include "ME.h"
17 
19 {
20 
21 public:
22 
23  // Julie's ntuple variables
25  enum { iMean, iRMS, iM3, iNevt, iMin, iMax, iSize_apdpn };
29 
31 
32  // channel views & logic ids
33  enum { iECAL, iECAL_LMR,
36  static TString channelViewName( int );
37  static int logicId( int channelView, int id1, int id2=0 );
38  static bool getViewIds( int logicId, int& channelView, int& id1, int& id2 );
39 
40  // constructor
41  MELaserPrim( ME::Header header, ME::Settings settings,
42  const char* inpath, const char* outfile );
43 
44  // destructor
45  virtual ~MELaserPrim();
46 
47  // functions
48  bool init_ok;
49  void init();
50  void bookHistograms();
51  void fillHistograms();
52  void writeHistograms();
53  void print(std::ostream& o );
54 
55  // name of tables
56  static TString lmfLaserName( int table, int type,
57  int color=ME::iBlue );
58 
59  // fill histograms from a user application (e.g. DB )
60  bool setInt( const char*, int ix, int iy, int ival );
61  bool setVal( const char*, int ix, int iy, float val );
62 
63  // fill tree variables from a user application (e.g. DB )
64  bool setInt( const char* tname, const char* vname, int ival );
65  bool setVal( const char* tname, const char* vname, float val );
66 
67  bool fill( const char* tname );
68 
69  // access
70  Int_t getInt( const char*, int ix, int iy );
71  Float_t getVal( const char*, int ix, int iy );
72 
73  static TString separator;
74 
75 private:
76 
77  // monitoring region (dcc+side), wavelength, run number and timestamp
78  int _reg;
79  bool _isBarrel;
80  int _lmr;
81  int _dcc;
82  int _side;
83  int _run;
84  int _lb;
85  int _events;
86 
87  int _type;
88  int _color;
89  int _power;
90  int _filter;
91  int _delay;
92 
93  // GHM
97 
98  int _mgpagain;
99  int _memgain;
100 
101  // useful
103  int _sm;
104  // std::map< int, std::pair<int, int> > _pn; // association module -> pair of PN diodes
105 
106  TString _sectorStr;
107  TString _regionStr;
108  TString _primStr;
109  TString _pnPrimStr;
110  TString _pulseStr;
111  TString _tpPrimStr;
112  TString _tpPnPrimStr;
113 
114  // root files
115  TFile* apdpn_file;
116  TFile* ab_file;
117  TFile* pn_file;
118  TFile* mtq_file;
119  TFile* tpapd_file;
120  TFile* out_file;
121 
122  // root trees
123  TTree* apdpn_tree;
124  TTree* ab_tree;
125  TTree* pn_tree;
126  TTree* mtq_tree;
127  TTree* tpapd_tree;
128  TTree* tppn_tree;
129 
130  // paths to laser monitoring trees
131  TString _inpath;
132 
133  // root file in output
134  TString _outfile;
135 
136  // index limits (depends on dcc)
137  int nx;
138  int ixmin;
139  int ixmax;
140  int ny;
141  int iymin;
142  int iymax;
143 
144  // 2D-histograms
145  std::map< TString, TH2* > i_h; // integer quantities
146  std::map< TString, TH2* > f_h; // floating point quantities
147 
148  // trees
149  std::map< TString, TTree* > t_t; // map of trees
150  std::map< TString, int > i_t; // integer values
151  std::map< TString, float > f_t; // float values
152  std::map< TString, const char* > c_t; // string values
153 
154  // leaves for the APDPN ntuple
155  Int_t apdpn_dccID;
159  // Double_t apdpn_gainID;
160  Int_t apdpn_side;
161  Int_t apdpn_ieta;
162  Int_t apdpn_iphi;
163  Int_t apdpn_flag;
164  Double_t apdpn_ShapeCor;
166 
167  // leaves for the AB ntuple
168  Int_t ab_dccID;
169  Int_t ab_towerID;
171  Int_t ab_ieta;
172  Int_t ab_iphi;
173  Int_t ab_flag;
174  Double_t ab_ab[iSize_ab];
175 
176  // leaves for the PN ntuple
177  Int_t pn_side;
178  Int_t pn_pnID;
179  Int_t pn_moduleID;
180  Double_t pn_PN[iSize_apdpn];
184 
185  // leaves for the MTQ ntuple
186  Int_t mtq_side;
187  Int_t mtq_color;
188  Double_t mtq_mtq[iSize_mtq];
189 
190  // leaves for the TPAPD ntuple
191  Int_t tpapd_iphi;
192  Int_t tpapd_ieta;
193  Int_t tpapd_dccID;
194  Int_t tpapd_side;
198  Int_t tpapd_flag;
199  Int_t tpapd_gain;
200  Double_t tpapd_APD[iSize_apdpn];
201 
202  // leaves for the TPPN ntuple
203  Int_t tppn_side;
204  Int_t tppn_pnID;
206  Int_t tppn_gain;
207  Double_t tppn_PN[iSize_apdpn];
208 
209  // List of branches for APDPN
210  TBranch *b_apdpn_dccID;
211  TBranch *b_apdpn_towerID;
212  TBranch *b_apdpn_channelID;
213  TBranch *b_apdpn_moduleID;
214  // TBranch *b_apdpn_gainID; //!
215  TBranch *b_apdpn_side;
216  TBranch *b_apdpn_ieta;
217  TBranch *b_apdpn_iphi;
218  TBranch *b_apdpn_flag;
219  TBranch *b_apdpn_ShapeCor;
221 
222  // List of branches for AB
223  TBranch *b_ab_dccID;
224  TBranch *b_ab_towerID;
225  TBranch *b_ab_channelID;
226  TBranch *b_ab_ieta;
227  TBranch *b_ab_iphi;
228  TBranch *b_ab_flag;
229  TBranch *b_ab_ab[iSize_ab];
230 
231  // List of branches for PN
232  TBranch *b_pn_side;
233  TBranch *b_pn_pnID;
234  TBranch *b_pn_moduleID;
235  TBranch *b_pn_PN;
236  TBranch *b_pn_PNoPN;
237  TBranch *b_pn_PNoPNA;
238  TBranch *b_pn_PNoPNB;
239 
240  // List of branches for MTQ
241  TBranch *b_mtq_side;
242  TBranch *b_mtq_color;
243  TBranch *b_mtq_mtq[iSize_mtq];
244 
245  // List of branches for TPAPD
246  TBranch *b_tpapd_iphi;
247  TBranch *b_tpapd_ieta;
248  TBranch *b_tpapd_dccID;
249  TBranch *b_tpapd_side;
250  TBranch *b_tpapd_towerID;
251  TBranch *b_tpapd_channelID;
252  TBranch *b_tpapd_moduleID;
253  TBranch *b_tpapd_flag;
254  TBranch *b_tpapd_gain;
255  TBranch *b_tpapd_APD;
256 
257  // List of branches for TPPN
258  TBranch *b_tppn_side;
259  TBranch *b_tppn_pnID;
260  TBranch *b_tppn_moduleID;
261  TBranch *b_tppn_gain;
262  TBranch *b_tppn_PN;
263 
265  static TString apdpn_varName[iSize_apdpn];
269  static TString ab_varName[iSize_ab];
270  static TString mtq_varName[iSize_mtq];
271  static TString mtq_varUnit[iSize_mtq];
272 
273  void setHistoStyle( TH1* );
274  void refresh();
275  void addBranchI( const char* t_name, const char* v_name );
276  void addBranchF( const char* t_name, const char* v_name );
277  void addBranchC( const char* t_name, const char* v_name );
278  void bookHistoI( const char* t_name, const char* v_name );
279  void bookHistoF( const char* t_name, const char* v_name );
280 
281  // ClassDef( MELaserPrim, 0 ) // reads/writes Laser primitives
282 
283 };
284 
285 #endif
std::map< TString, float > f_t
Definition: MELaserPrim.h:151
Int_t apdpn_dccID
Definition: MELaserPrim.h:155
Double_t tpapd_APD[iSize_apdpn]
Definition: MELaserPrim.h:200
type
Definition: HCALResponse.h:21
TBranch * b_ab_channelID
Definition: MELaserPrim.h:225
Int_t pn_pnID
Definition: MELaserPrim.h:178
bool _isBarrel
Definition: MELaserPrim.h:79
TBranch * b_tppn_moduleID
Definition: MELaserPrim.h:260
TBranch * b_apdpn_apdpn[iSizeArray_apdpn]
Definition: MELaserPrim.h:220
TString _inpath
Definition: MELaserPrim.h:131
TBranch * b_tppn_PN
Definition: MELaserPrim.h:262
TString _outfile
Definition: MELaserPrim.h:134
static bool getViewIds(int logicId, int &channelView, int &id1, int &id2)
Definition: MELaserPrim.cc:120
static TString mtq_varUnit[iSize_mtq]
Definition: MELaserPrim.h:271
TBranch * b_tppn_pnID
Definition: MELaserPrim.h:259
TTree * apdpn_tree
Definition: MELaserPrim.h:123
TBranch * b_mtq_color
Definition: MELaserPrim.h:242
TBranch * b_apdpn_channelID
Definition: MELaserPrim.h:212
Double_t pn_PN[iSize_apdpn]
Definition: MELaserPrim.h:180
TBranch * b_pn_pnID
Definition: MELaserPrim.h:233
TFile * mtq_file
Definition: MELaserPrim.h:118
void writeHistograms()
Definition: MELaserPrim.cc:932
TBranch * b_pn_PNoPNA
Definition: MELaserPrim.h:237
void fillHistograms()
Definition: MELaserPrim.cc:504
Double_t pn_PNoPNB[iSize_apdpn]
Definition: MELaserPrim.h:183
Int_t pn_moduleID
Definition: MELaserPrim.h:179
TString _tpPrimStr
Definition: MELaserPrim.h:111
TTree * tppn_tree
Definition: MELaserPrim.h:128
Int_t tppn_moduleID
Definition: MELaserPrim.h:205
Int_t tpapd_ieta
Definition: MELaserPrim.h:192
TBranch * b_ab_ab[iSize_ab]
Definition: MELaserPrim.h:229
Double_t pn_PNoPN[iSize_apdpn]
Definition: MELaserPrim.h:181
TBranch * b_ab_towerID
Definition: MELaserPrim.h:224
Double_t ab_ab[iSize_ab]
Definition: MELaserPrim.h:174
Int_t getInt(const char *, int ix, int iy)
TBranch * b_tpapd_dccID
Definition: MELaserPrim.h:248
TBranch * b_mtq_side
Definition: MELaserPrim.h:241
static TString apdpn_varName[iSize_apdpn]
Definition: MELaserPrim.h:265
bool setVal(const char *, int ix, int iy, float val)
Int_t ab_flag
Definition: MELaserPrim.h:173
static TString apdpn_arrayName[iSizeArray_apdpn]
Definition: MELaserPrim.h:264
Int_t tppn_gain
Definition: MELaserPrim.h:206
Double_t mtq_mtq[iSize_mtq]
Definition: MELaserPrim.h:188
TBranch * b_tpapd_gain
Definition: MELaserPrim.h:254
Int_t ab_towerID
Definition: MELaserPrim.h:169
TBranch * b_tpapd_APD
Definition: MELaserPrim.h:255
std::map< TString, TTree * > t_t
Definition: MELaserPrim.h:149
Int_t tpapd_dccID
Definition: MELaserPrim.h:193
Int_t ab_ieta
Definition: MELaserPrim.h:171
Int_t tppn_side
Definition: MELaserPrim.h:203
static TString channelViewName(int)
Definition: MELaserPrim.cc:94
TBranch * b_ab_ieta
Definition: MELaserPrim.h:226
TBranch * b_apdpn_ieta
Definition: MELaserPrim.h:216
Int_t tpapd_side
Definition: MELaserPrim.h:194
Int_t ab_channelID
Definition: MELaserPrim.h:170
Int_t apdpn_iphi
Definition: MELaserPrim.h:162
ME::TimeStamp _ts_end
Definition: MELaserPrim.h:96
Int_t tpapd_towerID
Definition: MELaserPrim.h:195
TFile * pn_file
Definition: MELaserPrim.h:117
TBranch * b_pn_moduleID
Definition: MELaserPrim.h:234
TTree * ab_tree
Definition: MELaserPrim.h:124
Int_t tpapd_iphi
Definition: MELaserPrim.h:191
Definition: ME.h:70
bool init_ok
Definition: MELaserPrim.h:48
TTree * mtq_tree
Definition: MELaserPrim.h:126
static TString apdpn_extraVarUnit[iSizeExtra_apdpn]
Definition: MELaserPrim.h:268
bool fill(const char *tname)
MELaserPrim(ME::Header header, ME::Settings settings, const char *inpath, const char *outfile)
Definition: MELaserPrim.cc:32
TBranch * b_pn_PN
Definition: MELaserPrim.h:235
Int_t pn_side
Definition: MELaserPrim.h:177
static TString mtq_varName[iSize_mtq]
Definition: MELaserPrim.h:270
Float_t getVal(const char *, int ix, int iy)
void addBranchC(const char *t_name, const char *v_name)
void print(std::ostream &o)
TBranch * b_pn_side
Definition: MELaserPrim.h:232
TBranch * b_tpapd_flag
Definition: MELaserPrim.h:253
void bookHistograms()
Definition: MELaserPrim.cc:326
TBranch * b_tppn_gain
Definition: MELaserPrim.h:261
TFile * apdpn_file
Definition: MELaserPrim.h:115
Int_t mtq_side
Definition: MELaserPrim.h:186
TBranch * b_ab_dccID
Definition: MELaserPrim.h:223
TBranch * b_apdpn_ShapeCor
Definition: MELaserPrim.h:219
bool setInt(const char *, int ix, int iy, int ival)
TBranch * b_pn_PNoPN
Definition: MELaserPrim.h:236
std::map< TString, TH2 * > i_h
Definition: MELaserPrim.h:145
TString _primStr
Definition: MELaserPrim.h:108
Int_t tpapd_flag
Definition: MELaserPrim.h:198
static int logicId(int channelView, int id1, int id2=0)
Definition: MELaserPrim.cc:113
Int_t apdpn_moduleID
Definition: MELaserPrim.h:158
TBranch * b_tpapd_towerID
Definition: MELaserPrim.h:250
Int_t apdpn_flag
Definition: MELaserPrim.h:163
static TString lmfLaserName(int table, int type, int color=ME::iBlue)
unsigned long long TimeStamp
Definition: ME.h:75
void refresh()
std::map< TString, const char * > c_t
Definition: MELaserPrim.h:152
TBranch * b_tppn_side
Definition: MELaserPrim.h:258
Int_t ab_iphi
Definition: MELaserPrim.h:172
#define table(NAME)
Definition: DbCore.h:49
void addBranchI(const char *t_name, const char *v_name)
TBranch * b_pn_PNoPNB
Definition: MELaserPrim.h:238
static TString ab_varName[iSize_ab]
Definition: MELaserPrim.h:269
static TString apdpn_varUnit[iSizeArray_apdpn][iSize_apdpn]
Definition: MELaserPrim.h:266
TBranch * b_apdpn_flag
Definition: MELaserPrim.h:218
Int_t tpapd_gain
Definition: MELaserPrim.h:199
TBranch * b_ab_flag
Definition: MELaserPrim.h:228
TBranch * b_mtq_mtq[iSize_mtq]
Definition: MELaserPrim.h:243
TBranch * b_tpapd_side
Definition: MELaserPrim.h:249
Double_t apdpn_ShapeCor
Definition: MELaserPrim.h:164
Int_t tpapd_moduleID
Definition: MELaserPrim.h:197
Double_t pn_PNoPNA[iSize_apdpn]
Definition: MELaserPrim.h:182
Int_t apdpn_channelID
Definition: MELaserPrim.h:157
Int_t apdpn_ieta
Definition: MELaserPrim.h:161
Int_t ab_dccID
Definition: MELaserPrim.h:168
Definition: ME.h:78
TBranch * b_tpapd_iphi
Definition: MELaserPrim.h:246
Int_t tppn_pnID
Definition: MELaserPrim.h:204
TBranch * b_tpapd_channelID
Definition: MELaserPrim.h:251
TString _pnPrimStr
Definition: MELaserPrim.h:109
TTree * tpapd_tree
Definition: MELaserPrim.h:127
static TString apdpn_extraVarName[iSizeExtra_apdpn]
Definition: MELaserPrim.h:267
TString _pulseStr
Definition: MELaserPrim.h:110
Int_t mtq_color
Definition: MELaserPrim.h:187
TBranch * b_tpapd_moduleID
Definition: MELaserPrim.h:252
Int_t apdpn_towerID
Definition: MELaserPrim.h:156
Int_t tpapd_channelID
Definition: MELaserPrim.h:196
ME::TimeStamp _ts_beg
Definition: MELaserPrim.h:95
TBranch * b_tpapd_ieta
Definition: MELaserPrim.h:247
TBranch * b_apdpn_iphi
Definition: MELaserPrim.h:217
virtual ~MELaserPrim()
Definition: MELaserPrim.cc:966
TFile * ab_file
Definition: MELaserPrim.h:116
TBranch * b_apdpn_towerID
Definition: MELaserPrim.h:211
void addBranchF(const char *t_name, const char *v_name)
TBranch * b_apdpn_side
Definition: MELaserPrim.h:215
ME::TimeStamp _ts
Definition: MELaserPrim.h:94
TFile * out_file
Definition: MELaserPrim.h:120
void setHistoStyle(TH1 *)
Double_t apdpn_apdpn[iSizeArray_apdpn][iSize_apdpn]
Definition: MELaserPrim.h:165
void bookHistoI(const char *t_name, const char *v_name)
TBranch * b_ab_iphi
Definition: MELaserPrim.h:227
static TString separator
Definition: MELaserPrim.h:73
TString _sectorStr
Definition: MELaserPrim.h:106
TString _regionStr
Definition: MELaserPrim.h:107
Double_t tppn_PN[iSize_apdpn]
Definition: MELaserPrim.h:207
TString _tpPnPrimStr
Definition: MELaserPrim.h:112
TFile * tpapd_file
Definition: MELaserPrim.h:119
int _ecal_region
Definition: MELaserPrim.h:102
TBranch * b_apdpn_dccID
Definition: MELaserPrim.h:210
std::map< TString, int > i_t
Definition: MELaserPrim.h:150
TTree * pn_tree
Definition: MELaserPrim.h:125
std::map< TString, TH2 * > f_h
Definition: MELaserPrim.h:146
TBranch * b_apdpn_moduleID
Definition: MELaserPrim.h:213
Int_t apdpn_side
Definition: MELaserPrim.h:160
void bookHistoF(const char *t_name, const char *v_name)