Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-08-26 00:18:47

0001 #ifndef DTNoiseCalibration_H
0002 #define DTNoiseCalibration_H
0003 
0004 /*
0005  * \file DTNoiseCalibration.h
0006  *
0007  * \author G. Mila - INFN Torino
0008  *         A. Vilela Pereira - INFN Torino
0009  *
0010 */
0011 
0012 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0013 #include "FWCore/Framework/interface/ESHandle.h"
0014 #include "FWCore/Utilities/interface/InputTag.h"
0015 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0016 #include "CondFormats/DataRecord/interface/DTTtrigRcd.h"
0017 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
0018 
0019 #include <string>
0020 #include <vector>
0021 #include <map>
0022 #include <ctime>
0023 
0024 class DTGeometry;
0025 class DTChamberId;
0026 class DTSuperLayerId;
0027 class DTLayerId;
0028 class DTWireId;
0029 class DTTtrig;
0030 class TFile;
0031 class TH2F;
0032 class TH1F;
0033 
0034 class DTNoiseCalibration : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0035 public:
0036   /// Constructor
0037   DTNoiseCalibration(const edm::ParameterSet& ps);
0038   /// Destructor
0039   ~DTNoiseCalibration() override;
0040 
0041   void beginJob() override;
0042   void beginRun(const edm::Run& run, const edm::EventSetup& setup) override;
0043   void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0044   void endRun(const edm::Run& run, const edm::EventSetup& setup) override{};
0045   void endJob() override;
0046 
0047 private:
0048   std::string getChannelName(const DTWireId&) const;
0049   // Get the name of the layer
0050   std::string getLayerName(const DTLayerId&) const;
0051   // Get the name of the superLayer
0052   std::string getSuperLayerName(const DTSuperLayerId&) const;
0053   // Get the name of the chamber
0054   std::string getChamberName(const DTChamberId&) const;
0055 
0056   const edm::EDGetTokenT<DTDigiCollection> digiToken_;
0057   const bool useTimeWindow_;
0058   const double triggerWidth_;
0059   const int timeWindowOffset_;
0060   const double maximumNoiseRate_;
0061   const bool useAbsoluteRate_;
0062 
0063   bool readDB_;
0064   int defaultTtrig_;
0065 
0066   std::vector<DTWireId> wireIdWithHisto_;
0067   unsigned int lumiMax_;
0068 
0069   int nevents_;
0070   //int counter;
0071   time_t runBeginTime_;
0072   time_t runEndTime_;
0073 
0074   // Get the DT Geometry
0075   edm::ESHandle<DTGeometry> dtGeom_;
0076   const edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomToken_;
0077 
0078   // tTrig map
0079   edm::ESHandle<DTTtrig> tTrigMap_;
0080   const edm::ESGetToken<DTTtrig, DTTtrigRcd> ttrigToken_;
0081 
0082   TFile* rootFile_;
0083   // TDC digi distribution
0084   TH1F* hTDCTriggerWidth_;
0085   // Map of the occupancy histograms by layer
0086   std::map<DTLayerId, TH1F*> theHistoOccupancyMap_;
0087   // Map of occupancy by lumi by wire
0088   std::map<DTWireId, TH1F*> theHistoOccupancyVsLumiMap_;
0089   // Map of occupancy by lumi by chamber
0090   std::map<DTChamberId, TH1F*> chamberOccupancyVsLumiMap_;
0091   // Map of occupancy by time by chamber
0092   std::map<DTChamberId, TH1F*> chamberOccupancyVsTimeMap_;
0093 };
0094 #endif