Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:01

0001 #ifndef GlobalTriggerAnalyzer_L1GtDataEmulAnalyzer_h
0002 #define GlobalTriggerAnalyzer_L1GtDataEmulAnalyzer_h
0003 
0004 /**
0005  * \class L1GtDataEmulAnalyzer
0006  * 
0007  * 
0008  * Description: compare hardware records with emulator records for L1 GT record.  
0009  *
0010  * Implementation:
0011  *    Get the L1 GT records from data and from emulator.   
0012  *    Compare every board between data and emulator.
0013  *   
0014  * \author: Vasile Mihai Ghete - HEPHY Vienna
0015  * 
0016  *
0017  */
0018 
0019 // system include files
0020 #include <memory>
0021 #include <string>
0022 
0023 // user include files
0024 #include "FWCore/Framework/interface/Frameworkfwd.h"
0025 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0026 
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/MakerMacros.h"
0029 
0030 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0031 #include "FWCore/Utilities/interface/InputTag.h"
0032 
0033 // forward declarations
0034 class L1GtfeWord;
0035 class L1GtFdlWord;
0036 class L1GtPsbWord;
0037 class L1TcsWord;
0038 class L1GtTriggerMenu;
0039 class L1GtTriggerMask;
0040 class L1GtTriggerMenuRcd;
0041 class L1GtTriggerMaskAlgoTrigRcd;
0042 class L1GtTriggerMaskTechTrigRcd;
0043 
0044 class TH1F;
0045 class TH1D;
0046 class TH2D;
0047 class TTree;
0048 
0049 // class declaration
0050 
0051 class L1GtDataEmulAnalyzer : public edm::one::EDAnalyzer<edm::one::SharedResources> {
0052 public:
0053   explicit L1GtDataEmulAnalyzer(const edm::ParameterSet&);
0054   ~L1GtDataEmulAnalyzer() override;
0055 
0056 private:
0057   void beginJob() override;
0058 
0059   /// compare the GTFE board
0060   virtual void compareGTFE(const edm::Event&, const edm::EventSetup&, const L1GtfeWord&, const L1GtfeWord&);
0061 
0062   /// compare the FDL board
0063   virtual void compareFDL(const edm::Event&, const edm::EventSetup&, const L1GtFdlWord&, const L1GtFdlWord&, const int);
0064 
0065   /// compare the PSB board
0066   virtual void comparePSB(const edm::Event&, const edm::EventSetup&, const L1GtPsbWord&, const L1GtPsbWord&);
0067 
0068   /// compare the TCS board
0069   virtual void compareTCS(const edm::Event&, const edm::EventSetup&, const L1TcsWord&, const L1TcsWord&);
0070 
0071   /// L1 GT DAQ record comparison
0072   virtual void compareDaqRecord(const edm::Event&, const edm::EventSetup&);
0073 
0074   /// L1 GT EVM record comparison
0075   virtual void compareEvmRecord(const edm::Event&, const edm::EventSetup&);
0076 
0077   /// compare the GCT collections obtained from L1 GT PSB with the input
0078   /// GCT collections
0079   virtual void compareGt_Gct(const edm::Event&, const edm::EventSetup&);
0080 
0081   /// analyze each event
0082   void analyze(const edm::Event&, const edm::EventSetup&) override;
0083 
0084   /// book all histograms for the module
0085   void bookHistograms();
0086 
0087   /// end of job
0088   void endJob() override;
0089 
0090 private:
0091   /// input tag for the L1 GT hardware DAQ/EVM record
0092   edm::InputTag m_l1GtDataInputTag;
0093 
0094   /// input tag for the L1 GT emulator DAQ/EVM record
0095   edm::InputTag m_l1GtEmulInputTag;
0096 
0097   /// input tag for the L1 GCT hardware record
0098   edm::InputTag m_l1GctDataInputTag;
0099 
0100 private:
0101   /// an output stream to print into
0102   /// it can then be directed to whatever log level is desired
0103   std::ostringstream m_myCoutStream;
0104 
0105   /// counters
0106   int m_nrDataEventError;
0107   int m_nrEmulEventError;
0108 
0109   // cached stuff
0110 
0111   /// trigger menu
0112   const L1GtTriggerMenu* m_l1GtMenu;
0113   unsigned long long m_l1GtMenuCacheID;
0114 
0115   /// trigger masks
0116   const L1GtTriggerMask* m_l1GtTmAlgo;
0117   unsigned long long m_l1GtTmAlgoCacheID;
0118 
0119   const L1GtTriggerMask* m_l1GtTmTech;
0120   unsigned long long m_l1GtTmTechCacheID;
0121 
0122   std::vector<unsigned int> m_triggerMaskAlgoTrig;
0123   std::vector<unsigned int> m_triggerMaskTechTrig;
0124 
0125 private:
0126   /// histograms
0127 
0128   /// GTFE
0129   TH1F* m_gtfeDataEmul;
0130 
0131   static constexpr int TotalBxInEvent = 5;
0132 
0133   /// FDL (0 for DAQ, 1 for EVM record)
0134   TH1F* m_fdlDataEmul[TotalBxInEvent][2];
0135 
0136   TH1F* m_fdlDataAlgoDecision[TotalBxInEvent][2];
0137   TH1F* m_fdlEmulAlgoDecision[TotalBxInEvent][2];
0138 
0139   TH1F* m_fdlDataAlgoDecisionMask[TotalBxInEvent][2];
0140   TH1F* m_fdlEmulAlgoDecisionMask[TotalBxInEvent][2];
0141 
0142   TH1F* m_fdlDataEmulAlgoDecision[TotalBxInEvent][2];
0143   TH1F* m_fdlDataEmulAlgoDecisionMask[TotalBxInEvent][2];
0144 
0145   TH1F* m_fdlDataTechDecision[TotalBxInEvent][2];
0146   TH1F* m_fdlEmulTechDecision[TotalBxInEvent][2];
0147 
0148   TH1F* m_fdlDataTechDecisionMask[TotalBxInEvent][2];
0149   TH1F* m_fdlEmulTechDecisionMask[TotalBxInEvent][2];
0150 
0151   TH1F* m_fdlDataEmulTechDecision[TotalBxInEvent][2];
0152   TH1F* m_fdlDataEmulTechDecisionMask[TotalBxInEvent][2];
0153 
0154   TH1F* m_fdlDataEmul_Err[2];
0155 
0156   TH1F* m_fdlDataAlgoDecision_Err[2];
0157   TH1F* m_fdlEmulAlgoDecision_Err[2];
0158   TH1F* m_fdlDataEmulAlgoDecision_Err[2];
0159 
0160   TH1F* m_fdlDataTechDecision_Err[2];
0161   TH1F* m_fdlEmulTechDecision_Err[2];
0162   TH1F* m_fdlDataEmulTechDecision_Err[2];
0163 
0164   /// PSB
0165 
0166   edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> m_l1GtMenuToken;
0167   edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd> m_l1GtTmAlgoToken;
0168   edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd> m_l1GtTmTechToken;
0169 };
0170 
0171 #endif /*GlobalTriggerAnalyzer_L1GtDataEmulAnalyzer_h*/