CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1ParticleMap.h
Go to the documentation of this file.
1 #ifndef L1Trigger_L1ParticleMap_h
2 #define L1Trigger_L1ParticleMap_h
3 // -*- C++ -*-
4 //
5 // Package: L1Trigger
6 // Class : L1ParticleMap
7 //
12 //
13 // Original Author: Werner Sun
14 // Created: Fri Jul 14 19:46:30 EDT 2006
15 // Revision 1.28 2007/08/08 03:49:03 wsun
16 // Diffractive trigger threshold update from X. Rouby.
17 //
18 // Revision 1.27 2007/08/07 01:18:15 wsun
19 // Added JetMET calibration triggers from Len.
20 //
21 // Revision 1.26 2007/07/31 15:20:14 ratnik
22 // QA campaign: include cleanup based on CMSSW_1_7_X_2007-07-30-1600 includechecker results.
23 //
24 // Revision 1.25 2007/07/14 19:03:25 wsun
25 // Added diffractive triggers from X. Rouby and S. Ovyn.
26 //
27 // Revision 1.24 2007/06/16 16:50:03 wsun
28 // Added SingleTauJet35 and DoubleTauJet35 for 131HLT6.
29 //
30 // Revision 1.23 2007/06/15 19:27:31 wsun
31 // New L1 trigger table for 131HLT6.
32 //
33 // Revision 1.22 2007/06/03 00:06:30 wsun
34 // Revision of L1 trigger table for 131HLT5.
35 //
36 // Revision 1.21 2007/06/01 02:57:11 wsun
37 // New L1 trigger table for 131HLT5.
38 //
39 // Revision 1.20 2007/05/23 05:09:09 wsun
40 // L1 trigger table for 131HLT4.
41 //
42 // Revision 1.19 2007/05/15 14:52:40 wsun
43 // A_Mu3_IsoEG15 -> A_Mu7_IsoEG10
44 //
45 // Revision 1.18 2007/05/11 04:59:32 wsun
46 // Retweaked trigger table.
47 //
48 // Revision 1.17 2007/04/30 21:00:39 wsun
49 // QuadJet50 -> QuadJet20
50 //
51 // Revision 1.16 2007/04/23 18:33:31 wsun
52 // Another iteration of the L1 trigger table.
53 //
54 // Revision 1.15 2007/04/22 22:35:47 wsun
55 // Updated L1 trigger table yet again.
56 //
57 // Revision 1.14 2007/04/16 21:15:46 wsun
58 // Tweaks to trigger table for 131HLT.
59 //
60 // Revision 1.13 2007/04/13 17:50:46 wsun
61 // New trigger table for HLT exercise.
62 //
63 // Revision 1.12 2007/04/02 08:03:13 wsun
64 // Updated Doxygen documentation.
65 //
66 // Revision 1.11 2006/08/31 10:23:32 wsun
67 // Added MinBias trigger.
68 //
69 // Revision 1.10 2006/08/28 03:10:40 wsun
70 // Revamped L1ParticleMap to handle OR triggers.
71 //
72 // Revision 1.9 2006/08/23 23:09:04 wsun
73 // Separated iso/non-iso EM triggers and RefVectors.
74 //
75 // Revision 1.8 2006/08/10 18:47:41 wsun
76 // Removed L1PhysObjectBase; particle classes now derived from LeafCandidate.
77 //
78 // Revision 1.7 2006/08/06 15:32:26 wsun
79 // Added comment.
80 //
81 // Revision 1.6 2006/08/04 03:30:47 wsun
82 // Separated tau/jet bookkeeping, added static function objectTypeIsGlobal().
83 //
84 // Revision 1.5 2006/08/02 20:48:55 wsun
85 // Added more trigger lines, added mapping for global objects.
86 //
87 // Revision 1.4 2006/08/02 14:21:33 wsun
88 // Added trigger name dictionary, moved particle type enum to L1ParticleMap.
89 //
90 // Revision 1.3 2006/07/26 20:41:30 wsun
91 // Added implementation of L1ParticleMap.
92 //
93 // Revision 1.2 2006/07/26 00:05:39 wsun
94 // Structural mods for HLT use.
95 //
96 // Revision 1.1 2006/07/17 20:35:19 wsun
97 // First draft.
98 //
99 //
100 
101 // system include files
102 #include <string>
103 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
104 #include <atomic>
105 #endif
106 // user include files
112 
113 // forward declarations
114 
115 namespace l1extra {
116 
118  public:
120  kEM, // = isolated or non-isolated
121  kJet, // = central, forward, or tau
127  };
128 
129  // For now, use trigger menu from PTDR:
130  // http://monicava.web.cern.ch/monicava/hlt_rates.htm#l1bits
131 
132  // RelaxedEM = isolated OR non-isolated
133  // Jet = central OR forward OR tau
134 
260  };
261 
262  typedef std::vector<unsigned int> L1IndexCombo;
263  typedef std::vector<L1IndexCombo> L1IndexComboVector;
264  typedef std::vector<L1ObjectType> L1ObjectTypeVector;
265 
266  L1ParticleMap();
268  bool triggerDecision,
277 
278  virtual ~L1ParticleMap();
279 
280  void swap(L1ParticleMap&);
281  // ---------- const member functions ---------------------
283 
284  const std::string& triggerName() const { return triggerName(triggerType_); }
285 
286  bool triggerDecision() const { return triggerDecision_; }
287 
288  // Indices of object types (see the above enum), that participated
289  // in this trigger. The order of these type indices corresponds to
290  // the particles listed in each L1IndexCombo.
291  const L1ObjectTypeVector& objectTypes() const { return objectTypes_; }
292 
293  // Number of objects that participated in this trigger.
294  int numOfObjects() const { return objectTypes_.size(); }
295 
296  const L1EmParticleVectorRef& emParticles() const { return emParticles_; }
297 
299 
301 
303 
304  // If there are zero or one non-global objects, then there is no need
305  // to store the object combinations. In this case, the stored
306  // vector m_objectCombinations will be empty, and it will be
307  // filled upon request at analysis time.
308  const L1IndexComboVector& indexCombos() const;
309 
310  // These functions retrieve the object corresponding to a
311  // particular entry in a given combination. The pointer is null
312  // if an error occurs (e.g. the particle requested does not match
313  // the type of the function).
314  const reco::LeafCandidate* candidateInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
315 
316  const L1EmParticle* emParticleInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
317 
318  const L1JetParticle* jetParticleInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
319 
320  const L1MuonParticle* muonParticleInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
321 
322  // This function just returns the single global object.
323  const L1EtMissParticle* etMissParticleInCombo(int aIndexInCombo, const L1IndexCombo& aCombo) const;
324 
325  // For a given particle combination, convert all the particles to
326  // reco::LeafCandidate pointers.
327  std::vector<const reco::LeafCandidate*> candidateCombo(const L1IndexCombo& aCombo) const;
328 
329  // ---------- static member functions --------------------
330  static const std::string& triggerName(L1TriggerType type);
331  static L1TriggerType triggerType(const std::string& name);
332  static bool objectTypeIsGlobal(L1ObjectType type);
333 
334  // ---------- member functions ---------------------------
335 
336  private:
337  // L1ParticleMap(const L1ParticleMap&); // stop default
338 
339  // const L1ParticleMap& operator=(const L1ParticleMap&); // stop default
340 
341  void setIndexCombos() const;
342  // ---------- member data --------------------------------
343 
344  // Index into trigger menu.
346 
348 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
349  mutable std::atomic<char> indexCombosState_;
350 #else
351  mutable char indexCombosState_;
352 #endif
353  // Vector of length numOfObjects() that gives the
354  // type of each trigger object.
356 
357  // Lists of particles that fired this trigger, perhaps in combination
358  // with another particle.
362 
363  // Global (event-wide) objects. The Ref is null if the object
364  // was not used in this trigger.
366 
367  // Object combinations that fired this trigger. The inner
368  // vector< int > has length numOfObjects() and contains
369  // references to the elements in emParticles_, jetParticles_, and
370  // muonParticles_ for a successful combination. A dummy index is
371  // entered for each global object in the trigger. The object type
372  // of each entry is given by objectTypes_.
373  //
374  // This data member is mutable because if #particles = 1, then this
375  // vector is empty and is filled on request.
376  mutable L1IndexComboVector indexCombos_; //CMS thread safe via indexCombosState_
377 
378  // Static array of trigger names.
380  };
381 
382 } // namespace l1extra
383 
384 #endif
std::atomic< char > indexCombosState_
void swap(L1ParticleMap &)
std::vector< unsigned int > L1IndexCombo
std::vector< L1ObjectType > L1ObjectTypeVector
const L1EtMissParticleRefProd & etMissParticle() const
const std::string & triggerName() const
const L1JetParticle * jetParticleInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
L1IndexComboVector indexCombos_
const L1MuonParticleVectorRef & muonParticles() const
const L1EtMissParticle * etMissParticleInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
int numOfObjects() const
L1ParticleMap & operator=(const L1ParticleMap &)
static const std::string triggerNames_[kNumOfL1TriggerTypes]
bool triggerDecision() const
std::vector< L1JetParticleRef > L1JetParticleVectorRef
const L1MuonParticle * muonParticleInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
std::vector< L1MuonParticleRef > L1MuonParticleVectorRef
const L1EmParticleVectorRef & emParticles() const
L1EtMissParticleRefProd etMissParticle_
const L1EmParticle * emParticleInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
const L1JetParticleVectorRef & jetParticles() const
void setIndexCombos() const
edm::RefProd< L1EtMissParticle > L1EtMissParticleRefProd
std::vector< const reco::LeafCandidate * > candidateCombo(const L1IndexCombo &aCombo) const
L1EmParticleVectorRef emParticles_
std::vector< L1IndexCombo > L1IndexComboVector
L1MuonParticleVectorRef muonParticles_
static bool objectTypeIsGlobal(L1ObjectType type)
L1TriggerType triggerType() const
const reco::LeafCandidate * candidateInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
const L1IndexComboVector & indexCombos() const
std::vector< L1EmParticleRef > L1EmParticleVectorRef
L1JetParticleVectorRef jetParticles_
L1ObjectTypeVector objectTypes_
L1TriggerType triggerType_
const L1ObjectTypeVector & objectTypes() const