Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:39:26

0001 #ifndef L1Trigger_L1ParticleMap_h
0002 #define L1Trigger_L1ParticleMap_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     L1Trigger
0006 // Class  :     L1ParticleMap
0007 //
0008 /**\class L1ParticleMap \file L1ParticleMap.h DataFormats/L1Trigger/interface/L1ParticleMap.h \author Werner Sun
0009 
0010  Description: L1Extra class for map between triggers and L1Extra particles.
0011 */
0012 //
0013 // Original Author:  Werner Sun
0014 //         Created:  Fri Jul 14 19:46:30 EDT 2006
0015 // Revision 1.28  2007/08/08 03:49:03  wsun
0016 // Diffractive trigger threshold update from X. Rouby.
0017 //
0018 // Revision 1.27  2007/08/07 01:18:15  wsun
0019 // Added JetMET calibration triggers from Len.
0020 //
0021 // Revision 1.26  2007/07/31 15:20:14  ratnik
0022 // QA campaign: include cleanup based on CMSSW_1_7_X_2007-07-30-1600 includechecker results.
0023 //
0024 // Revision 1.25  2007/07/14 19:03:25  wsun
0025 // Added diffractive triggers from X. Rouby and S. Ovyn.
0026 //
0027 // Revision 1.24  2007/06/16 16:50:03  wsun
0028 // Added SingleTauJet35 and DoubleTauJet35 for 131HLT6.
0029 //
0030 // Revision 1.23  2007/06/15 19:27:31  wsun
0031 // New L1 trigger table for 131HLT6.
0032 //
0033 // Revision 1.22  2007/06/03 00:06:30  wsun
0034 // Revision of L1 trigger table for 131HLT5.
0035 //
0036 // Revision 1.21  2007/06/01 02:57:11  wsun
0037 // New L1 trigger table for 131HLT5.
0038 //
0039 // Revision 1.20  2007/05/23 05:09:09  wsun
0040 // L1 trigger table for 131HLT4.
0041 //
0042 // Revision 1.19  2007/05/15 14:52:40  wsun
0043 // A_Mu3_IsoEG15 -> A_Mu7_IsoEG10
0044 //
0045 // Revision 1.18  2007/05/11 04:59:32  wsun
0046 // Retweaked trigger table.
0047 //
0048 // Revision 1.17  2007/04/30 21:00:39  wsun
0049 // QuadJet50 -> QuadJet20
0050 //
0051 // Revision 1.16  2007/04/23 18:33:31  wsun
0052 // Another iteration of the L1 trigger table.
0053 //
0054 // Revision 1.15  2007/04/22 22:35:47  wsun
0055 // Updated L1 trigger table yet again.
0056 //
0057 // Revision 1.14  2007/04/16 21:15:46  wsun
0058 // Tweaks to trigger table for 131HLT.
0059 //
0060 // Revision 1.13  2007/04/13 17:50:46  wsun
0061 // New trigger table for HLT exercise.
0062 //
0063 // Revision 1.12  2007/04/02 08:03:13  wsun
0064 // Updated Doxygen documentation.
0065 //
0066 // Revision 1.11  2006/08/31 10:23:32  wsun
0067 // Added MinBias trigger.
0068 //
0069 // Revision 1.10  2006/08/28 03:10:40  wsun
0070 // Revamped L1ParticleMap to handle OR triggers.
0071 //
0072 // Revision 1.9  2006/08/23 23:09:04  wsun
0073 // Separated iso/non-iso EM triggers and RefVectors.
0074 //
0075 // Revision 1.8  2006/08/10 18:47:41  wsun
0076 // Removed L1PhysObjectBase; particle classes now derived from LeafCandidate.
0077 //
0078 // Revision 1.7  2006/08/06 15:32:26  wsun
0079 // Added comment.
0080 //
0081 // Revision 1.6  2006/08/04 03:30:47  wsun
0082 // Separated tau/jet bookkeeping, added static function objectTypeIsGlobal().
0083 //
0084 // Revision 1.5  2006/08/02 20:48:55  wsun
0085 // Added more trigger lines, added mapping for global objects.
0086 //
0087 // Revision 1.4  2006/08/02 14:21:33  wsun
0088 // Added trigger name dictionary, moved particle type enum to L1ParticleMap.
0089 //
0090 // Revision 1.3  2006/07/26 20:41:30  wsun
0091 // Added implementation of L1ParticleMap.
0092 //
0093 // Revision 1.2  2006/07/26 00:05:39  wsun
0094 // Structural mods for HLT use.
0095 //
0096 // Revision 1.1  2006/07/17 20:35:19  wsun
0097 // First draft.
0098 //
0099 //
0100 
0101 // system include files
0102 #include <string>
0103 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
0104 #include <atomic>
0105 #endif
0106 // user include files
0107 #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
0108 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
0109 #include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h"
0110 #include "DataFormats/L1Trigger/interface/L1EtMissParticle.h"
0111 #include "DataFormats/L1Trigger/interface/L1EtMissParticleFwd.h"
0112 
0113 // forward declarations
0114 
0115 namespace l1extra {
0116 
0117   class L1ParticleMap {
0118   public:
0119     enum L1ObjectType {
0120       kEM,   // = isolated or non-isolated
0121       kJet,  // = central, forward, or tau
0122       kMuon,
0123       kEtMiss,
0124       kEtTotal,
0125       kEtHad,
0126       kNumOfL1ObjectTypes
0127     };
0128 
0129     // For now, use trigger menu from PTDR:
0130     // http://monicava.web.cern.ch/monicava/hlt_rates.htm#l1bits
0131 
0132     // RelaxedEM = isolated OR non-isolated
0133     // Jet = central OR forward OR tau
0134 
0135     enum L1TriggerType {
0136       kSingleMu3,
0137       kSingleMu5,
0138       kSingleMu7,
0139       kSingleMu10,
0140       kSingleMu14,
0141       kSingleMu20,
0142       kSingleMu25,
0143       kSingleIsoEG5,
0144       kSingleIsoEG8,
0145       kSingleIsoEG10,
0146       kSingleIsoEG12,
0147       kSingleIsoEG15,
0148       kSingleIsoEG20,
0149       kSingleIsoEG25,
0150       kSingleEG5,
0151       kSingleEG8,
0152       kSingleEG10,
0153       kSingleEG12,
0154       kSingleEG15,
0155       kSingleEG20,
0156       kSingleEG25,
0157       kSingleJet15,
0158       kSingleJet20,
0159       kSingleJet30,
0160       kSingleJet50,
0161       kSingleJet70,
0162       kSingleJet100,
0163       kSingleJet150,
0164       kSingleJet200,
0165       kSingleTauJet10,
0166       kSingleTauJet20,
0167       kSingleTauJet30,
0168       kSingleTauJet35,
0169       kSingleTauJet40,
0170       kSingleTauJet60,
0171       kSingleTauJet80,
0172       kSingleTauJet100,
0173       kHTT100,
0174       kHTT200,
0175       kHTT250,
0176       kHTT300,
0177       kHTT400,
0178       kHTT500,
0179       kETM10,
0180       kETM15,
0181       kETM20,
0182       kETM30,
0183       kETM40,
0184       kETM50,
0185       kETM60,
0186       kETT60,
0187       kDoubleMu3,
0188       kDoubleIsoEG8,
0189       kDoubleIsoEG10,
0190       kDoubleEG5,
0191       kDoubleEG10,
0192       kDoubleEG15,
0193       kDoubleJet70,
0194       kDoubleJet100,
0195       kDoubleTauJet20,
0196       kDoubleTauJet30,
0197       kDoubleTauJet35,
0198       kDoubleTauJet40,
0199       kMu3_IsoEG5,
0200       kMu5_IsoEG10,
0201       kMu3_EG12,
0202       kMu3_Jet15,
0203       kMu5_Jet15,
0204       kMu3_Jet70,
0205       kMu5_Jet20,
0206       kMu5_TauJet20,
0207       kMu5_TauJet30,
0208       kIsoEG10_EG10,
0209       kIsoEG10_Jet15,
0210       kIsoEG10_Jet20,
0211       kIsoEG10_Jet30,
0212       kIsoEG10_Jet70,
0213       kIsoEG10_TauJet20,
0214       kIsoEG10_TauJet30,
0215       kEG10_Jet15,
0216       kEG12_Jet20,
0217       kEG12_Jet70,
0218       kEG12_TauJet40,
0219       kJet70_TauJet40,
0220       kMu3_HTT200,
0221       kIsoEG10_HTT200,
0222       kEG12_HTT200,
0223       kJet70_HTT200,
0224       kTauJet40_HTT200,
0225       kMu3_ETM30,
0226       kIsoEG10_ETM30,
0227       kEG12_ETM30,
0228       kJet70_ETM40,
0229       kTauJet20_ETM20,
0230       kTauJet30_ETM30,
0231       kTauJet30_ETM40,
0232       kHTT100_ETM30,
0233       kTripleMu3,
0234       kTripleIsoEG5,
0235       kTripleEG10,
0236       kTripleJet50,
0237       kTripleTauJet40,
0238       kDoubleMu3_IsoEG5,
0239       kDoubleMu3_EG10,
0240       kDoubleIsoEG5_Mu3,
0241       kDoubleEG10_Mu3,
0242       kDoubleMu3_HTT200,
0243       kDoubleIsoEG5_HTT200,
0244       kDoubleEG10_HTT200,
0245       kDoubleJet50_HTT200,
0246       kDoubleTauJet40_HTT200,
0247       kDoubleMu3_ETM20,
0248       kDoubleIsoEG5_ETM20,
0249       kDoubleEG10_ETM20,
0250       kDoubleJet50_ETM20,
0251       kDoubleTauJet40_ETM20,
0252       kQuadJet30,
0253       kExclusiveDoubleIsoEG4,
0254       kExclusiveDoubleJet60,
0255       kExclusiveJet25_Gap_Jet25,
0256       kIsoEG10_Jet20_ForJet10,
0257       kMinBias_HTT10,
0258       kZeroBias,
0259       kNumOfL1TriggerTypes
0260     };
0261 
0262     typedef std::vector<unsigned int> L1IndexCombo;
0263     typedef std::vector<L1IndexCombo> L1IndexComboVector;
0264     typedef std::vector<L1ObjectType> L1ObjectTypeVector;
0265 
0266     L1ParticleMap();
0267     L1ParticleMap(L1TriggerType triggerType,
0268                   bool triggerDecision,
0269                   const L1ObjectTypeVector& objectTypes,
0270                   const L1EmParticleVectorRef& emParticles = L1EmParticleVectorRef(),
0271                   const L1JetParticleVectorRef& jetParticles = L1JetParticleVectorRef(),
0272                   const L1MuonParticleVectorRef& muonParticles = L1MuonParticleVectorRef(),
0273                   const L1EtMissParticleRefProd& etMissParticle = L1EtMissParticleRefProd(),
0274                   const L1IndexComboVector& indexCombos = L1IndexComboVector());
0275     L1ParticleMap(const L1ParticleMap&);
0276     L1ParticleMap& operator=(const L1ParticleMap&);
0277 
0278     virtual ~L1ParticleMap();
0279 
0280     void swap(L1ParticleMap&);
0281     // ---------- const member functions ---------------------
0282     L1TriggerType triggerType() const { return triggerType_; }
0283 
0284     const std::string& triggerName() const { return triggerName(triggerType_); }
0285 
0286     bool triggerDecision() const { return triggerDecision_; }
0287 
0288     // Indices of object types (see the above enum), that participated
0289     // in this trigger.  The order of these type indices corresponds to
0290     // the particles listed in each L1IndexCombo.
0291     const L1ObjectTypeVector& objectTypes() const { return objectTypes_; }
0292 
0293     // Number of objects that participated in this trigger.
0294     int numOfObjects() const { return objectTypes_.size(); }
0295 
0296     const L1EmParticleVectorRef& emParticles() const { return emParticles_; }
0297 
0298     const L1JetParticleVectorRef& jetParticles() const { return jetParticles_; }
0299 
0300     const L1MuonParticleVectorRef& muonParticles() const { return muonParticles_; }
0301 
0302     const L1EtMissParticleRefProd& etMissParticle() const { return etMissParticle_; }
0303 
0304     // If there are zero or one non-global objects, then there is no need
0305     // to store the object combinations.  In this case, the stored
0306     // vector m_objectCombinations will be empty, and it will be
0307     // filled upon request at analysis time.
0308     const L1IndexComboVector& indexCombos() const;
0309 
0310     // These functions retrieve the object corresponding to a
0311     // particular entry in a given combination.  The pointer is null
0312     // if an error occurs (e.g. the particle requested does not match
0313     // the type of the function).
0314     const reco::LeafCandidate* candidateInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
0315 
0316     const L1EmParticle* emParticleInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
0317 
0318     const L1JetParticle* jetParticleInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
0319 
0320     const L1MuonParticle* muonParticleInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
0321 
0322     // This function just returns the single global object.
0323     const L1EtMissParticle* etMissParticleInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
0324 
0325     // For a given particle combination, convert all the particles to
0326     // reco::LeafCandidate pointers.
0327     std::vector<const reco::LeafCandidate*> candidateCombo(const L1IndexCombo& aCombo) const;
0328 
0329     // ---------- static member functions --------------------
0330     static const std::string& triggerName(L1TriggerType type);
0331     static L1TriggerType triggerType(const std::string& name);
0332     static bool objectTypeIsGlobal(L1ObjectType type);
0333 
0334     // ---------- member functions ---------------------------
0335 
0336   private:
0337     // L1ParticleMap(const L1ParticleMap&); // stop default
0338 
0339     // const L1ParticleMap& operator=(const L1ParticleMap&); // stop default
0340 
0341     void setIndexCombos() const;
0342     // ---------- member data --------------------------------
0343 
0344     // Index into trigger menu.
0345     L1TriggerType triggerType_;
0346 
0347     bool triggerDecision_;
0348 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
0349     mutable std::atomic<char> indexCombosState_;
0350 #else
0351     mutable char indexCombosState_;
0352 #endif
0353     // Vector of length numOfObjects() that gives the
0354     // type of each trigger object.
0355     L1ObjectTypeVector objectTypes_;
0356 
0357     // Lists of particles that fired this trigger, perhaps in combination
0358     // with another particle.
0359     L1EmParticleVectorRef emParticles_;
0360     L1JetParticleVectorRef jetParticles_;
0361     L1MuonParticleVectorRef muonParticles_;
0362 
0363     // Global (event-wide) objects.  The Ref is null if the object
0364     // was not used in this trigger.
0365     L1EtMissParticleRefProd etMissParticle_;
0366 
0367     // Object combinations that fired this trigger.  The inner
0368     // vector< int > has length numOfObjects() and contains
0369     // references to the elements in emParticles_, jetParticles_, and
0370     // muonParticles_ for a successful combination.  A dummy index is
0371     // entered for each global object in the trigger.  The object type
0372     // of each entry is given by objectTypes_.
0373     //
0374     // This data member is mutable because if #particles = 1, then this
0375     // vector is empty and is filled on request.
0376     mutable L1IndexComboVector indexCombos_;  //CMS thread safe via indexCombosState_
0377 
0378     // Static array of trigger names.
0379     static const std::string triggerNames_[kNumOfL1TriggerTypes];
0380   };
0381 
0382 }  // namespace l1extra
0383 
0384 #endif