CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalLaserAnalyzer2.h
Go to the documentation of this file.
1 #ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer2_h
2 #define CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer2_h
3 // $Id: EcalLaserAnalyzer2.h
4 
5 #include <memory>
6 
7 #include <vector>
8 #include <map>
9 
11 
16 
17 class TFile;
18 class TTree;
19 class TProfile;
20 class TPNCor;
21 class TPN;
22 class TAPD;
23 class TMom;
24 class TAPDPulse;
25 class TPNPulse;
26 class TMem;
27 
28 // Define geometrical constants
29 // NOT the same for "EB" and "EE"
30 //
31 // "EB" "EE"
32 //
33 // 0 0
34 // 1 2 1 2
35 // 3 4
36 // 5 6
37 // 7 8
38 //
39 //
40 
41 // "EB" geometry
42 #define NCRYSEB 1700 // Number of crystals per EB supermodule
43 #define NMODEB 9 // Number of EB submodules
44 #define NPNPERMOD 2 // Number of PN per module
45 
46 // "EE" geometry
47 #define NCRYSEE 830 // Number of crystals per EE supermodule
48 #define NMODEE 21 // Number of EE submodules
49 
50 #define NSIDES 2 // Number of sides
51 #define NREFCHAN 2 // Ref number for APDB
52 #define NSAMPSHAPES 250
53 
55 public:
57  ~EcalLaserAnalyzer2() override;
58 
59  void analyze(const edm::Event &e, const edm::EventSetup &c) override;
60  void beginJob() override;
61  void endJob() override;
62 
63  void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal, int apdRefTT, int channel, int lmr);
64  void setGeomEE(
65  int etaG, int phiG, int iX, int iY, int iZ, int module, int tower, int ch, int apdRefTT, int channel, int lmr);
66 
67  enum VarCol { iBlue, iRed, nColor };
68 
69 private:
70  int iEvent;
71 
77 
83 
84  // Framework parameters
85 
86  const unsigned int _nsamples;
87  unsigned int _presample;
88  const unsigned int _firstsample;
89  const unsigned int _lastsample;
90  const unsigned int _nsamplesPN;
91  const unsigned int _presamplePN;
92  const unsigned int _firstsamplePN;
93  const unsigned int _lastsamplePN;
94  const unsigned int _timingcutlow;
95  const unsigned int _timingcuthigh;
96  const unsigned int _timingquallow;
97  const unsigned int _timingqualhigh;
98  const double _ratiomincutlow;
99  const double _ratiomincuthigh;
100  const double _ratiomaxcutlow;
101  const double _presamplecut;
102  const unsigned int _niter;
103  const double _noise;
105  const bool _saveshapes;
106  const bool _docorpn;
107  const int _fedid;
108  const bool _saveallevents;
109  const double _qualpercent;
110  const int _debug;
111 
117 
121 
122  // Output file names
123 
129 
130  // Define geometrical constants
131  // Default values correspond to "EB" geometry (1700 crystals)
132 
133  unsigned int nCrys;
134  unsigned int nPNPerMod;
135  unsigned int nRefChan;
136  unsigned int nRefTrees;
137  unsigned int nMod;
138  unsigned int nSides;
139 
140  unsigned int nSamplesShapes;
141 
143 
144  // Identify run type
145 
146  int runType;
147  int runNum;
148 
149  // Identify channel
150 
151  int towerID;
153  int fedID;
154  int dccID;
155  int side;
157  int iZ;
158 
159  // Count Laser Events
161 
162  std::vector<int> colors;
163  std::map<int, int> channelMapEE;
164  std::vector<int> dccMEM;
165  std::vector<int> modules;
166  std::map<int, unsigned int> apdRefMap[2];
167 
168  // PN linearity corrections
169 
171 
172  // get the shapes for amplitude determination
173 
174  bool getShapes();
175 
176  // Temporary root files and trees
177 
178  TFile *ADCFile;
179  TTree *ADCtrees[NCRYSEB];
180 
181  TFile *APDFile;
182  TTree *APDtrees[NCRYSEB];
184 
185  TFile *resFile;
186  TTree *restrees[nColor];
188 
189  TFile *ShapeFile;
190  TProfile *PulseShape;
191 
192  // Declaration of leaves types for temporary trees
193 
194  int phi, eta;
195  int event;
196  int color;
197  double adc[10];
198  int adcG[10];
199  double pn0, pn1;
200  double pn[50];
201  int pnG[50];
202  double apdAmpl;
203  double apdAmplA;
204  double apdAmplB;
205  double apdTime;
206  double pnAmpl;
207 
208  int eventref;
209  int colorref;
210 
211  double *adcNoPed;
212  double *pnNoPed;
213 
214  // declare TPN stuff
217 
218  // declare TAPD stuff
221 
223 
224  // Declaration of shapes
225 
226  std::vector<double> shapesVec;
230  bool isSPRFine;
231 
232  // Declaration of leaves types for results tree
233 
236 
237  double APD[6], Time[6], PN[6], APDoPN[6], APDoPNA[6], APDoPNB[6], APDoAPDA[6], APDoAPDB[6], PNoPN[6], PNoPNA[6],
238  PNoPNB[6], ShapeCor;
239  // [0]=mean, [1]=rms, [2]=L3, [3]=nevt, [4]=min, [5]=max
240 
241  double adcMean[NCRYSEB][10];
242  int adcC[NCRYSEB];
243 
245  unsigned int iModule[NCRYSEB];
247  unsigned int firstChanMod[NMODEE];
249 
250  // Quality Checks variables and flags
251 
255 
258 
259  bool isGainOK;
261 };
262 #endif
#define NMODEB
double adcMean[1700][10]
TPN * PNAnal[9][2][nColor]
const std::string eventHeaderCollection_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
const edm::EventSetup & c
Definition: TPN.h:8
const std::string _ecalPart
std::vector< int > dccMEM
std::map< int, int > channelMapEE
const std::string digiPNCollection_
const unsigned int _firstsamplePN
Definition: TAPD.h:8
const std::string pncorfile_
void beginJob() override
#define NPNPERMOD
TAPD * APDAnal[1700][nColor]
#define NREFCHAN
TAPD * APDFirstAnal[1700][nColor]
#define NMODEE
TPN * PNFirstAnal[9][2][nColor]
const std::string resdir_
const unsigned int _firstsample
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)
const unsigned int _lastsamplePN
Definition: TMom.h:7
const unsigned int _lastsample
const double _ratiomaxcutlow
const unsigned int _presamplePN
const unsigned int _timingcuthigh
std::vector< double > shapesVec
edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
Definition: TMem.h:7
const std::string eventHeaderProducer_
const unsigned int _timingqualhigh
const unsigned int _nsamples
const std::string digiProducer_
EcalLaserAnalyzer2(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
std::vector< int > modules
const std::string elecfile_
const double _presamplecut
const std::string digiCollection_
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
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)
const unsigned int _niter
unsigned int nSamplesShapes
const double _ratiomincutlow
int IsThereDataADC[1700][nColor]
const double _ratiomincuthigh
const unsigned int _timingquallow
const unsigned int _timingcutlow
void endJob() override
TTree * respntrees[nColor]
TTree * RefAPDtrees[2][21]
TTree * restrees[nColor]
std::vector< int > colors
unsigned int iModule[1700]
const unsigned int _nsamplesPN
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDiodeDigiToken_
Definition: TPNCor.h:7
std::map< int, unsigned int > apdRefMap[2]
tuple module
Definition: callgraph.py:69
#define NCRYSEB