CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
49  public:
50 
51  explicit EcalLaserAnalyzer(const edm::ParameterSet& iConfig);
53 
54 
55  virtual void analyze( const edm::Event & e, const edm::EventSetup& c);
56  virtual void beginJob();
57  virtual void endJob();
58 
59  void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal,
60  int apdRefTT, int channel, int lmr);
61  void setGeomEE(int etaG, int phiG,int iX, int iY, int iZ, int module, int tower,
62  int ch , int apdRefTT, int channel, int lmr);
63 
64  enum VarCol { iBlue, iRed, nColor };
65 
66  private:
67 
68  int iEvent;
69 
70 
71  // Framework parameters
72 
73  unsigned int _nsamples;
74  unsigned int _presample;
75  unsigned int _firstsample;
76  unsigned int _lastsample;
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  bool _fitab ;
91  double _alpha;
92  double _beta;
93  unsigned int _nevtmax;
94  double _noise;
95  double _chi2cut;
96  std::string _ecalPart;
97  bool _docorpn;
98  int _fedid;
100  double _qualpercent;
101  int _debug;
102 
108 
110 
111  std::string resdir_;
112  std::string pncorfile_;
113  std::string digiCollection_;
114  std::string digiPNCollection_;
115  std::string digiProducer_;
117  std::string eventHeaderProducer_;
118 
119  // Output file names
120 
121  std::string alphafile;
122  std::string alphainitfile;
123  std::string ADCfile;
124  std::string APDfile;
125  std::string resfile;
126 
127 
129  unsigned int nevtAB[NCRYSEB];
130 
131  // Define geometrical constants
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  // Identify run type
141 
142  int runType;
143  int runNum;
144 
145  // Identify channel
146 
147  int towerID;
149  int fedID;
150  int dccID;
151  int side;
153  int iZ;
154 
155  // Count Laser Events
157 
158  // PN linearity corrections
159 
161 
162  // Temporary root files and trees
163 
164  TFile *ADCFile;
165  TTree *ADCtrees[NCRYSEB];
166 
167  TFile *APDFile;
168  TTree *APDtrees[NCRYSEB];
170 
171  TFile *resFile;
172  TTree *restrees[nColor];
174 
175  std::vector<int> colors;
176  std::map<unsigned int, unsigned int> channelMapEE;
177  std::vector<int> modules;
178  std::map <int, unsigned int> apdRefMap[2];
179 
180 
181  // Declaration of leaves types for temporary trees
182 
183  int phi, eta;
184  int event ;
185  int color ;
186  double adc[10];
187  int adcG[10];
188  double pn0,pn1;
189  double pn[50];
190  int pnG[50];
191  double apdAmpl;
192  double apdAmplA;
193  double apdAmplB;
194  double apdTime;
195  double pnAmpl;
196 
197  int eventref;
198  int colorref;
199 
200  double *adcNoPed;
201  double *pnNoPed;
202 
203  // declare TPN stuff
206 
207  // declare TAPD stuff
210 
212 
213  // Declaration of leaves types for results tree
214 
217 
218  double APD[6], Time[6], PN[6], APDoPN[6], APDoPNA[6], APDoPNB[6],
219  APDoAPDA[6], APDoAPDB[6], PNoPN[6], PNoPNA[6], PNoPNB[6];
220 
221  // [0]=mean, [1]=rms, [2]=L3, [3]=nevt, [4]=min, [5]=max
222  // flag is 1 if fit if there is data, 0 if there is no data
223 
225  unsigned int iModule[NCRYSEB];
227  unsigned int firstChanMod[NMODEE];
229 
230  // Quality Checks variables and flags
231 
235 
239 
240  bool isGainOK;
242 
243 };
244 
245 
unsigned int _firstsamplePN
unsigned int _nsamples
virtual void endJob()
int IsThereDataADC[NCRYSEB][nColor]
int nEvtBadTiming[NCRYSEB]
Definition: TPN.h:8
#define NMODEE
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
std::vector< int > modules
EcalLaserAnalyzer(const edm::ParameterSet &iConfig)
Definition: TAPD.h:8
std::map< int, unsigned int > apdRefMap[2]
std::string digiPNCollection_
TTree * RefAPDtrees[NREFCHAN][NMODEE]
#define NCRYSEB
TAPD * APDFirstAnal[NCRYSEB][nColor]
int iChannelID[NCRYSEB]
unsigned int _timingcuthigh
unsigned int _nevtmax
unsigned int _nsamplesPN
unsigned int nRefTrees
unsigned int _timingcutlow
Definition: TMom.h:7
unsigned int _timingquallow
unsigned int isFirstChanModFilled[NMODEE]
std::string digiProducer_
Definition: TMem.h:7
std::vector< int > colors
TTree * ADCtrees[NCRYSEB]
std::string digiCollection_
unsigned int _lastsamplePN
bool wasTimingOK[NCRYSEB]
std::string eventHeaderProducer_
TPN * PNFirstAnal[NMODEE][NPNPERMOD][nColor]
unsigned int _firstsample
#define NREFCHAN
std::string eventHeaderCollection_
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
unsigned int _presample
TAPD * APDAnal[NCRYSEB][nColor]
std::map< unsigned int, unsigned int > channelMapEE
int nEvtBadGain[NCRYSEB]
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)
unsigned int nPNPerMod
#define NPNPERMOD
void setGeomEE(int etaG, int phiG, int iX, int iY, int iZ, int module, int tower, int ch, int apdRefTT, int channel, int lmr)
unsigned int _timingqualhigh
unsigned int iModule[NCRYSEB]
unsigned int _lastsample
virtual void beginJob()
TTree * APDtrees[NCRYSEB]
bool wasGainOK[NCRYSEB]
unsigned int firstChanMod[NMODEE]
unsigned int nevtAB[NCRYSEB]
Definition: TPNCor.h:7
bool wasABCalcOK[NCRYSEB]
unsigned int _presamplePN
TTree * respntrees[nColor]
Definition: vlib.h:209
TPN * PNAnal[NMODEE][NPNPERMOD][nColor]