Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:59

0001 #ifndef GlobalTrigger_L1GlobalTrigger_h
0002 #define GlobalTrigger_L1GlobalTrigger_h
0003 
0004 /**
0005  * \class L1GlobalTrigger
0006  *
0007  *
0008  * Description: L1 Global Trigger producer.
0009  *
0010  * Implementation:
0011  *    <TODO: enter implementation details>
0012  *
0013  * \author: Vasile Mihai Ghete - HEPHY Vienna
0014  *
0015  *
0016  * The CMSSW implementation of the L1 Global Trigger emulator
0017  * uses concepts and code from the ORCA L1 Global Trigger simulation,
0018  * authors: N. Neumeister, M. Fierro, M. Eder  - HEPHY Vienna.
0019  *
0020  */
0021 
0022 // system include files
0023 #include <string>
0024 #include <vector>
0025 
0026 // user include files
0027 
0028 #include "CondFormats/L1TObjects/interface/L1GtBoard.h"
0029 #include "CondFormats/L1TObjects/interface/L1GtFwd.h"
0030 
0031 #include "FWCore/Framework/interface/Frameworkfwd.h"
0032 #include "FWCore/Framework/interface/stream/EDProducer.h"
0033 
0034 #include "FWCore/Framework/interface/Event.h"
0035 #include "FWCore/Framework/interface/EventSetup.h"
0036 
0037 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0038 #include "FWCore/Utilities/interface/InputTag.h"
0039 #include "FWCore/Utilities/interface/ESGetToken.h"
0040 
0041 #include "CondFormats/DataRecord/interface/L1GtStableParametersRcd.h"
0042 #include "CondFormats/L1TObjects/interface/L1GtStableParameters.h"
0043 
0044 #include "CondFormats/DataRecord/interface/L1GtParametersRcd.h"
0045 #include "CondFormats/L1TObjects/interface/L1GtParameters.h"
0046 
0047 #include "CondFormats/DataRecord/interface/L1GtBoardMapsRcd.h"
0048 #include "CondFormats/L1TObjects/interface/L1GtBoard.h"
0049 #include "CondFormats/L1TObjects/interface/L1GtBoardMaps.h"
0050 #include "CondFormats/L1TObjects/interface/L1GtFwd.h"
0051 
0052 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsAlgoTrigRcd.h"
0053 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsTechTrigRcd.h"
0054 #include "CondFormats/L1TObjects/interface/L1GtPrescaleFactors.h"
0055 
0056 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
0057 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h"
0058 #include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h"
0059 
0060 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskVetoAlgoTrigRcd.h"
0061 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskVetoTechTrigRcd.h"
0062 
0063 #include <cstdint>
0064 
0065 // forward classes
0066 class L1GlobalTriggerPSB;
0067 class L1GlobalTriggerGTL;
0068 class L1GlobalTriggerFDL;
0069 
0070 class L1GtStableParameters;
0071 class L1GtParameters;
0072 class L1GtBoardMaps;
0073 
0074 class L1GtPrescaleFactors;
0075 class L1GtTriggerMask;
0076 
0077 // class declaration
0078 class L1GlobalTrigger : public edm::stream::EDProducer<> {
0079 public:
0080   explicit L1GlobalTrigger(const edm::ParameterSet &);
0081   ~L1GlobalTrigger() override;
0082 
0083   void produce(edm::Event &, const edm::EventSetup &) override;
0084 
0085   // return pointer to PSB
0086   inline const L1GlobalTriggerPSB *gtPSB() const { return m_gtPSB; }
0087 
0088   // return pointer to GTL
0089   inline const L1GlobalTriggerGTL *gtGTL() const { return m_gtGTL; }
0090 
0091   // return pointer to FDL
0092   inline const L1GlobalTriggerFDL *gtFDL() const { return m_gtFDL; }
0093 
0094 private:
0095   /// cached stuff
0096 
0097   /// stable parameters
0098   const L1GtStableParameters *m_l1GtStablePar;
0099   unsigned long long m_l1GtStableParCacheID;
0100 
0101   /// number of physics triggers
0102   unsigned int m_numberPhysTriggers;
0103 
0104   /// number of technical triggers
0105   unsigned int m_numberTechnicalTriggers;
0106 
0107   /// number of DAQ partitions
0108   unsigned int m_numberDaqPartitions;
0109 
0110   /// number of objects of each type
0111   ///    { Mu, NoIsoEG, IsoEG, CenJet, ForJet, TauJet, ETM, ETT, HTT, JetCounts
0112   ///    };
0113   int m_nrL1Mu;
0114 
0115   int m_nrL1NoIsoEG;
0116   int m_nrL1IsoEG;
0117 
0118   int m_nrL1CenJet;
0119   int m_nrL1ForJet;
0120   int m_nrL1TauJet;
0121 
0122   int m_nrL1JetCounts;
0123 
0124   // ... the rest of the objects are global
0125 
0126   int m_ifMuEtaNumberBits;
0127   int m_ifCaloEtaNumberBits;
0128 
0129   /// parameters
0130   const L1GtParameters *m_l1GtPar;
0131   unsigned long long m_l1GtParCacheID;
0132 
0133   ///    total number of Bx's in the event coming from EventSetup
0134   int m_totalBxInEvent;
0135 
0136   ///    active boards in L1 GT DAQ record and in L1 GT EVM record
0137   uint16_t m_activeBoardsGtDaq;
0138   uint16_t m_activeBoardsGtEvm;
0139 
0140   /// length of BST record (in bytes) from event setup
0141   unsigned int m_bstLengthBytes;
0142 
0143   /// board maps - cache only the record
0144   const L1GtBoardMaps *m_l1GtBM;
0145   unsigned long long m_l1GtBMCacheID;
0146 
0147   /// prescale factors
0148   const L1GtPrescaleFactors *m_l1GtPfAlgo;
0149   unsigned long long m_l1GtPfAlgoCacheID;
0150 
0151   const L1GtPrescaleFactors *m_l1GtPfTech;
0152   unsigned long long m_l1GtPfTechCacheID;
0153 
0154   const std::vector<std::vector<int>> *m_prescaleFactorsAlgoTrig;
0155   const std::vector<std::vector<int>> *m_prescaleFactorsTechTrig;
0156 
0157   /// trigger masks & veto masks
0158   const L1GtTriggerMask *m_l1GtTmAlgo;
0159   unsigned long long m_l1GtTmAlgoCacheID;
0160 
0161   const L1GtTriggerMask *m_l1GtTmTech;
0162   unsigned long long m_l1GtTmTechCacheID;
0163 
0164   const L1GtTriggerMask *m_l1GtTmVetoAlgo;
0165   unsigned long long m_l1GtTmVetoAlgoCacheID;
0166 
0167   const L1GtTriggerMask *m_l1GtTmVetoTech;
0168   unsigned long long m_l1GtTmVetoTechCacheID;
0169 
0170   std::vector<unsigned int> m_triggerMaskAlgoTrig;
0171   std::vector<unsigned int> m_triggerMaskTechTrig;
0172 
0173   std::vector<unsigned int> m_triggerMaskVetoAlgoTrig;
0174   std::vector<unsigned int> m_triggerMaskVetoTechTrig;
0175 
0176   L1GlobalTriggerPSB *m_gtPSB;
0177   L1GlobalTriggerGTL *m_gtGTL;
0178   L1GlobalTriggerFDL *m_gtFDL;
0179 
0180   /// input tag for muon collection from GMT
0181   const edm::InputTag m_muGmtInputTag;
0182 
0183   /// input tag for calorimeter collections from GCT
0184   const edm::InputTag m_caloGctInputTag;
0185 
0186   /// input tag for CASTOR record
0187   const edm::InputTag m_castorInputTag;
0188 
0189   /// input tag for technical triggers
0190   const std::vector<edm::InputTag> m_technicalTriggersInputTags;
0191 
0192   /// logical flag to produce the L1 GT DAQ readout record
0193   const bool m_produceL1GtDaqRecord;
0194 
0195   /// logical flag to produce the L1 GT EVM readout record
0196   const bool m_produceL1GtEvmRecord;
0197 
0198   /// logical flag to produce the L1 GT object map record
0199   const bool m_produceL1GtObjectMapRecord;
0200 
0201   /// logical flag to write the PSB content in the  L1 GT DAQ record
0202   const bool m_writePsbL1GtDaqRecord;
0203 
0204   /// logical flag to read the technical trigger records
0205   const bool m_readTechnicalTriggerRecords;
0206 
0207   /// number of "bunch crossing in the event" (BxInEvent) to be emulated
0208   /// symmetric around L1Accept (BxInEvent = 0):
0209   ///    1 (BxInEvent = 0); 3 (F 0 1) (standard record); 5 (E F 0 1 2) (debug
0210   ///    record)
0211   /// even numbers (except 0) "rounded" to the nearest lower odd number
0212   int m_emulateBxInEvent;
0213 
0214   /// number of BXs in the event corresponding to alternative 0 and 1 in
0215   /// altNrBxBoard() EmulateBxInEvent >= max(RecordLength[0], RecordLength[1])
0216   /// negative values: take the numbers from event setup, from L1GtParameters
0217   const std::vector<int> m_recordLength;
0218 
0219   /// alternative for number of BX per active board in GT DAQ record: 0 or 1
0220   /// the position is identical with the active board bit
0221   const unsigned int m_alternativeNrBxBoardDaq;
0222 
0223   /// alternative for number of BX per active board in GT EVM record: 0 or 1
0224   /// the position is identical with the active board bit
0225   const unsigned int m_alternativeNrBxBoardEvm;
0226 
0227   /// length of BST record (in bytes) from parameter set
0228   const int m_psBstLengthBytes;
0229 
0230   /// run algorithm triggers
0231   ///     if true, unprescaled (all prescale factors 1)
0232   ///     will overwrite the event setup
0233   const bool m_algorithmTriggersUnprescaled;
0234 
0235   ///     if true, unmasked - all enabled (all trigger masks set to 0)
0236   ///     will overwrite the event setup
0237   const bool m_algorithmTriggersUnmasked;
0238 
0239   /// run technical triggers
0240   ///     if true, unprescaled (all prescale factors 1)
0241   ///     will overwrite the event setup
0242   const bool m_technicalTriggersUnprescaled;
0243 
0244   ///     if true, unmasked - all enabled (all trigger masks set to 0)
0245   ///     will overwrite the event setup
0246   const bool m_technicalTriggersUnmasked;
0247 
0248   ///     if true, veto unmasked - all enabled (all trigger veto masks set to 0)
0249   ///     will overwrite the event setup
0250   const bool m_technicalTriggersVetoUnmasked;
0251 
0252   /// verbosity level
0253   const int m_verbosity;
0254   const bool m_isDebugEnabled;
0255 
0256   /// EventSetup Tokens
0257   edm::ESGetToken<L1GtStableParameters, L1GtStableParametersRcd> m_l1GtStableParToken;
0258   edm::ESGetToken<L1GtParameters, L1GtParametersRcd> m_l1GtParToken;
0259   edm::ESGetToken<L1GtBoardMaps, L1GtBoardMapsRcd> m_l1GtBMToken;
0260   edm::ESGetToken<L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd> m_l1GtPfAlgoToken;
0261   edm::ESGetToken<L1GtPrescaleFactors, L1GtPrescaleFactorsTechTrigRcd> m_l1GtPfTechToken;
0262   edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd> m_l1GtTmAlgoToken;
0263   edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd> m_l1GtTmTechToken;
0264   edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskVetoAlgoTrigRcd> m_l1GtTmVetoAlgoToken;
0265   edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskVetoTechTrigRcd> m_l1GtTmVetoTechToken;
0266 };
0267 
0268 #endif /*GlobalTrigger_L1GlobalTrigger_h*/