Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:48

0001 #ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalABAnalyzer_h
0002 #define CalibCalorimetry_EcalLaserAnalyzer_EcalABAnalyzer_h
0003 
0004 // $Id: EcalABAnalyzer.h
0005 
0006 #include <memory>
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 TShapeAnalysis;
0018 class TAPDPulse;
0019 class TMom;
0020 
0021 // Define geometrical constants
0022 // NOT the same for "EB" and "EE"
0023 //
0024 //     "EB"       "EE"
0025 //
0026 //      0          0
0027 //   1     2    1     2
0028 //   3     4
0029 //   5     6
0030 //   7     8
0031 //
0032 //
0033 
0034 // "EB" geometry
0035 #define NCRYSEB 1700  // Number of crystals per EB supermodule
0036 
0037 // "EE" geometry
0038 #define NCRYSEE 830  // Number of crystals per EE supermodule
0039 
0040 class EcalABAnalyzer : public edm::one::EDAnalyzer<> {
0041 public:
0042   explicit EcalABAnalyzer(const edm::ParameterSet &iConfig);
0043   ~EcalABAnalyzer() override;
0044 
0045   void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0046   void beginJob() override;
0047   void endJob() override;
0048 
0049   enum VarCol { iBlue, iRed, nColor };
0050 
0051 private:
0052   int iEvent;
0053 
0054   const std::string eventHeaderCollection_;
0055   const std::string eventHeaderProducer_;
0056   const std::string digiCollection_;
0057   const std::string digiProducer_;
0058 
0059   const edm::EDGetTokenT<EcalRawDataCollection> rawDataToken_;
0060   edm::EDGetTokenT<EBDigiCollection> ebDigiToken_;
0061   edm::EDGetTokenT<EEDigiCollection> eeDigiToken_;
0062   const edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> mappingToken_;
0063 
0064   // Framework parameters
0065 
0066   const unsigned int _nsamples;
0067   unsigned int _presample;
0068   const unsigned int _firstsample;
0069   const unsigned int _lastsample;
0070   const unsigned int _timingcutlow;
0071   const unsigned int _timingcuthigh;
0072   const unsigned int _timingquallow;
0073   const unsigned int _timingqualhigh;
0074   const double _ratiomincutlow;
0075   const double _ratiomincuthigh;
0076   const double _ratiomaxcutlow;
0077   const double _presamplecut;
0078   const unsigned int _niter;
0079   const double _alpha;
0080   const double _beta;
0081   const unsigned int _nevtmax;
0082   const double _noise;
0083   const double _chi2cut;
0084   const std::string _ecalPart;
0085   const int _fedid;
0086   const double _qualpercent;
0087   const int _debug;
0088 
0089   TAPDPulse *APDPulse;
0090   TMom *Delta01;
0091   TMom *Delta12;
0092 
0093   const std::string resdir_;
0094 
0095   // Output file names
0096 
0097   std::string alphafile;
0098   std::string alphainitfile;
0099 
0100   TShapeAnalysis *shapana;
0101   unsigned int nevtAB[NCRYSEB];
0102 
0103   //  Define geometrical constants
0104   //  Default values correspond to "EB" geometry (1700 crystals)
0105 
0106   unsigned int nCrys;
0107   bool doesABTreeExist;
0108 
0109   bool _fitab;
0110   // Identify run type
0111 
0112   int runType;
0113   int runNum;
0114   int fedID;
0115   int dccID;
0116   int side;
0117   int lightside;
0118   int iZ;
0119 
0120   // Temporary root files and trees
0121 
0122   std::vector<int> colors;
0123   std::map<int, int> channelMapEE;
0124   std::vector<int> dccMEM;
0125   std::vector<int> modules;
0126 
0127   // Declaration of leaves types for temporary trees
0128 
0129   int phi, eta;
0130   int event;
0131   int color;
0132   double adc[10];
0133   int adcG[10];
0134   int channelIteratorEE;
0135 
0136   int iEta[NCRYSEB], iPhi[NCRYSEB];
0137   int iTowerID[NCRYSEB], iChannelID[NCRYSEB], idccID[NCRYSEB], iside[NCRYSEB];
0138 
0139   // Quality Checks variables and flags
0140 
0141   int nEvtBadGain[NCRYSEB];
0142   int nEvtBadTiming[NCRYSEB];
0143   int nEvtTot[NCRYSEB];
0144 
0145   bool wasGainOK[NCRYSEB];
0146   bool wasTimingOK[NCRYSEB];
0147 
0148   bool isGainOK;
0149   bool isTimingOK;
0150 };
0151 
0152 #endif