File indexing completed on 2024-04-06 11:57:48
0001 #ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer_h
0002 #define CalibCalorimetry_EcalLaserAnalyzer_EcalLaserAnalyzer_h
0003
0004
0005 #include <memory>
0006
0007 #include <vector>
0008 #include <map>
0009
0010 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0011
0012 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0013 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
0014 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
0015 #include "Geometry/EcalMapping/interface/EcalMappingRcd.h"
0016
0017 class TFile;
0018 class TTree;
0019 class TProfile;
0020 class TPNCor;
0021 class TPN;
0022 class TAPD;
0023 class TMom;
0024 class TShapeAnalysis;
0025 class TAPDPulse;
0026 class TPNPulse;
0027 class TMem;
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043 #define NCRYSEB 1700
0044 #define NMODEB 9
0045 #define NPNPERMOD 2
0046
0047
0048 #define NCRYSEE 830
0049 #define NMODEE 22
0050
0051 #define NSIDES 2
0052 #define NREFCHAN 2
0053
0054 class EcalLaserAnalyzer : public edm::one::EDAnalyzer<> {
0055 public:
0056 explicit EcalLaserAnalyzer(const edm::ParameterSet &iConfig);
0057 ~EcalLaserAnalyzer() override;
0058
0059 void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0060 void beginJob() override;
0061 void endJob() override;
0062
0063 void setGeomEB(int etaG, int phiG, int module, int tower, int strip, int xtal, int apdRefTT, int channel, int lmr);
0064 void setGeomEE(
0065 int etaG, int phiG, int iX, int iY, int iZ, int module, int tower, int ch, int apdRefTT, int channel, int lmr);
0066
0067 enum VarCol { iBlue, iRed, nColor };
0068
0069 private:
0070 int iEvent;
0071
0072 const std::string eventHeaderCollection_;
0073 const std::string eventHeaderProducer_;
0074 const std::string digiCollection_;
0075 const std::string digiProducer_;
0076 const std::string digiPNCollection_;
0077
0078 const edm::EDGetTokenT<EcalRawDataCollection> rawDataToken_;
0079 edm::EDGetTokenT<EBDigiCollection> ebDigiToken_;
0080 edm::EDGetTokenT<EEDigiCollection> eeDigiToken_;
0081 const edm::EDGetTokenT<EcalPnDiodeDigiCollection> pnDiodeDigiToken_;
0082 const edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> mappingToken_;
0083
0084
0085
0086 const unsigned int _nsamples;
0087 unsigned int _presample;
0088 const unsigned int _firstsample;
0089 const unsigned int _lastsample;
0090 const unsigned int _nsamplesPN;
0091 const unsigned int _presamplePN;
0092 const unsigned int _firstsamplePN;
0093 const unsigned int _lastsamplePN;
0094 const unsigned int _timingcutlow;
0095 const unsigned int _timingcuthigh;
0096 const unsigned int _timingquallow;
0097 const unsigned int _timingqualhigh;
0098 const double _ratiomincutlow;
0099 const double _ratiomincuthigh;
0100 const double _ratiomaxcutlow;
0101 const double _presamplecut;
0102 const unsigned int _niter;
0103 bool _fitab;
0104 const double _alpha;
0105 const double _beta;
0106 const unsigned int _nevtmax;
0107 const double _noise;
0108 const double _chi2cut;
0109 const std::string _ecalPart;
0110 const bool _docorpn;
0111 const int _fedid;
0112 const bool _saveallevents;
0113 const double _qualpercent;
0114 const int _debug;
0115
0116 TAPDPulse *APDPulse;
0117 TPNPulse *PNPulse;
0118 TMem *Mem;
0119 TMom *Delta01;
0120 TMom *Delta12;
0121
0122 bool doesABTreeExist;
0123
0124 const std::string resdir_;
0125 const std::string pncorfile_;
0126
0127
0128
0129 std::string alphafile;
0130 std::string alphainitfile;
0131 std::string ADCfile;
0132 std::string APDfile;
0133 std::string resfile;
0134
0135 TShapeAnalysis *shapana;
0136 unsigned int nevtAB[NCRYSEB];
0137
0138
0139
0140 unsigned int nCrys;
0141 unsigned int nPNPerMod;
0142 unsigned int nRefChan;
0143 unsigned int nRefTrees;
0144 unsigned int nMod;
0145 unsigned int nSides;
0146
0147
0148
0149 int runType;
0150 int runNum;
0151
0152
0153
0154 int towerID;
0155 int channelID;
0156 int fedID;
0157 int dccID;
0158 int side;
0159 int lightside;
0160 int iZ;
0161
0162
0163 int laserEvents;
0164
0165
0166
0167 TPNCor *pnCorrector;
0168
0169
0170
0171 TFile *ADCFile;
0172 TTree *ADCtrees[NCRYSEB];
0173
0174 TFile *APDFile;
0175 TTree *APDtrees[NCRYSEB];
0176 TTree *RefAPDtrees[NREFCHAN][NMODEE];
0177
0178 TFile *resFile;
0179 TTree *restrees[nColor];
0180 TTree *respntrees[nColor];
0181
0182 std::vector<int> colors;
0183 std::map<unsigned int, unsigned int> channelMapEE;
0184 std::vector<int> modules;
0185 std::map<int, unsigned int> apdRefMap[2];
0186
0187
0188
0189 int phi, eta;
0190 int event;
0191 int color;
0192 double adc[10];
0193 int adcG[10];
0194 double pn0, pn1;
0195 double pn[50];
0196 int pnG[50];
0197 double apdAmpl;
0198 double apdAmplA;
0199 double apdAmplB;
0200 double apdTime;
0201 double pnAmpl;
0202
0203 int eventref;
0204 int colorref;
0205
0206 double *adcNoPed;
0207 double *pnNoPed;
0208
0209
0210 TPN *PNFirstAnal[NMODEE][NPNPERMOD][nColor];
0211 TPN *PNAnal[NMODEE][NPNPERMOD][nColor];
0212
0213
0214 TAPD *APDFirstAnal[NCRYSEB][nColor];
0215 TAPD *APDAnal[NCRYSEB][nColor];
0216
0217 int IsThereDataADC[NCRYSEB][nColor];
0218
0219
0220
0221 int pnID, moduleID, flag, flagAB;
0222 int channelIteratorEE;
0223
0224 double APD[6], Time[6], PN[6], APDoPN[6], APDoPNA[6], APDoPNB[6], APDoAPDA[6], APDoAPDB[6], PNoPN[6], PNoPNA[6],
0225 PNoPNB[6];
0226
0227
0228
0229
0230 int iEta[NCRYSEB], iPhi[NCRYSEB];
0231 unsigned int iModule[NCRYSEB];
0232 int iTowerID[NCRYSEB], iChannelID[NCRYSEB], idccID[NCRYSEB], iside[NCRYSEB];
0233 unsigned int firstChanMod[NMODEE];
0234 unsigned int isFirstChanModFilled[NMODEE];
0235
0236
0237
0238 int nEvtBadGain[NCRYSEB];
0239 int nEvtBadTiming[NCRYSEB];
0240 int nEvtTot[NCRYSEB];
0241
0242 bool wasGainOK[NCRYSEB];
0243 bool wasTimingOK[NCRYSEB];
0244 bool wasABCalcOK[NCRYSEB];
0245
0246 bool isGainOK;
0247 bool isTimingOK;
0248 };
0249 #endif