CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  auto_ptr< L1JetParticleCollection > internJetColl(new L1JetParticleCollection );
54 
55  ESHandle< L1CaloGeometry > caloGeomESH ;
56  iSetup.get< L1CaloGeometryRecord >().get( caloGeomESH ) ;
57  const L1CaloGeometry* caloGeom = &( *caloGeomESH ) ;
58 
59  ESHandle< L1CaloEtScale > jetScale ;
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( internJetColl, "Internal" ) ;
105 }
106 
108 
110 
111 //define this as a plug-in
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
T eta() const
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:26
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
const T & get() const
Definition: EventSetup.h:55
L1GctInternJetProducer(const edm::ParameterSet &)
tuple cout
Definition: gather_cfg.py:121
virtual void produce(edm::Event &, const edm::EventSetup &)
Definition: DDAxes.h:10