Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef CalibMuon_DTTTrigCalibration_H
0002 #define CalibMuon_DTTTrigCalibration_H
0003 
0004 /** \class DTTTrigCalibration
0005  *  Analyzer class which fills time box plots with SL granularity
0006  *  for t_trig computation, fits the rising edge and write results to DB.
0007  *  The time boxes are written to file.
0008  *
0009  *  \author G. Cerminara - INFN Torino
0010  */
0011 
0012 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0013 #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
0014 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0015 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
0016 
0017 #include <string>
0018 #include <map>
0019 
0020 namespace edm {
0021   class ParameterSet;
0022   class Event;
0023   class EventSetup;
0024 }  // namespace edm
0025 
0026 class TFile;
0027 class TH1F;
0028 class DTTimeBoxFitter;
0029 class DTTTrigBaseSync;
0030 class DTTtrig;
0031 class DTStatusFlag;
0032 class DTStatusFlagRcd;
0033 
0034 class DTTTrigCalibration : public edm::one::EDAnalyzer<> {
0035 public:
0036   /// Constructor
0037   DTTTrigCalibration(const edm::ParameterSet& pset);
0038 
0039   /// Destructor
0040   ~DTTTrigCalibration() override;
0041 
0042   // Operations
0043 
0044   /// Fill the time boxes
0045   void analyze(const edm::Event& event, const edm::EventSetup& eventSetup) override;
0046 
0047   /// Fit the time box rising edge and write the resulting ttrig to the DB
0048   void endJob() override;
0049 
0050 protected:
0051 private:
0052   // Generate the time box name
0053   std::string getTBoxName(const DTSuperLayerId& slId) const;
0054   // Generate the time box name
0055   std::string getOccupancyName(const DTLayerId& slId) const;
0056 
0057   // Print computed ttrig
0058   void dumpTTrigMap(const DTTtrig* tTrig) const;
0059 
0060   // Plot computed ttrig
0061   void plotTTrig(const DTTtrig* tTrig) const;
0062 
0063   // Debug flag
0064   bool debug;
0065 
0066   // The token used to retrieve digis from the event
0067   edm::EDGetTokenT<DTDigiCollection> digiToken;
0068 
0069   // The TDC time-window
0070   int maxTDCCounts;
0071   //The maximum number of digis per layer
0072   int maxDigiPerLayer;
0073 
0074   // The file which will contain the time boxes
0075   TFile* theFile;
0076 
0077   // Map of the histograms by SL
0078   std::map<DTSuperLayerId, TH1F*> theHistoMap;
0079   std::map<DTLayerId, TH1F*> theOccupancyMap;
0080 
0081   // Switch for t0 subtraction
0082   bool doSubtractT0;
0083   // Switch for checking of noisy channels
0084   bool checkNoisyChannels;
0085   //card to switch on/off the DB writing
0086   bool findTMeanAndSigma;
0087   // the kfactor to be uploaded in the ttrig DB
0088   double kFactor;
0089 
0090   // The fitter
0091   std::unique_ptr<DTTimeBoxFitter> theFitter;
0092   // The module for t0 subtraction
0093   std::unique_ptr<DTTTrigBaseSync> theSync;  //FIXME: should be const
0094   edm::ESGetToken<DTStatusFlag, DTStatusFlagRcd> theStatusMapToken;
0095 };
0096 #endif