CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
pat::PATMHTProducer Class Reference

#include <PATMHTProducer.h>

Inheritance diagram for pat::PATMHTProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  uncertaintyFunctions
 

Public Member Functions

 PATMHTProducer (const edm::ParameterSet &)
 
 ~PATMHTProducer ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
double getElectrons (edm::Event &, const edm::EventSetup &)
 
double getJets (edm::Event &, const edm::EventSetup &)
 
double getMuons (edm::Event &, const edm::EventSetup &)
 
void getTowers (edm::Event &, const edm::EventSetup &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
void setUncertaintyParameters ()
 

Private Attributes

edm::InputTag CaloJetAlgorithmTag_
 
edm::InputTag CaloTowerTag_
 
bool controlledUncertainty_
 
edm::InputTag CorJetAlgorithmTag_
 
uncertaintyFunctions ecalEBUncertainty
 
uncertaintyFunctions ecalEEUncertainty
 
edm::InputTag ElectronTag_
 
double eleEtaMax_
 
double eleEtUncertaintyParameter0_
 
double elePhiUncertaintyParameter0_
 
double elePtMin_
 
edm::EDGetTokenT< edm::View
< pat::Electron > > 
eleToken_
 
uncertaintyFunctions eleUncertainty
 
uncertaintyFunctions hcalHBUncertainty
 
uncertaintyFunctions hcalHEUncertainty
 
uncertaintyFunctions hcalHFUncertainty
 
uncertaintyFunctions hcalHOUncertainty
 
std::string JetCorrectionService_
 
uncertaintyFunctions jetCorrUncertainty
 
double jetEMfracMax_
 
double jetEtaMax_
 
double jetEtUncertaintyParameter0_
 
double jetEtUncertaintyParameter1_
 
double jetEtUncertaintyParameter2_
 
double jetPhiUncertaintyParameter0_
 
double jetPhiUncertaintyParameter1_
 
double jetPhiUncertaintyParameter2_
 
double jetPtMin_
 
edm::EDGetTokenT< edm::View
< pat::Jet > > 
jetToken_
 
uncertaintyFunctions jetUncertainty
 
std::string metCollectionLabel_
 
edm::InputTag mhtLabel_
 
double muonChiSqMax_
 
uncertaintyFunctions muonCorrUncertainty
 
double muonDPtMax_
 
double muonEtaMax_
 
double muonEtUncertaintyParameter0_
 
int muonNHitsMin_
 
double muonPhiUncertaintyParameter0_
 
double muonPtMin_
 
edm::InputTag MuonTag_
 
double muonTrackD0Max_
 
double muonTrackDzMax_
 
uncertaintyFunctions muonUncertainty
 
edm::EDGetTokenT< edm::View
< pat::Muon > > 
muoToken_
 
bool noHF_
 
edm::EDGetTokenT< edm::View
< pat::Photon > > 
phoToken_
 
std::vector< metsig::SigInputObjphysobjvector_
 
std::set< CaloTowerDetIds_clusteredTowers
 
std::string significanceLabel_
 
edm::EDGetTokenT< edm::View
< pat::Tau > > 
tauToken_
 
double towerEtThreshold_
 
double uncertaintyScaleFactor_
 
bool useCaloTowers_
 
bool useElectrons_
 
bool useHO_
 
bool useJets_
 
bool useMuons_
 
double verbose_
 

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

Definition at line 64 of file PATMHTProducer.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file PATMHTProducer.cc.

References CaloTowerTag_, controlledUncertainty_, eleEtaMax_, eleEtUncertaintyParameter0_, elePhiUncertaintyParameter0_, elePtMin_, eleToken_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), jetEMfracMax_, jetEtaMax_, jetEtUncertaintyParameter0_, jetEtUncertaintyParameter1_, jetEtUncertaintyParameter2_, jetPhiUncertaintyParameter0_, jetPhiUncertaintyParameter1_, jetPhiUncertaintyParameter2_, jetPtMin_, jetToken_, muonEtaMax_, muonEtUncertaintyParameter0_, muonPhiUncertaintyParameter0_, muonPtMin_, muoToken_, noHF_, phoToken_, tauToken_, towerEtThreshold_, uncertaintyScaleFactor_, useHO_, and verbose_.

6  {
7 
8  // Initialize the configurables
9  verbose_ = iConfig.getParameter<double>("verbose");
10 
11  jetToken_ = consumes<edm::View<pat::Jet> >(iConfig.getUntrackedParameter<edm::InputTag>("jetTag"));
12  eleToken_ = consumes<edm::View<pat::Electron> >(iConfig.getUntrackedParameter<edm::InputTag>("electronTag"));
13  muoToken_ = consumes<edm::View<pat::Muon> >(iConfig.getUntrackedParameter<edm::InputTag>("muonTag"));
14  tauToken_ = consumes<edm::View<pat::Tau> >(iConfig.getUntrackedParameter<edm::InputTag>("tauTag"));
15  phoToken_ = consumes<edm::View<pat::Photon> >(iConfig.getUntrackedParameter<edm::InputTag>("photonTag"));
16 
17  uncertaintyScaleFactor_ = iConfig.getParameter<double>( "uncertaintyScaleFactor") ;
18  controlledUncertainty_ = iConfig.getParameter<bool>( "controlledUncertainty") ;
19 
20  jetPtMin_ = iConfig.getParameter<double>("jetPtMin");
21  jetEtaMax_ = iConfig.getParameter<double>("jetEtaMax");
22  jetEMfracMax_ = iConfig.getParameter<double>("jetEMfracMax");
23  elePtMin_ = iConfig.getParameter<double>("elePtMin");
24  eleEtaMax_ = iConfig.getParameter<double>("eleEtaMax");
25  muonPtMin_ = iConfig.getParameter<double>("muonPtMin");
26  muonEtaMax_ = iConfig.getParameter<double>("muonEtaMax");
27 
28  jetEtUncertaintyParameter0_ = iConfig.getParameter<double>( "jetEtUncertaintyParameter0") ;
29  jetEtUncertaintyParameter1_ = iConfig.getParameter<double>( "jetEtUncertaintyParameter1") ;
30  jetEtUncertaintyParameter2_ = iConfig.getParameter<double>( "jetEtUncertaintyParameter2") ;
31  jetPhiUncertaintyParameter0_= iConfig.getParameter<double>( "jetPhiUncertaintyParameter0");
32  jetPhiUncertaintyParameter1_= iConfig.getParameter<double>( "jetPhiUncertaintyParameter1");
33  jetPhiUncertaintyParameter2_= iConfig.getParameter<double>( "jetPhiUncertaintyParameter2");
34 
35  eleEtUncertaintyParameter0_ = iConfig.getParameter<double>( "eleEtUncertaintyParameter0") ;
36  elePhiUncertaintyParameter0_ = iConfig.getParameter<double>( "elePhiUncertaintyParameter0") ;
37 
38  muonEtUncertaintyParameter0_ = iConfig.getParameter<double>( "muonEtUncertaintyParameter0") ;
39  muonPhiUncertaintyParameter0_ = iConfig.getParameter<double>( "muonPhiUncertaintyParameter0") ;
40 
41  CaloTowerTag_ = iConfig.getParameter<edm::InputTag>("CaloTowerTag");
42  noHF_ = iConfig.getParameter<bool>( "noHF");
43 
44  // muonCalo_ = iConfig.getParameter<bool>("muonCalo");
45  towerEtThreshold_ = iConfig.getParameter<double>( "towerEtThreshold") ;
46  useHO_ = iConfig.getParameter<bool>("useHO");
47 
48  produces<pat::MHTCollection>();
49 
50 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< pat::Photon > > phoToken_
double eleEtUncertaintyParameter0_
double muonPhiUncertaintyParameter0_
edm::EDGetTokenT< edm::View< pat::Muon > > muoToken_
double jetEtUncertaintyParameter1_
double elePhiUncertaintyParameter0_
double jetEtUncertaintyParameter2_
double jetPhiUncertaintyParameter2_
edm::EDGetTokenT< edm::View< pat::Tau > > tauToken_
double muonEtUncertaintyParameter0_
edm::EDGetTokenT< edm::View< pat::Electron > > eleToken_
double uncertaintyScaleFactor_
edm::InputTag CaloTowerTag_
double jetPhiUncertaintyParameter1_
double jetPhiUncertaintyParameter0_
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
double jetEtUncertaintyParameter0_
PATMHTProducer::~PATMHTProducer ( )

Definition at line 53 of file PATMHTProducer.cc.

53  {
54 }

Member Function Documentation

void PATMHTProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 56 of file PATMHTProducer.cc.

56  {
58 }
void PATMHTProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 59 of file PATMHTProducer.cc.

59  {
60 }
double PATMHTProducer::getElectrons ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 224 of file PATMHTProducer.cc.

References Abs(), edm::View< T >::begin(), gather_cfg::cout, HI_PhotonSkim_cff::electrons, edm::View< T >::end(), edm::Event::getByToken(), and AlCaHLTBitMon_QueryRunRegistry::string.

224  {
225 
226  std::string objectname="electron";
227 
228  double number_of_electrons_ = 0.0;
229 
230  // edm::ESHandle<CaloTowerConstituentsMap> cttopo;
231  // iSetup.get<IdealGeometryRecord>().get(cttopo);
232  // const CaloTowerConstituentsMap* caloTowerMap = cttopo.product();
233 
234  edm::Handle<edm::View<pat::Electron> > electronHandle;
235  iEvent.getByToken(eleToken_,electronHandle);
236  edm::View<pat::Electron> electrons = *electronHandle;
237  DetId nullDetId;
238 
239  // Fill Input Vector with Electrons
240  for(edm::View<pat::Electron>::const_iterator electron_iter = electrons.begin(); electron_iter!=electrons.end(); ++electron_iter){
241 
242  // Select electrons
243  if (electron_iter->et() < elePtMin_ ||
244  TMath::Abs(electron_iter->eta()) > eleEtaMax_ ) continue;
245 
246  if (verbose_ == 3.) {
247  std::cout << "electron pt = " << electron_iter->pt() << " eta : " << electron_iter->eta()
248  << std::endl;
249  }
250 
251  double electron_et = electron_iter->et();
252  double electron_phi = electron_iter->phi();
253 
254  double sigma_et, sigma_phi ;
255 
257  sigma_et = eleUncertainty.etUncertainty->Eval(electron_et);
258  sigma_phi = eleUncertainty.phiUncertainty->Eval(electron_et);
259  }
260  else {
261  sigma_et = 0.0; //electron_iter->resolutionEt();
262  sigma_phi = 0.0; // electron_iter->resolutionPhi();
263  }
264 
265  if (verbose_ == 3.) {
266  std::cout << "electron sigma_et : " << sigma_et << ", electron sigma_phi : " << sigma_phi
267  << std::endl;}
268 
269  if(sigma_et< 0 || sigma_phi< 0)
270  edm::LogWarning("PATMHTProducer") << " uncertainties for " << objectname
271  <<" are (et, phi): " << sigma_et
272  << "," << sigma_phi << " (et,phi): "
273  << electron_et << "," << electron_phi;
274 
275  if (uncertaintyScaleFactor_ != 1.0){
276  sigma_et = sigma_et * uncertaintyScaleFactor_;
277  sigma_phi = sigma_phi * uncertaintyScaleFactor_;
278  }
279 
280  metsig::SigInputObj tmp_electron(objectname,electron_et,electron_phi,sigma_et,sigma_phi);
281  physobjvector_.push_back(tmp_electron);
282  number_of_electrons_ ++;
283 
284  //-- Store tower DetId's to be removed from Calo Tower sum later --//
285  /*
286  const reco::SuperCluster& eleSC = *( electron_iter->superCluster() );
287 
288  std::vector<DetId> v_eleDetIds = eleSC.getHitsByDetId();
289 
290  //-- Convert cells to calo towers and add to set --//
291  for( std::vector<DetId>::iterator cellId = v_eleDetIds.begin();
292  cellId != v_eleDetIds.end();
293  cellId++) {
294 
295  CaloTowerDetId towerId = caloTowerMap->towerOf(*cellId);
296  if (towerId != nullDetId) {
297  //std::cout << ">>> electron towerId: " << towerId << std::endl;
298  std::pair<std::_Rb_tree_const_iterator<CaloTowerDetId>,bool> p1 = s_clusteredTowers.insert(towerId);
299  }
300  else
301  std::cerr<<"No matching tower found for electron cell!\n";
302  }
303 
304  */
305 
306  }
307 
308  return number_of_electrons_;
309 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
const_iterator begin() const
T Abs(T a)
Definition: MathUtil.h:49
Definition: DetId.h:18
std::vector< metsig::SigInputObj > physobjvector_
edm::EDGetTokenT< edm::View< pat::Electron > > eleToken_
double uncertaintyScaleFactor_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
tuple cout
Definition: gather_cfg.py:121
const_iterator end() const
uncertaintyFunctions eleUncertainty
double PATMHTProducer::getJets ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 132 of file PATMHTProducer.cc.

References Abs(), edm::View< T >::begin(), gather_cfg::cout, edm::View< T >::end(), edm::Event::getByToken(), cuy::ii, fwrapper::jets, and AlCaHLTBitMon_QueryRunRegistry::string.

132  {
133 
134  std::string objectname="jet";
135 
136  double number_of_jets_ = 0.0;
137 
139  iEvent.getByToken(jetToken_,jetHandle);
140  edm::View<pat::Jet> jets = *jetHandle;
141 
142  // Fill Input Vector with Jets
143  for(edm::View<pat::Jet>::const_iterator jet_iter = jets.begin(); jet_iter!=jets.end(); ++jet_iter){
144 
145  if( (jet_iter->pt() < jetPtMin_) ||
146  (TMath::Abs(jet_iter->eta()) > jetEtaMax_) ||
147  (jet_iter->emEnergyFraction() > jetEMfracMax_ ) )
148  continue;
149 
150  double jet_et = jet_iter->et();
151  double jet_phi = jet_iter->phi();
152 
153  if (verbose_ == 3.) {
154  std::cout << "jet pt : " << jet_iter->pt() << " eta : " << jet_iter->eta()
155  << " EMF: " << jet_iter->emEnergyFraction() << std::endl;
156  }
157 
158  double sigma_et, sigma_phi ;
159 
161  sigma_et = jetUncertainty.etUncertainty->Eval(jet_et);
162  sigma_phi = jetUncertainty.phiUncertainty->Eval(jet_et);
163  }
164  else {
165  sigma_et = 0.0 ; // jet_iter->resolutionEt();
166  sigma_phi = 0.0 ; //jet_iter->resolutionPhi();
167  }
168 
169  if (verbose_ == 3.) {
170  std::cout << "jet sigma_et : " << sigma_et << ", jet sigma_phi : " << sigma_phi << std::endl;
171  }
172 
173  if(sigma_et<=0 || sigma_phi<=0)
174  edm::LogWarning("PATMHTProducer") <<
175  " uncertainties for " << objectname <<
176  " are (et, phi): " << sigma_et << "," << sigma_phi << " (et,phi): " << jet_et << "," << jet_phi;
177  // try to read out the jet resolution from the root file at PatUtils
178  //-- Store jet for Significance Calculation --//
179 
180  if (uncertaintyScaleFactor_ != 1.0){
181  sigma_et = sigma_et * uncertaintyScaleFactor_;
182  sigma_phi = sigma_phi * uncertaintyScaleFactor_;
183  // edm::LogWarning("PATMHTProducer") << " using uncertainty scale factor: " << uncertaintyScaleFactor_ <<
184  //" , uncertainties for " << objectname <<" changed to (et, phi): " << sigma_et << "," << sigma_phi;
185  }
186 
187 
188  if (verbose_ == 101.) { // Study the Jets behavior
189 
190  std::cout << "v101> " << number_of_jets_ << " "
191  << jet_et << " " << sigma_et << " "
192  << jet_phi << " " << sigma_phi << std::endl;
193  }
194 
195 
196  metsig::SigInputObj tmp_jet(objectname,jet_et,jet_phi,sigma_et,sigma_phi);
197  physobjvector_.push_back(tmp_jet);
198  number_of_jets_ ++;
199 
200  //-- Store tower DetId's to be removed from Calo Tower sum later --//
201  std::vector<CaloTowerPtr> v_towers = jet_iter->getCaloConstituents();
202  //std::cout << "tower size = " << v_towers.size() << std::endl;
203 
204  for (unsigned int ii=0; ii < v_towers.size(); ii++) {
205  s_clusteredTowers.insert( (*v_towers.at(ii)).id() );
206  //std::cout << "tower id = " << (*v_towers.at(ii)).id() << std::endl;
207  }
208 
209  }
210 
211  if (verbose_ == 101.) { // Study the Jets behavior - seperate events
212  std::cout << "v101> --------------------------------------------" << std::endl;
213  }
214 
215  return number_of_jets_;
216 
217 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
uncertaintyFunctions jetUncertainty
int ii
Definition: cuy.py:588
const_iterator begin() const
vector< PseudoJet > jets
T Abs(T a)
Definition: MathUtil.h:49
std::vector< metsig::SigInputObj > physobjvector_
double uncertaintyScaleFactor_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
tuple cout
Definition: gather_cfg.py:121
const_iterator end() const
std::set< CaloTowerDetId > s_clusteredTowers
double PATMHTProducer::getMuons ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 317 of file PATMHTProducer.cc.

References Abs(), edm::View< T >::begin(), gather_cfg::cout, edm::View< T >::end(), edm::Event::getByToken(), edm::HandleBase::isValid(), patZpeak::muons, and AlCaHLTBitMon_QueryRunRegistry::string.

317  {
318 
319  std::string objectname="muon";
321  iEvent.getByToken(muoToken_,muonHandle);
322  edm::View<pat::Muon> muons = *muonHandle;
323 
324  if ( !muonHandle.isValid() ) {
325  std::cout << ">>> PATMHTSelector not valid muon Handle!" << std::endl;
326  return 0.0;
327  }
328 
329 
330  double number_of_muons_ = 0.0;
331 
332  for(edm::View<pat::Muon>::const_iterator muon_iter = muons.begin(); muon_iter!=muons.end(); ++muon_iter){
333 
334  if (muon_iter->pt() < muonPtMin_ || TMath::Abs(muon_iter->eta()) > muonEtaMax_ ) continue;
335 
336  if (verbose_ == 3.) {
337  std::cout << "muon pt = " << muon_iter->pt() << " eta : " << muon_iter->eta() << std::endl;
338  }
339 
340  double muon_pt = muon_iter->pt();
341  double muon_phi = muon_iter->phi();
342 
343  double sigma_et, sigma_phi ;
344 
346  sigma_et = muonUncertainty.etUncertainty->Eval(muon_pt);
347  sigma_phi = muonUncertainty.phiUncertainty->Eval(muon_pt);
348  }
349  else {
350  sigma_et = 0.0; //muon_iter->resolutionEt();
351  sigma_phi = 0.0; // muon_iter->resolutionPhi();
352  }
353 
354  if (verbose_ == 3.) {
355  std::cout << "muon sigma_et : " << sigma_et
356  << ", muon sigma_phi : " << sigma_phi
357  << std::endl;}
358 
359  if(sigma_et< 0 || sigma_phi< 0)
360  edm::LogWarning("PATMHTProducer") <<
361  " uncertainties for " << objectname << " are (et, phi): " << sigma_et << "," <<
362  sigma_phi << " (pt,phi): " << muon_pt << "," << muon_phi;
363 
364  if (uncertaintyScaleFactor_ != 1.0){
365  sigma_et = sigma_et * uncertaintyScaleFactor_;
366  sigma_phi = sigma_phi * uncertaintyScaleFactor_;
367  }
368 
369  metsig::SigInputObj tmp_muon(objectname,muon_pt,muon_phi,sigma_et,sigma_phi);
370  physobjvector_.push_back(tmp_muon);
371  number_of_muons_ ++;
372 
373  }// end Muon loop
374 
375  return number_of_muons_;
376 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< edm::View< pat::Muon > > muoToken_
uncertaintyFunctions muonUncertainty
const_iterator begin() const
T Abs(T a)
Definition: MathUtil.h:49
bool isValid() const
Definition: HandleBase.h:75
std::vector< metsig::SigInputObj > physobjvector_
double uncertaintyScaleFactor_
tuple muons
Definition: patZpeak.py:38
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
tuple cout
Definition: gather_cfg.py:121
const_iterator end() const
void pat::PATMHTProducer::getTowers ( edm::Event ,
const edm::EventSetup  
)
private
void PATMHTProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 64 of file PATMHTProducer.cc.

References metsig::significanceAlgo::addObjects(), funct::cos(), gather_cfg::cout, HWWFunctions::getJets(), edm::Event::put(), pat::MHT::setNumberOfElectrons(), pat::MHT::setNumberOfJets(), pat::MHT::setNumberOfMuons(), metsig::significanceAlgo::significance(), and funct::sin().

65 {
66  // make sure the SigInputObj container is empty
67  while(physobjvector_.size()>0){
68  physobjvector_.erase(physobjvector_.begin(),physobjvector_.end());
69  }
70 
71  // Clean the clustered towers
72  s_clusteredTowers.clear();
73 
74  double number_of_jets = getJets(iEvent, iSetup);
75 
76  double number_of_electrons = getElectrons(iEvent, iSetup);
77 
78  double number_of_muons = getMuons(iEvent, iSetup);
79 
80  if (verbose_ == 1.) {
81  std::cout << ">>>---> Number of jets: " << number_of_jets << std::endl;
82  std::cout << ">>>---> Number of electrons: " << number_of_jets << std::endl;
83  std::cout << ">>>---> Number of muons: " << number_of_muons << std::endl;
84  }
85 
86  double met_x=0;
87  double met_y=0;
88  double met_et=0;
89  double met_phi=0;
90  double met_set=0;
91 
92 
93  std::auto_ptr<pat::MHTCollection> themetsigcoll (new pat::MHTCollection);
94 
95  if(physobjvector_.size() >= 1) { // Only when the vector is not empty
96 
97  // calculate the MHT significance
98 
99  metsig::significanceAlgo signifAlgo;
100  signifAlgo.addObjects(physobjvector_);
101  double significance = signifAlgo.significance(met_et,met_phi,met_set);
102 
103  met_x=met_et*cos(met_phi);
104  met_y=met_et*sin(met_phi);
105 
106  if (verbose_ == 1.) {
107  std::cout << ">>>----> MHT Sgificance = " << significance << std::endl;
108  }
109 
110  pat::MHT themetsigobj(reco::Particle::LorentzVector(met_x,met_y,0,met_et),met_set,significance);
111 
112 
113  // Store the number of jets, electrons, muons
114  themetsigobj.setNumberOfJets(number_of_jets);
115  themetsigobj.setNumberOfElectrons(number_of_electrons);
116  themetsigobj.setNumberOfMuons(number_of_muons);
117 
118  themetsigcoll->push_back(themetsigobj);
119 
120  } // If the vector is empty, just put empty product.
121 
122 
123  iEvent.put( themetsigcoll);
124 
125 
126 }
const void addObjects(const std::vector< metsig::SigInputObj > &EventVec)
double getJets(edm::Event &, const edm::EventSetup &)
const double significance(double &met_r, double &met_phi, double &met_set)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: MHT.h:10
double getMuons(edm::Event &, const edm::EventSetup &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< pat::MHT > MHTCollection
Definition: MHT.h:41
double getElectrons(edm::Event &, const edm::EventSetup &)
std::vector< metsig::SigInputObj > physobjvector_
tuple cout
Definition: gather_cfg.py:121
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
std::set< CaloTowerDetId > s_clusteredTowers
void PATMHTProducer::setUncertaintyParameters ( )
private

Definition at line 380 of file PATMHTProducer.cc.

380  {
381 
382  // set the various functions here:
383 
384  //-- For Et functions, [0]= par_n, [1]=par_s, [2]= par_c ---//
385  //-- Ecal Uncertainty Functions ------------------------------------//
386  //-- From: FastSimulation/Calorimetry/data/HcalResponse.cfi --//
387  //-- Ecal Barrel --//
388  ecalEBUncertainty.etUncertainty = new TF1("ecalEBEtFunc","x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
389  ecalEBUncertainty.etUncertainty->SetParameter(0,0.2);
390  ecalEBUncertainty.etUncertainty->SetParameter(1,0.03);
391  ecalEBUncertainty.etUncertainty->SetParameter(2,0.005);
392 
393  ecalEBUncertainty.phiUncertainty = new TF1("ecalEBphiFunc","[0]*x",1);
394  ecalEBUncertainty.phiUncertainty->SetParameter(0,0.0174);
395 
396  //-- Ecal Endcap --//
397  ecalEEUncertainty.etUncertainty = new TF1("ecalEEEtFunc","x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
398  ecalEEUncertainty.etUncertainty->SetParameter(0,0.2);
399  ecalEEUncertainty.etUncertainty->SetParameter(1,0.03);
400  ecalEEUncertainty.etUncertainty->SetParameter(2,0.005);
401 
402  ecalEEUncertainty.phiUncertainty = new TF1("ecalEEphiFunc","[0]*x",1);
403  ecalEEUncertainty.phiUncertainty->SetParameter(0,0.087);
404 
405  //-- Hcal Uncertainty Functions --------------------------------------//
406  //-- From: FastSimulation/Calorimetry/data/HcalResponse.cfi --//
407  //-- Hcal Barrel --//
408  hcalHBUncertainty.etUncertainty = new TF1("hcalHBEtFunc","x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
409  hcalHBUncertainty.etUncertainty->SetParameter(0,0.);
410  hcalHBUncertainty.etUncertainty->SetParameter(1,1.22);
411  hcalHBUncertainty.etUncertainty->SetParameter(2,0.05);
412 
413  hcalHBUncertainty.phiUncertainty = new TF1("ecalHBphiFunc","[0]*x",1);
414  hcalHBUncertainty.phiUncertainty->SetParameter(0,0.087);
415 
416  //-- Hcal Endcap --//
417  hcalHEUncertainty.etUncertainty = new TF1("hcalHEEtFunc","x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
418  hcalHEUncertainty.etUncertainty->SetParameter(0,0.);
419  hcalHEUncertainty.etUncertainty->SetParameter(1,1.3);
420  hcalHEUncertainty.etUncertainty->SetParameter(2,0.05);
421 
422  hcalHEUncertainty.phiUncertainty = new TF1("ecalHEphiFunc","[0]*x",1);
423  hcalHEUncertainty.phiUncertainty->SetParameter(0,0.087);
424 
425  //-- Hcal Outer --//
426  hcalHOUncertainty.etUncertainty = new TF1("hcalHOEtFunc","x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
427  hcalHOUncertainty.etUncertainty->SetParameter(0,0.);
428  hcalHOUncertainty.etUncertainty->SetParameter(1,1.82);
429  hcalHOUncertainty.etUncertainty->SetParameter(2,0.09);
430 
431  hcalHOUncertainty.phiUncertainty = new TF1("ecalHOphiFunc","[0]*x",1);
432  hcalHOUncertainty.phiUncertainty->SetParameter(0,0.087);
433 
434  //-- Hcal Forward --//
435  hcalHFUncertainty.etUncertainty = new TF1("hcalHFEtFunc","x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
436  hcalHFUncertainty.etUncertainty->SetParameter(0,0.);
437  hcalHFUncertainty.etUncertainty->SetParameter(1,1.82);
438  hcalHFUncertainty.etUncertainty->SetParameter(2,0.09);
439 
440  hcalHFUncertainty.phiUncertainty = new TF1("ecalHFphiFunc","[0]*x",1);
441  hcalHFUncertainty.phiUncertainty->SetParameter(0,0.174);
442 
443  //--- Jet Uncertainty Functions --------------------------------------//
444  jetUncertainty.etUncertainty = new TF1("jetEtFunc","x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
445  //-- values from PTDR 1, ch 11.4 --//
449 
450 
451  //-- phi value from our own fits --//
452  //jetUncertainty.phiUncertainty = new TF1("jetPhiFunc","[0]*x",1);
453  //jetUncertainty.phiUncertainty->SetParameter(0, jetPhiUncertaintyParameter0_);
454 
455  //-- phi Functions and values from
456  // http://indico.cern.ch/getFile.py/access?contribId=9&sessionId=0&resId=0&materialId=slides&confId=46394
457  jetUncertainty.phiUncertainty = new TF1("jetPhiFunc","x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
461 
462 
463 
464  //-- Jet corrections are assumed not to have an error --//
465  /*jetCorrUncertainty.etUncertainty = new TF1("jetCorrEtFunc","[0]*x",1);
466  jetCorrUncertainty.etUncertainty->SetParameter(0,0.0);
467  jetCorrUncertainty.phiUncertainty = new TF1("jetCorrPhiFunc","[0]*x",1);
468  jetCorrUncertainty.phiUncertainty->SetParameter(0,0.0*(3.14159/180.));*/
469 
470 
471  //--- Electron Uncertainty Functions ---------------------------------//
472  // completely ambiguious values for electron-like jets...
473  // the egamma group keeps track of these here:
474  // https://twiki.cern.ch/twiki/bin/view/CMS/EgammaCMSSWVal
475  // electron resolution in energy is around 3.4%, measured for 10 < pT < 50 at realistic events with pile-up.
476 
477  eleUncertainty.etUncertainty = new TF1("eleEtFunc","[0] * x",1);
478  // eleUncertainty.etUncertainty->SetParameter(0,0.034);
480 
481 
482  eleUncertainty.phiUncertainty = new TF1("elePhiFunc","[0] * x",1);
483  // eleUncertainty.phiUncertainty->SetParameter(0,1*(3.14159/180.));
485 
486  //--- Muon Uncertainty Functions ------------------------------------//
487  // and ambiguious values for the muons...
488 
489  muonUncertainty.etUncertainty = new TF1("muonEtFunc","[0] * x",1);
490  // muonUncertainty.etUncertainty->SetParameter(0,0.01);
492  muonUncertainty.phiUncertainty = new TF1("muonPhiFunc","[0] * x",1);
493  // muonUncertainty.phiUncertainty->SetParameter(0,1*(3.14159/180.));
495 
496  //-- Muon calo deposites are assumed not to have an error --//
497  /*muonCorrUncertainty.etUncertainty = new TF1("muonCorrEtFunc","[0] * x",1);
498  muonCorrUncertainty.etUncertainty->SetParameter(0,0.0);
499  muonCorrUncertainty.phiUncertainty = new TF1("muonCorrPhiFunc","[0] * x",1);
500  muonCorrUncertainty.phiUncertainty->SetParameter(0,0.0*(3.14159/180.)); */
501 
502 }
double eleEtUncertaintyParameter0_
uncertaintyFunctions hcalHEUncertainty
double muonPhiUncertaintyParameter0_
uncertaintyFunctions muonUncertainty
uncertaintyFunctions ecalEEUncertainty
uncertaintyFunctions jetUncertainty
double jetEtUncertaintyParameter1_
double elePhiUncertaintyParameter0_
double jetEtUncertaintyParameter2_
double jetPhiUncertaintyParameter2_
uncertaintyFunctions hcalHBUncertainty
double muonEtUncertaintyParameter0_
uncertaintyFunctions hcalHFUncertainty
double jetPhiUncertaintyParameter1_
double jetPhiUncertaintyParameter0_
uncertaintyFunctions ecalEBUncertainty
double jetEtUncertaintyParameter0_
uncertaintyFunctions hcalHOUncertainty
uncertaintyFunctions eleUncertainty

Member Data Documentation

edm::InputTag pat::PATMHTProducer::CaloJetAlgorithmTag_
private

Definition at line 161 of file PATMHTProducer.h.

edm::InputTag pat::PATMHTProducer::CaloTowerTag_
private

Definition at line 166 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

bool pat::PATMHTProducer::controlledUncertainty_
private

Definition at line 95 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

edm::InputTag pat::PATMHTProducer::CorJetAlgorithmTag_
private

Definition at line 162 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::ecalEBUncertainty
private

Definition at line 107 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::ecalEEUncertainty
private

Definition at line 108 of file PATMHTProducer.h.

edm::InputTag pat::PATMHTProducer::ElectronTag_
private

Definition at line 165 of file PATMHTProducer.h.

double pat::PATMHTProducer::eleEtaMax_
private

Definition at line 135 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::eleEtUncertaintyParameter0_
private

Definition at line 155 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::elePhiUncertaintyParameter0_
private

Definition at line 156 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::elePtMin_
private

Definition at line 134 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

edm::EDGetTokenT<edm::View<pat::Electron> > pat::PATMHTProducer::eleToken_
private

Definition at line 87 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

uncertaintyFunctions pat::PATMHTProducer::eleUncertainty
private

Definition at line 116 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::hcalHBUncertainty
private

Definition at line 109 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::hcalHEUncertainty
private

Definition at line 110 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::hcalHFUncertainty
private

Definition at line 112 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::hcalHOUncertainty
private

Definition at line 111 of file PATMHTProducer.h.

std::string pat::PATMHTProducer::JetCorrectionService_
private

Definition at line 163 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::jetCorrUncertainty
private

Definition at line 115 of file PATMHTProducer.h.

double pat::PATMHTProducer::jetEMfracMax_
private

Definition at line 132 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetEtaMax_
private

Definition at line 131 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetEtUncertaintyParameter0_
private

Definition at line 147 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetEtUncertaintyParameter1_
private

Definition at line 148 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetEtUncertaintyParameter2_
private

Definition at line 149 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetPhiUncertaintyParameter0_
private

Definition at line 151 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetPhiUncertaintyParameter1_
private

Definition at line 152 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetPhiUncertaintyParameter2_
private

Definition at line 153 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetPtMin_
private

Definition at line 130 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

edm::EDGetTokenT<edm::View<pat::Jet> > pat::PATMHTProducer::jetToken_
private

Definition at line 86 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

uncertaintyFunctions pat::PATMHTProducer::jetUncertainty
private

Definition at line 114 of file PATMHTProducer.h.

std::string pat::PATMHTProducer::metCollectionLabel_
private

Definition at line 167 of file PATMHTProducer.h.

edm::InputTag pat::PATMHTProducer::mhtLabel_
private

Definition at line 85 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonChiSqMax_
private

Definition at line 143 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::muonCorrUncertainty
private

Definition at line 118 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonDPtMax_
private

Definition at line 142 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonEtaMax_
private

Definition at line 138 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::muonEtUncertaintyParameter0_
private

Definition at line 158 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

int pat::PATMHTProducer::muonNHitsMin_
private

Definition at line 141 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonPhiUncertaintyParameter0_
private

Definition at line 159 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::muonPtMin_
private

Definition at line 137 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

edm::InputTag pat::PATMHTProducer::MuonTag_
private

Definition at line 164 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonTrackD0Max_
private

Definition at line 139 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonTrackDzMax_
private

Definition at line 140 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::muonUncertainty
private

Definition at line 117 of file PATMHTProducer.h.

edm::EDGetTokenT<edm::View<pat::Muon> > pat::PATMHTProducer::muoToken_
private

Definition at line 88 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

bool pat::PATMHTProducer::noHF_
private

Definition at line 128 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

edm::EDGetTokenT<edm::View<pat::Photon> > pat::PATMHTProducer::phoToken_
private

Definition at line 90 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

std::vector<metsig::SigInputObj> pat::PATMHTProducer::physobjvector_
private

Definition at line 92 of file PATMHTProducer.h.

std::set<CaloTowerDetId> pat::PATMHTProducer::s_clusteredTowers
private

Definition at line 126 of file PATMHTProducer.h.

std::string pat::PATMHTProducer::significanceLabel_
private

Definition at line 168 of file PATMHTProducer.h.

edm::EDGetTokenT<edm::View<pat::Tau> > pat::PATMHTProducer::tauToken_
private

Definition at line 89 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::towerEtThreshold_
private

Definition at line 174 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::uncertaintyScaleFactor_
private

Definition at line 94 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

bool pat::PATMHTProducer::useCaloTowers_
private

Definition at line 122 of file PATMHTProducer.h.

bool pat::PATMHTProducer::useElectrons_
private

Definition at line 124 of file PATMHTProducer.h.

bool pat::PATMHTProducer::useHO_
private

Definition at line 175 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

bool pat::PATMHTProducer::useJets_
private

Definition at line 123 of file PATMHTProducer.h.

bool pat::PATMHTProducer::useMuons_
private

Definition at line 125 of file PATMHTProducer.h.

double pat::PATMHTProducer::verbose_
private

Definition at line 82 of file PATMHTProducer.h.

Referenced by PATMHTProducer().