Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CalibCalorimetry_EcalLaserAnalyzer_EcalTestPulseAnalyzer_h
0002 #define CalibCalorimetry_EcalLaserAnalyzer_EcalTestPulseAnalyzer_h
0003 
0004 #include <memory>
0005 
0006 #include <vector>
0007 #include <map>
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 
0032 // "EB" geometry
0033 #define NCRYSEB 1700  // Number of crystals per EB supermodule
0034 #define NMODEB 9      // Number of EB submodules
0035 #define NPNPERMOD 2   // Number of PN per module
0036 
0037 // "EE" geometry
0038 #define NCRYSEE 830  // Number of crystals per EE supermodule
0039 #define NMODEE 21    // Number of EE submodules
0040 
0041 #define NGAINPN 2   // Number of gains
0042 #define NGAINAPD 4  // Number of gains
0043 
0044 class EcalTestPulseAnalyzer : public edm::one::EDAnalyzer<> {
0045 public:
0046   explicit EcalTestPulseAnalyzer(const edm::ParameterSet &iConfig);
0047   ~EcalTestPulseAnalyzer() override;
0048 
0049   void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0050   void beginJob() override;
0051   void endJob() override;
0052 
0053 private:
0054   int iEvent;
0055 
0056   const std::string eventHeaderCollection_;
0057   const std::string eventHeaderProducer_;
0058   const std::string digiCollection_;
0059   const std::string digiProducer_;
0060   const std::string digiPNCollection_;
0061 
0062   const edm::EDGetTokenT<EcalRawDataCollection> rawDataToken_;
0063   edm::EDGetTokenT<EBDigiCollection> ebDigiToken_;
0064   edm::EDGetTokenT<EEDigiCollection> eeDigiToken_;
0065   const edm::EDGetTokenT<EcalPnDiodeDigiCollection> pnDiodeDigiToken_;
0066   const edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> mappingToken_;
0067 
0068   // Framework parameters
0069 
0070   const unsigned int _nsamples;
0071   const unsigned int _presample;
0072   const unsigned int _firstsample;
0073   const unsigned int _lastsample;
0074   const unsigned int _samplemin;
0075   const unsigned int _samplemax;
0076   const unsigned int _nsamplesPN;
0077   const unsigned int _presamplePN;
0078   const unsigned int _firstsamplePN;
0079   const unsigned int _lastsamplePN;
0080   const unsigned int _niter;
0081   const double _chi2max;
0082   const double _timeofmax;
0083   const std::string _ecalPart;
0084   const int _fedid;
0085 
0086   const std::string resdir_;
0087 
0088   // Output file names
0089 
0090   std::string rootfile;
0091   std::string resfile;
0092 
0093   //  Define geometrical constants
0094   //  Default values correspond to "EB" geometry (1700 crystals)
0095 
0096   unsigned int nCrys;
0097   unsigned int nMod;
0098   unsigned int nGainPN;
0099   unsigned int nGainAPD;
0100 
0101   // Count TP Events
0102   int TPEvents;
0103 
0104   double ret_data[20];
0105 
0106   int towerID;
0107   int channelID;
0108 
0109   // Identify run
0110 
0111   int runType;
0112   int runNum;
0113   int fedID;
0114   int dccID;
0115   int side;
0116   int iZ;
0117 
0118   // Root Files
0119 
0120   TFile *outFile;  // from 'analyze': Data
0121   TFile *resFile;  // from 'endJob': Results
0122 
0123   // Temporary data trees
0124 
0125   TTree *trees[NCRYSEB];
0126 
0127   // Declaration of leaves types
0128 
0129   int phi, eta;
0130   int event;
0131   double adc[10];
0132   double pn[50];
0133 
0134   int apdGain;
0135   int pnGain;
0136   int pnG;
0137   double apdAmpl;
0138   double apdTime;
0139   double pnAmpl0;
0140   double pnAmpl1;
0141   double pnAmpl;
0142 
0143   // Results trees
0144 
0145   TTree *restrees;
0146   TTree *respntrees;
0147 
0148   std::map<int, int> channelMapEE;
0149   std::vector<int> dccMEM;
0150   std::vector<int> modules;
0151 
0152   // Declaration of leaves types
0153 
0154   int ieta, iphi, flag, gain;
0155   int pnID, moduleID;
0156   int channelIteratorEE;
0157   double APD[6], PN[6];
0158 
0159   int iEta[NCRYSEB], iPhi[NCRYSEB];
0160   unsigned int iModule[NCRYSEB];
0161   int iTowerID[NCRYSEB], iChannelID[NCRYSEB], idccID[NCRYSEB], iside[NCRYSEB];
0162 
0163   unsigned int firstChanMod[NMODEB];
0164   unsigned int isFirstChanModFilled[NMODEB];
0165 };
0166 #endif