Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-16 03:23:20

0001 #ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalPerEvtLaserAnalyzer_h
0002 #define CalibCalorimetry_EcalLaserAnalyzer_EcalPerEvtLaserAnalyzer_h
0003 // $Id: EcalPerEvtLaserAnalyzer.h
0004 
0005 #include <memory>
0006 
0007 #include <vector>
0008 
0009 #include <FWCore/Framework/interface/one/EDAnalyzer.h>
0010 
0011 #include <DataFormats/EcalDigi/interface/EcalDigiCollections.h>
0012 #include <DataFormats/EcalRawData/interface/EcalRawDataCollections.h>
0013 #include <Geometry/EcalMapping/interface/EcalElectronicsMapping.h>
0014 #include <Geometry/EcalMapping/interface/EcalMappingRcd.h>
0015 
0016 class TFile;
0017 class TTree;
0018 
0019 // Define geometrical constants
0020 // NOT the same for "EB" and "EE"
0021 //
0022 //     "EB"       "EE"
0023 //
0024 //      0          0
0025 //   1     2    1     2
0026 //   3     4
0027 //   5     6
0028 //   7     8
0029 //
0030 //
0031 #define NSIDES 2  // Number of sides (0, 1)
0032 
0033 // "EB" geometry
0034 #define NCRYSEB 1700  // Number of crystals per EB supermodule
0035 #define NTTEB 68      // Number of EB Trigger Towers
0036 #define NPNEB 10      // Number of PN per EB supermodule
0037 
0038 // "EE" geometry
0039 #define NCRYSEE 825  // Number of crystals per EE supermodule
0040 #define NTTEE 33     // Number of EE Trigger Towers
0041 #define NPNEE 4      // Number of PN per EE supermodule
0042 
0043 class EcalPerEvtLaserAnalyzer : public edm::one::EDAnalyzer<> {
0044 public:
0045   explicit EcalPerEvtLaserAnalyzer(const edm::ParameterSet &iConfig);
0046   ~EcalPerEvtLaserAnalyzer() override;
0047 
0048   void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0049   void beginJob() override;
0050   void endJob() override;
0051 
0052   enum VarCol { iBlue, iRed, nColor };
0053 
0054 private:
0055   int iEvent;
0056 
0057   const std::string eventHeaderCollection_;
0058   const std::string eventHeaderProducer_;
0059   const std::string digiCollection_;
0060   const std::string digiProducer_;
0061   const std::string digiPNCollection_;
0062 
0063   const edm::EDGetTokenT<EcalRawDataCollection> rawDataToken_;
0064   edm::EDGetTokenT<EBDigiCollection> ebDigiToken_;
0065   edm::EDGetTokenT<EEDigiCollection> eeDigiToken_;
0066   const edm::EDGetTokenT<EcalPnDiodeDigiCollection> pnDiodeDigiToken_;
0067   const edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> mappingToken_;
0068 
0069   // Framework parameters
0070 
0071   const unsigned int _nsamples;
0072   const unsigned int _presample;
0073   const unsigned int _firstsample;
0074   const unsigned int _lastsample;
0075   const unsigned int _nsamplesPN;
0076   const unsigned int _presamplePN;
0077   const unsigned int _firstsamplePN;
0078   const unsigned int _lastsamplePN;
0079   const unsigned int _timingcutlow;
0080   const unsigned int _timingcuthigh;
0081   const unsigned int _niter;
0082   const int _fedid;
0083   const unsigned int _tower;
0084   const unsigned int _channel;
0085   const std::string _ecalPart;
0086 
0087   const std::string resdir_;
0088   const std::string refalphabeta_;
0089 
0090   // Output file names
0091 
0092   std::string ADCfile;
0093   std::string resfile;
0094 
0095   //  Define geometrical constants
0096   //  Default values correspond to "EB" geometry (1700 crystals)
0097 
0098   unsigned int nCrys;
0099 
0100   int IsFileCreated;
0101 
0102   // Identify run type
0103 
0104   int runType;
0105   int runNum;
0106   int dccID;
0107   int fedID;
0108   int lightside;
0109 
0110   int channelNumber;
0111 
0112   std::vector<int> colors;
0113 
0114   // Temporary root files and trees
0115   TFile *matacqFile;
0116   TTree *matacqTree;
0117 
0118   TFile *ADCFile;
0119   TTree *ADCtrees;
0120 
0121   TFile *APDFile;
0122   TTree *header[2];
0123   TTree *APDtrees;
0124 
0125   int doesRefFileExist;
0126   int IsThereDataADC[nColor];
0127   int IsHeaderFilled[nColor];
0128 
0129   double ttMat, peakMat, peak;
0130   int evtMat, colMat;
0131 
0132   // Declaration of leaves types for temporary trees
0133 
0134   int phi, eta;
0135   int event;
0136   int color;
0137   double adc[10];
0138   int adcG[10];
0139   double tt;
0140   double ttrig;
0141   double pn0, pn1;
0142   double pn[50];
0143   double apdAmpl;
0144   double apdTime;
0145   double pnAmpl;
0146 };
0147 #endif