Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DTDigiTask_H
0002 #define DTDigiTask_H
0003 
0004 /*
0005  * \file DTDigiTask.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/Event.h"
0014 #include "FWCore/Framework/interface/MakerMacros.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 
0017 #include "DQMServices/Core/interface/DQMStore.h"
0018 
0019 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0020 
0021 #include "CondFormats/DTObjects/interface/DTReadOutMapping.h"
0022 #include "CondFormats/DTObjects/interface/DTStatusFlag.h"
0023 //Records
0024 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0025 #include "CondFormats/DataRecord/interface/DTReadOutMappingRcd.h"
0026 #include "CondFormats/DataRecord/interface/DTTtrigRcd.h"
0027 #include "CondFormats/DataRecord/interface/DTT0Rcd.h"
0028 #include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h"
0029 
0030 #include "DataFormats/LTCDigi/interface/LTCDigi.h"
0031 #include "DataFormats/DTDigi/interface/DTDigi.h"
0032 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
0033 
0034 #include "FWCore/Framework/interface/LuminosityBlock.h"
0035 #include "FWCore/Utilities/interface/InputTag.h"
0036 
0037 #include <memory>
0038 #include <iostream>
0039 #include <fstream>
0040 #include <string>
0041 #include <vector>
0042 #include <map>
0043 
0044 class DTGeometry;
0045 class DTSuperLayerId;
0046 class DTLayerId;
0047 class DTChamberId;
0048 class DTTtrig;
0049 class DTT0;
0050 
0051 class DTDigiTask : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
0052 public:
0053   /// Constructor
0054   DTDigiTask(const edm::ParameterSet& ps);
0055 
0056   /// Destructor
0057   ~DTDigiTask() override;
0058 
0059 protected:
0060   void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
0061 
0062   // Book the histograms
0063   void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0064 
0065   /// Book the ME
0066   void bookHistos(DQMStore::IBooker& ibooker, const DTSuperLayerId& dtSL, std::string folder, std::string histoTag);
0067   void bookHistos(DQMStore::IBooker& ibooker, const DTChamberId& dtCh, std::string folder, std::string histoTag);
0068   void bookHistos(DQMStore::IBooker& ibooker, const int wheelId, std::string folder, std::string histoTag);
0069 
0070   /// To reset the MEs
0071   void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) override;
0072   void endLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) final {}
0073 
0074   /// To map real channels
0075   void channelsMap(const DTChamberId& dtCh, std::string histoTag);
0076 
0077   /// Analyze
0078   void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0079 
0080   /// get the L1A source
0081   std::string triggerSource();
0082 
0083 private:
0084   std::string topFolder() const;
0085 
0086   int nevents;
0087 
0088   /// no needs to be precise. Value from PSets will always be used
0089   int tMax;
0090   int maxTDCHits;
0091 
0092   /// tTrig from the DB
0093   float tTrig;
0094   float tTrigRMS;
0095   float kFactor;
0096 
0097   //check for sync noise
0098 
0099   std::map<DTChamberId, int> hitMap;
0100   std::set<DTChamberId> syncNoisyChambers;
0101   int syncNumTot;
0102   int syncNum;
0103 
0104   edm::Handle<LTCDigiCollection> ltcdigis;
0105 
0106   edm::ESGetToken<DTGeometry, MuonGeometryRecord> muonGeomToken_;
0107   const DTGeometry* muonGeom;
0108   edm::ESGetToken<DTReadOutMapping, DTReadOutMappingRcd> readOutMapToken_;
0109   const DTReadOutMapping* mapping;
0110 
0111   edm::ESGetToken<DTTtrig, DTTtrigRcd> TtrigToken_;
0112   const DTTtrig* tTrigMap;
0113   edm::ESGetToken<DTT0, DTT0Rcd> T0Token_;
0114   const DTT0* t0Map;
0115 
0116   // Status map (for noisy channels)
0117   edm::ESGetToken<DTStatusFlag, DTStatusFlagRcd> statusMapToken_;
0118   const DTStatusFlag* statusMap;
0119 
0120   std::map<std::string, std::map<uint32_t, MonitorElement*> > digiHistos;
0121   std::map<std::string, std::map<int, MonitorElement*> > wheelHistos;
0122 
0123   // Parameters from config file
0124 
0125   // The label to retrieve the digis
0126   edm::EDGetTokenT<DTDigiCollection> dtDigiToken_;
0127 
0128   edm::EDGetTokenT<LTCDigiCollection> ltcDigiCollectionToken_;
0129 
0130   // Set to true to read the ttrig from DB (useful to determine in-time and out-of-time hits)
0131   bool readTTrigDB;
0132   // Set to true to subtract t0 from test pulses
0133   bool subtractT0;
0134   // Tmax value (TDC counts)
0135   int defaultTmax;
0136   // Switch from static (all histo at the beginninig of the job) to
0137   // dynamic (book when needed) histo booking
0138   bool doStaticBooking;
0139   // Switch for local/global runs
0140   bool isLocalRun;
0141   // Setting for the reset of the ME after n (= ResetCycle) luminosity sections
0142   int resetCycle;
0143   // Check the DB of noisy channels
0144   bool checkNoisyChannels;
0145   // Default TTrig to be used when not reading the TTrig DB
0146   int defaultTTrig;
0147 
0148   int inTimeHitsLowerBound;
0149   int inTimeHitsUpperBound;
0150   int timeBoxGranularity;
0151   int maxTTMounts;
0152   bool doAllHitsOccupancies;
0153   bool doNoiseOccupancies;
0154   bool doInTimeOccupancies;
0155 
0156   bool tpMode;
0157   bool lookForSyncNoise;
0158   bool filterSyncNoise;
0159 
0160   bool sliceTestMode;
0161   int tdcPedestal;
0162 
0163   bool doLayerTimeBoxes;
0164 
0165   std::map<DTChamberId, int> nSynchNoiseEvents;
0166   MonitorElement* nEventMonitor;
0167 };
0168 
0169 #endif
0170 
0171 /* Local Variables: */
0172 /* show-trailing-whitespace: t */
0173 /* truncate-lines: t */
0174 /* End: */