|
1 | | -// -*- C++ -*- |
2 | | -// |
3 | | -// Package: L1GctInternJetProducer |
4 | | -// Class: L1GctInternJetProducer |
5 | | -// |
6 | | -/**\class L1GctInternJetProducer \file L1GctInternJetProducer.cc EventFilter/GctRawToDigi/plugins/L1GctInternJetProducer.cc |
7 | | -*/ |
8 | | -// |
9 | | -// Original Author: Alex Tapper |
10 | | -// |
11 | | -// |
12 | | - |
13 | | -// system include files |
14 | | -#include <memory> |
15 | | - |
16 | | -// user include files |
17 | | -#include "EventFilter/GctRawToDigi/plugins/L1GctInternJetProducer.h" |
18 | | - |
19 | | -#include "FWCore/Framework/interface/Frameworkfwd.h" |
20 | | -#include "FWCore/Framework/interface/MakerMacros.h" |
21 | | - |
22 | | -#include "DataFormats/Common/interface/Handle.h" |
23 | | -#include "FWCore/Framework/interface/ESHandle.h" |
24 | | -#include "DataFormats/Common/interface/OrphanHandle.h" |
25 | | - |
26 | | -L1GctInternJetProducer::L1GctInternJetProducer(const edm::ParameterSet& iConfig) |
27 | | - : internalJetSource_(iConfig.getParameter<edm::InputTag>("internalJetSource")), |
28 | | - caloGeomToken_(esConsumes<L1CaloGeometry, L1CaloGeometryRecord>()), |
29 | | - jetScaleToken_(esConsumes<L1CaloEtScale, L1JetEtScaleRcd>()), |
30 | | - centralBxOnly_(iConfig.getParameter<bool>("centralBxOnly")) { |
31 | | - using namespace l1extra; |
32 | | - |
33 | | - produces<L1JetParticleCollection>("Internal"); |
34 | | -} |
35 | | - |
36 | | -void L1GctInternJetProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { |
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 | | - |
44 | | - ESHandle<L1CaloGeometry> caloGeomESH = iSetup.getHandle(caloGeomToken_); |
45 | | - const L1CaloGeometry* caloGeom = &(*caloGeomESH); |
46 | | - |
47 | | - ESHandle<L1CaloEtScale> jetScale = iSetup.getHandle(jetScaleToken_); |
48 | | - |
49 | | - double etSumLSB = jetScale->linearLsb(); |
50 | | - //std::cout << "Inside the Jet producer " << etSumLSB << std::endl; |
51 | | - |
52 | | - Handle<L1GctInternJetDataCollection> hwIntJetCands; |
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( |
78 | | - L1JetParticle(math::PtEtaPhiMLorentzVector(et, eta, phi, 0.), Ref<L1GctJetCandCollection>(), jetItr->bx())); |
79 | | - } |
80 | | - } |
81 | | - } |
82 | | - |
83 | | - OrphanHandle<L1JetParticleCollection> internalJetHandle = iEvent.put(std::move(internJetColl), "Internal"); |
84 | | -} |
85 | | - |
86 | | -//define this as a plug-in |
87 | | -DEFINE_FWK_MODULE(L1GctInternJetProducer); |
| 1 | +// -*- C++ -*- |
| 2 | +// |
| 3 | +// Package: L1GctInternJetProducer |
| 4 | +// Class: L1GctInternJetProducer |
| 5 | +// |
| 6 | +/**\class L1GctInternJetProducer \file L1GctInternJetProducer.cc EventFilter/GctRawToDigi/plugins/L1GctInternJetProducer.cc |
| 7 | +*/ |
| 8 | +// |
| 9 | +// Original Author: Alex Tapper |
| 10 | +// |
| 11 | +// |
| 12 | + |
| 13 | +// system include files |
| 14 | +#include <memory> |
| 15 | + |
| 16 | +// user include files |
| 17 | +#include "DataFormats/Common/interface/Handle.h" |
| 18 | +#include "FWCore/Framework/interface/ESHandle.h" |
| 19 | +#include "FWCore/Framework/interface/Frameworkfwd.h" |
| 20 | +#include "FWCore/Framework/interface/MakerMacros.h" |
| 21 | + |
| 22 | +#include "L1GctInternJetProducer.h" |
| 23 | + |
| 24 | +L1GctInternJetProducer::L1GctInternJetProducer(const edm::ParameterSet& iConfig) |
| 25 | + : internalJetSource_(iConfig.getParameter<edm::InputTag>("internalJetSource")), |
| 26 | + caloGeomToken_(esConsumes<L1CaloGeometry, L1CaloGeometryRecord>()), |
| 27 | + jetScaleToken_(esConsumes<L1CaloEtScale, L1JetEtScaleRcd>()), |
| 28 | + centralBxOnly_(iConfig.getParameter<bool>("centralBxOnly")) { |
| 29 | + using namespace l1extra; |
| 30 | + |
| 31 | + produces<L1JetParticleCollection>("Internal"); |
| 32 | +} |
| 33 | + |
| 34 | +void L1GctInternJetProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { |
| 35 | + //std::cout << "ARGGHHH!" << std::endl; |
| 36 | + using namespace edm; |
| 37 | + using namespace l1extra; |
| 38 | + using namespace std; |
| 39 | + |
| 40 | + unique_ptr<L1JetParticleCollection> internJetColl(new L1JetParticleCollection); |
| 41 | + |
| 42 | + ESHandle<L1CaloGeometry> caloGeomESH = iSetup.getHandle(caloGeomToken_); |
| 43 | + const L1CaloGeometry* caloGeom = &(*caloGeomESH); |
| 44 | + |
| 45 | + ESHandle<L1CaloEtScale> jetScale = iSetup.getHandle(jetScaleToken_); |
| 46 | + |
| 47 | + double etSumLSB = jetScale->linearLsb(); |
| 48 | + //std::cout << "Inside the Jet producer " << etSumLSB << std::endl; |
| 49 | + |
| 50 | + Handle<L1GctInternJetDataCollection> hwIntJetCands; |
| 51 | + iEvent.getByLabel(internalJetSource_, hwIntJetCands); |
| 52 | + //std::cout << "At leas Something is happening" <<std::endl; |
| 53 | + if (!hwIntJetCands.isValid()) { |
| 54 | + std::cout << "These aren't the Jets you're looking for" << std::endl; |
| 55 | + |
| 56 | + LogDebug("L1GctInternJetProducer") << "\nWarning: L1GctJetCandCollection with " << internalJetSource_ |
| 57 | + << "\nrequested in configuration, but not found in the event." << std::endl; |
| 58 | + |
| 59 | + } else { |
| 60 | + //std::cout << "apparently the collection was found" <<std::endl; |
| 61 | + L1GctInternJetDataCollection::const_iterator jetItr = hwIntJetCands->begin(); |
| 62 | + L1GctInternJetDataCollection::const_iterator jetEnd = hwIntJetCands->end(); |
| 63 | + int i; |
| 64 | + for (i = 0; jetItr != jetEnd; ++jetItr, ++i) { |
| 65 | + //std::cout << " JetS a plenty" <<std::endl; |
| 66 | + if (!jetItr->empty() && (!centralBxOnly_ || jetItr->bx() == 0)) { |
| 67 | + double et = (jetItr->oflow() ? (double)0xfff : (double)jetItr->et()) * etSumLSB + 1.e-6; |
| 68 | + |
| 69 | + //double et = 10.; |
| 70 | + //std::cout << "jetET: " << jetItr->et() <<std::endl; |
| 71 | + //std::cout << "ET was: " << et << std::endl; |
| 72 | + double eta = caloGeom->etaBinCenter(jetItr->regionId()); |
| 73 | + double phi = caloGeom->emJetPhiBinCenter(jetItr->regionId()); |
| 74 | + |
| 75 | + internJetColl->push_back( |
| 76 | + L1JetParticle(math::PtEtaPhiMLorentzVector(et, eta, phi, 0.), Ref<L1GctJetCandCollection>(), jetItr->bx())); |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | + |
| 81 | + iEvent.put(std::move(internJetColl), "Internal"); |
| 82 | +} |
| 83 | + |
| 84 | +//define this as a plug-in |
| 85 | +DEFINE_FWK_MODULE(L1GctInternJetProducer); |
0 commit comments