test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Attributes

std::string jetType_
 
std::string rhoTag_
 

Private Member Functions

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

Private Attributes

edm::InputTag src_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, 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 ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description:

Implementation:

Definition at line 41 of file HiL1Subtractor.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file HiL1Subtractor.cc.

References edm::hlt::Exception, and jetType_.

23  :
24  src_ ( iConfig.getParameter<edm::InputTag>("src") ),
25  jetType_ (iConfig.getParameter<std::string>("jetType") ),
26  rhoTag_ (iConfig.getParameter<std::string>("rhoTag") )
27 
28 {
29 
30  if(jetType_ == "CaloJet"){
31  produces<reco::CaloJetCollection >();
32  }
33  else if(jetType_ == "PFJet"){
34  produces<reco::PFJetCollection >();
35  }
36  else if(jetType_ == "GenJet"){
37  produces<reco::GenJetCollection >();
38  }
39  else{
40  throw cms::Exception("InvalidInput") << "invalid jet type in HiL1Subtractor\n";
41  }
42 
43 }
T getParameter(std::string const &) const
edm::InputTag src_
std::string rhoTag_
std::string jetType_
HiL1Subtractor::~HiL1Subtractor ( )

Definition at line 46 of file HiL1Subtractor.cc.

47 {
48 }

Member Function Documentation

void HiL1Subtractor::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 254 of file HiL1Subtractor.cc.

255 {
256 }
void HiL1Subtractor::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 260 of file HiL1Subtractor.cc.

260  {
261 }
void HiL1Subtractor::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 57 of file HiL1Subtractor.cc.

References reco::LeafCandidate::et(), reco::LeafCandidate::eta(), edm::Event::getByLabel(), j, metsig::jet, reco::Jet::jetArea(), fwrapper::jets, jetType_, medianPtkt, edm::Event::put(), rho, rhoTag_, reco::Jet::scaleEnergy(), reco::Jet::setPileup(), and src_.

58 {
59 
60  // get the input jet collection and create output jet collection
61 
62  // right now, identical loop for calo and PF jets, should template
63  if(jetType_ == "GenJet"){
64  std::auto_ptr<reco::GenJetCollection> jets( new reco::GenJetCollection);
66  iEvent.getByLabel( src_, h_jets );
67 
68  // Grab appropriate rho, hard coded for the moment
70  iEvent.getByLabel(edm::InputTag(rhoTag_,"rhos"),rs);
71  //iEvent.getByLabel(edm::InputTag("ic5CaloJets","rhos"),rs);
72  int rsize = rs->size();
73 
74  for(int j = 0; j < rsize; j++){
75  double medianpt=rs->at(j);
76  medianPtkt[j]=medianpt;
77  }
78 
79  // loop over the jets
80  int jetsize = h_jets->size();
81  for(int ijet = 0; ijet < jetsize; ++ijet){
82 
83  reco::GenJet jet = ((*h_jets)[ijet]);
84 
85  double jet_eta = jet.eta();
86  double jet_et = jet.et();
87 
88  //std::cout<<" pre-subtracted jet_et "<<jet_et<<std::endl;
89 
90  if(fabs(jet_eta)<=3){
91 
92  double rho=-999;
93 
94  if (jet_eta<-2.5 && jet_eta>-3.5)rho=medianPtkt[2];
95  if (jet_eta<-1.5 && jet_eta>-2.5)rho=medianPtkt[3];
96  if (jet_eta<-0.5 && jet_eta>-1.5)rho=medianPtkt[4];
97  if (jet_eta<0.5 && jet_eta>-0.5)rho=medianPtkt[5];
98  if (jet_eta<1.5 && jet_eta>0.5)rho=medianPtkt[6];
99  if (jet_eta<2.5 && jet_eta>1.5)rho=medianPtkt[7];
100  if (jet_eta<3.5 && jet_eta>2.5)rho=medianPtkt[8];
101 
102  double jet_area = jet.jetArea();
103 
104  double CorrFactor =0.;
105  if(rho*jet_area<jet_et) CorrFactor = 1.0 - rho*jet_area/jet_et;
106  jet.scaleEnergy( CorrFactor );
107  jet.setPileup(rho*jet_area);
108 
109  //std::cout<<" correction factor "<<1.0 - rho*jet_area/jet_et<<std::endl;
110  }
111 
112  //std::cout<<" subtracted jet_et "<<jet.et()<<std::endl;
113  jets->push_back(jet);
114 
115 
116  }
117  iEvent.put(jets);
118 
119  }else if(jetType_ == "CaloJet"){
120  std::auto_ptr<reco::CaloJetCollection> jets( new reco::CaloJetCollection);
122  iEvent.getByLabel( src_, h_jets );
123 
124  // Grab appropriate rho, hard coded for the moment
126  iEvent.getByLabel(edm::InputTag(rhoTag_,"rhos"),rs);
127  //iEvent.getByLabel(edm::InputTag("ic5CaloJets","rhos"),rs);
128 
129 
130  int rsize = rs->size();
131 
132  for(int j = 0; j < rsize; j++){
133  double medianpt=rs->at(j);
134  medianPtkt[j]=medianpt;
135  }
136 
137  // loop over the jets
138 
139  int jetsize = h_jets->size();
140 
141  for(int ijet = 0; ijet < jetsize; ++ijet){
142 
143  reco::CaloJet jet = ((*h_jets)[ijet]);
144 
145  double jet_eta = jet.eta();
146  double jet_et = jet.et();
147 
148  //std::cout<<" pre-subtracted jet_et "<<jet_et<<std::endl;
149 
150  if(fabs(jet_eta)<=3){
151 
152  double rho=-999;
153 
154  if (jet_eta<-2.5 && jet_eta>-3.5)rho=medianPtkt[2];
155  if (jet_eta<-1.5 && jet_eta>-2.5)rho=medianPtkt[3];
156  if (jet_eta<-0.5 && jet_eta>-1.5)rho=medianPtkt[4];
157  if (jet_eta<0.5 && jet_eta>-0.5)rho=medianPtkt[5];
158  if (jet_eta<1.5 && jet_eta>0.5)rho=medianPtkt[6];
159  if (jet_eta<2.5 && jet_eta>1.5)rho=medianPtkt[7];
160  if (jet_eta<3.5 && jet_eta>2.5)rho=medianPtkt[8];
161 
162  double jet_area = jet.jetArea();
163 
164  double CorrFactor =0.;
165  if(rho*jet_area<jet_et) CorrFactor = 1.0 - rho*jet_area/jet_et;
166  jet.scaleEnergy( CorrFactor );
167  jet.setPileup(rho*jet_area);
168 
169  //std::cout<<" correction factor "<<1.0 - rho*jet_area/jet_et<<std::endl;
170  }
171 
172  //std::cout<<" subtracted jet_et "<<jet.et()<<std::endl;
173 
174  jets->push_back(jet);
175 
176 
177  }
178  iEvent.put(jets);
179 
180  }
181  else if(jetType_ == "PFJet"){
182  std::auto_ptr<reco::PFJetCollection> jets( new reco::PFJetCollection);
184  iEvent.getByLabel( src_, h_jets );
185 
186  // Grab appropriate rho, hard coded for the moment
188  iEvent.getByLabel(edm::InputTag(rhoTag_,"rhos"),rs);
189  //iEvent.getByLabel(edm::InputTag("ic5CaloJets","rhos"),rs);
190 
191 
192  int rsize = rs->size();
193 
194  for(int j = 0; j < rsize; j++){
195  double medianpt=rs->at(j);
196  medianPtkt[j]=medianpt;
197  }
198 
199  // loop over the jets
200 
201  int jetsize = h_jets->size();
202 
203  for(int ijet = 0; ijet < jetsize; ++ijet){
204 
205  reco::PFJet jet = ((*h_jets)[ijet]);
206 
207  double jet_eta = jet.eta();
208  double jet_et = jet.et();
209 
210  //std::cout<<" pre-subtracted jet_et "<<jet_et<<std::endl;
211 
212  if(fabs(jet_eta)<=3){
213 
214  double rho=-999;
215 
216  if (jet_eta<-2.5 && jet_eta>-3.5)rho=medianPtkt[2];
217  if (jet_eta<-1.5 && jet_eta>-2.5)rho=medianPtkt[3];
218  if (jet_eta<-0.5 && jet_eta>-1.5)rho=medianPtkt[4];
219  if (jet_eta<0.5 && jet_eta>-0.5)rho=medianPtkt[5];
220  if (jet_eta<1.5 && jet_eta>0.5)rho=medianPtkt[6];
221  if (jet_eta<2.5 && jet_eta>1.5)rho=medianPtkt[7];
222  if (jet_eta<3.5 && jet_eta>2.5)rho=medianPtkt[8];
223 
224  double jet_area = jet.jetArea();
225 
226  double CorrFactor =0.;
227  if(rho*jet_area<jet_et) CorrFactor = 1.0 - rho*jet_area/jet_et;
228  jet.scaleEnergy( CorrFactor );
229  jet.setPileup(rho*jet_area);
230 
231  //std::cout<<" correction factor "<<1.0 - rho*jet_area/jet_et<<std::endl;
232  }
233 
234  //std::cout<<" subtracted jet_et "<<jet.et()<<std::endl;
235 
236  jets->push_back(jet);
237 
238 
239  }
240  iEvent.put(jets);
241 
242  }
243 
244 
245 
246 
247 
248 
249 
250 }
Jets made from CaloTowers.
Definition: CaloJet.h:29
edm::InputTag src_
virtual double et() const
transverse energy
virtual void setPileup(float fEnergy)
Set pileup energy contribution as calculated by algorithm.
Definition: Jet.h:108
Definition: DDAxes.h:10
std::vector< GenJet > GenJetCollection
collection of GenJet objects
virtual void scaleEnergy(double fScale)
scale energy of the jet
Definition: Jet.cc:444
std::string rhoTag_
Jets made from PFObjects.
Definition: PFJet.h:21
std::string jetType_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual float eta() const
momentum pseudorapidity
vector< PseudoJet > jets
double medianPtkt[12]
int j
Definition: DBlmapReader.cc:9
Jets made from MC generator particles.
Definition: GenJet.h:24
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::vector< PFJet > PFJetCollection
collection of PFJet objects
virtual float jetArea() const
get jet area
Definition: Jet.h:105
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects

Member Data Documentation

std::string HiL1Subtractor::jetType_
protected

Definition at line 64 of file HiL1Subtractor.h.

Referenced by HiL1Subtractor(), and produce().

std::string HiL1Subtractor::rhoTag_
protected

Definition at line 65 of file HiL1Subtractor.h.

Referenced by produce().

edm::InputTag HiL1Subtractor::src_
private

Definition at line 61 of file HiL1Subtractor.h.

Referenced by produce().