Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-21 22:39:41

0001 #ifndef DTChamberEfficiencyTask_H
0002 #define DTChamberEfficiencyTask_H
0003 
0004 /** \class DTChamberEfficiencyTask
0005  *  DQM Analysis of 4D DT segments, it produces plots about: <br>
0006  *      - single chamber efficiency
0007  *  All histos are produced per Chamber
0008  *
0009  *  Class based on the code written by S. Lacaprara :
0010  *  RecoLocalMuon / DTSegment / test / DTEffAnalyzer.h
0011  *
0012  *  \author G. Mila - INFN Torino
0013  */
0014 
0015 #include "FWCore/Framework/interface/Frameworkfwd.h"
0016 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0017 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0018 #include "FWCore/Framework/interface/EDAnalyzer.h"
0019 #include "FWCore/Framework/interface/LuminosityBlock.h"
0020 
0021 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0022 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0023 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
0024 #include "DataFormats/Common/interface/Handle.h"
0025 #include "FWCore/Framework/interface/ESHandle.h"
0026 
0027 #include "DQMServices/Core/interface/DQMStore.h"
0028 #include "FWCore/ServiceRegistry/interface/Service.h"
0029 
0030 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0031 
0032 #include <string>
0033 #include <map>
0034 #include <vector>
0035 
0036 class DTChamberEfficiencyTask : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
0037 public:
0038   /// Constructor
0039   DTChamberEfficiencyTask(const edm::ParameterSet& pset);
0040 
0041   /// Destructor
0042   ~DTChamberEfficiencyTask() override;
0043 
0044   /// BeginRun
0045   void dqmBeginRun(const edm::Run& run, const edm::EventSetup& setup) override;
0046 
0047   /// To reset the MEs
0048   void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) override;
0049   void endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) final {}
0050 
0051   // Operations
0052   void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
0053 
0054 protected:
0055   // Book the histograms
0056   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0057 
0058 private:
0059   const DTRecSegment4D& getBestSegment(const DTRecSegment4DCollection::range& segs) const;
0060   const DTRecSegment4D* getBestSegment(const DTRecSegment4D* s1, const DTRecSegment4D* s2) const;
0061   bool isGoodSegment(const DTRecSegment4D& seg) const;
0062   LocalPoint interpolate(const DTRecSegment4D& seg1, const DTRecSegment4D& seg3, const DTChamberId& MB2) const;
0063 
0064   void bookHistos(DQMStore::IBooker& ibooker, DTChamberId chId);
0065 
0066   // Switch for verbosity
0067   bool debug;
0068   // The running mode
0069   bool onlineMonitor;
0070   // The analysis mode
0071   bool detailedAnalysis;
0072 
0073   // Lable of 4D segments in the event
0074   edm::EDGetTokenT<DTRecSegment4DCollection> recHits4DToken_;
0075 
0076   edm::ParameterSet parameters;
0077 
0078   std::map<DTChamberId, std::vector<MonitorElement*> > histosPerCh;
0079 
0080   unsigned int theMinHitsSegment;
0081   double theMinChi2NormSegment;
0082   double theMinCloseDist;
0083 
0084   //Load geometry
0085   edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeomToken_;
0086   const DTGeometry* dtGeom;
0087   edm::Handle<DTRecSegment4DCollection> segs;
0088 };
0089 #endif
0090 
0091 /* Local Variables: */
0092 /* show-trailing-whitespace: t */
0093 /* truncate-lines: t */
0094 /* End: */