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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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_
 
edm::InputTag eleLabel_
 
double elePhiUncertaintyParameter0_
 
double elePtMin_
 
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_
 
edm::InputTag jetLabel_
 
double jetPhiUncertaintyParameter0_
 
double jetPhiUncertaintyParameter1_
 
double jetPhiUncertaintyParameter2_
 
double jetPtMin_
 
uncertaintyFunctions jetUncertainty
 
std::string metCollectionLabel_
 
edm::InputTag mhtLabel_
 
edm::InputTag muoLabel_
 
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
 
bool noHF_
 
edm::InputTag phoLabel_
 
std::vector< metsig::SigInputObjphysobjvector_
 
std::set< CaloTowerDetIds_clusteredTowers
 
std::string significanceLabel_
 
edm::InputTag tauLabel_
 
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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 65 of file PATMHTProducer.h.

Constructor & Destructor Documentation

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

Definition at line 7 of file PATMHTProducer.cc.

References CaloTowerTag_, controlledUncertainty_, eleEtaMax_, eleEtUncertaintyParameter0_, eleLabel_, elePhiUncertaintyParameter0_, elePtMin_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), jetEMfracMax_, jetEtaMax_, jetEtUncertaintyParameter0_, jetEtUncertaintyParameter1_, jetEtUncertaintyParameter2_, jetLabel_, jetPhiUncertaintyParameter0_, jetPhiUncertaintyParameter1_, jetPhiUncertaintyParameter2_, jetPtMin_, muoLabel_, muonEtaMax_, muonEtUncertaintyParameter0_, muonPhiUncertaintyParameter0_, muonPtMin_, noHF_, phoLabel_, tauLabel_, towerEtThreshold_, uncertaintyScaleFactor_, useHO_, and verbose_.

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

Definition at line 54 of file PATMHTProducer.cc.

54  {
55 }

Member Function Documentation

void PATMHTProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 57 of file PATMHTProducer.cc.

57  {
59 }
void PATMHTProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 60 of file PATMHTProducer.cc.

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

Definition at line 225 of file PATMHTProducer.cc.

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

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

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

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

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

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

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

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

Definition at line 381 of file PATMHTProducer.cc.

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

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

Definition at line 167 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

bool pat::PATMHTProducer::controlledUncertainty_
private

Definition at line 96 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

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

Definition at line 163 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::ecalEBUncertainty
private

Definition at line 108 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::ecalEEUncertainty
private

Definition at line 109 of file PATMHTProducer.h.

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

Definition at line 166 of file PATMHTProducer.h.

double pat::PATMHTProducer::eleEtaMax_
private

Definition at line 136 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::eleEtUncertaintyParameter0_
private

Definition at line 156 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

edm::InputTag pat::PATMHTProducer::eleLabel_
private

Definition at line 88 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::elePhiUncertaintyParameter0_
private

Definition at line 157 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::elePtMin_
private

Definition at line 135 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

uncertaintyFunctions pat::PATMHTProducer::eleUncertainty
private

Definition at line 117 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::hcalHBUncertainty
private

Definition at line 110 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::hcalHEUncertainty
private

Definition at line 111 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::hcalHFUncertainty
private

Definition at line 113 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::hcalHOUncertainty
private

Definition at line 112 of file PATMHTProducer.h.

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

Definition at line 164 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::jetCorrUncertainty
private

Definition at line 116 of file PATMHTProducer.h.

double pat::PATMHTProducer::jetEMfracMax_
private

Definition at line 133 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetEtaMax_
private

Definition at line 132 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetEtUncertaintyParameter0_
private

Definition at line 148 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetEtUncertaintyParameter1_
private

Definition at line 149 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetEtUncertaintyParameter2_
private

Definition at line 150 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

edm::InputTag pat::PATMHTProducer::jetLabel_
private

Definition at line 87 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetPhiUncertaintyParameter0_
private

Definition at line 152 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetPhiUncertaintyParameter1_
private

Definition at line 153 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetPhiUncertaintyParameter2_
private

Definition at line 154 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::jetPtMin_
private

Definition at line 131 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

uncertaintyFunctions pat::PATMHTProducer::jetUncertainty
private

Definition at line 115 of file PATMHTProducer.h.

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

Definition at line 168 of file PATMHTProducer.h.

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

Definition at line 86 of file PATMHTProducer.h.

edm::InputTag pat::PATMHTProducer::muoLabel_
private

Definition at line 89 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::muonChiSqMax_
private

Definition at line 144 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::muonCorrUncertainty
private

Definition at line 119 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonDPtMax_
private

Definition at line 143 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonEtaMax_
private

Definition at line 139 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::muonEtUncertaintyParameter0_
private

Definition at line 159 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

int pat::PATMHTProducer::muonNHitsMin_
private

Definition at line 142 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonPhiUncertaintyParameter0_
private

Definition at line 160 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::muonPtMin_
private

Definition at line 138 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

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

Definition at line 165 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonTrackD0Max_
private

Definition at line 140 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonTrackDzMax_
private

Definition at line 141 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::muonUncertainty
private

Definition at line 118 of file PATMHTProducer.h.

bool pat::PATMHTProducer::noHF_
private

Definition at line 129 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

edm::InputTag pat::PATMHTProducer::phoLabel_
private

Definition at line 91 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

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

Definition at line 93 of file PATMHTProducer.h.

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

Definition at line 127 of file PATMHTProducer.h.

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

Definition at line 169 of file PATMHTProducer.h.

edm::InputTag pat::PATMHTProducer::tauLabel_
private

Definition at line 90 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::towerEtThreshold_
private

Definition at line 175 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::uncertaintyScaleFactor_
private

Definition at line 95 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

bool pat::PATMHTProducer::useCaloTowers_
private

Definition at line 123 of file PATMHTProducer.h.

bool pat::PATMHTProducer::useElectrons_
private

Definition at line 125 of file PATMHTProducer.h.

bool pat::PATMHTProducer::useHO_
private

Definition at line 176 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

bool pat::PATMHTProducer::useJets_
private

Definition at line 124 of file PATMHTProducer.h.

bool pat::PATMHTProducer::useMuons_
private

Definition at line 126 of file PATMHTProducer.h.

double pat::PATMHTProducer::verbose_
private

Definition at line 83 of file PATMHTProducer.h.

Referenced by PATMHTProducer().