CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 // 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 
39  //std::cout << "ARGGHHH!" << std::endl;
40  using namespace edm;
41  using namespace l1extra;
42  using namespace std;
43 
44  unique_ptr<L1JetParticleCollection> internJetColl(new L1JetParticleCollection);
45 
47  const L1CaloGeometry* caloGeom = &(*caloGeomESH);
48 
50 
51  double etSumLSB = jetScale->linearLsb();
52  //std::cout << "Inside the Jet producer " << etSumLSB << std::endl;
53 
55  iEvent.getByLabel(internalJetSource_, hwIntJetCands);
56  //std::cout << "At leas Something is happening" <<std::endl;
57  if (!hwIntJetCands.isValid()) {
58  std::cout << "These aren't the Jets you're looking for" << std::endl;
59 
60  LogDebug("L1GctInternJetProducer") << "\nWarning: L1GctJetCandCollection with " << internalJetSource_
61  << "\nrequested in configuration, but not found in the event." << std::endl;
62 
63  } else {
64  //std::cout << "apparently the collection was found" <<std::endl;
65  L1GctInternJetDataCollection::const_iterator jetItr = hwIntJetCands->begin();
66  L1GctInternJetDataCollection::const_iterator jetEnd = hwIntJetCands->end();
67  int i;
68  for (i = 0; jetItr != jetEnd; ++jetItr, ++i) {
69  //std::cout << " JetS a plenty" <<std::endl;
70  if (!jetItr->empty() && (!centralBxOnly_ || jetItr->bx() == 0)) {
71  double et = (jetItr->oflow() ? (double)0xfff : (double)jetItr->et()) * etSumLSB + 1.e-6;
72 
73  //double et = 10.;
74  //std::cout << "jetET: " << jetItr->et() <<std::endl;
75  //std::cout << "ET was: " << et << std::endl;
76  double eta = caloGeom->etaBinCenter(jetItr->regionId());
77  double phi = caloGeom->emJetPhiBinCenter(jetItr->regionId());
78 
79  internJetColl->push_back(
80  L1JetParticle(math::PtEtaPhiMLorentzVector(et, eta, phi, 0.), Ref<L1GctJetCandCollection>(), jetItr->bx()));
81  }
82  }
83  }
84 
85  OrphanHandle<L1JetParticleCollection> internalJetHandle = iEvent.put(std::move(internJetColl), "Internal");
86 }
87 
89 
91 
92 //define this as a plug-in
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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_
def move
Definition: eostools.py:511
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500
L1GctInternJetProducer(const edm::ParameterSet &)
void produce(edm::Event &, const edm::EventSetup &) override
tuple cout
Definition: gather_cfg.py:144
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
#define LogDebug(id)