Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:41:22

0001 // $Id: EcalMatacqAnalyzer.h
0002 
0003 #include <memory>
0004 #include <DataFormats/EcalDigi/interface/EcalDigiCollections.h>
0005 #include <DataFormats/EcalRawData/interface/EcalRawDataCollections.h>
0006 #include <FWCore/Framework/interface/one/EDAnalyzer.h>
0007 
0008 class TFile;
0009 class TTree;
0010 class TMTQ;
0011 
0012 #define N_samples 2560
0013 #define N_channels 1
0014 #define NSIDES 2  // Number of sides
0015 
0016 class EcalMatacqAnalyzer : public edm::one::EDAnalyzer<> {
0017 public:
0018   explicit EcalMatacqAnalyzer(const edm::ParameterSet &iConfig);
0019   ~EcalMatacqAnalyzer() override = default;
0020 
0021   void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0022   void beginJob() override;
0023   void endJob() override;
0024 
0025   enum VarCol { iBlue, iRed, nColor };
0026   enum VarSide { iSide0, iSide1, nSide };
0027 
0028 private:
0029   int iEvent;
0030 
0031   //
0032   // Framework parameters
0033   //
0034 
0035   const double _presample;
0036   const unsigned int _nsamplesaftmax;
0037   const unsigned int _noiseCut;
0038   const unsigned int _parabnbefmax;
0039   const unsigned int _parabnaftmax;
0040   const unsigned int _thres;
0041   const unsigned int _lowlev;
0042   const unsigned int _highlev;
0043   const unsigned int _nevlasers;
0044   const unsigned int _timebefmax;
0045   const unsigned int _timeaftmax;
0046   const double _cutwindow;
0047   const unsigned int _nsamplesshape;
0048   const unsigned int _presampleshape;
0049   const unsigned int _slide;
0050   const int _fedid;
0051   const int _debug;
0052 
0053   const std::string resdir_;
0054   const std::string digiCollection_;
0055   const std::string digiProducer_;
0056   const std::string eventHeaderCollection_;
0057   const std::string eventHeaderProducer_;
0058   const edm::EDGetTokenT<EcalMatacqDigiCollection> pmatToken_;
0059   const edm::EDGetTokenT<EcalRawDataCollection> dccToken_;
0060 
0061   std::string outfile;
0062   std::string sampfile;
0063 
0064   // Identify run type
0065 
0066   unsigned int nSides;
0067   int lightside;
0068   int runType;
0069   int runNum;
0070   int dccID;
0071   int fedID;
0072 
0073   // Count Laser Events
0074   int laserEvents;
0075   bool isThereMatacq;
0076 
0077   //Declaration of leaves types
0078 
0079   int event;
0080   int color;
0081   double matacq[N_samples];
0082   int maxsamp;
0083   int nsamples;
0084   double tt;
0085 
0086   TFile *sampFile;
0087   TTree *tree;
0088 
0089   TMTQ *MTQ[nColor][nSide];
0090   TTree *meanTree[nColor];
0091 
0092   std::vector<int> colors;
0093 
0094   TFile *outFile;
0095   int status;
0096   double peak, sigma, fit, ampl, trise, fwhm, fw20, fw80, ped, pedsig, ttrig, sliding;
0097   TTree *mtqShape;
0098 };