Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-25 23:59:51

0001 #ifndef HLTfilters_HLTLevel1GTSeed_h
0002 #define HLTfilters_HLTLevel1GTSeed_h
0003 
0004 /**
0005  * \class HLTLevel1GTSeed
0006  *
0007  *
0008  * Description: filter L1 bits and extract seed objects from L1 GT for HLT algorithms.
0009  *
0010  * Implementation:
0011  *    This class is an HLTStreamFilter (-> stream::EDFilter). It implements:
0012  *      - filtering on Level-1 bits, given via a logical expression of algorithm names
0013  *      - extraction of the seed objects from L1 GT object map record
0014  *
0015  * \author: Vasile Mihai Ghete - HEPHY Vienna
0016  *
0017  *
0018  */
0019 
0020 // system include files
0021 #include <string>
0022 #include <vector>
0023 
0024 // user include files
0025 #include "FWCore/Utilities/interface/InputTag.h"
0026 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
0027 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskAlgoTrigRcd.h"
0028 #include "CondFormats/DataRecord/interface/L1GtTriggerMaskTechTrigRcd.h"
0029 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
0030 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h"
0031 #include "CondFormats/L1TObjects/interface/L1GtTriggerMask.h"
0032 #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
0033 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0034 #include "DataFormats/L1GlobalTrigger/interface/L1GtLogicParser.h"
0035 #include "HLTrigger/HLTcore/interface/HLTStreamFilter.h"
0036 
0037 // forward declarations
0038 class L1GlobalTriggerReadoutRecord;
0039 class L1GlobalTriggerObjectMapRecord;
0040 namespace edm {
0041   class ConfigurationDescriptions;
0042 }
0043 
0044 #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
0045 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
0046 #include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h"
0047 #include "DataFormats/L1Trigger/interface/L1EtMissParticleFwd.h"
0048 
0049 // class declaration
0050 class HLTLevel1GTSeed : public HLTStreamFilter {
0051 public:
0052   /// constructor
0053   explicit HLTLevel1GTSeed(const edm::ParameterSet &);
0054 
0055   /// destructor
0056   ~HLTLevel1GTSeed() override;
0057 
0058   /// parameter description
0059   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0060 
0061   /// filter the event
0062   bool hltFilter(edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) override;
0063 
0064 private:
0065   /// get the vector of object types for a condition cndName on the GTL chip chipNumber
0066   const std::vector<L1GtObject> *objectTypeVec(const int chipNumber, const std::string &cndName) const;
0067 
0068   /// update the tokenNumber (holding the bit numbers) from m_l1AlgoLogicParser
0069   /// for a new L1 Trigger menu
0070   void updateAlgoLogicParser(const L1GtTriggerMenu *, const AlgorithmMap &);
0071 
0072   /// update the tokenResult members from m_l1AlgoLogicParser
0073   /// for a new event
0074   void updateAlgoLogicParser(const std::vector<bool> &gtWord,
0075                              const std::vector<unsigned int> &triggerMask,
0076                              const int physicsDaqPartition);
0077 
0078   /// for seeding via technical triggers, convert the "name" to tokenNumber
0079   /// (seeding via bit numbers) - done once in constructor
0080   void convertStringToBitNumber();
0081 
0082   /// debug print grouped in a single function
0083   /// can be called for a new menu (bool "true") or for a new event
0084   void debugPrint(bool) const;
0085 
0086   /// seeding is done via L1 trigger object maps, considering the objects which fired in L1
0087   bool seedsL1TriggerObjectMaps(edm::Event &,
0088                                 trigger::TriggerFilterObjectWithRefs &,
0089                                 const L1GtTriggerMask *,
0090                                 const L1GlobalTriggerReadoutRecord *,
0091                                 const int physicsDaqPartition);
0092 
0093   /// seeding is done ignoring if a L1 object fired or not
0094   /// if the event is selected at L1, fill all the L1 objects of types corresponding to the
0095   /// L1 conditions from the seeding logical expression for bunch crosses F, 0, 1
0096   /// directly from L1Extra and use them as seeds at HLT
0097   /// method and filter return true if at least an object is filled
0098   bool seedsL1Extra(edm::Event &, trigger::TriggerFilterObjectWithRefs &) const;
0099 
0100   /// detailed print of filter content
0101   void dumpTriggerFilterObjectWithRefs(trigger::TriggerFilterObjectWithRefs &) const;
0102 
0103 private:
0104   // cached stuff
0105 
0106   /// trigger menu
0107   const L1GtTriggerMenu *m_l1GtMenu;
0108   unsigned long long m_l1GtMenuCacheID;
0109 
0110   // trigger records
0111   edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> const m_l1GtTriggerMenuToken;
0112   edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd> const m_l1GtTriggerMaskAlgoTrigRcdToken;
0113   edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd> const m_l1GtTriggerMaskTechTrigRcdToken;
0114 
0115   /// logic parser for m_l1SeedsLogicalExpression
0116   L1GtLogicParser m_l1AlgoLogicParser;
0117 
0118   /// list of required algorithms for seeding
0119   std::vector<L1GtLogicParser::OperandToken> m_l1AlgoSeeds;
0120 
0121   /// vector of Rpn vectors for the required algorithms for seeding
0122   std::vector<const std::vector<L1GtLogicParser::TokenRPN> *> m_l1AlgoSeedsRpn;
0123 
0124   /// vector of object-type vectors for each condition in the required algorithms for seeding
0125   std::vector<std::vector<const std::vector<L1GtObject> *> > m_l1AlgoSeedsObjType;
0126 
0127 private:
0128   /// if true:
0129   ///    seeding done via L1 trigger object maps, with objects that fired
0130   ///    only objects from the central BxInEvent (L1A) are used
0131   /// if false:
0132   ///    seeding is done ignoring if a L1 object fired or not,
0133   ///    adding all L1EXtra objects corresponding to the object types
0134   ///    used in all conditions from the algorithms in logical expression
0135   ///    for a given number of BxInEvent
0136   bool m_l1UseL1TriggerObjectMaps;
0137 
0138   /// option used forL1UseL1TriggerObjectMaps = False only
0139   /// number of BxInEvent: 1: L1A=0; 3: -1, L1A=0, 1; 5: -2, -1, L1A=0, 1, 2
0140   int m_l1NrBxInEvent;
0141 
0142   /// seeding done via technical trigger bits, if value is "true"
0143   bool m_l1TechTriggerSeeding;
0144 
0145   /// seeding uses algorithm aliases instead of algorithm names, if value is "true"
0146   bool m_l1UseAliasesForSeeding;
0147 
0148   /// logical expression for the required L1 algorithms
0149   /// the algorithms are specified by name
0150   std::string m_l1SeedsLogicalExpression;
0151 
0152   /// InputTag for the L1 Global Trigger DAQ readout record
0153   edm::InputTag m_l1GtReadoutRecordTag;
0154   edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> m_l1GtReadoutRecordToken;
0155 
0156   /// InputTag for L1 Global Trigger object maps
0157   edm::InputTag m_l1GtObjectMapTag;
0158   edm::EDGetTokenT<L1GlobalTriggerObjectMapRecord> m_l1GtObjectMapToken;
0159 
0160   /// Meta InputTag for L1 particle collections (except muon)
0161   edm::InputTag m_l1CollectionsTag;
0162 
0163   /// Meta InputTag for L1 muon collection
0164   edm::InputTag m_l1MuonCollectionTag;
0165 
0166   /// cached InputTags
0167   edm::InputTag m_l1ExtraTag;
0168   edm::InputTag m_l1MuonTag;
0169   edm::EDGetTokenT<l1extra::L1MuonParticleCollection> m_l1MuonToken;
0170   edm::InputTag m_l1IsoEGTag;
0171   edm::EDGetTokenT<l1extra::L1EmParticleCollection> m_l1IsoEGToken;
0172   edm::InputTag m_l1NoIsoEGTag;
0173   edm::EDGetTokenT<l1extra::L1EmParticleCollection> m_l1NoIsoEGToken;
0174   edm::InputTag m_l1CenJetTag;
0175   edm::EDGetTokenT<l1extra::L1JetParticleCollection> m_l1CenJetToken;
0176   edm::InputTag m_l1ForJetTag;
0177   edm::EDGetTokenT<l1extra::L1JetParticleCollection> m_l1ForJetToken;
0178   edm::InputTag m_l1TauJetTag;
0179   edm::EDGetTokenT<l1extra::L1JetParticleCollection> m_l1TauJetToken;
0180   edm::InputTag m_l1IsoTauJetTag;
0181   edm::EDGetTokenT<l1extra::L1JetParticleCollection> m_l1IsoTauJetToken;
0182   edm::InputTag m_l1EtMissMETTag;
0183   edm::EDGetTokenT<l1extra::L1EtMissParticleCollection> m_l1EtMissMETToken;
0184   edm::InputTag m_l1EtMissMHTTag;
0185   edm::EDGetTokenT<l1extra::L1EtMissParticleCollection> m_l1EtMissMHTToken;
0186 
0187   /// replace string "L1GlobalDecision" with bool to speed up the "if"
0188   bool m_l1GlobalDecision;
0189 
0190   /// cache edm::isDebugEnabled()
0191   bool m_isDebugEnabled;
0192 };
0193 
0194 #endif  // HLTfilters_HLTLevel1GTSeed_h