CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
HiL1Subtractor Class Reference

#include <RecoHI/HiJetAlgos/plugins/HiL1Subtractor.cc>

Inheritance diagram for HiL1Subtractor:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HiL1Subtractor (const edm::ParameterSet &)
 
 ~HiL1Subtractor () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Attributes

std::string jetType_
 
edm::EDGetTokenT< std::vector< double > > rhoTag_
 
std::string rhoTagString_
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::EDGetTokenT< edm::View< reco::CaloJet > > caloJetSrc_
 
edm::EDGetTokenT< edm::View< reco::GenJet > > genJetSrc_
 
edm::EDGetTokenT< edm::View< reco::PFJet > > pfJetSrc_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description:

Implementation:

Definition at line 42 of file HiL1Subtractor.h.

Constructor & Destructor Documentation

◆ HiL1Subtractor()

HiL1Subtractor::HiL1Subtractor ( const edm::ParameterSet iConfig)
explicit

Definition at line 20 of file HiL1Subtractor.cc.

21  : jetType_(iConfig.getParameter<std::string>("jetType")),
22  rhoTagString_(iConfig.getParameter<std::string>("rhoTag"))
23 
24 {
25  rhoTag_ = (consumes<std::vector<double> >(rhoTagString_));
26 
27  if (jetType_ == "CaloJet") {
28  produces<reco::CaloJetCollection>();
29  caloJetSrc_ = (consumes<edm::View<reco::CaloJet> >(iConfig.getParameter<edm::InputTag>("src")));
30  } else if (jetType_ == "PFJet") {
31  produces<reco::PFJetCollection>();
32  pfJetSrc_ = (consumes<edm::View<reco::PFJet> >(iConfig.getParameter<edm::InputTag>("src")));
33  } else if (jetType_ == "GenJet") {
34  produces<reco::GenJetCollection>();
35  genJetSrc_ = (consumes<edm::View<reco::GenJet> >(iConfig.getParameter<edm::InputTag>("src")));
36 
37  } else {
38  throw cms::Exception("InvalidInput") << "invalid jet type in HiL1Subtractor\n";
39  }
40 }

References caloJetSrc_, Exception, genJetSrc_, edm::ParameterSet::getParameter(), jetType_, pfJetSrc_, rhoTag_, and rhoTagString_.

◆ ~HiL1Subtractor()

HiL1Subtractor::~HiL1Subtractor ( )
override

Definition at line 42 of file HiL1Subtractor.cc.

42 {}

Member Function Documentation

◆ beginJob()

void HiL1Subtractor::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 242 of file HiL1Subtractor.cc.

242 {}

◆ endJob()

void HiL1Subtractor::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 245 of file HiL1Subtractor.cc.

245 {}

◆ produce()

void HiL1Subtractor::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 49 of file HiL1Subtractor.cc.

49  {
50  // get the input jet collection and create output jet collection
51 
52  // right now, identical loop for calo and PF jets, should template
53  if (jetType_ == "GenJet") {
54  auto jets = std::make_unique<reco::GenJetCollection>();
56  iEvent.getByToken(genJetSrc_, h_jets);
57 
58  // Grab appropriate rho, hard coded for the moment
60  iEvent.getByToken(rhoTag_, rs);
61 
62  int rsize = rs->size();
63 
64  for (int j = 0; j < rsize; j++) {
65  double medianpt = rs->at(j);
66  medianPtkt[j] = medianpt;
67  }
68 
69  // loop over the jets
70  int jetsize = h_jets->size();
71  for (int ijet = 0; ijet < jetsize; ++ijet) {
72  reco::GenJet jet = ((*h_jets)[ijet]);
73 
74  double jet_eta = jet.eta();
75  double jet_et = jet.et();
76 
77  //std::cout<<" pre-subtracted jet_et "<<jet_et<<std::endl;
78 
79  if (fabs(jet_eta) <= 3) {
80  double rho = -999;
81 
82  if (jet_eta < -2.5 && jet_eta > -3.5)
83  rho = medianPtkt[2];
84  if (jet_eta < -1.5 && jet_eta > -2.5)
85  rho = medianPtkt[3];
86  if (jet_eta < -0.5 && jet_eta > -1.5)
87  rho = medianPtkt[4];
88  if (jet_eta < 0.5 && jet_eta > -0.5)
89  rho = medianPtkt[5];
90  if (jet_eta < 1.5 && jet_eta > 0.5)
91  rho = medianPtkt[6];
92  if (jet_eta < 2.5 && jet_eta > 1.5)
93  rho = medianPtkt[7];
94  if (jet_eta < 3.5 && jet_eta > 2.5)
95  rho = medianPtkt[8];
96 
97  double jet_area = jet.jetArea();
98 
99  double CorrFactor = 0.;
100  if (rho * jet_area < jet_et)
101  CorrFactor = 1.0 - rho * jet_area / jet_et;
102  jet.scaleEnergy(CorrFactor);
103  jet.setPileup(rho * jet_area);
104 
105  //std::cout<<" correction factor "<<1.0 - rho*jet_area/jet_et<<std::endl;
106  }
107 
108  //std::cout<<" subtracted jet_et "<<jet.et()<<std::endl;
109  jets->push_back(jet);
110  }
111  iEvent.put(std::move(jets));
112 
113  } else if (jetType_ == "CaloJet") {
114  auto jets = std::make_unique<reco::CaloJetCollection>();
116  iEvent.getByToken(caloJetSrc_, h_jets);
117 
118  // Grab appropriate rho, hard coded for the moment
120  iEvent.getByToken(rhoTag_, rs);
121 
122  int rsize = rs->size();
123 
124  for (int j = 0; j < rsize; j++) {
125  double medianpt = rs->at(j);
126  medianPtkt[j] = medianpt;
127  }
128 
129  // loop over the jets
130 
131  int jetsize = h_jets->size();
132 
133  for (int ijet = 0; ijet < jetsize; ++ijet) {
134  reco::CaloJet jet = ((*h_jets)[ijet]);
135 
136  double jet_eta = jet.eta();
137  double jet_et = jet.et();
138 
139  //std::cout<<" pre-subtracted jet_et "<<jet_et<<std::endl;
140 
141  if (fabs(jet_eta) <= 3) {
142  double rho = -999;
143 
144  if (jet_eta < -2.5 && jet_eta > -3.5)
145  rho = medianPtkt[2];
146  if (jet_eta < -1.5 && jet_eta > -2.5)
147  rho = medianPtkt[3];
148  if (jet_eta < -0.5 && jet_eta > -1.5)
149  rho = medianPtkt[4];
150  if (jet_eta < 0.5 && jet_eta > -0.5)
151  rho = medianPtkt[5];
152  if (jet_eta < 1.5 && jet_eta > 0.5)
153  rho = medianPtkt[6];
154  if (jet_eta < 2.5 && jet_eta > 1.5)
155  rho = medianPtkt[7];
156  if (jet_eta < 3.5 && jet_eta > 2.5)
157  rho = medianPtkt[8];
158 
159  double jet_area = jet.jetArea();
160 
161  double CorrFactor = 0.;
162  if (rho * jet_area < jet_et)
163  CorrFactor = 1.0 - rho * jet_area / jet_et;
164  jet.scaleEnergy(CorrFactor);
165  jet.setPileup(rho * jet_area);
166 
167  //std::cout<<" correction factor "<<1.0 - rho*jet_area/jet_et<<std::endl;
168  }
169 
170  //std::cout<<" subtracted jet_et "<<jet.et()<<std::endl;
171 
172  jets->push_back(jet);
173  }
174  iEvent.put(std::move(jets));
175 
176  } else if (jetType_ == "PFJet") {
177  auto jets = std::make_unique<reco::PFJetCollection>();
179  iEvent.getByToken(pfJetSrc_, h_jets);
180 
181  // Grab appropriate rho, hard coded for the moment
183  iEvent.getByToken(rhoTag_, rs);
184 
185  int rsize = rs->size();
186 
187  for (int j = 0; j < rsize; j++) {
188  double medianpt = rs->at(j);
189  medianPtkt[j] = medianpt;
190  }
191 
192  // loop over the jets
193 
194  int jetsize = h_jets->size();
195 
196  for (int ijet = 0; ijet < jetsize; ++ijet) {
197  reco::PFJet jet = ((*h_jets)[ijet]);
198 
199  double jet_eta = jet.eta();
200  double jet_et = jet.et();
201 
202  //std::cout<<" pre-subtracted jet_et "<<jet_et<<std::endl;
203 
204  if (fabs(jet_eta) <= 3) {
205  double rho = -999;
206 
207  if (jet_eta < -2.5 && jet_eta > -3.5)
208  rho = medianPtkt[2];
209  if (jet_eta < -1.5 && jet_eta > -2.5)
210  rho = medianPtkt[3];
211  if (jet_eta < -0.5 && jet_eta > -1.5)
212  rho = medianPtkt[4];
213  if (jet_eta < 0.5 && jet_eta > -0.5)
214  rho = medianPtkt[5];
215  if (jet_eta < 1.5 && jet_eta > 0.5)
216  rho = medianPtkt[6];
217  if (jet_eta < 2.5 && jet_eta > 1.5)
218  rho = medianPtkt[7];
219  if (jet_eta < 3.5 && jet_eta > 2.5)
220  rho = medianPtkt[8];
221 
222  double jet_area = jet.jetArea();
223 
224  double CorrFactor = 0.;
225  if (rho * jet_area < jet_et)
226  CorrFactor = 1.0 - rho * jet_area / jet_et;
227  jet.scaleEnergy(CorrFactor);
228  jet.setPileup(rho * jet_area);
229 
230  //std::cout<<" correction factor "<<1.0 - rho*jet_area/jet_et<<std::endl;
231  }
232 
233  //std::cout<<" subtracted jet_et "<<jet.et()<<std::endl;
234 
235  jets->push_back(jet);
236  }
237  iEvent.put(std::move(jets));
238  }
239 }

References caloJetSrc_, genJetSrc_, iEvent, dqmiolumiharvest::j, metsig::jet, singleTopDQM_cfi::jets, jetType_, medianPtkt, eostools::move(), pfJetSrc_, rho, and rhoTag_.

Member Data Documentation

◆ caloJetSrc_

edm::EDGetTokenT<edm::View<reco::CaloJet> > HiL1Subtractor::caloJetSrc_
private

Definition at line 60 of file HiL1Subtractor.h.

Referenced by HiL1Subtractor(), and produce().

◆ genJetSrc_

edm::EDGetTokenT<edm::View<reco::GenJet> > HiL1Subtractor::genJetSrc_
private

Definition at line 59 of file HiL1Subtractor.h.

Referenced by HiL1Subtractor(), and produce().

◆ jetType_

std::string HiL1Subtractor::jetType_
protected

Definition at line 64 of file HiL1Subtractor.h.

Referenced by HiL1Subtractor(), and produce().

◆ pfJetSrc_

edm::EDGetTokenT<edm::View<reco::PFJet> > HiL1Subtractor::pfJetSrc_
private

Definition at line 61 of file HiL1Subtractor.h.

Referenced by HiL1Subtractor(), and produce().

◆ rhoTag_

edm::EDGetTokenT<std::vector<double> > HiL1Subtractor::rhoTag_
protected

Definition at line 67 of file HiL1Subtractor.h.

Referenced by HiL1Subtractor(), and produce().

◆ rhoTagString_

std::string HiL1Subtractor::rhoTagString_
protected

Definition at line 65 of file HiL1Subtractor.h.

Referenced by HiL1Subtractor().

reco::CaloJet
Jets made from CaloTowers.
Definition: CaloJet.h:27
reco::GenJet
Jets made from MC generator particles.
Definition: GenJet.h:23
HiL1Subtractor::pfJetSrc_
edm::EDGetTokenT< edm::View< reco::PFJet > > pfJetSrc_
Definition: HiL1Subtractor.h:61
HiL1Subtractor::genJetSrc_
edm::EDGetTokenT< edm::View< reco::GenJet > > genJetSrc_
Definition: HiL1Subtractor.h:59
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
HiL1Subtractor::jetType_
std::string jetType_
Definition: HiL1Subtractor.h:64
DDAxes::rho
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
medianPtkt
double medianPtkt[12]
Definition: HiL1Subtractor.cc:11
iEvent
int iEvent
Definition: GenABIO.cc:224
HiL1Subtractor::rhoTagString_
std::string rhoTagString_
Definition: HiL1Subtractor.h:65
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
metsig::jet
Definition: SignAlgoResolutions.h:47
Exception
Definition: hltDiff.cc:246
reco::PFJet
Jets made from PFObjects.
Definition: PFJet.h:20
HiL1Subtractor::rhoTag_
edm::EDGetTokenT< std::vector< double > > rhoTag_
Definition: HiL1Subtractor.h:67
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::InputTag
Definition: InputTag.h:15
HiL1Subtractor::caloJetSrc_
edm::EDGetTokenT< edm::View< reco::CaloJet > > caloJetSrc_
Definition: HiL1Subtractor.h:60