Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef GlobalTriggerAnalyzer_L1GtAnalyzer_h
0002 #define GlobalTriggerAnalyzer_L1GtAnalyzer_h
0003 
0004 /**
0005  * \class L1GtAnalyzer
0006  * 
0007  * 
0008  * Description: test analyzer to illustrate various methods for L1 GT trigger.
0009  *
0010  * Implementation:
0011  *    <TODO: enter implementation details>
0012  *   
0013  * \author: Vasile Mihai Ghete - HEPHY Vienna
0014  * 
0015  *
0016  */
0017 
0018 // system include files
0019 #include <memory>
0020 #include <string>
0021 
0022 // user include files
0023 
0024 #include "DataFormats/Common/interface/ConditionsInEdm.h"
0025 
0026 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0027 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h"
0028 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMaps.h"
0029 #include "DataFormats/L1GlobalTrigger/interface/L1GtTriggerMenuLite.h"
0030 
0031 #include "FWCore/Framework/interface/Frameworkfwd.h"
0032 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0033 
0034 #include "FWCore/Framework/interface/Event.h"
0035 #include "FWCore/Framework/interface/EventSetup.h"
0036 #include "FWCore/Framework/interface/MakerMacros.h"
0037 
0038 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0039 #include "FWCore/Utilities/interface/EDGetToken.h"
0040 #include "FWCore/Utilities/interface/InputTag.h"
0041 
0042 #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1GtUtils.h"
0043 #include "L1Trigger/GlobalTriggerAnalyzer/interface/L1RetrieveL1Extra.h"
0044 
0045 // class declaration
0046 
0047 class L1GtAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one::WatchLuminosityBlocks> {
0048 public:
0049   explicit L1GtAnalyzer(const edm::ParameterSet&);
0050   ~L1GtAnalyzer() override;
0051 
0052 private:
0053   void beginJob() override;
0054   void beginRun(const edm::Run&, const edm::EventSetup&) override;
0055   void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override;
0056 
0057   /// analyze: decision and decision word
0058   ///   bunch cross in event BxInEvent = 0 - L1Accept event
0059   virtual void analyzeDecisionReadoutRecord(const edm::Event&, const edm::EventSetup&);
0060 
0061   /// analyze: usage of L1GtUtils
0062   void analyzeL1GtUtilsCore(const edm::Event&, const edm::EventSetup&);
0063   ///   for tests, use only one of the following methods
0064   void analyzeL1GtUtilsMenuLite(const edm::Event&, const edm::EventSetup&);
0065   void analyzeL1GtUtilsEventSetup(const edm::Event&, const edm::EventSetup&);
0066   void analyzeL1GtUtils(const edm::Event&, const edm::EventSetup&);
0067 
0068   /// full analysis of an algorithm or technical trigger
0069   void analyzeTrigger(const edm::Event&, const edm::EventSetup&);
0070 
0071   /// analyze: object map product
0072   virtual void analyzeObjectMap(const edm::Event&, const edm::EventSetup&);
0073 
0074   /// analyze: usage of L1GtTriggerMenuLite
0075   void analyzeL1GtTriggerMenuLite(const edm::Event&, const edm::EventSetup&);
0076 
0077   /// analyze: usage of ConditionsInEdm
0078   ///
0079   /// to be used in beginRun
0080   void analyzeConditionsInRunBlock(const edm::Run&, const edm::EventSetup&);
0081   /// to be used in beginLuminosityBlock
0082   void analyzeConditionsInLumiBlock(const edm::LuminosityBlock&, const edm::EventSetup&);
0083   /// to be used in analyze/produce/filter
0084   void analyzeConditionsInEventBlock(const edm::Event&, const edm::EventSetup&);
0085 
0086   /// print the output stream to the required output, given by m_printOutput
0087   void printOutput(std::ostringstream&);
0088 
0089   /// analyze each event: event loop over various code snippets
0090   void analyze(const edm::Event&, const edm::EventSetup&) override;
0091 
0092   /// end section
0093   void endLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override;
0094   void endRun(const edm::Run&, const edm::EventSetup&) override;
0095 
0096   /// end of job
0097   void endJob() override;
0098 
0099 private:
0100   // L1Extra collections
0101   L1RetrieveL1Extra m_retrieveL1Extra;
0102 
0103   /// print output
0104   int m_printOutput;
0105 
0106   /// enable / disable various analysis methods
0107   bool m_analyzeDecisionReadoutRecordEnable;
0108   //
0109   bool m_analyzeL1GtUtilsMenuLiteEnable;
0110   bool m_analyzeL1GtUtilsEventSetupEnable;
0111   bool m_analyzeL1GtUtilsEnable;
0112   bool m_analyzeTriggerEnable;
0113   //
0114   bool m_analyzeObjectMapEnable;
0115   //
0116   bool m_analyzeL1GtTriggerMenuLiteEnable;
0117   //
0118   bool m_analyzeConditionsInRunBlockEnable;
0119   bool m_analyzeConditionsInLumiBlockEnable;
0120   bool m_analyzeConditionsInEventBlockEnable;
0121 
0122 private:
0123   /// input tags for GT DAQ product
0124   edm::InputTag m_l1GtDaqReadoutRecordInputTag;
0125   edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_l1GtDaqReadoutRecordToken;
0126 
0127   /// input tags for GT lite product
0128   edm::InputTag m_l1GtRecordInputTag;
0129 
0130   /// input tags for GT object map collection L1GlobalTriggerObjectMapRecord
0131   edm::InputTag m_l1GtObjectMapTag;
0132   edm::EDGetTokenT<L1GlobalTriggerObjectMapRecord> m_l1GtObjectMapToken;
0133 
0134   /// input tags for GT object map collection L1GlobalTriggerObjectMaps
0135   edm::InputTag m_l1GtObjectMapsInputTag;
0136   edm::EDGetTokenT<L1GlobalTriggerObjectMaps> m_l1GtObjectMapsToken;
0137 
0138   /// input tag for muon collection from GMT
0139   edm::InputTag m_l1GmtInputTag;
0140 
0141   /// input tag for L1GtTriggerMenuLite
0142   edm::InputTag m_l1GtTmLInputTag;
0143   edm::EDGetTokenT<L1GtTriggerMenuLite> m_l1GtTmLToken;
0144 
0145   /// input tag for ConditionInEdm products
0146   edm::InputTag m_condInEdmInputTag;
0147   edm::EDGetTokenT<edm::ConditionsInRunBlock> m_condInRunToken;
0148   edm::EDGetTokenT<edm::ConditionsInLumiBlock> m_condInLumiToken;
0149   edm::EDGetTokenT<edm::ConditionsInEventBlock> m_condInEventToken;
0150 
0151   /// an algorithm trigger (name or alias) or a technical trigger name
0152   std::string m_nameAlgTechTrig;
0153 
0154   /// a condition in the algorithm trigger to test the object maps
0155   std::string m_condName;
0156 
0157   /// a bit number to retrieve the name and the alias
0158   unsigned int m_bitNumber;
0159 
0160   /// L1 configuration code for L1GtUtils
0161   unsigned int m_l1GtUtilsConfiguration;
0162 
0163   /// if true, use methods in L1GtUtils with the input tag for L1GtTriggerMenuLite
0164   /// from provenance
0165   bool m_l1GtTmLInputTagProv;
0166 
0167   /// if true, use methods in L1GtUtils with the given input tags
0168   /// for L1GlobalTriggerReadoutRecord and / or L1GlobalTriggerRecord from provenance
0169   bool m_l1GtRecordsInputTagProv;
0170 
0171   /// if true, configure (partially) L1GtUtils in beginRun using getL1GtRunCache
0172   bool m_l1GtUtilsConfigureBeginRun;
0173 
0174   /// expression to test the L1GtUtils methods to retrieve L1 trigger decisions,
0175   ///   prescale factors and masks for logical expressions
0176   std::string m_l1GtUtilsLogicalExpression;
0177 
0178 private:
0179   L1GtUtils m_l1GtUtilsProv;
0180   L1GtUtils m_l1GtUtils;
0181   L1GtUtils::LogicalExpressionL1Results m_logicalExpressionL1ResultsProv;
0182   L1GtUtils::LogicalExpressionL1Results m_logicalExpressionL1Results;
0183 };
0184 
0185 #endif /*GlobalTriggerAnalyzer_L1GtAnalyzer_h*/