File indexing completed on 2024-04-06 11:57:46
0001 #ifndef CL_EcnaAnalyzer_H
0002 #define CL_EcnaAnalyzer_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 #include "Riostream.h"
0026 #include <ctime>
0027 #include <fstream>
0028 #include <iomanip>
0029 #include <iostream>
0030 #include <memory>
0031 #include <string>
0032 #include <vector>
0033
0034 #include <csignal>
0035 #include <sys/time.h>
0036
0037
0038 #include "TObject.h"
0039 #include "TString.h"
0040 #include "TSystem.h"
0041 #include "TTreeIndex.h"
0042 #include "TVectorD.h"
0043
0044
0045 #include "CondCore/CondDB/interface/Time.h"
0046 #include "DataFormats/Common/interface/Handle.h"
0047 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0048 #include "FWCore/Framework/interface/ESHandle.h"
0049 #include "FWCore/Framework/interface/Event.h"
0050 #include "FWCore/Framework/interface/EventSetup.h"
0051 #include "FWCore/Framework/interface/Frameworkfwd.h"
0052 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0053
0054 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0055
0056 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0057 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0058 #include "DataFormats/EcalDigi/interface/EBDataFrame.h"
0059 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0060 #include "DataFormats/EcalDigi/interface/EcalMGPASample.h"
0061 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0062 #include "DataFormats/Provenance/interface/EventID.h"
0063
0064 #include "DataFormats/Provenance/interface/Timestamp.h"
0065
0066 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
0067 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0068
0069
0070 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaNumbering.h"
0071 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaObject.h"
0072 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParEcal.h"
0073 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaParPaths.h"
0074 #include "CalibCalorimetry/EcalCorrelatedNoiseAnalysisAlgos/interface/TEcnaRun.h"
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133 class EcnaAnalyzer : public edm::one::EDAnalyzer<> {
0134 public:
0135 enum { kChannels = 1700, kGains = 3, kFirstGainId = 1 };
0136
0137 explicit EcnaAnalyzer(const edm::ParameterSet &);
0138 ~EcnaAnalyzer() override;
0139
0140 void analyze(const edm::Event &, const edm::EventSetup &) override;
0141 TString runtype(const Int_t &);
0142 Int_t gainvalue(const Int_t &);
0143 void CheckMsg(const Int_t &, const Int_t &);
0144 void CheckMsg(const Int_t &);
0145 Bool_t AnalysisOutcome(const TString &);
0146
0147 private:
0148 constexpr static Int_t fgMaxCar = 512;
0149 TString fTTBELL;
0150
0151
0152 unsigned int verbosity_;
0153 Int_t nChannels_;
0154 Int_t iEvent_;
0155 std::string eventHeaderProducer_;
0156 std::string digiProducer_;
0157 std::string eventHeaderCollection_;
0158 std::string EBdigiCollection_;
0159 std::string EEdigiCollection_;
0160 edm::EDGetTokenT<EcalRawDataCollection> eventHeaderToken_;
0161 edm::EDGetTokenT<EBDigiCollection> EBdigiToken_;
0162 edm::EDGetTokenT<EEDigiCollection> EEdigiToken_;
0163
0164 TString sAnalysisName_;
0165 TString sNbOfSamples_;
0166 TString sFirstReqEvent_;
0167 TString sLastReqEvent_;
0168 TString sReqNbOfEvts_;
0169 TString sStexName_;
0170 TString sStexNumber_;
0171
0172 Bool_t fOutcomeError;
0173
0174 Int_t fEvtNumber;
0175 Int_t fEvtNumberMemo;
0176 Int_t fRecNumber;
0177 Int_t fCurrentEventNumber;
0178 Int_t fNbOfSelectedEvents;
0179
0180 std::vector<Int_t> fBuildEventDistribBad;
0181 std::vector<Int_t> fBuildEventDistribGood;
0182
0183 TString fCfgAnalyzerParametersFilePath;
0184
0185 TString fCfgAnalyzerParametersFileName;
0186 std::ifstream fFcin_f;
0187
0188 TString fAnalysisName;
0189 Int_t fChozenGainNumber;
0190 Int_t fChozenRunTypeNumber;
0191 TString fDynBaseLineSub;
0192
0193 Int_t fNbOfSamples;
0194 Int_t fRunNumber;
0195 Int_t fRunTypeNumber;
0196 Int_t fFirstReqEvent;
0197 Int_t fLastReqEvent;
0198 TString fStexName;
0199 Int_t fStexNumber;
0200
0201 Int_t fReqNbOfEvts;
0202 Int_t fMgpaGainNumber;
0203
0204 Int_t fSMIndexBegin;
0205 Int_t fSMIndexStop;
0206 Int_t fDeeIndexBegin;
0207 Int_t fDeeIndexStop;
0208 Int_t fStexIndexBegin;
0209 Int_t fStexIndexStop;
0210
0211 Int_t fFedTcc;
0212 std::vector<Int_t> fSMFromFedTcc;
0213 std::vector<Int_t> fESFromFedTcc;
0214 Int_t fTreatedFedOrder;
0215 std::vector<Int_t> fFedStatusOrder;
0216 Int_t fFedId;
0217 std::vector<std::string> fDeeNumberString;
0218
0219 Int_t fMaxTreatedStexCounter = 0;
0220 Int_t fDeeDS5Memo1;
0221 Int_t fDeeDS5Memo2;
0222 std::vector<Int_t> fStexDigiOK;
0223 std::vector<Int_t> fStexNbOfTreatedEvents;
0224 std::vector<Int_t> fStexStatus;
0225
0226 Int_t fMaxFedUnitCounter = 0;
0227 std::vector<Int_t> fFedStatus;
0228 std::vector<Int_t> fFedDigiOK;
0229 std::vector<Int_t> fFedNbOfTreatedEvents;
0230
0231 Int_t fMemoCutOK;
0232 Int_t fNbOfTreatedStexs;
0233 std::vector<Int_t> fNbOfTreatedFedsInDee;
0234 std::vector<Int_t> fNbOfTreatedFedsInStex;
0235
0236 Int_t fANY_RUN;
0237 Int_t fPEDESTAL_STD;
0238 Int_t fPEDESTAL_GAP;
0239 Int_t fLASER_STD;
0240 Int_t fPHYSICS_GLOBAL;
0241 Int_t fPEDSIM;
0242
0243 std::vector<time_t> fTimeFirst;
0244 std::vector<time_t> fTimeLast;
0245 std::vector<TString> fDateFirst;
0246 std::vector<TString> fDateLast;
0247
0248 std::vector<Int_t> fMemoDateFirstEvent;
0249
0250 TEcnaObject fMyEcnaEBObjectManager;
0251 TEcnaObject fMyEcnaEEObjectManager;
0252
0253 std::vector<std::unique_ptr<TEcnaRun>> fMyCnaEBSM;
0254 std::vector<std::unique_ptr<TEcnaRun>> fMyCnaEEDee;
0255
0256 TEcnaNumbering fMyEBNumbering;
0257 TEcnaParEcal fMyEBEcal;
0258
0259 TEcnaNumbering fMyEENumbering;
0260 TEcnaParEcal fMyEEEcal;
0261
0262
0263
0264
0265 constexpr static Int_t fMaxRunTypeCounter = 26;
0266 std::array<Int_t, fMaxRunTypeCounter> fRunTypeCounter;
0267
0268 constexpr static Int_t fMaxMgpaGainCounter = 4;
0269 std::array<Int_t, fMaxMgpaGainCounter> fMgpaGainCounter;
0270
0271 constexpr static Int_t fMaxFedIdCounter = 54;
0272 std::array<Int_t, fMaxFedIdCounter> fFedIdCounter;
0273 };
0274
0275 #endif