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 // system include files
14 #include <memory>
15 
16 // user include files
18 
21 
25 
27  : internalJetSource_(iConfig.getParameter<edm::InputTag>("internalJetSource")),
29  jetScaleToken_(esConsumes<L1CaloEtScale, L1JetEtScaleRcd>()),
30  centralBxOnly_(iConfig.getParameter<bool>("centralBxOnly")) {
31  using namespace l1extra;
32 
33  produces<L1JetParticleCollection>("Internal");
34 }
35 
37  //std::cout << "ARGGHHH!" << std::endl;
38  using namespace edm;
39  using namespace l1extra;
40  using namespace std;
41 
42  unique_ptr<L1JetParticleCollection> internJetColl(new L1JetParticleCollection);
43 
45  const L1CaloGeometry* caloGeom = &(*caloGeomESH);
46 
48 
49  double etSumLSB = jetScale->linearLsb();
50  //std::cout << "Inside the Jet producer " << etSumLSB << std::endl;
51 
53  iEvent.getByLabel(internalJetSource_, hwIntJetCands);
54  //std::cout << "At leas Something is happening" <<std::endl;
55  if (!hwIntJetCands.isValid()) {
56  std::cout << "These aren't the Jets you're looking for" << std::endl;
57 
58  LogDebug("L1GctInternJetProducer") << "\nWarning: L1GctJetCandCollection with " << internalJetSource_
59  << "\nrequested in configuration, but not found in the event." << std::endl;
60 
61  } else {
62  //std::cout << "apparently the collection was found" <<std::endl;
63  L1GctInternJetDataCollection::const_iterator jetItr = hwIntJetCands->begin();
64  L1GctInternJetDataCollection::const_iterator jetEnd = hwIntJetCands->end();
65  int i;
66  for (i = 0; jetItr != jetEnd; ++jetItr, ++i) {
67  //std::cout << " JetS a plenty" <<std::endl;
68  if (!jetItr->empty() && (!centralBxOnly_ || jetItr->bx() == 0)) {
69  double et = (jetItr->oflow() ? (double)0xfff : (double)jetItr->et()) * etSumLSB + 1.e-6;
70 
71  //double et = 10.;
72  //std::cout << "jetET: " << jetItr->et() <<std::endl;
73  //std::cout << "ET was: " << et << std::endl;
74  double eta = caloGeom->etaBinCenter(jetItr->regionId());
75  double phi = caloGeom->emJetPhiBinCenter(jetItr->regionId());
76 
77  internJetColl->push_back(
79  }
80  }
81  }
82 
83  OrphanHandle<L1JetParticleCollection> internalJetHandle = iEvent.put(std::move(internJetColl), "Internal");
84 }
85 
86 //define this as a plug-in
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESGetToken< L1CaloGeometry, L1CaloGeometryRecord > caloGeomToken_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
int iEvent
Definition: GenABIO.cc:224
edm::ESGetToken< L1CaloEtScale, L1JetEtScaleRcd > jetScaleToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
L1GctInternJetProducer(const edm::ParameterSet &)
bool isValid() const
Definition: HandleBase.h:70
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
HLT enums.
double emJetPhiBinCenter(unsigned int phiIndex) const
double etaBinCenter(unsigned int etaIndex, bool central=true) const
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)