Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-04-29 23:10:18

0001 #ifndef DTLocalTriggerTask_H
0002 #define DTLocalTriggerTask_H
0003 
0004 /*
0005  * \file DTLocalTriggerTask.h
0006  *
0007  * \author M. Zanetti - INFN Padova
0008  *
0009 */
0010 
0011 #include "FWCore/Framework/interface/Frameworkfwd.h"
0012 #include "DataFormats/Common/interface/Handle.h"
0013 #include "FWCore/Framework/interface/LuminosityBlock.h"
0014 
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/Framework/interface/MakerMacros.h"
0017 
0018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0019 #include "FWCore/Utilities/interface/InputTag.h"
0020 
0021 #include "DQMServices/Core/interface/DQMStore.h"
0022 
0023 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0024 
0025 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambPhContainer.h"
0026 #include "DataFormats/L1DTTrackFinder/interface/L1MuDTChambThContainer.h"
0027 #include "DataFormats/LTCDigi/interface/LTCDigi.h"
0028 #include "DataFormats/DTDigi/interface/DTLocalTriggerCollection.h"
0029 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
0030 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0031 
0032 #include <vector>
0033 #include <string>
0034 #include <map>
0035 
0036 class DTGeometry;
0037 class DTTrigGeomUtils;
0038 class DTChamberId;
0039 class DTRecSegment4D;
0040 class DTLocalTrigger;
0041 class L1MuDTChambPhDigi;
0042 class L1MuDTChambThDigi;
0043 
0044 typedef std::array<std::array<std::array<int, 13>, 5>, 6> DTArr3int;
0045 typedef std::array<std::array<std::array<const L1MuDTChambPhDigi*, 15>, 5>, 6> DTArr3PhDigi;
0046 typedef std::array<std::array<std::array<const L1MuDTChambThDigi*, 15>, 5>, 6> DTArr3ThDigi;
0047 typedef std::array<std::array<std::array<const DTLocalTrigger*, 15>, 5>, 6> DTArr3LocalTrigger;
0048 typedef std::array<std::array<std::array<int, 2>, 13>, 6> DTArr3mapInt;
0049 
0050 class DTLocalTriggerTask : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
0051   friend class DTMonitorModule;
0052 
0053 public:
0054   /// Constructor
0055   DTLocalTriggerTask(const edm::ParameterSet& ps);
0056 
0057   /// Destructor
0058   ~DTLocalTriggerTask() override;
0059 
0060 protected:
0061   ///Beginrun
0062   void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
0063 
0064   /// Book the histograms
0065 
0066   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0067   void bookHistos(DQMStore::IBooker&, const DTChamberId& dtCh, std::string folder, std::string histoTag);
0068 
0069   /// Book the histograms
0070   void bookWheelHistos(DQMStore::IBooker&, int wh, std::string histoTag);
0071 
0072   /// Book the histograms
0073   void bookBarrelHistos(DQMStore::IBooker&, std::string histoTag);
0074 
0075   /// Set Quality labels
0076   void setQLabels(MonitorElement* me, short int iaxis);
0077   void setQLabelsTheta(MonitorElement* me, short int iaxis);
0078 
0079   /// Run analysis on TM data
0080   void runTMAnalysis(std::vector<L1MuDTChambPhDigi> const* phTrigs, std::vector<L1MuDTChambThDigi> const* thTrigs);
0081 
0082   /// Run analysis using DT 4D segments
0083   void runSegmentAnalysis(edm::Handle<DTRecSegment4DCollection>& segments4D);
0084 
0085   /// Analyze
0086   void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0087 
0088   /// To reset the MEs
0089   void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) override;
0090   void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) final {}
0091 
0092   /// Get the L1A source
0093   void triggerSource(const edm::Event& e);
0094 
0095   /// Get the Top folder (different between Physics and TP and TM)
0096   std::string& topFolder() { return baseFolderTM; }
0097 
0098   const int wheelArrayShift = 3;
0099 
0100 private:
0101   edm::EDGetTokenT<L1MuDTChambPhContainer> tm_Token_;
0102   edm::EDGetTokenT<L1MuDTChambThContainer> tmTh_Token_;
0103   edm::EDGetTokenT<DTLocalTriggerCollection> ros_Token_;
0104   edm::EDGetTokenT<DTRecSegment4DCollection> seg_Token_;
0105   edm::EDGetTokenT<LTCDigiCollection> ltcDigiCollectionToken_;
0106 
0107   bool useTM, useSEG;
0108   std::string trigsrc;
0109   int nevents;
0110   bool tpMode;
0111   std::string baseFolderTM;
0112   bool doTMTheta;
0113   bool detailedAnalysis;
0114 
0115   DTArr3int phcode_best;
0116   DTArr3int thcode_best;
0117   DTArr3mapInt mapDTTF;
0118   DTArr3PhDigi iphbest;
0119   DTArr3ThDigi ithbest;
0120   bool track_ok[6][5][15];
0121 
0122   edm::ParameterSet parameters;
0123   edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeomToken_;
0124   const DTGeometry* muonGeom;
0125   DTTrigGeomUtils* trigGeomUtils;
0126   std::map<uint32_t, std::map<std::string, MonitorElement*> > digiHistos;
0127   std::map<int, std::map<std::string, MonitorElement*> > wheelHistos;
0128 
0129   MonitorElement* tm_IDDataErrorPlot;
0130 
0131   bool isLocalRun;
0132 };
0133 
0134 #endif
0135 
0136 /* Local Variables: */
0137 /* show-trailing-whitespace: t */
0138 /* truncate-lines: t */
0139 /* End: */