CMS 3D CMS Logo

EcalLaserAnalyzer.h
Go to the documentation of this file.
1 // $Id: EcalLaserAnalyzer.h
2 
3 #include <memory>
4 
5 #include <vector>
6 #include <map>
7 
9 
10 class TFile;
11 class TTree;
12 class TProfile;
13 class TPNCor;
14 class TPN;
15 class TAPD;
16 class TMom;
17 class TShapeAnalysis;
18 class TAPDPulse;
19 class TPNPulse;
20 class TMem;
21 
22 // Define geometrical constants
23 // NOT the same for "EB" and "EE"
24 //
25 // "EB" "EE"
26 //
27 // 0 0
28 // 1 2 1 2
29 // 3 4
30 // 5 6
31 // 7 8
32 //
33 //
34 
35 // "EB" geometry
36 #define NCRYSEB 1700 // Number of crystals per EB supermodule
37 #define NMODEB 9 // Number of EB submodules
38 #define NPNPERMOD 2 // Number of PN per module
39 
40 // "EE" geometry
41 #define NCRYSEE 830 // Number of crystals per EE supermodule
42 #define NMODEE 22 // Number of EE submodules
43 
44 #define NSIDES 2 // Number of sides
45 #define NREFCHAN 2 // Ref number for APDB
46 
48 public:
49  explicit EcalLaserAnalyzer(const edm::ParameterSet &iConfig);
50  ~EcalLaserAnalyzer() override;
51 
52  void analyze(const edm::Event &e, const edm::EventSetup &c) override;
53  void beginJob() override;
54  void endJob() override;
55 
56  void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal, int apdRefTT, int channel, int lmr);
57  void setGeomEE(
58  int etaG, int phiG, int iX, int iY, int iZ, int module, int tower, int ch, int apdRefTT, int channel, int lmr);
59 
60  enum VarCol { iBlue, iRed, nColor };
61 
62 private:
63  int iEvent;
64 
65  // Framework parameters
66 
67  unsigned int _nsamples;
68  unsigned int _presample;
69  unsigned int _firstsample;
70  unsigned int _lastsample;
71  unsigned int _nsamplesPN;
72  unsigned int _presamplePN;
73  unsigned int _firstsamplePN;
74  unsigned int _lastsamplePN;
75  unsigned int _timingcutlow;
76  unsigned int _timingcuthigh;
77  unsigned int _timingquallow;
78  unsigned int _timingqualhigh;
82  double _presamplecut;
83  unsigned int _niter;
84  bool _fitab;
85  double _alpha;
86  double _beta;
87  unsigned int _nevtmax;
88  double _noise;
89  double _chi2cut;
91  bool _docorpn;
92  int _fedid;
94  double _qualpercent;
95  int _debug;
96 
102 
104 
112 
113  // Output file names
114 
120 
122  unsigned int nevtAB[NCRYSEB];
123 
124  // Define geometrical constants
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  // Identify run type
134 
135  int runType;
136  int runNum;
137 
138  // Identify channel
139 
140  int towerID;
142  int fedID;
143  int dccID;
144  int side;
146  int iZ;
147 
148  // Count Laser Events
150 
151  // PN linearity corrections
152 
154 
155  // Temporary root files and trees
156 
157  TFile *ADCFile;
158  TTree *ADCtrees[NCRYSEB];
159 
160  TFile *APDFile;
161  TTree *APDtrees[NCRYSEB];
163 
164  TFile *resFile;
165  TTree *restrees[nColor];
167 
168  std::vector<int> colors;
169  std::map<unsigned int, unsigned int> channelMapEE;
170  std::vector<int> modules;
171  std::map<int, unsigned int> apdRefMap[2];
172 
173  // Declaration of leaves types for temporary trees
174 
175  int phi, eta;
176  int event;
177  int color;
178  double adc[10];
179  int adcG[10];
180  double pn0, pn1;
181  double pn[50];
182  int pnG[50];
183  double apdAmpl;
184  double apdAmplA;
185  double apdAmplB;
186  double apdTime;
187  double pnAmpl;
188 
189  int eventref;
190  int colorref;
191 
192  double *adcNoPed;
193  double *pnNoPed;
194 
195  // declare TPN stuff
198 
199  // declare TAPD stuff
202 
204 
205  // Declaration of leaves types for results tree
206 
209 
210  double APD[6], Time[6], PN[6], APDoPN[6], APDoPNA[6], APDoPNB[6], APDoAPDA[6], APDoAPDB[6], PNoPN[6], PNoPNA[6],
211  PNoPNB[6];
212 
213  // [0]=mean, [1]=rms, [2]=L3, [3]=nevt, [4]=min, [5]=max
214  // flag is 1 if fit if there is data, 0 if there is no data
215 
217  unsigned int iModule[NCRYSEB];
219  unsigned int firstChanMod[NMODEE];
221 
222  // Quality Checks variables and flags
223 
227 
231 
232  bool isGainOK;
234 };
unsigned int _firstsamplePN
unsigned int _nsamples
TAPD * APDAnal[1700][nColor]
Definition: TPN.h:8
TPN * PNFirstAnal[22][2][nColor]
#define NMODEE
void endJob() override
std::vector< int > modules
EcalLaserAnalyzer(const edm::ParameterSet &iConfig)
Definition: TAPD.h:8
std::map< int, unsigned int > apdRefMap[2]
std::string digiPNCollection_
~EcalLaserAnalyzer() override
#define NCRYSEB
unsigned int _timingcuthigh
unsigned int _nevtmax
unsigned int _nsamplesPN
unsigned int nRefTrees
unsigned int _timingcutlow
Definition: TMom.h:7
TPN * PNAnal[22][2][nColor]
unsigned int _timingquallow
void beginJob() override
TTree * RefAPDtrees[2][22]
std::string digiProducer_
Definition: TMem.h:7
std::vector< int > colors
TAPD * APDFirstAnal[1700][nColor]
unsigned int firstChanMod[22]
std::string digiCollection_
unsigned int isFirstChanModFilled[22]
unsigned int _lastsamplePN
std::string eventHeaderProducer_
unsigned int _firstsample
#define NREFCHAN
std::string eventHeaderCollection_
unsigned int _presample
std::map< unsigned int, unsigned int > channelMapEE
unsigned int iModule[1700]
std::string alphainitfile
TShapeAnalysis * shapana
TTree * restrees[nColor]
void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal, int apdRefTT, int channel, int lmr)
TTree * APDtrees[1700]
unsigned int nPNPerMod
#define NPNPERMOD
void analyze(const edm::Event &e, const edm::EventSetup &c) override
void setGeomEE(int etaG, int phiG, int iX, int iY, int iZ, int module, int tower, int ch, int apdRefTT, int channel, int lmr)
int IsThereDataADC[1700][nColor]
unsigned int _timingqualhigh
unsigned int _lastsample
unsigned int nevtAB[1700]
TTree * ADCtrees[1700]
Definition: TPNCor.h:7
unsigned int _presamplePN
TTree * respntrees[nColor]
Definition: vlib.h:198