Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef L1TdeRCT_H
0002 #define L1TdeRCT_H
0003 
0004 // system include files
0005 #include <memory>
0006 #include <unistd.h>
0007 
0008 #include <iostream>
0009 #include <fstream>
0010 #include <vector>
0011 #include <bitset>
0012 
0013 // user include files
0014 #include "FWCore/Framework/interface/Frameworkfwd.h"
0015 
0016 #include "FWCore/Framework/interface/Event.h"
0017 #include "FWCore/Framework/interface/MakerMacros.h"
0018 
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 
0021 #include "FWCore/ServiceRegistry/interface/Service.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 
0024 // DQM
0025 #include "DQMServices/Core/interface/DQMStore.h"
0026 
0027 // GCT and RCT data formats
0028 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
0029 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
0030 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
0031 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0032 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
0033 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0034 // TPGs
0035 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0036 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0037 
0038 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0039 
0040 class RunInfoRcd;
0041 class RunInfo;
0042 // Trigger Headers
0043 //
0044 // class declaration
0045 //
0046 namespace l1tderct {
0047   struct Empty {};
0048 }  // namespace l1tderct
0049 
0050 class L1TdeRCT : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<l1tderct::Empty>> {
0051 public:
0052   // Constructor
0053   L1TdeRCT(const edm::ParameterSet& ps);
0054 
0055   // Destructor
0056   ~L1TdeRCT() override;
0057 
0058 protected:
0059   // Analyze
0060   void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0061 
0062   //For FED vector monitoring
0063   void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup&) override;
0064   std::shared_ptr<l1tderct::Empty> globalBeginLuminosityBlock(const edm::LuminosityBlock&,
0065                                                               const edm::EventSetup&) const override;
0066   void globalEndLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) final {}
0067   void readFEDVector(MonitorElement*, const edm::EventSetup&, const bool isLumitransition = true) const;
0068 
0069 private:
0070   // ----------member data ---------------------------
0071 
0072   // begin GT decision information
0073   MonitorElement* triggerAlgoNumbers_;
0074 
0075   // trigger type information
0076   MonitorElement* triggerType_;
0077 
0078   // begin region information
0079   MonitorElement* rctRegDataOcc1D_;
0080   MonitorElement* rctRegEmulOcc1D_;
0081   MonitorElement* rctRegMatchedOcc1D_;
0082   MonitorElement* rctRegUnmatchedDataOcc1D_;
0083   MonitorElement* rctRegUnmatchedEmulOcc1D_;
0084   MonitorElement* rctRegSpEffOcc1D_;
0085   MonitorElement* rctRegSpIneffOcc1D_;
0086 
0087   MonitorElement* rctRegEff1D_;
0088   MonitorElement* rctRegIneff1D_;
0089   MonitorElement* rctRegOvereff1D_;
0090   MonitorElement* rctRegSpEff1D_;
0091   MonitorElement* rctRegSpIneff1D_;
0092 
0093   MonitorElement* rctRegDataOcc2D_;
0094   MonitorElement* rctRegEmulOcc2D_;
0095   MonitorElement* rctRegMatchedOcc2D_;
0096   MonitorElement* rctRegUnmatchedDataOcc2D_;
0097   MonitorElement* rctRegUnmatchedEmulOcc2D_;
0098   //  MonitorElement *rctRegDeltaEt2D_;
0099   MonitorElement* rctRegSpEffOcc2D_;
0100   MonitorElement* rctRegSpIneffOcc2D_;
0101 
0102   MonitorElement* rctRegEff2D_;
0103   MonitorElement* rctRegIneff2D_;
0104   MonitorElement* rctRegOvereff2D_;
0105   MonitorElement* rctRegSpEff2D_;
0106   MonitorElement* rctRegSpIneff2D_;
0107 
0108   MonitorElement* rctRegBitOn_;
0109   MonitorElement* rctRegBitOff_;
0110   MonitorElement* rctRegBitDiff_;
0111 
0112   // end region information
0113 
0114   // begin bit information
0115   MonitorElement* rctBitEmulOverFlow2D_;
0116   MonitorElement* rctBitDataOverFlow2D_;
0117   MonitorElement* rctBitMatchedOverFlow2D_;
0118   MonitorElement* rctBitUnmatchedEmulOverFlow2D_;
0119   MonitorElement* rctBitUnmatchedDataOverFlow2D_;
0120   MonitorElement* rctBitOverFlowEff2D_;
0121   MonitorElement* rctBitOverFlowIneff2D_;
0122   MonitorElement* rctBitOverFlowOvereff2D_;
0123   MonitorElement* rctBitEmulTauVeto2D_;
0124   MonitorElement* rctBitDataTauVeto2D_;
0125   MonitorElement* rctBitMatchedTauVeto2D_;
0126   MonitorElement* rctBitUnmatchedEmulTauVeto2D_;
0127   MonitorElement* rctBitUnmatchedDataTauVeto2D_;
0128   MonitorElement* rctBitTauVetoEff2D_;
0129   MonitorElement* rctBitTauVetoIneff2D_;
0130   MonitorElement* rctBitTauVetoOvereff2D_;
0131   MonitorElement* rctBitEmulMip2D_;
0132   MonitorElement* rctBitDataMip2D_;
0133   MonitorElement* rctBitMatchedMip2D_;
0134   MonitorElement* rctBitUnmatchedEmulMip2D_;
0135   MonitorElement* rctBitUnmatchedDataMip2D_;
0136   MonitorElement* rctBitMipEff2D_;
0137   MonitorElement* rctBitMipIneff2D_;
0138   MonitorElement* rctBitMipOvereff2D_;
0139   MonitorElement* rctBitEmulQuiet2D_;
0140   MonitorElement* rctBitDataQuiet2D_;
0141   MonitorElement* rctBitMatchedQuiet2D_;
0142   MonitorElement* rctBitUnmatchedEmulQuiet2D_;
0143   MonitorElement* rctBitUnmatchedDataQuiet2D_;
0144   // QUIETBIT: To add quiet bit information, uncomment following 3 lines:
0145   // MonitorElement *rctBitQuietEff2D_;
0146   // MonitorElement *rctBitQuietIneff2D_;
0147   // MonitorElement *rctBitQuietOvereff2D_;
0148   MonitorElement* rctBitEmulHfPlusTau2D_;
0149   MonitorElement* rctBitDataHfPlusTau2D_;
0150   MonitorElement* rctBitMatchedHfPlusTau2D_;
0151   MonitorElement* rctBitUnmatchedEmulHfPlusTau2D_;
0152   MonitorElement* rctBitUnmatchedDataHfPlusTau2D_;
0153   MonitorElement* rctBitHfPlusTauEff2D_;
0154   MonitorElement* rctBitHfPlusTauIneff2D_;
0155   MonitorElement* rctBitHfPlusTauOvereff2D_;
0156 
0157   // end bit information
0158 
0159   MonitorElement* rctInputTPGEcalOcc_;
0160   MonitorElement* rctInputTPGEcalOccNoCut_;
0161   MonitorElement* rctInputTPGEcalRank_;
0162   MonitorElement* rctInputTPGHcalOcc_;
0163   MonitorElement* rctInputTPGHcalRank_;
0164   MonitorElement* rctInputTPGHcalSample_;
0165 
0166   MonitorElement* rctIsoEmDataOcc_;
0167   MonitorElement* rctIsoEmEmulOcc_;
0168   MonitorElement* rctIsoEmEff1Occ_;
0169   MonitorElement* rctIsoEmEff2Occ_;
0170   MonitorElement* rctIsoEmIneff2Occ_;
0171   MonitorElement* rctIsoEmIneffOcc_;
0172   MonitorElement* rctIsoEmOvereffOcc_;
0173   MonitorElement* rctIsoEmEff1_;
0174   MonitorElement* rctIsoEmEff2_;
0175   MonitorElement* rctIsoEmIneff2_;
0176   MonitorElement* rctIsoEmIneff_;
0177   MonitorElement* rctIsoEmOvereff_;
0178 
0179   MonitorElement* rctIsoEmDataOcc1D_;
0180   MonitorElement* rctIsoEmEmulOcc1D_;
0181   MonitorElement* rctIsoEmEff1Occ1D_;
0182   MonitorElement* rctIsoEmEff2Occ1D_;
0183   MonitorElement* rctIsoEmIneff2Occ1D_;
0184   MonitorElement* rctIsoEmIneffOcc1D_;
0185   MonitorElement* rctIsoEmOvereffOcc1D_;
0186   MonitorElement* rctIsoEmEff1oneD_;
0187   MonitorElement* rctIsoEmEff2oneD_;
0188   MonitorElement* rctIsoEmIneff2oneD_;
0189   MonitorElement* rctIsoEmIneff1D_;
0190   MonitorElement* rctIsoEmOvereff1D_;
0191 
0192   MonitorElement* rctIsoEmBitOn_;
0193   MonitorElement* rctIsoEmBitOff_;
0194   MonitorElement* rctIsoEmBitDiff_;
0195 
0196   MonitorElement* rctNisoEmDataOcc_;
0197   MonitorElement* rctNisoEmEmulOcc_;
0198   MonitorElement* rctNisoEmEff1Occ_;
0199   MonitorElement* rctNisoEmEff2Occ_;
0200   MonitorElement* rctNisoEmIneff2Occ_;
0201   MonitorElement* rctNisoEmIneffOcc_;
0202   MonitorElement* rctNisoEmOvereffOcc_;
0203   MonitorElement* rctNisoEmEff1_;
0204   MonitorElement* rctNisoEmEff2_;
0205   MonitorElement* rctNisoEmIneff2_;
0206   MonitorElement* rctNisoEmIneff_;
0207   MonitorElement* rctNisoEmOvereff_;
0208 
0209   MonitorElement* rctNisoEmDataOcc1D_;
0210   MonitorElement* rctNisoEmEmulOcc1D_;
0211   MonitorElement* rctNisoEmEff1Occ1D_;
0212   MonitorElement* rctNisoEmEff2Occ1D_;
0213   MonitorElement* rctNisoEmIneff2Occ1D_;
0214   MonitorElement* rctNisoEmIneffOcc1D_;
0215   MonitorElement* rctNisoEmOvereffOcc1D_;
0216   MonitorElement* rctNisoEmEff1oneD_;
0217   MonitorElement* rctNisoEmEff2oneD_;
0218   MonitorElement* rctNisoEmIneff2oneD_;
0219   MonitorElement* rctNisoEmIneff1D_;
0220   MonitorElement* rctNisoEmOvereff1D_;
0221 
0222   MonitorElement* rctNIsoEmBitOn_;
0223   MonitorElement* rctNIsoEmBitOff_;
0224   MonitorElement* rctNIsoEmBitDiff_;
0225 
0226   MonitorElement* rctIsoEffChannel_[396];
0227   MonitorElement* rctIsoIneffChannel_[396];
0228   MonitorElement* rctIsoOvereffChannel_[396];
0229 
0230   MonitorElement* rctNisoEffChannel_[396];
0231   MonitorElement* rctNisoIneffChannel_[396];
0232   MonitorElement* rctNisoOvereffChannel_[396];
0233 
0234   // begin region channel information
0235   MonitorElement* rctRegEffChannel_[396];
0236   MonitorElement* rctRegIneffChannel_[396];
0237   MonitorElement* rctRegOvereffChannel_[396];
0238 
0239   //efficiency
0240   MonitorElement* trigEffThresh_;
0241   MonitorElement* trigEffThreshOcc_;
0242   MonitorElement* trigEffTriggThreshOcc_;
0243   MonitorElement* trigEff_[396];
0244   MonitorElement* trigEffOcc_[396];
0245   MonitorElement* trigEffTriggOcc_[396];
0246 
0247   // end region channel information
0248 
0249   //begin fed vector information
0250   static const int crateFED[108];
0251   MonitorElement* fedVectorMonitorRUN_;
0252   MonitorElement* fedVectorMonitorLS_;
0253   ///////////////////////////////
0254 
0255   int nev_;                 // Number of events processed
0256   std::string histFolder_;  // base dqm folder
0257   bool verbose_;
0258   bool singlechannelhistos_;
0259   bool perLSsaving_;  //to avoid nanoDQMIO crashing, driven by  DQMServices/Core/python/DQMStore_cfi.py
0260 
0261   edm::EDGetTokenT<L1CaloRegionCollection> rctSourceEmul_rgnEmul_;
0262   edm::EDGetTokenT<L1CaloEmCollection> rctSourceEmul_emEmul_;
0263   edm::EDGetTokenT<L1CaloRegionCollection> rctSourceData_rgnData_;
0264   edm::EDGetTokenT<L1CaloEmCollection> rctSourceData_emData_;
0265   edm::EDGetTokenT<L1CaloRegionCollection> gctSourceData_rgnData_;
0266   edm::EDGetTokenT<L1CaloEmCollection> gctSourceData_emData_;
0267   edm::EDGetTokenT<EcalTrigPrimDigiCollection> ecalTPGData_;
0268   edm::EDGetTokenT<HcalTrigPrimDigiCollection> hcalTPGData_;
0269   edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> gtDigisLabel_;
0270   edm::ESGetToken<RunInfo, RunInfoRcd> runInfoToken_;
0271   edm::ESGetToken<RunInfo, RunInfoRcd> runInfolumiToken_;
0272   std::string gtEGAlgoName_;  // name of algo to determine EG trigger threshold
0273   int doubleThreshold_;       // value of ET at which to make 2-D eff plot
0274 
0275   /// filter TriggerType
0276   int filterTriggerType_;
0277   int selectBX_;
0278 
0279   std::string dataInputTagName_;
0280 
0281   int trigCount, notrigCount;
0282 
0283 protected:
0284   void DivideME1D(MonitorElement* numerator, MonitorElement* denominator, MonitorElement* result);
0285   void DivideME2D(MonitorElement* numerator, MonitorElement* denominator, MonitorElement* result);
0286 };
0287 
0288 #endif