CMS 3D CMS Logo

EcalLaserAnalyzer.h
Go to the documentation of this file.
1 #ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer_h
2 #define CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer_h
3 // $Id: EcalLaserAnalyzer.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 TShapeAnalysis;
25 class TAPDPulse;
26 class TPNPulse;
27 class TMem;
28 
29 // Define geometrical constants
30 // NOT the same for "EB" and "EE"
31 //
32 // "EB" "EE"
33 //
34 // 0 0
35 // 1 2 1 2
36 // 3 4
37 // 5 6
38 // 7 8
39 //
40 //
41 
42 // "EB" geometry
43 #define NCRYSEB 1700 // Number of crystals per EB supermodule
44 #define NMODEB 9 // Number of EB submodules
45 #define NPNPERMOD 2 // Number of PN per module
46 
47 // "EE" geometry
48 #define NCRYSEE 830 // Number of crystals per EE supermodule
49 #define NMODEE 22 // Number of EE submodules
50 
51 #define NSIDES 2 // Number of sides
52 #define NREFCHAN 2 // Ref number for APDB
53 
55 public:
56  explicit EcalLaserAnalyzer(const edm::ParameterSet &iConfig);
57  ~EcalLaserAnalyzer() 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  bool _fitab;
104  const double _alpha;
105  const double _beta;
106  const unsigned int _nevtmax;
107  const double _noise;
108  const double _chi2cut;
110  const bool _docorpn;
111  const int _fedid;
112  const bool _saveallevents;
113  const double _qualpercent;
114  const int _debug;
115 
121 
123 
126 
127  // Output file names
128 
134 
136  unsigned int nevtAB[NCRYSEB];
137 
138  // Define geometrical constants
139 
140  unsigned int nCrys;
141  unsigned int nPNPerMod;
142  unsigned int nRefChan;
143  unsigned int nRefTrees;
144  unsigned int nMod;
145  unsigned int nSides;
146 
147  // Identify run type
148 
149  int runType;
150  int runNum;
151 
152  // Identify channel
153 
154  int towerID;
156  int fedID;
157  int dccID;
158  int side;
160  int iZ;
161 
162  // Count Laser Events
164 
165  // PN linearity corrections
166 
168 
169  // Temporary root files and trees
170 
171  TFile *ADCFile;
172  TTree *ADCtrees[NCRYSEB];
173 
174  TFile *APDFile;
175  TTree *APDtrees[NCRYSEB];
177 
178  TFile *resFile;
179  TTree *restrees[nColor];
181 
182  std::vector<int> colors;
183  std::map<unsigned int, unsigned int> channelMapEE;
184  std::vector<int> modules;
185  std::map<int, unsigned int> apdRefMap[2];
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 leaves types for results tree
220 
223 
224  double APD[6], Time[6], PN[6], APDoPN[6], APDoPNA[6], APDoPNB[6], APDoAPDA[6], APDoAPDB[6], PNoPN[6], PNoPNA[6],
225  PNoPNB[6];
226 
227  // [0]=mean, [1]=rms, [2]=L3, [3]=nevt, [4]=min, [5]=max
228  // flag is 1 if fit if there is data, 0 if there is no data
229 
231  unsigned int iModule[NCRYSEB];
233  unsigned int firstChanMod[NMODEE];
235 
236  // Quality Checks variables and flags
237 
241 
245 
246  bool isGainOK;
248 };
249 #endif
TAPD * APDAnal[1700][nColor]
Definition: TPN.h:8
TPN * PNFirstAnal[22][2][nColor]
const std::string digiProducer_
#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]
const double _ratiomincuthigh
~EcalLaserAnalyzer() override
#define NCRYSEB
const unsigned int _nsamplesPN
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
const std::string eventHeaderCollection_
unsigned int nRefTrees
Definition: TMom.h:7
TPN * PNAnal[22][2][nColor]
void beginJob() override
const double _presamplecut
edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
TTree * RefAPDtrees[2][22]
const unsigned int _nevtmax
const double _ratiomaxcutlow
const unsigned int _niter
const std::string eventHeaderProducer_
Definition: TMem.h:7
std::vector< int > colors
TAPD * APDFirstAnal[1700][nColor]
unsigned int firstChanMod[22]
const unsigned int _timingqualhigh
const std::string digiPNCollection_
const unsigned int _nsamples
unsigned int isFirstChanModFilled[22]
#define NREFCHAN
const unsigned int _lastsamplePN
unsigned int _presample
const unsigned int _lastsample
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > mappingToken_
std::map< unsigned int, unsigned int > channelMapEE
unsigned int iModule[1700]
const std::string resdir_
std::string alphainitfile
TShapeAnalysis * shapana
const unsigned int _timingcutlow
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)
edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
int IsThereDataADC[1700][nColor]
const unsigned int _timingcuthigh
const unsigned int _presamplePN
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDiodeDigiToken_
const unsigned int _firstsample
const unsigned int _firstsamplePN
const double _qualpercent
unsigned int nevtAB[1700]
TTree * ADCtrees[1700]
const std::string digiCollection_
Definition: TPNCor.h:7
const std::string pncorfile_
const double _ratiomincutlow
const unsigned int _timingquallow
TTree * respntrees[nColor]
const std::string _ecalPart