CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
L1ExtraParticlesProd Class Reference

#include <L1ExtraParticlesProd.h>

Inheritance diagram for L1ExtraParticlesProd:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 L1ExtraParticlesProd (const edm::ParameterSet &)
 
 ~L1ExtraParticlesProd ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
math::PtEtaPhiMLorentzVector gctLorentzVector (const double &et, const L1GctCand &cand, const L1CaloGeometry *geom, bool central)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag cenJetSource_
 
bool centralBxOnly_
 
edm::InputTag etHadSource_
 
edm::InputTag etMissSource_
 
edm::InputTag etTotSource_
 
edm::InputTag forJetSource_
 
edm::InputTag hfRingBitCountsSource_
 
edm::InputTag hfRingEtSumsSource_
 
edm::InputTag htMissSource_
 
bool ignoreHtMiss_
 
edm::InputTag isoEmSource_
 
edm::InputTag muonSource_
 
edm::InputTag nonIsoEmSource_
 
bool produceCaloParticles_
 
bool produceMuonParticles_
 
edm::InputTag tauJetSource_
 

Static Private Attributes

static double muonMassGeV_ = 0.105658369
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

L1Trigger/L1ExtraFromDigis/interface/L1ExtraParticlesProd.h

Author
Werner Sun

Description: producer of L1Extra particle objects from Level-1 hardware objects.

src/L1ExtraParticlesProd/src/L1ExtraParticlesProd.cc

Definition at line 42 of file L1ExtraParticlesProd.h.

Constructor & Destructor Documentation

L1ExtraParticlesProd::L1ExtraParticlesProd ( const edm::ParameterSet iConfig)
explicit

Definition at line 68 of file L1ExtraParticlesProd.cc.

69  : produceMuonParticles_( iConfig.getParameter< bool >(
70  "produceMuonParticles" ) ),
72  "muonSource" ) ),
73  produceCaloParticles_( iConfig.getParameter< bool >(
74  "produceCaloParticles" ) ),
76  "isolatedEmSource" ) ),
78  "nonIsolatedEmSource" ) ),
80  "centralJetSource" ) ),
82  "forwardJetSource" ) ),
84  "tauJetSource" ) ),
86  "etTotalSource" ) ),
88  "etHadSource" ) ),
90  "etMissSource" ) ),
92  "htMissSource" ) ),
94  "hfRingEtSumsSource" ) ),
96  "hfRingBitCountsSource" ) ),
97  centralBxOnly_( iConfig.getParameter< bool >( "centralBxOnly" ) ),
98  ignoreHtMiss_( iConfig.getParameter< bool >( "ignoreHtMiss" ) )
99 {
100  using namespace l1extra ;
101 
102  //register your products
103  produces< L1EmParticleCollection >( "Isolated" ) ;
104  produces< L1EmParticleCollection >( "NonIsolated" ) ;
105  produces< L1JetParticleCollection >( "Central" ) ;
106  produces< L1JetParticleCollection >( "Forward" ) ;
107  produces< L1JetParticleCollection >( "Tau" ) ;
108  produces< L1MuonParticleCollection >() ;
109  produces< L1EtMissParticleCollection >( "MET" ) ;
110  produces< L1EtMissParticleCollection >( "MHT" ) ;
111  produces< L1HFRingsCollection >() ;
112 
113  //now do what ever other initialization is needed
114 }
T getParameter(std::string const &) const
edm::InputTag hfRingEtSumsSource_
edm::InputTag hfRingBitCountsSource_
L1ExtraParticlesProd::~L1ExtraParticlesProd ( )

Definition at line 117 of file L1ExtraParticlesProd.cc.

118 {
119 
120  // do anything here that needs to be done at desctruction time
121  // (e.g. close files, deallocate resources etc.)
122 
123 }

Member Function Documentation

void L1ExtraParticlesProd::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 1092 of file L1ExtraParticlesProd.cc.

1093 {
1094 }
void L1ExtraParticlesProd::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 1098 of file L1ExtraParticlesProd.cc.

1098  {
1099 }
math::PtEtaPhiMLorentzVector L1ExtraParticlesProd::gctLorentzVector ( const double &  et,
const L1GctCand cand,
const L1CaloGeometry geom,
bool  central 
)
private

Definition at line 1064 of file L1ExtraParticlesProd.cc.

References L1CaloGeometry::emJetPhiBinCenter(), eta(), L1CaloGeometry::etaBinCenter(), L1GctCand::etaIndex(), phi, and L1GctCand::phiIndex().

Referenced by produce().

1068 {
1069  // To keep x and y components non-zero.
1070  double etCorr = et + 1.e-6 ; // protect against roundoff, not only for et=0
1071 
1072  double eta = geom->etaBinCenter( cand.etaIndex(), central ) ;
1073 
1074 // double tanThOver2 = exp( -eta ) ;
1075 // double ez = etCorr * ( 1. - tanThOver2 * tanThOver2 ) / ( 2. * tanThOver2 );
1076 // double e = etCorr * ( 1. + tanThOver2 * tanThOver2 ) / ( 2. * tanThOver2 );
1077 
1078  double phi = geom->emJetPhiBinCenter( cand.phiIndex() ) ;
1079 
1080 // return math::XYZTLorentzVector( etCorr * cos( phi ),
1081 // etCorr * sin( phi ),
1082 // ez,
1083 // e ) ;
1084  return math::PtEtaPhiMLorentzVector( etCorr,
1085  eta,
1086  phi,
1087  0. ) ;
1088 }
T eta() const
double etaBinCenter(unsigned int etaIndex, bool central=true) const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:26
virtual unsigned etaIndex() const =0
get eta index (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
virtual unsigned phiIndex() const =0
get phi index (0-17)
double emJetPhiBinCenter(unsigned int phiIndex) const
Definition: DDAxes.h:10
void L1ExtraParticlesProd::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 132 of file L1ExtraParticlesProd.cc.

References cenJetSource_, centralBxOnly_, eta(), etHadSource_, etMissSource_, L1CaloGeometry::etSumPhiBinCenter(), etTotSource_, forJetSource_, gctLorentzVector(), edm::EventSetup::get(), edm::Event::getByLabel(), hfRingBitCountsSource_, hfRingEtSumsSource_, htMissSource_, L1CaloGeometry::htSumPhiBinCenter(), i, ignoreHtMiss_, isoEmSource_, edm::HandleBase::isValid(), L1GctEtHad::kEtHadMaxValue, L1GctEtMiss::kEtMissMaxValue, L1GctEtTotal::kEtTotalMaxValue, LogDebug, muonMassGeV_, muonSource_, nonIsoEmSource_, p4, phi, produceCaloParticles_, produceMuonParticles_, edm::Event::put(), tauJetSource_, and funct::true.

134 {
135  using namespace edm ;
136  using namespace l1extra ;
137  using namespace std ;
138 
139  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140  // ~~~~~~~~~~~~~~~~~~~~ Muons ~~~~~~~~~~~~~~~~~~~~
141  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142 
143  auto_ptr< L1MuonParticleCollection > muColl(
145 
147  {
149  iSetup.get< L1MuTriggerScalesRcd >().get( muScales ) ;
150 
152  iSetup.get< L1MuTriggerPtScaleRcd >().get( muPtScale ) ;
153 
154  Handle< L1MuGMTReadoutCollection > hwMuCollection ;
155  iEvent.getByLabel( muonSource_, hwMuCollection ) ;
156 
157  vector< L1MuGMTExtendedCand > hwMuCands ;
158 
159  if( !hwMuCollection.isValid() )
160  {
161  LogDebug("L1ExtraParticlesProd")
162  << "\nWarning: L1MuGMTReadoutCollection with " << muonSource_
163  << "\nrequested in configuration, but not found in the event."
164  << std::endl;
165  }
166  else
167  {
168  if( centralBxOnly_ )
169  {
170  // Get GMT candidates from central bunch crossing only
171  hwMuCands = hwMuCollection->getRecord().getGMTCands() ;
172  }
173  else
174  {
175  // Get GMT candidates from all bunch crossings
176  vector< L1MuGMTReadoutRecord > records = hwMuCollection->getRecords();
177  vector< L1MuGMTReadoutRecord >::const_iterator rItr = records.begin();
178  vector< L1MuGMTReadoutRecord >::const_iterator rEnd = records.end();
179 
180  for( ; rItr != rEnd ; ++rItr )
181  {
182  vector< L1MuGMTExtendedCand > tmpCands = rItr->getGMTCands() ;
183 
184  hwMuCands.insert( hwMuCands.end(),
185  tmpCands.begin(),
186  tmpCands.end() ) ;
187  }
188  }
189 
190 // cout << "HW muons" << endl ;
191  vector< L1MuGMTExtendedCand >::const_iterator muItr = hwMuCands.begin() ;
192  vector< L1MuGMTExtendedCand >::const_iterator muEnd = hwMuCands.end() ;
193  for( int i = 0 ; muItr != muEnd ; ++muItr, ++i )
194  {
195 // cout << "#" << i
196 // << " name " << muItr->name()
197 // << " empty " << muItr->empty()
198 // << " pt " << muItr->ptIndex()
199 // << " eta " << muItr->etaIndex()
200 // << " phi " << muItr->phiIndex()
201 // << " iso " << muItr->isol()
202 // << " mip " << muItr->mip()
203 // << " bx " << muItr->bx()
204 // << endl ;
205 
206  if( !muItr->empty() )
207  {
208  // keep x and y components non-zero and protect against roundoff.
209  double pt =
210  muPtScale->getPtScale()->getLowEdge( muItr->ptIndex() ) + 1.e-6 ;
211 
212 // cout << "L1Extra pt " << pt << endl ;
213 
214  double eta =
215  muScales->getGMTEtaScale()->getCenter( muItr->etaIndex() ) ;
216 
217  double phi =
218  muScales->getPhiScale()->getLowEdge( muItr->phiIndex() ) ;
219 
221  eta,
222  phi,
223  muonMassGeV_ ) ;
224 
225  muColl->push_back(
226  L1MuonParticle( muItr->charge(),
227  p4,
228  *muItr,
229  muItr->bx() )
230  ) ;
231  }
232  }
233  }
234  }
235 
237  iEvent.put( muColl );
238 
239 
240  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
241  // ~~~~~~~~~~~~~~~~~~~~ Calorimeter ~~~~~~~~~~~~~~~~~~~~
242  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
243 
244  auto_ptr< L1EmParticleCollection > isoEmColl(
246 
247  auto_ptr< L1EmParticleCollection > nonIsoEmColl(
249 
250  auto_ptr< L1JetParticleCollection > cenJetColl(
252 
253  auto_ptr< L1JetParticleCollection > forJetColl(
255 
256  auto_ptr< L1JetParticleCollection > tauJetColl(
258 
259  auto_ptr< L1EtMissParticleCollection > etMissColl(
261 
262  auto_ptr< L1EtMissParticleCollection > htMissColl(
264 
265  auto_ptr< L1HFRingsCollection > hfRingsColl( new L1HFRingsCollection );
266 
268  {
269  // ~~~~~~~~~~~~~~~~~~~~ Geometry ~~~~~~~~~~~~~~~~~~~~
270 
271  ESHandle< L1CaloGeometry > caloGeomESH ;
272  iSetup.get< L1CaloGeometryRecord >().get( caloGeomESH ) ;
273  const L1CaloGeometry* caloGeom = &( *caloGeomESH ) ;
274 
275  // ~~~~~~~~~~~~~~~~~~~~ EM ~~~~~~~~~~~~~~~~~~~~
276 
277  ESHandle< L1CaloEtScale > emScale ;
278  iSetup.get< L1EmEtScaleRcd >().get( emScale ) ;
279 
280  // Isolated EM
281  Handle< L1GctEmCandCollection > hwIsoEmCands ;
282  iEvent.getByLabel( isoEmSource_, hwIsoEmCands ) ;
283 
284  if( !hwIsoEmCands.isValid() )
285  {
286  LogDebug("L1ExtraParticlesProd")
287  << "\nWarning: L1GctEmCandCollection with " << isoEmSource_
288  << "\nrequested in configuration, but not found in the event."
289  << std::endl;
290  }
291  else
292  {
293 // cout << "HW iso EM" << endl ;
294 
295  L1GctEmCandCollection::const_iterator emItr = hwIsoEmCands->begin() ;
296  L1GctEmCandCollection::const_iterator emEnd = hwIsoEmCands->end() ;
297  for( int i = 0 ; emItr != emEnd ; ++emItr, ++i )
298  {
299 // cout << "#" << i
300 // << " name " << emItr->name()
301 // << " empty " << emItr->empty()
302 // << " rank " << emItr->rank()
303 // << " eta " << emItr->etaIndex()
304 // << " sign " << emItr->etaSign()
305 // << " phi " << emItr->phiIndex()
306 // << " iso " << emItr->isolated()
307 // << " bx " << emItr->bx()
308 // << endl ;
309 
310  if( !emItr->empty() &&
311  ( !centralBxOnly_ || emItr->bx() == 0 ) )
312  {
313  double et = emScale->et( emItr->rank() ) ;
314 
315 // cout << "L1Extra et " << et << endl ;
316 
317  isoEmColl->push_back(
318  L1EmParticle( gctLorentzVector( et, *emItr, caloGeom, true ),
319  Ref< L1GctEmCandCollection >( hwIsoEmCands,
320  i ),
321  emItr->bx() ) ) ;
322  }
323  }
324  }
325 
326 
327  // Non-isolated EM
328  Handle< L1GctEmCandCollection > hwNonIsoEmCands ;
329  iEvent.getByLabel( nonIsoEmSource_, hwNonIsoEmCands ) ;
330 
331  if( !hwNonIsoEmCands.isValid() )
332  {
333  LogDebug("L1ExtraParticlesProd")
334  << "\nWarning: L1GctEmCandCollection with " << nonIsoEmSource_
335  << "\nrequested in configuration, but not found in the event."
336  << std::endl;
337  }
338  else
339  {
340 // cout << "HW non-iso EM" << endl ;
341  L1GctEmCandCollection::const_iterator emItr = hwNonIsoEmCands->begin() ;
342  L1GctEmCandCollection::const_iterator emEnd = hwNonIsoEmCands->end() ;
343  for( int i = 0 ; emItr != emEnd ; ++emItr, ++i )
344  {
345 // cout << "#" << i
346 // << " name " << emItr->name()
347 // << " empty " << emItr->empty()
348 // << " rank " << emItr->rank()
349 // << " eta " << emItr->etaIndex()
350 // << " sign " << emItr->etaSign()
351 // << " phi " << emItr->phiIndex()
352 // << " iso " << emItr->isolated()
353 // << " bx " << emItr->bx()
354 // << endl ;
355 
356  if( !emItr->empty() &&
357  ( !centralBxOnly_ || emItr->bx() == 0 ) )
358  {
359  double et = emScale->et( emItr->rank() ) ;
360 
361 // cout << "L1Extra et " << et << endl ;
362 
363  nonIsoEmColl->push_back(
364  L1EmParticle( gctLorentzVector( et, *emItr, caloGeom, true ),
365  Ref< L1GctEmCandCollection >( hwNonIsoEmCands,
366  i ),
367  emItr->bx() ) );
368  }
369  }
370  }
371 
372 
373  // ~~~~~~~~~~~~~~~~~~~~ Jets ~~~~~~~~~~~~~~~~~~~~
374 
375  ESHandle< L1CaloEtScale > jetScale ;
376  iSetup.get< L1JetEtScaleRcd >().get( jetScale ) ;
377 
378  // Central jets.
379  Handle< L1GctJetCandCollection > hwCenJetCands ;
380  iEvent.getByLabel( cenJetSource_, hwCenJetCands ) ;
381 
382  if( !hwCenJetCands.isValid() )
383  {
384  LogDebug("L1ExtraParticlesProd")
385  << "\nWarning: L1GctJetCandCollection with " << cenJetSource_
386  << "\nrequested in configuration, but not found in the event."
387  << std::endl;
388  }
389  else
390  {
391 // cout << "HW central jets" << endl ;
392  L1GctJetCandCollection::const_iterator jetItr = hwCenJetCands->begin() ;
393  L1GctJetCandCollection::const_iterator jetEnd = hwCenJetCands->end() ;
394  for( int i = 0 ; jetItr != jetEnd ; ++jetItr, ++i )
395  {
396 // cout << "#" << i
397 // << " name " << jetItr->name()
398 // << " empty " << jetItr->empty()
399 // << " rank " << jetItr->rank()
400 // << " eta " << jetItr->etaIndex()
401 // << " sign " << jetItr->etaSign()
402 // << " phi " << jetItr->phiIndex()
403 // << " cen " << jetItr->isCentral()
404 // << " for " << jetItr->isForward()
405 // << " tau " << jetItr->isTau()
406 // << " bx " << jetItr->bx()
407 // << endl ;
408 
409  if( !jetItr->empty() &&
410  ( !centralBxOnly_ || jetItr->bx() == 0 ) )
411  {
412  double et = jetScale->et( jetItr->rank() ) ;
413 
414 // cout << "L1Extra et " << et << endl ;
415 
416  cenJetColl->push_back(
417  L1JetParticle( gctLorentzVector( et, *jetItr, caloGeom, true ),
418  Ref< L1GctJetCandCollection >( hwCenJetCands,
419  i ),
420  jetItr->bx() ) ) ;
421  }
422  }
423  }
424 
425 
426  // Forward jets.
427  Handle< L1GctJetCandCollection > hwForJetCands ;
428  iEvent.getByLabel( forJetSource_, hwForJetCands ) ;
429 
430  if( !hwForJetCands.isValid() )
431  {
432  LogDebug("L1ExtraParticlesProd")
433  << "\nWarning: L1GctEmCandCollection with " << forJetSource_
434  << "\nrequested in configuration, but not found in the event."
435  << std::endl;
436  }
437  else
438  {
439 // cout << "HW forward jets" << endl ;
440  L1GctJetCandCollection::const_iterator jetItr = hwForJetCands->begin() ;
441  L1GctJetCandCollection::const_iterator jetEnd = hwForJetCands->end() ;
442  for( int i = 0 ; jetItr != jetEnd ; ++jetItr, ++i )
443  {
444 // cout << "#" << i
445 // << " name " << jetItr->name()
446 // << " empty " << jetItr->empty()
447 // << " rank " << jetItr->rank()
448 // << " eta " << jetItr->etaIndex()
449 // << " sign " << jetItr->etaSign()
450 // << " phi " << jetItr->phiIndex()
451 // << " cen " << jetItr->isCentral()
452 // << " for " << jetItr->isForward()
453 // << " tau " << jetItr->isTau()
454 // << " bx " << jetItr->bx()
455 // << endl ;
456 
457  if( !jetItr->empty() &&
458  ( !centralBxOnly_ || jetItr->bx() == 0 ) )
459  {
460  double et = jetScale->et( jetItr->rank() ) ;
461 
462 // cout << "L1Extra et " << et << endl ;
463 
464  forJetColl->push_back(
465  L1JetParticle( gctLorentzVector( et, *jetItr, caloGeom, false ),
466  Ref< L1GctJetCandCollection >( hwForJetCands,
467  i ),
468  jetItr->bx() ) ) ;
469  }
470  }
471  }
472 
473 
474  // Tau jets.
475 // cout << "HW tau jets" << endl ;
476  Handle< L1GctJetCandCollection > hwTauJetCands ;
477  iEvent.getByLabel( tauJetSource_, hwTauJetCands ) ;
478 
479  if( !hwTauJetCands.isValid() )
480  {
481  LogDebug("L1ExtraParticlesProd")
482  << "\nWarning: L1GctJetCandCollection with " << tauJetSource_
483  << "\nrequested in configuration, but not found in the event."
484  << std::endl;
485  }
486  else
487  {
488  L1GctJetCandCollection::const_iterator jetItr = hwTauJetCands->begin() ;
489  L1GctJetCandCollection::const_iterator jetEnd = hwTauJetCands->end() ;
490  for( int i = 0 ; jetItr != jetEnd ; ++jetItr, ++i )
491  {
492 // cout << "#" << i
493 // << " name " << jetItr->name()
494 // << " empty " << jetItr->empty()
495 // << " rank " << jetItr->rank()
496 // << " eta " << jetItr->etaIndex()
497 // << " sign " << jetItr->etaSign()
498 // << " phi " << jetItr->phiIndex()
499 // << " cen " << jetItr->isCentral()
500 // << " for " << jetItr->isForward()
501 // << " tau " << jetItr->isTau()
502 // << " bx " << jetItr->bx()
503 // << endl ;
504 
505  if( !jetItr->empty() &&
506  ( !centralBxOnly_ || jetItr->bx() == 0 ) )
507  {
508  double et = jetScale->et( jetItr->rank() ) ;
509 
510 // cout << "L1Extra et " << et << endl ;
511 
512  tauJetColl->push_back(
513  L1JetParticle( gctLorentzVector( et, *jetItr, caloGeom, true ),
514  Ref< L1GctJetCandCollection >( hwTauJetCands,
515  i ),
516  jetItr->bx() ) ) ;
517  }
518  }
519  }
520 
521  // ~~~~~~~~~~~~~~~~~~~~ ET Sums ~~~~~~~~~~~~~~~~~~~~
522 
523  double etSumLSB = jetScale->linearLsb() ;
524 
526  iEvent.getByLabel( etTotSource_, hwEtTotColl ) ;
527 
528  Handle< L1GctEtMissCollection > hwEtMissColl ;
529  iEvent.getByLabel( etMissSource_, hwEtMissColl ) ;
530 
531  if( !hwEtTotColl.isValid() )
532  {
533  LogDebug("L1ExtraParticlesProd")
534  << "\nWarning: L1GctEtTotalCollection with " << etTotSource_
535  << "\nrequested in configuration, but not found in the event."
536  << std::endl;
537  }
538  else if( !hwEtMissColl.isValid() )
539  {
540  LogDebug("L1ExtraParticlesProd")
541  << "\nWarning: L1GctEtMissCollection with " << etMissSource_
542  << "\nrequested in configuration, but not found in the event."
543  << std::endl;
544  }
545  else
546  {
547  // Make a L1EtMissParticle even if either L1GctEtTotal or L1GctEtMiss
548  // is missing for a given bx. Keep track of which L1GctEtMiss objects
549  // have a corresponding L1GctEtTotal object.
550  std::vector< bool > etMissMatched ;
551 
552  L1GctEtMissCollection::const_iterator hwEtMissItr =
553  hwEtMissColl->begin() ;
554  L1GctEtMissCollection::const_iterator hwEtMissEnd =
555  hwEtMissColl->end() ;
556  for( ; hwEtMissItr != hwEtMissEnd ; ++hwEtMissItr )
557  {
558  etMissMatched.push_back( false ) ;
559  }
560 
561  // Collate energy sums by bx
562  L1GctEtTotalCollection::const_iterator hwEtTotItr =
563  hwEtTotColl->begin() ;
564  L1GctEtTotalCollection::const_iterator hwEtTotEnd =
565  hwEtTotColl->end() ;
566 
567  int iTot = 0 ;
568  for( ; hwEtTotItr != hwEtTotEnd ; ++hwEtTotItr, ++iTot )
569  {
570  int bx = hwEtTotItr->bx() ;
571 
572  if( !centralBxOnly_ || bx == 0 )
573  {
574  // ET bin low edge
575  double etTot =
576  ( hwEtTotItr->overFlow() ?
577  ( double ) L1GctEtTotal::kEtTotalMaxValue :
578  ( double ) hwEtTotItr->et() ) * etSumLSB + 1.e-6 ;
579 
580  int iMiss = 0 ;
581  hwEtMissItr = hwEtMissColl->begin() ;
582  hwEtMissEnd = hwEtMissColl->end() ;
583  for( ; hwEtMissItr != hwEtMissEnd ; ++hwEtMissItr, ++iMiss )
584  {
585  if( hwEtMissItr->bx() == bx )
586  {
587  etMissMatched[ iMiss ] = true ;
588  break ;
589  }
590  }
591 
592  double etMiss = 0. ;
593  double phi = 0. ;
596 
597  // If a L1GctEtMiss with the right bx is not found, itr == end.
598  if( hwEtMissItr != hwEtMissEnd )
599  {
600  // ET bin low edge
601  etMiss =
602  ( hwEtMissItr->overFlow() ?
603  ( double ) L1GctEtMiss::kEtMissMaxValue :
604  ( double ) hwEtMissItr->et() ) * etSumLSB + 1.e-6 ;
605  // keep x and y components non-zero and
606  // protect against roundoff.
607 
608  phi = caloGeom->etSumPhiBinCenter( hwEtMissItr->phi() ) ;
609 
610  p4 = math::PtEtaPhiMLorentzVector( etMiss,
611  0.,
612  phi,
613  0. ) ;
614 
615  metRef = Ref< L1GctEtMissCollection >( hwEtMissColl, iMiss ) ;
616 
617 // cout << "HW ET Sums " << endl
618 // << "MET: phi " << hwEtMissItr->phi() << " = " << phi
619 // << " et " << hwEtMissItr->et() << " = " << etMiss
620 // << " EtTot " << hwEtTotItr->et() << " = " << etTot
621 // << " bx " << bx
622 // << endl ;
623  }
624 // else
625 // {
626 // cout << "HW ET Sums " << endl
627 // << "MET: phi " << phi
628 // << " et "<< etMiss
629 // << " EtTot " << hwEtTotItr->et() << " = " << etTot
630 // << " bx " << bx
631 // << endl ;
632 // }
633 
634  etMissColl->push_back(
636  p4,
637  L1EtMissParticle::kMET,
638  etTot,
639  metRef,
640  Ref< L1GctEtTotalCollection >( hwEtTotColl, iTot ),
643  bx
644  ) ) ;
645  }
646  }
647 
648  if( !centralBxOnly_ )
649  {
650  // Make L1EtMissParticles for those L1GctEtMiss objects without
651  // a matched L1GctEtTotal object.
652 
653  double etTot = 0. ;
654 
655  hwEtMissItr = hwEtMissColl->begin() ;
656  hwEtMissEnd = hwEtMissColl->end() ;
657  int iMiss = 0 ;
658  for( ; hwEtMissItr != hwEtMissEnd ; ++hwEtMissItr, ++iMiss )
659  {
660  if( !etMissMatched[ iMiss ] )
661  {
662  int bx = hwEtMissItr->bx() ;
663 
664  // ET bin low edge
665  double etMiss =
666  ( hwEtMissItr->overFlow() ?
667  ( double ) L1GctEtMiss::kEtMissMaxValue :
668  ( double ) hwEtMissItr->et() ) * etSumLSB + 1.e-6 ;
669  // keep x and y components non-zero and
670  // protect against roundoff.
671 
672  double phi =
673  caloGeom->etSumPhiBinCenter( hwEtMissItr->phi() ) ;
674 
676  0.,
677  phi,
678  0. ) ;
679 
680 // cout << "HW ET Sums " << endl
681 // << "MET: phi " << hwEtMissItr->phi() << " = " << phi
682 // << " et " << hwEtMissItr->et() << " = " << etMiss
683 // << " EtTot " << etTot
684 // << " bx " << bx
685 // << endl ;
686 
687  etMissColl->push_back(
689  p4,
690  L1EtMissParticle::kMET,
691  etTot,
692  Ref< L1GctEtMissCollection >( hwEtMissColl, iMiss ),
696  bx
697  ) ) ;
698  }
699  }
700  }
701  }
702 
703  // ~~~~~~~~~~~~~~~~~~~~ HT Sums ~~~~~~~~~~~~~~~~~~~~
704 
705  Handle< L1GctEtHadCollection > hwEtHadColl ;
706  iEvent.getByLabel( etHadSource_, hwEtHadColl ) ;
707 
708  Handle< L1GctHtMissCollection > hwHtMissColl ;
709  if( !ignoreHtMiss_ )
710  {
711  iEvent.getByLabel( htMissSource_, hwHtMissColl ) ;
712  }
713 
714  ESHandle< L1GctJetFinderParams > jetFinderParams ;
715  iSetup.get< L1GctJetFinderParamsRcd >().get( jetFinderParams ) ;
716  double htSumLSB = jetFinderParams->getHtLsbGeV();
717 
718  ESHandle< L1CaloEtScale > htMissScale ;
719  std::vector< bool > htMissMatched ;
720  if( !ignoreHtMiss_ )
721  {
722  iSetup.get< L1HtMissScaleRcd >().get( htMissScale ) ;
723 
724  if( !hwEtHadColl.isValid() )
725  {
726  LogDebug("L1ExtraParticlesProd")
727  << "\nWarning: L1GctEtHadCollection with " << etHadSource_
728  << "\nrequested in configuration, but not found in the event."
729  << std::endl;
730  }
731  else if( !hwHtMissColl.isValid() )
732  {
733  LogDebug("L1ExtraParticlesProd")
734  << "\nWarning: L1GctHtMissCollection with " << htMissSource_
735  << "\nrequested in configuration, but not found in the event."
736  << std::endl;
737  }
738  else
739  {
740  // Make a L1EtMissParticle even if either L1GctEtHad or L1GctHtMiss
741  // is missing for a given bx. Keep track of which L1GctHtMiss objects
742  // have a corresponding L1GctHtTotal object.
743  L1GctHtMissCollection::const_iterator hwHtMissItr =
744  hwHtMissColl->begin() ;
745  L1GctHtMissCollection::const_iterator hwHtMissEnd =
746  hwHtMissColl->end() ;
747  for( ; hwHtMissItr != hwHtMissEnd ; ++hwHtMissItr )
748  {
749  htMissMatched.push_back( false ) ;
750  }
751  }
752  }
753 
754  if( !hwEtHadColl.isValid() )
755  {
756  LogDebug("L1ExtraParticlesProd")
757  << "\nWarning: L1GctEtHadCollection with " << etHadSource_
758  << "\nrequested in configuration, but not found in the event."
759  << std::endl;
760  }
761  else if( !hwHtMissColl.isValid() )
762  {
763  LogDebug("L1ExtraParticlesProd")
764  << "\nWarning: L1GctHtMissCollection with " << htMissSource_
765  << "\nrequested in configuration, but not found in the event."
766  << std::endl;
767  }
768  else
769  {
770  L1GctEtHadCollection::const_iterator hwEtHadItr =
771  hwEtHadColl->begin() ;
772  L1GctEtHadCollection::const_iterator hwEtHadEnd =
773  hwEtHadColl->end() ;
774 
775  int iHad = 0 ;
776  for( ; hwEtHadItr != hwEtHadEnd ; ++hwEtHadItr, ++iHad )
777  {
778  int bx = hwEtHadItr->bx() ;
779 
780  if( !centralBxOnly_ || bx == 0 )
781  {
782  // HT bin low edge
783  double htTot =
784  ( hwEtHadItr->overFlow() ?
785  ( double ) L1GctEtHad::kEtHadMaxValue :
786  ( double ) hwEtHadItr->et() ) * htSumLSB + 1.e-6 ;
787 
788  double htMiss = 0. ;
789  double phi = 0. ;
792 
793  if( !ignoreHtMiss_ )
794  {
795  L1GctHtMissCollection::const_iterator hwHtMissItr =
796  hwHtMissColl->begin() ;
797  L1GctHtMissCollection::const_iterator hwHtMissEnd =
798  hwHtMissColl->end() ;
799 
800  int iMiss = 0 ;
801  for( ; hwHtMissItr != hwHtMissEnd ; ++hwHtMissItr, ++iMiss )
802  {
803  if( hwHtMissItr->bx() == bx )
804  {
805  htMissMatched[ iMiss ] = true ;
806  break ;
807  }
808  }
809 
810  // If a L1GctHtMiss with the right bx is not found, itr == end.
811  if( hwHtMissItr != hwHtMissEnd )
812  {
813  // HT bin low edge
814  htMiss =
815  htMissScale->et( hwHtMissItr->overFlow() ?
816  htMissScale->rankScaleMax() :
817  hwHtMissItr->et() ) + 1.e-6 ;
818  // keep x and y components non-zero and
819  // protect against roundoff.
820 
821  phi =
822  caloGeom->htSumPhiBinCenter( hwHtMissItr->phi() ) ;
823 
824  p4 = math::PtEtaPhiMLorentzVector( htMiss,
825  0.,
826  phi,
827  0. ) ;
828 
829  mhtRef=Ref< L1GctHtMissCollection >( hwHtMissColl, iMiss );
830 
831 // cout << "HW HT Sums " << endl
832 // << "MHT: phi " << hwHtMissItr->phi() << " = " << phi
833 // << " ht " << hwHtMissItr->et() << " = " << htMiss
834 // << " HtTot " << hwEtHadItr->et() << " = " << htTot
835 // << " bx " << bx
836 // << endl ;
837  }
838 // else
839 // {
840 // cout << "HW HT Sums " << endl
841 // << "MHT: phi " << phi
842 // << " ht " << htMiss
843 // << " HtTot " << hwEtHadItr->et() << " = " << htTot
844 // << " bx " << bx
845 // << endl ;
846 // }
847  }
848 
849  htMissColl->push_back(
851  p4,
852  L1EtMissParticle::kMHT,
853  htTot,
856  mhtRef,
857  Ref< L1GctEtHadCollection >( hwEtHadColl, iHad ),
858  bx
859  ) ) ;
860  }
861  }
862 
863  if( !centralBxOnly_ && !ignoreHtMiss_ )
864  {
865  // Make L1EtMissParticles for those L1GctHtMiss objects without
866  // a matched L1GctHtTotal object.
867  double htTot = 0. ;
868 
869  L1GctHtMissCollection::const_iterator hwHtMissItr =
870  hwHtMissColl->begin() ;
871  L1GctHtMissCollection::const_iterator hwHtMissEnd =
872  hwHtMissColl->end() ;
873 
874  int iMiss = 0 ;
875  for( ; hwHtMissItr != hwHtMissEnd ; ++hwHtMissItr, ++iMiss )
876  {
877  if( !htMissMatched[ iMiss ] )
878  {
879  int bx = hwHtMissItr->bx() ;
880 
881  // HT bin low edge
882  double htMiss =
883  htMissScale->et( hwHtMissItr->overFlow() ?
884  htMissScale->rankScaleMax() :
885  hwHtMissItr->et() ) + 1.e-6 ;
886  // keep x and y components non-zero and
887  // protect against roundoff.
888 
889  double phi =
890  caloGeom->htSumPhiBinCenter( hwHtMissItr->phi() ) ;
891 
893  0.,
894  phi,
895  0. ) ;
896 
897 // cout << "HW HT Sums " << endl
898 // << "MHT: phi " << hwHtMissItr->phi() << " = " << phi
899 // << " ht " << hwHtMissItr->et() << " = " << htMiss
900 // << " HtTot " << htTot
901 // << " bx " << bx
902 // << endl ;
903 
904  htMissColl->push_back(
906  p4,
907  L1EtMissParticle::kMHT,
908  htTot,
911  Ref< L1GctHtMissCollection >( hwHtMissColl, iMiss ),
913  bx
914  ) ) ;
915  }
916  }
917  }
918  }
919 
920  // ~~~~~~~~~~~~~~~~~~~~ HF Rings ~~~~~~~~~~~~~~~~~~~~
921 
923  iEvent.getByLabel( hfRingEtSumsSource_, hwHFEtSumsColl ) ;
924 
925  Handle< L1GctHFBitCountsCollection > hwHFBitCountsColl ;
926  iEvent.getByLabel( hfRingBitCountsSource_, hwHFBitCountsColl ) ;
927 
928  ESHandle< L1CaloEtScale > hfRingEtScale ;
929  iSetup.get< L1HfRingEtScaleRcd >().get( hfRingEtScale ) ;
930 
931  if( !hwHFEtSumsColl.isValid() )
932  {
933  LogDebug("L1ExtraParticlesProd")
934  << "\nWarning: L1GctHFRingEtSumsCollection with " << hfRingEtSumsSource_
935  << "\nrequested in configuration, but not found in the event."
936  << std::endl;
937  }
938  else if( !hwHFBitCountsColl.isValid() )
939  {
940  LogDebug("L1ExtraParticlesProd")
941  << "\nWarning: L1GctHFBitCountsCollection with " << hfRingBitCountsSource_
942  << "\nrequested in configuration, but not found in the event."
943  << std::endl;
944  }
945  else
946  {
947  L1GctHFRingEtSumsCollection::const_iterator hwHFEtSumsItr =
948  hwHFEtSumsColl->begin() ;
949  L1GctHFRingEtSumsCollection::const_iterator hwHFEtSumsEnd =
950  hwHFEtSumsColl->end() ;
951 
952  int iEtSums = 0 ;
953  for( ; hwHFEtSumsItr != hwHFEtSumsEnd ; ++hwHFEtSumsItr, ++iEtSums )
954  {
955  int bx = hwHFEtSumsItr->bx() ;
956 
957  if( !centralBxOnly_ || bx == 0 )
958  {
959  L1GctHFBitCountsCollection::const_iterator hwHFBitCountsItr =
960  hwHFBitCountsColl->begin() ;
961  L1GctHFBitCountsCollection::const_iterator hwHFBitCountsEnd =
962  hwHFBitCountsColl->end() ;
963 
964  int iBitCounts = 0 ;
965  for( ; hwHFBitCountsItr != hwHFBitCountsEnd ;
966  ++hwHFBitCountsItr, ++iBitCounts )
967  {
968  if( hwHFBitCountsItr->bx() == bx )
969  {
970  break ;
971  }
972  }
973 
974  // If a L1GctHFBitCounts with the right bx is not found, itr == end.
975  if( hwHFBitCountsItr != hwHFBitCountsEnd )
976  {
977  // Construct L1HFRings only if both HW objects are present.
978 
979  // cout << "HF Rings " << endl
980 
981  // HF Et sums
982  double etSums[ L1HFRings::kNumRings ] ;
983  etSums[ L1HFRings::kRing1PosEta ] =
984  hfRingEtScale->et( hwHFEtSumsItr->etSum( 0 ) ) + 1.e-6 ;
985  etSums[ L1HFRings::kRing1NegEta ] =
986  hfRingEtScale->et( hwHFEtSumsItr->etSum( 1 ) ) + 1.e-6 ;
987  etSums[ L1HFRings::kRing2PosEta ] =
988  hfRingEtScale->et( hwHFEtSumsItr->etSum( 2 ) ) + 1.e-6 ;
989  etSums[ L1HFRings::kRing2NegEta ] =
990  hfRingEtScale->et( hwHFEtSumsItr->etSum( 3 ) ) + 1.e-6 ;
991  // protect against roundoff.
992 
993 // cout << "HF Et Sums "
994 // << hwHFEtSumsItr->etSum( 0 ) << " = "
995 // << etSums[ L1HFRings::kRing1PosEta ] << " "
996 // << hwHFEtSumsItr->etSum( 1 ) << " = "
997 // << etSums[ L1HFRings::kRing1NegEta ] << " "
998 // << hwHFEtSumsItr->etSum( 2 ) << " = "
999 // << etSums[ L1HFRings::kRing2PosEta ] << " "
1000 // << hwHFEtSumsItr->etSum( 3 ) << " = "
1001 // << etSums[ L1HFRings::kRing2NegEta ]
1002 // << endl ;
1003 
1004  // HF bit counts
1005  int bitCounts[ L1HFRings::kNumRings ] ;
1006  bitCounts[ L1HFRings::kRing1PosEta ] =
1007  hwHFBitCountsItr->bitCount( 0 ) ;
1008  bitCounts[ L1HFRings::kRing1NegEta ] =
1009  hwHFBitCountsItr->bitCount( 1 ) ;
1010  bitCounts[ L1HFRings::kRing2PosEta ] =
1011  hwHFBitCountsItr->bitCount( 2 ) ;
1012  bitCounts[ L1HFRings::kRing2NegEta ] =
1013  hwHFBitCountsItr->bitCount( 3 ) ;
1014 
1015 // cout << "HF bit counts "
1016 // << hwHFBitCountsItr->bitCount( 0 ) << " "
1017 // << hwHFBitCountsItr->bitCount( 1 ) << " "
1018 // << hwHFBitCountsItr->bitCount( 2 ) << " "
1019 // << hwHFBitCountsItr->bitCount( 3 ) << " "
1020 // << endl ;
1021 
1022  hfRingsColl->push_back(
1023  L1HFRings( etSums,
1024  bitCounts,
1025  Ref< L1GctHFRingEtSumsCollection >( hwHFEtSumsColl,
1026  iEtSums ),
1027  Ref< L1GctHFBitCountsCollection >( hwHFBitCountsColl,
1028  iBitCounts ),
1029  bx
1030  ) ) ;
1031  }
1032  }
1033  }
1034  }
1035  }
1036 
1038  iEvent.put( isoEmColl, "Isolated" ) ;
1039 
1041  iEvent.put( nonIsoEmColl, "NonIsolated" ) ;
1042 
1044  iEvent.put( cenJetColl, "Central" ) ;
1045 
1047  iEvent.put( forJetColl, "Forward" ) ;
1048 
1050  iEvent.put( tauJetColl, "Tau" ) ;
1051 
1053  iEvent.put( etMissColl, "MET" ) ;
1054 
1056  iEvent.put( htMissColl, "MHT" ) ;
1057 
1058  OrphanHandle< L1HFRingsCollection > hfRingsCollHandle =
1059  iEvent.put( hfRingsColl ) ;
1060 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
math::PtEtaPhiMLorentzVector gctLorentzVector(const double &et, const L1GctCand &cand, const L1CaloGeometry *geom, bool central)
T eta() const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:26
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
double p4[4]
Definition: TauolaWrapper.h:92
double htSumPhiBinCenter(unsigned int phiIndex) const
edm::InputTag hfRingEtSumsSource_
edm::InputTag hfRingBitCountsSource_
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
const T & get() const
Definition: EventSetup.h:55
std::vector< L1EtMissParticle > L1EtMissParticleCollection
double etSumPhiBinCenter(unsigned int phiIndex) const
Definition: DDAxes.h:10

Member Data Documentation

edm::InputTag L1ExtraParticlesProd::cenJetSource_
private

Definition at line 65 of file L1ExtraParticlesProd.h.

Referenced by produce().

bool L1ExtraParticlesProd::centralBxOnly_
private

Definition at line 77 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::etHadSource_
private

Definition at line 69 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::etMissSource_
private

Definition at line 70 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::etTotSource_
private

Definition at line 68 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::forJetSource_
private

Definition at line 66 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::hfRingBitCountsSource_
private

Definition at line 73 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::hfRingEtSumsSource_
private

Definition at line 72 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::htMissSource_
private

Definition at line 71 of file L1ExtraParticlesProd.h.

Referenced by produce().

bool L1ExtraParticlesProd::ignoreHtMiss_
private

Definition at line 81 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::isoEmSource_
private

Definition at line 63 of file L1ExtraParticlesProd.h.

Referenced by produce().

double L1ExtraParticlesProd::muonMassGeV_ = 0.105658369
staticprivate

Definition at line 75 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::muonSource_
private

Definition at line 60 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::nonIsoEmSource_
private

Definition at line 64 of file L1ExtraParticlesProd.h.

Referenced by produce().

bool L1ExtraParticlesProd::produceCaloParticles_
private

Definition at line 62 of file L1ExtraParticlesProd.h.

Referenced by produce().

bool L1ExtraParticlesProd::produceMuonParticles_
private

Definition at line 59 of file L1ExtraParticlesProd.h.

Referenced by produce().

edm::InputTag L1ExtraParticlesProd::tauJetSource_
private

Definition at line 67 of file L1ExtraParticlesProd.h.

Referenced by produce().