CMS 3D CMS Logo

EcalLaserAnalyzer2.h
Go to the documentation of this file.
1 // $Id: EcalLaserAnalyzer2.h
2 
3 #include <memory>
5 
6 class TFile;
7 class TTree;
8 class TProfile;
9 class TPNCor;
10 class TPN;
11 class TAPD;
12 class TMom;
13 class TAPDPulse;
14 class TPNPulse;
15 class TMem;
16 
17 // Define geometrical constants
18 // NOT the same for "EB" and "EE"
19 //
20 // "EB" "EE"
21 //
22 // 0 0
23 // 1 2 1 2
24 // 3 4
25 // 5 6
26 // 7 8
27 //
28 //
29 
30 // "EB" geometry
31 #define NCRYSEB 1700 // Number of crystals per EB supermodule
32 #define NMODEB 9 // Number of EB submodules
33 #define NPNPERMOD 2 // Number of PN per module
34 
35 // "EE" geometry
36 #define NCRYSEE 830 // Number of crystals per EE supermodule
37 #define NMODEE 21 // Number of EE submodules
38 
39 #define NSIDES 2 // Number of sides
40 #define NREFCHAN 2 // Ref number for APDB
41 #define NSAMPSHAPES 250
42 
44 public:
45  explicit EcalLaserAnalyzer2(const edm::ParameterSet &iConfig);
46  ~EcalLaserAnalyzer2() override;
47 
48  void analyze(const edm::Event &e, const edm::EventSetup &c) override;
49  void beginJob() override;
50  void endJob() override;
51 
52  void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal, int apdRefTT, int channel, int lmr);
53  void setGeomEE(
54  int etaG, int phiG, int iX, int iY, int iZ, int module, int tower, int ch, int apdRefTT, int channel, int lmr);
55 
56  enum VarCol { iBlue, iRed, nColor };
57 
58 private:
59  int iEvent;
60 
61  // Framework parameters
62 
63  unsigned int _nsamples;
64  unsigned int _presample;
65  unsigned int _firstsample;
66  unsigned int _lastsample;
67  unsigned int _samplemin;
68  unsigned int _samplemax;
69  unsigned int _nsamplesPN;
70  unsigned int _presamplePN;
71  unsigned int _firstsamplePN;
72  unsigned int _lastsamplePN;
73  unsigned int _timingcutlow;
74  unsigned int _timingcuthigh;
75  unsigned int _timingquallow;
76  unsigned int _timingqualhigh;
80  double _presamplecut;
81  unsigned int _niter;
82  double _noise;
85  bool _docorpn;
86  int _fedid;
88  double _qualpercent;
89  int _debug;
90 
96 
105 
106  // Output file names
107 
113 
114  // Define geometrical constants
115  // Default values correspond to "EB" geometry (1700 crystals)
116 
117  unsigned int nCrys;
118  unsigned int nPNPerMod;
119  unsigned int nRefChan;
120  unsigned int nRefTrees;
121  unsigned int nMod;
122  unsigned int nSides;
123 
124  unsigned int nSamplesShapes;
125 
127 
128  // Identify run type
129 
130  int runType;
131  int runNum;
132 
133  // Identify channel
134 
135  int towerID;
137  int fedID;
138  int dccID;
139  int side;
141  int iZ;
142 
143  // Count Laser Events
145 
146  std::vector<int> colors;
147  std::map<int, int> channelMapEE;
148  std::vector<int> dccMEM;
149  std::vector<int> modules;
150  std::map<int, unsigned int> apdRefMap[2];
151 
152  // PN linearity corrections
153 
155 
156  // get the shapes for amplitude determination
157 
158  bool getShapes();
159 
160  // Temporary root files and trees
161 
162  TFile *ADCFile;
163  TTree *ADCtrees[NCRYSEB];
164 
165  TFile *APDFile;
166  TTree *APDtrees[NCRYSEB];
168 
169  TFile *resFile;
170  TTree *restrees[nColor];
172 
173  TFile *ShapeFile;
174  TProfile *PulseShape;
175 
176  // Declaration of leaves types for temporary trees
177 
178  int phi, eta;
179  int event;
180  int color;
181  double adc[10];
182  int adcG[10];
183  double pn0, pn1;
184  double pn[50];
185  int pnG[50];
186  double apdAmpl;
187  double apdAmplA;
188  double apdAmplB;
189  double apdTime;
190  double pnAmpl;
191 
192  int eventref;
193  int colorref;
194 
195  double *adcNoPed;
196  double *pnNoPed;
197 
198  // declare TPN stuff
201 
202  // declare TAPD stuff
205 
207 
208  // Declaration of shapes
209 
210  std::vector<double> shapesVec;
214  bool isSPRFine;
215 
216  // Declaration of leaves types for results tree
217 
220 
221  double APD[6], Time[6], PN[6], APDoPN[6], APDoPNA[6], APDoPNB[6], APDoAPDA[6], APDoAPDB[6], PNoPN[6], PNoPNA[6],
222  PNoPNB[6], ShapeCor;
223  // [0]=mean, [1]=rms, [2]=L3, [3]=nevt, [4]=min, [5]=max
224 
225  double adcMean[NCRYSEB][10];
226  int adcC[NCRYSEB];
227 
229  unsigned int iModule[NCRYSEB];
231  unsigned int firstChanMod[NMODEE];
233 
234  // Quality Checks variables and flags
235 
239 
242 
243  bool isGainOK;
245 };
#define NMODEB
double adcMean[1700][10]
TPN * PNAnal[9][2][nColor]
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: TPN.h:8
std::vector< int > dccMEM
std::map< int, int > channelMapEE
Definition: TAPD.h:8
void beginJob() override
#define NPNPERMOD
TAPD * APDAnal[1700][nColor]
#define NREFCHAN
TAPD * APDFirstAnal[1700][nColor]
#define NMODEE
TPN * PNFirstAnal[9][2][nColor]
unsigned int _timingcuthigh
unsigned int isFirstChanModFilled[21]
void setGeomEE(int etaG, int phiG, int iX, int iY, int iZ, int module, int tower, int ch, int apdRefTT, int channel, int lmr)
Definition: TMom.h:7
unsigned int _timingquallow
std::string digiPNCollection_
unsigned int _presamplePN
std::vector< double > shapesVec
Definition: TMem.h:7
std::string eventHeaderCollection_
unsigned int _nsamplesPN
EcalLaserAnalyzer2(const edm::ParameterSet &iConfig)
unsigned int _lastsample
std::vector< int > modules
unsigned int firstChanMod[21]
#define NSAMPSHAPES
void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal, int apdRefTT, int channel, int lmr)
unsigned int nSamplesShapes
int IsThereDataADC[1700][nColor]
std::string digiCollection_
void endJob() override
TTree * respntrees[nColor]
TTree * RefAPDtrees[2][21]
unsigned int _firstsamplePN
TTree * restrees[nColor]
std::vector< int > colors
unsigned int _firstsample
unsigned int _timingcutlow
unsigned int iModule[1700]
std::string eventHeaderProducer_
Definition: TPNCor.h:7
std::map< int, unsigned int > apdRefMap[2]
Definition: vlib.h:198
unsigned int _timingqualhigh
unsigned int _lastsamplePN
#define NCRYSEB