CMS 3D CMS Logo

L1GctInternJetProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: L1GctInternJetProducer
4 // Class: L1GctInternJetProducer
5 //
8 //
9 // Original Author: Alex Tapper
10 //
11 //
12 
13 
14 // system include files
15 #include <memory>
16 
17 // user include files
19 
22 
26 
29 
32 
34  internalJetSource_(iConfig.getParameter<edm::InputTag>("internalJetSource")),
35  centralBxOnly_(iConfig.getParameter<bool>("centralBxOnly"))
36 {
37  using namespace l1extra ;
38 
39  produces< L1JetParticleCollection >( "Internal" ) ;
40 }
41 
42 
44 
46 {
47 
48  //std::cout << "ARGGHHH!" << std::endl;
49  using namespace edm ;
50  using namespace l1extra ;
51  using namespace std ;
52 
53  unique_ptr< L1JetParticleCollection > internJetColl(new L1JetParticleCollection );
54 
55  ESHandle< L1CaloGeometry > caloGeomESH ;
56  iSetup.get< L1CaloGeometryRecord >().get( caloGeomESH ) ;
57  const L1CaloGeometry* caloGeom = &( *caloGeomESH ) ;
58 
60  iSetup.get< L1JetEtScaleRcd >().get( jetScale ) ;
61 
62  double etSumLSB = jetScale->linearLsb() ;
63  //std::cout << "Inside the Jet producer " << etSumLSB << std::endl;
64 
66  iEvent.getByLabel( internalJetSource_, hwIntJetCands ) ;
67  //std::cout << "At leas Something is happening" <<std::endl;
68  if( !hwIntJetCands.isValid() ) {
69  std::cout << "These aren't the Jets you're looking for" << std::endl;
70 
71  LogDebug("L1GctInternJetProducer")
72  << "\nWarning: L1GctJetCandCollection with " << internalJetSource_
73  << "\nrequested in configuration, but not found in the event."
74  << std::endl;
75 
76  } else {
77  //std::cout << "apparently the collection was found" <<std::endl;
78  L1GctInternJetDataCollection::const_iterator jetItr = hwIntJetCands->begin() ;
79  L1GctInternJetDataCollection::const_iterator jetEnd = hwIntJetCands->end() ;
80  int i;
81  for( i = 0 ; jetItr != jetEnd ; ++jetItr, ++i ){
82  //std::cout << " JetS a plenty" <<std::endl;
83  if( !jetItr->empty() &&
84  ( !centralBxOnly_ || jetItr->bx() == 0 ) ) {
85 
86 
87  double et = (jetItr->oflow() ?
88  (double) 0xfff:
89  (double) jetItr->et() ) * etSumLSB + 1.e-6;
90 
91  //double et = 10.;
92  //std::cout << "jetET: " << jetItr->et() <<std::endl;
93  //std::cout << "ET was: " << et << std::endl;
94  double eta = caloGeom->etaBinCenter( jetItr->regionId() );
95  double phi = caloGeom->emJetPhiBinCenter( jetItr->regionId() );
96 
97  internJetColl->push_back(L1JetParticle( math::PtEtaPhiMLorentzVector( et, eta, phi, 0.),
99  jetItr->bx() ) ) ;
100  }
101  }
102  }
103 
104  OrphanHandle< L1JetParticleCollection > internalJetHandle = iEvent.put(std::move(internJetColl), "Internal" ) ;
105 }
106 
108 
110 
111 //define this as a plug-in
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
double etaBinCenter(unsigned int etaIndex, bool central=true) const
double linearLsb() const
get LSB of linear input scale
Definition: L1CaloEtScale.h:53
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
int iEvent
Definition: GenABIO.cc:230
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:535
L1GctInternJetProducer(const edm::ParameterSet &)
et
define resolution functions of each parameter
void produce(edm::Event &, const edm::EventSetup &) override
HLT enums.
T get() const
Definition: EventSetup.h:68
double emJetPhiBinCenter(unsigned int phiIndex) const
def move(src, dest)
Definition: eostools.py:511