Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:08

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/LuminosityBlock.h"
0019 
0020 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0021 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0022 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
0023 #include "DataFormats/Common/interface/Handle.h"
0024 #include "FWCore/Framework/interface/ESHandle.h"
0025 
0026 #include "DQMServices/Core/interface/DQMStore.h"
0027 #include "FWCore/ServiceRegistry/interface/Service.h"
0028 
0029 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0030 
0031 #include <string>
0032 #include <map>
0033 #include <vector>
0034 
0035 class DTChamberEfficiencyTask : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
0036 public:
0037   /// Constructor
0038   DTChamberEfficiencyTask(const edm::ParameterSet& pset);
0039 
0040   /// Destructor
0041   ~DTChamberEfficiencyTask() override;
0042 
0043   /// BeginRun
0044   void dqmBeginRun(const edm::Run& run, const edm::EventSetup& setup) override;
0045 
0046   /// To reset the MEs
0047   void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) override;
0048   void endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) final {}
0049 
0050   // Operations
0051   void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
0052 
0053 protected:
0054   // Book the histograms
0055   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0056 
0057 private:
0058   const DTRecSegment4D& getBestSegment(const DTRecSegment4DCollection::range& segs) const;
0059   const DTRecSegment4D* getBestSegment(const DTRecSegment4D* s1, const DTRecSegment4D* s2) const;
0060   bool isGoodSegment(const DTRecSegment4D& seg) const;
0061   LocalPoint interpolate(const DTRecSegment4D& seg1, const DTRecSegment4D& seg3, const DTChamberId& MB2) const;
0062 
0063   void bookHistos(DQMStore::IBooker& ibooker, DTChamberId chId);
0064 
0065   // Switch for verbosity
0066   bool debug;
0067   // The running mode
0068   bool onlineMonitor;
0069   // The analysis mode
0070   bool detailedAnalysis;
0071 
0072   // Lable of 4D segments in the event
0073   edm::EDGetTokenT<DTRecSegment4DCollection> recHits4DToken_;
0074 
0075   edm::ParameterSet parameters;
0076 
0077   std::map<DTChamberId, std::vector<MonitorElement*> > histosPerCh;
0078 
0079   unsigned int theMinHitsSegment;
0080   double theMinChi2NormSegment;
0081   double theMinCloseDist;
0082 
0083   //Load geometry
0084   edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeomToken_;
0085   const DTGeometry* dtGeom;
0086   edm::Handle<DTRecSegment4DCollection> segs;
0087 };
0088 #endif
0089 
0090 /* Local Variables: */
0091 /* show-trailing-whitespace: t */
0092 /* truncate-lines: t */
0093 /* End: */