CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
18 // Define geometrical constants
19 // NOT the same for "EB" and "EE"
20 //
21 // "EB" "EE"
22 //
23 // 0 0
24 // 1 2 1 2
25 // 3 4
26 // 5 6
27 // 7 8
28 //
29 //
30 
31 // "EB" geometry
32 #define NCRYSEB 1700 // Number of crystals per EB supermodule
33 #define NMODEB 9 // Number of EB submodules
34 #define NPNPERMOD 2 // Number of PN per module
35 
36 // "EE" geometry
37 #define NCRYSEE 830 // Number of crystals per EE supermodule
38 #define NMODEE 21 // Number of EE submodules
39 
40 #define NSIDES 2 // Number of sides
41 #define NREFCHAN 2 // Ref number for APDB
42 #define NSAMPSHAPES 250
43 
44 
46 
47  public:
48 
49  explicit EcalLaserAnalyzer2(const edm::ParameterSet& iConfig);
51 
52 
53  virtual void analyze( const edm::Event & e, const edm::EventSetup& c);
54  virtual void beginJob();
55  virtual void endJob();
56 
57  void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal,
58  int apdRefTT, int channel, int lmr);
59  void setGeomEE(int etaG, int phiG,int iX, int iY, int iZ, int module, int tower,
60  int ch , int apdRefTT, int channel, int lmr);
61 
62  enum VarCol { iBlue, iRed, nColor };
63 
64  private:
65 
66  int iEvent;
67 
68 
69  // Framework parameters
70 
71  unsigned int _nsamples;
72  unsigned int _presample;
73  unsigned int _firstsample;
74  unsigned int _lastsample;
75  unsigned int _samplemin;
76  unsigned int _samplemax;
77  unsigned int _nsamplesPN;
78  unsigned int _presamplePN;
79  unsigned int _firstsamplePN;
80  unsigned int _lastsamplePN;
81  unsigned int _timingcutlow;
82  unsigned int _timingcuthigh;
83  unsigned int _timingquallow;
84  unsigned int _timingqualhigh;
88  double _presamplecut;
89  unsigned int _niter ;
90  double _noise;
93  bool _docorpn;
94  int _fedid;
96  double _qualpercent;
97  int _debug;
98 
104 
113 
114 
115  // Output file names
116 
122 
123  // Define geometrical constants
124  // Default values correspond to "EB" geometry (1700 crystals)
125 
126  unsigned int nCrys;
127  unsigned int nPNPerMod;
128  unsigned int nRefChan;
129  unsigned int nRefTrees;
130  unsigned int nMod;
131  unsigned int nSides;
132 
133  unsigned int nSamplesShapes;
134 
136 
137  // Identify run type
138 
139  int runType;
140  int runNum;
141 
142  // Identify channel
143 
144  int towerID;
146  int fedID;
147  int dccID;
148  int side;
150  int iZ;
151 
152  // Count Laser Events
154 
155  std::vector<int> colors;
156  std::map<int, int> channelMapEE;
157  std::vector<int> dccMEM;
158  std::vector<int> modules;
159  std::map <int, unsigned int> apdRefMap[2];
160 
161  // PN linearity corrections
162 
164 
165  // get the shapes for amplitude determination
166 
167  bool getShapes();
168 
169 
170  // Temporary root files and trees
171 
172  TFile *ADCFile;
173  TTree *ADCtrees[NCRYSEB];
174 
175  TFile *APDFile;
176  TTree *APDtrees[NCRYSEB];
178 
179  TFile *resFile;
180  TTree *restrees[nColor];
182 
183  TFile *ShapeFile;
184  TProfile *PulseShape;
185 
186 
187  // Declaration of leaves types for temporary trees
188 
189  int phi, eta;
190  int event ;
191  int color ;
192  double adc[10];
193  int adcG[10];
194  double pn0,pn1;
195  double pn[50];
196  int pnG[50];
197  double apdAmpl;
198  double apdAmplA;
199  double apdAmplB;
200  double apdTime;
201  double pnAmpl;
202 
203  int eventref;
204  int colorref;
205 
206  double *adcNoPed;
207  double *pnNoPed;
208 
209  // declare TPN stuff
212 
213  // declare TAPD stuff
216 
218 
219  // Declaration of shapes
220 
221  std::vector< double > shapesVec;
225  bool isSPRFine;
226 
227 
228  // Declaration of leaves types for results tree
229 
232 
233  double APD[6], Time[6], PN[6], APDoPN[6], APDoPNA[6], APDoPNB[6],
234  APDoAPDA[6], APDoAPDB[6], PNoPN[6], PNoPNA[6], PNoPNB[6], ShapeCor;
235  // [0]=mean, [1]=rms, [2]=L3, [3]=nevt, [4]=min, [5]=max
236 
237 
238  double adcMean[NCRYSEB][10];
239  int adcC[NCRYSEB];
240 
242  unsigned int iModule[NCRYSEB];
244  unsigned int firstChanMod[NMODEE];
246 
247  // Quality Checks variables and flags
248 
252 
255 
256  bool isGainOK;
258 
259 
260 };
261 
262 
#define NMODEB
TTree * RefAPDtrees[NREFCHAN][NMODEE]
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: TPN.h:8
std::vector< int > dccMEM
std::map< int, int > channelMapEE
Definition: TAPD.h:8
#define NPNPERMOD
TAPD * APDAnal[NCRYSEB][nColor]
#define NREFCHAN
#define NMODEE
unsigned int _timingcuthigh
TTree * ADCtrees[NCRYSEB]
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_
TPN * PNAnal[NMODEB][NPNPERMOD][nColor]
unsigned int _presamplePN
Definition: TMem.h:7
double shapes[NSAMPSHAPES]
std::string eventHeaderCollection_
unsigned int _nsamplesPN
int IsThereDataADC[NCRYSEB][nColor]
EcalLaserAnalyzer2(const edm::ParameterSet &iConfig)
unsigned int _lastsample
std::vector< int > modules
bool wasTimingOK[NCRYSEB]
TTree * APDtrees[NCRYSEB]
#define NSAMPSHAPES
void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal, int apdRefTT, int channel, int lmr)
unsigned int firstChanMod[NMODEE]
TAPD * APDFirstAnal[NCRYSEB][nColor]
unsigned int nSamplesShapes
unsigned int iModule[NCRYSEB]
unsigned int isFirstChanModFilled[NMODEE]
TTree * respntrees[nColor]
unsigned int _firstsamplePN
std::vector< double > shapesVec
TTree * restrees[nColor]
std::vector< int > colors
unsigned int _firstsample
unsigned int _timingcutlow
std::string eventHeaderProducer_
Definition: TPNCor.h:7
TPN * PNFirstAnal[NMODEB][NPNPERMOD][nColor]
std::map< int, unsigned int > apdRefMap[2]
int nEvtBadTiming[NCRYSEB]
Definition: vlib.h:208
unsigned int _timingqualhigh
unsigned int _lastsamplePN
double adcMean[NCRYSEB][10]
#define NCRYSEB