CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1ParticleMap.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1Trigger
4 // Class : L1ParticleMap
5 //
8 //
9 // Original Author: Werner Sun
10 // Created: Wed Jul 26 14:42:56 EDT 2006
11 // $Id: L1ParticleMap.cc,v 1.27 2007/09/27 22:31:21 ratnik Exp $
12 //
13 
14 // system include files
15 
16 // user include files
21 
22 using namespace l1extra ;
23 
24 //
25 // constants, enums and typedefs
26 //
27 
28 //
29 // static data member definitions
30 //
31 
32 // EG = isolated OR non-isolated
33 // Jet = central OR forward OR tau
35 L1ParticleMap::triggerNames_[ kNumOfL1TriggerTypes ] = {
36  "L1_SingleMu3",
37  "L1_SingleMu5",
38  "L1_SingleMu7",
39  "L1_SingleMu10",
40  "L1_SingleMu14",
41  "L1_SingleMu20",
42  "L1_SingleMu25",
43  "L1_SingleIsoEG5",
44  "L1_SingleIsoEG8",
45  "L1_SingleIsoEG10",
46  "L1_SingleIsoEG12",
47  "L1_SingleIsoEG15",
48  "L1_SingleIsoEG20",
49  "L1_SingleIsoEG25",
50  "L1_SingleEG5",
51  "L1_SingleEG8",
52  "L1_SingleEG10",
53  "L1_SingleEG12",
54  "L1_SingleEG15",
55  "L1_SingleEG20",
56  "L1_SingleEG25",
57  "L1_SingleJet15",
58  "L1_SingleJet20",
59  "L1_SingleJet30",
60  "L1_SingleJet50",
61  "L1_SingleJet70",
62  "L1_SingleJet100",
63  "L1_SingleJet150",
64  "L1_SingleJet200",
65  "L1_SingleTauJet10",
66  "L1_SingleTauJet20",
67  "L1_SingleTauJet30",
68  "L1_SingleTauJet35",
69  "L1_SingleTauJet40",
70  "L1_SingleTauJet60",
71  "L1_SingleTauJet80",
72  "L1_SingleTauJet100",
73  "L1_HTT100",
74  "L1_HTT200",
75  "L1_HTT250",
76  "L1_HTT300",
77  "L1_HTT400",
78  "L1_HTT500",
79  "L1_ETM10",
80  "L1_ETM15",
81  "L1_ETM20",
82  "L1_ETM30",
83  "L1_ETM40",
84  "L1_ETM50",
85  "L1_ETM60",
86  "L1_ETT60",
87  "L1_DoubleMu3",
88  "L1_DoubleIsoEG8",
89  "L1_DoubleIsoEG10",
90  "L1_DoubleEG5",
91  "L1_DoubleEG10",
92  "L1_DoubleEG15",
93  "L1_DoubleJet70",
94  "L1_DoubleJet100",
95  "L1_DoubleTauJet20",
96  "L1_DoubleTauJet30",
97  "L1_DoubleTauJet35",
98  "L1_DoubleTauJet40",
99  "L1_Mu3_IsoEG5",
100  "L1_Mu5_IsoEG10",
101  "L1_Mu3_EG12",
102  "L1_Mu3_Jet15",
103  "L1_Mu5_Jet15",
104  "L1_Mu3_Jet70",
105  "L1_Mu5_Jet20",
106  "L1_Mu5_TauJet20",
107  "L1_Mu5_TauJet30",
108  "L1_IsoEG10_EG10",
109  "L1_IsoEG10_Jet15",
110  "L1_IsoEG10_Jet20",
111  "L1_IsoEG10_Jet30",
112  "L1_IsoEG10_Jet70",
113  "L1_IsoEG10_TauJet20",
114  "L1_IsoEG10_TauJet30",
115  "L1_EG10_Jet15",
116  "L1_EG12_Jet20",
117  "L1_EG12_Jet70",
118  "L1_EG12_TauJet40",
119  "L1_Jet70_TauJet40",
120  "L1_Mu3_HTT200",
121  "L1_IsoEG10_HTT200",
122  "L1_EG12_HTT200",
123  "L1_Jet70_HTT200",
124  "L1_TauJet40_HTT200",
125  "L1_Mu3_ETM30",
126  "L1_IsoEG10_ETM30",
127  "L1_EG12_ETM30",
128  "L1_Jet70_ETM40",
129  "L1_TauJet20_ETM20",
130  "L1_TauJet30_ETM30",
131  "L1_TauJet30_ETM40",
132  "L1_HTT100_ETM30",
133  "L1_TripleMu3",
134  "L1_TripleIsoEG5",
135  "L1_TripleEG10",
136  "L1_TripleJet50",
137  "L1_TripleTauJet40",
138  "L1_DoubleMu3_IsoEG5",
139  "L1_DoubleMu3_EG10",
140  "L1_DoubleIsoEG5_Mu3",
141  "L1_DoubleEG10_Mu3",
142  "L1_DoubleMu3_HTT200",
143  "L1_DoubleIsoEG5_HTT200",
144  "L1_DoubleEG10_HTT200",
145  "L1_DoubleJet50_HTT200",
146  "L1_DoubleTauJet40_HTT200",
147  "L1_DoubleMu3_ETM20",
148  "L1_DoubleIsoEG5_ETM20",
149  "L1_DoubleEG10_ETM20",
150  "L1_DoubleJet50_ETM20",
151  "L1_DoubleTauJet40_ETM20",
152  "L1_QuadJet30",
153  "L1_ExclusiveDoubleIsoEG4",
154  "L1_ExclusiveDoubleJet60",
155  "L1_ExclusiveJet25_Gap_Jet25",
156  "L1_IsoEG10_Jet20_ForJet10",
157  "L1_MinBias_HTT10",
158  "L1_ZeroBias"
159 } ;
160 
161 //
162 // constructors and destructor
163 //
165 {
166 }
167 
169  L1TriggerType triggerType,
170  bool triggerDecision,
171  const L1ObjectTypeVector& objectTypes,
172  const L1EmParticleVectorRef& emParticles,
173  const L1JetParticleVectorRef& jetParticles,
174  const L1MuonParticleVectorRef& muonParticles,
175  const L1EtMissParticleRefProd& etMissParticle,
176  const L1IndexComboVector& indexCombos )
177  : triggerType_( triggerType ),
178  triggerDecision_( triggerDecision ),
179  objectTypes_( objectTypes ),
180  emParticles_( emParticles ),
181  jetParticles_( jetParticles ),
182  muonParticles_( muonParticles ),
183  etMissParticle_( etMissParticle ),
184  indexCombos_( indexCombos )
185 {
186 }
187 
188 // L1ParticleMap::L1ParticleMap(const L1ParticleMap& rhs)
189 // {
190 // // do actual copying here;
191 // }
192 
194 {
195 }
196 
197 //
198 // assignment operators
199 //
200 // const L1ParticleMap& L1ParticleMap::operator=(const L1ParticleMap& rhs)
201 // {
202 // //An exception safe implementation is
203 // L1ParticleMap temp(rhs);
204 // swap(rhs);
205 //
206 // return *this;
207 // }
208 
209 //
210 // member functions
211 //
212 
213 //
214 // const member functions
215 //
216 
219 {
220  if( indexCombos_.size() == 0 )
221  {
222  // Determine the number of non-global objects. There should be 0 or 1.
223  int numNonGlobal = 0 ;
224  L1ObjectType nonGlobalType = kNumOfL1ObjectTypes ;
225  int nonGlobalIndex = -1 ;
226  for( int i = 0 ; i < numOfObjects() ; ++i )
227  {
228  if( !objectTypeIsGlobal( objectTypes_[ i ] ) )
229  {
230  ++numNonGlobal ;
231  nonGlobalType = objectTypes_[ i ] ;
232  nonGlobalIndex = i ;
233  }
234  }
235 
236  if( numNonGlobal == 0 )
237  {
238  // Dummy entry for each object type.
239  L1IndexCombo tmpCombo ;
240 
241  for( int i = 0 ; i < numOfObjects() ; ++i )
242  {
243  tmpCombo.push_back( 0 ) ;
244  }
245 
246  indexCombos_.push_back( tmpCombo ) ;
247  }
248  else if( numNonGlobal == 1 )
249  {
250  int nParticles = 0 ;
251 
252  if( nonGlobalType == kEM )
253  {
254  nParticles = emParticles_.size() ;
255  }
256  else if( nonGlobalType == kJet )
257  {
258  nParticles = jetParticles_.size() ;
259  }
260  else if( nonGlobalType == kMuon )
261  {
262  nParticles = muonParticles_.size() ;
263  }
264 
265  for( int i = 0 ; i < nParticles ; ++i )
266  {
267  L1IndexCombo tmpCombo ;
268 
269  for( int j = 0 ; j < numOfObjects() ; ++j )
270  {
271  if( j == nonGlobalIndex )
272  {
273  tmpCombo.push_back( i ) ;
274  }
275  else
276  {
277  tmpCombo.push_back( 0 ) ;
278  }
279  }
280 
281  indexCombos_.push_back( tmpCombo ) ;
282  }
283  }
284  }
285 
286  return indexCombos_ ;
287 }
288 
289 const reco::LeafCandidate*
291  const L1IndexCombo& aCombo ) const
292 {
293  L1ObjectType type = objectTypes_[ aIndexInCombo ] ;
294  int particleInList = aCombo[ aIndexInCombo ] ;
295 
296  if( type == kEM )
297  {
298  return dynamic_cast< const reco::LeafCandidate* >(
299  emParticles_[ particleInList ].get() ) ;
300  }
301  else if( type == kJet )
302  {
303  return dynamic_cast< const reco::LeafCandidate* >(
304  jetParticles_[ particleInList ].get() ) ;
305  }
306  else if( type == kMuon )
307  {
308  return dynamic_cast< const reco::LeafCandidate* >(
309  muonParticles_[ particleInList ].get() ) ;
310  }
311  else if( type == kEtMiss || type == kEtTotal || type == kEtHad )
312  {
313  return dynamic_cast< const reco::LeafCandidate* >(
314  etMissParticle_.get() ) ;
315  }
316  else
317  {
318  return 0 ;
319  }
320 }
321 
322 const L1EmParticle*
324  const L1IndexCombo& aCombo ) const
325 {
326  L1ObjectType type = objectTypes_[ aIndexInCombo ] ;
327  int particleInList = aCombo[ aIndexInCombo ] ;
328 
329  if( type == kEM )
330  {
331  return emParticles_[ particleInList ].get() ;
332  }
333  else
334  {
335  return 0 ;
336  }
337 }
338 
339 const L1JetParticle*
341  const L1IndexCombo& aCombo ) const
342 {
343  L1ObjectType type = objectTypes_[ aIndexInCombo ] ;
344  int particleInList = aCombo[ aIndexInCombo ] ;
345 
346  if( type == kJet )
347  {
348  return jetParticles_[ particleInList ].get() ;
349  }
350  else
351  {
352  return 0 ;
353  }
354 }
355 
356 const L1MuonParticle*
358  const L1IndexCombo& aCombo ) const
359 {
360  L1ObjectType type = objectTypes_[ aIndexInCombo ] ;
361  int particleInList = aCombo[ aIndexInCombo ] ;
362 
363  if( type == kMuon )
364  {
365  return muonParticles_[ particleInList ].get() ;
366  }
367  else
368  {
369  return 0 ;
370  }
371 }
372 
373 const L1EtMissParticle*
375  const L1IndexCombo& aCombo ) const
376 {
377  L1ObjectType type = objectTypes_[ aIndexInCombo ] ;
378 
379  if( type == kEtMiss || type == kEtTotal || type == kEtHad )
380  {
381  return etMissParticle_.get() ;
382  }
383  else
384  {
385  return 0 ;
386  }
387 }
388 
389 std::vector< const reco::LeafCandidate* >
391 {
392  std::vector< const reco::LeafCandidate* > tmp ;
393 
394  for( int i = 0 ; i < numOfObjects() ; ++i )
395  {
396  tmp.push_back( candidateInCombo( i, aCombo ) ) ;
397  }
398 
399  return tmp ;
400 }
401 
402 //
403 // static member functions
404 //
405 const std::string&
407 {
408  return triggerNames_[ type ] ;
409 }
410 
413 {
414  for( int i = 0 ; i < kNumOfL1TriggerTypes ; ++i )
415  {
416  if( triggerNames_[ i ] == name )
417  {
418  return ( L1TriggerType ) i ;
419  }
420  }
421 
422  return kNumOfL1TriggerTypes ;
423 }
424 
425 bool
427 {
428  return type == kEtMiss || type == kEtTotal || type == kEtHad ;
429 }
std::vector< L1EmParticleRef > L1EmParticleVectorRef
type
Definition: HCALResponse.h:21
int i
Definition: DBlmapReader.cc:9
std::vector< L1JetParticleRef > L1JetParticleVectorRef
const std::string & triggerName() const
const L1JetParticle * jetParticleInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
L1IndexComboVector indexCombos_
const L1EtMissParticle * etMissParticleInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
int numOfObjects() const
std::vector< unsigned int > L1IndexCombo
const L1MuonParticle * muonParticleInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
std::vector< L1IndexCombo > L1IndexComboVector
#define nParticles
Definition: Histograms.cc:24
int j
Definition: DBlmapReader.cc:9
L1EtMissParticleRefProd etMissParticle_
const L1EmParticle * emParticleInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
std::vector< const reco::LeafCandidate * > candidateCombo(const L1IndexCombo &aCombo) const
L1EmParticleVectorRef emParticles_
L1MuonParticleVectorRef muonParticles_
product_type const * get() const
Definition: RefProd.h:116
static std::string triggerNames_[kNumOfL1TriggerTypes]
static bool objectTypeIsGlobal(L1ObjectType type)
L1TriggerType triggerType() const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
const reco::LeafCandidate * candidateInCombo(int aIndexInCombo, const L1IndexCombo &aCombo) const
const L1IndexComboVector & indexCombos() const
std::vector< L1ObjectType > L1ObjectTypeVector
std::vector< L1MuonParticleRef > L1MuonParticleVectorRef
L1JetParticleVectorRef jetParticles_
L1ObjectTypeVector objectTypes_