CMS 3D CMS Logo

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::stream::EDProducer<>

Classes

class  uncertaintyFunctions
 

Public Member Functions

 PATMHTProducer (const edm::ParameterSet &)
 
 ~PATMHTProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Member Functions

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 &)
 
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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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_, setUncertaintyParameters(), 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 
49 
50  produces<pat::MHTCollection>();
51 
52 }
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 ( )
override

Definition at line 55 of file PATMHTProducer.cc.

55  {
56 }

Member Function Documentation

double PATMHTProducer::getElectrons ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 219 of file PATMHTProducer.cc.

References Abs(), edm::View< T >::begin(), controlledUncertainty_, gather_cfg::cout, nano_cff::electrons, eleEtaMax_, elePtMin_, eleToken_, eleUncertainty, edm::View< T >::end(), pat::PATMHTProducer::uncertaintyFunctions::etUncertainty, edm::Event::getByToken(), pat::PATMHTProducer::uncertaintyFunctions::phiUncertainty, physobjvector_, AlCaHLTBitMon_QueryRunRegistry::string, uncertaintyScaleFactor_, and verbose_.

Referenced by produce().

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

Definition at line 127 of file PATMHTProducer.cc.

References Abs(), edm::View< T >::begin(), controlledUncertainty_, gather_cfg::cout, edm::View< T >::end(), pat::PATMHTProducer::uncertaintyFunctions::etUncertainty, edm::Event::getByToken(), cuy::ii, jetEMfracMax_, jetEtaMax_, jetPtMin_, fwrapper::jets, jetToken_, jetUncertainty, pat::PATMHTProducer::uncertaintyFunctions::phiUncertainty, physobjvector_, s_clusteredTowers, AlCaHLTBitMon_QueryRunRegistry::string, uncertaintyScaleFactor_, and verbose_.

Referenced by produce().

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

Definition at line 311 of file PATMHTProducer.cc.

References Abs(), edm::View< T >::begin(), controlledUncertainty_, gather_cfg::cout, edm::View< T >::end(), pat::PATMHTProducer::uncertaintyFunctions::etUncertainty, edm::Event::getByToken(), edm::HandleBase::isValid(), muonEtaMax_, muonPtMin_, extraflags_cff::muons, muonUncertainty, muoToken_, pat::PATMHTProducer::uncertaintyFunctions::phiUncertainty, physobjvector_, AlCaHLTBitMon_QueryRunRegistry::string, uncertaintyScaleFactor_, and verbose_.

Referenced by produce().

311  {
312 
313  std::string objectname="muon";
315  iEvent.getByToken(muoToken_,muonHandle);
316  edm::View<pat::Muon> muons = *muonHandle;
317 
318  if ( !muonHandle.isValid() ) {
319  std::cout << ">>> PATMHTSelector not valid muon Handle!" << std::endl;
320  return 0.0;
321  }
322 
323 
324  double number_of_muons_ = 0.0;
325 
326  for(edm::View<pat::Muon>::const_iterator muon_iter = muons.begin(); muon_iter!=muons.end(); ++muon_iter){
327 
328  if (muon_iter->pt() < muonPtMin_ || TMath::Abs(muon_iter->eta()) > muonEtaMax_ ) continue;
329 
330  if (verbose_ == 3.) {
331  std::cout << "muon pt = " << muon_iter->pt() << " eta : " << muon_iter->eta() << std::endl;
332  }
333 
334  double muon_pt = muon_iter->pt();
335  double muon_phi = muon_iter->phi();
336 
337  double sigma_et, sigma_phi ;
338 
340  sigma_et = muonUncertainty.etUncertainty->Eval(muon_pt);
341  sigma_phi = muonUncertainty.phiUncertainty->Eval(muon_pt);
342  }
343  else {
344  sigma_et = 0.0; //muon_iter->resolutionEt();
345  sigma_phi = 0.0; // muon_iter->resolutionPhi();
346  }
347 
348  if (verbose_ == 3.) {
349  std::cout << "muon sigma_et : " << sigma_et
350  << ", muon sigma_phi : " << sigma_phi
351  << std::endl;}
352 
353  if(sigma_et< 0 || sigma_phi< 0)
354  edm::LogWarning("PATMHTProducer") <<
355  " uncertainties for " << objectname << " are (et, phi): " << sigma_et << "," <<
356  sigma_phi << " (pt,phi): " << muon_pt << "," << muon_phi;
357 
358  if (uncertaintyScaleFactor_ != 1.0){
359  sigma_et = sigma_et * uncertaintyScaleFactor_;
360  sigma_phi = sigma_phi * uncertaintyScaleFactor_;
361  }
362 
363  metsig::SigInputObj tmp_muon(objectname,muon_pt,muon_phi,sigma_et,sigma_phi);
364  physobjvector_.push_back(tmp_muon);
365  number_of_muons_ ++;
366 
367  }// end Muon loop
368 
369  return number_of_muons_;
370 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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:74
std::vector< metsig::SigInputObj > physobjvector_
double uncertaintyScaleFactor_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
const_iterator end() const
void pat::PATMHTProducer::getTowers ( edm::Event ,
const edm::EventSetup  
)
private
void PATMHTProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 59 of file PATMHTProducer.cc.

References metsig::significanceAlgo::addObjects(), funct::cos(), gather_cfg::cout, getElectrons(), getJets(), getMuons(), eostools::move(), physobjvector_, edm::Event::put(), s_clusteredTowers, pat::MHT::setNumberOfElectrons(), pat::MHT::setNumberOfJets(), pat::MHT::setNumberOfMuons(), met_cff::significance, metsig::significanceAlgo::significance(), funct::sin(), and verbose_.

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

Definition at line 374 of file PATMHTProducer.cc.

References DEFINE_FWK_MODULE, ecalEBUncertainty, ecalEEUncertainty, eleEtUncertaintyParameter0_, elePhiUncertaintyParameter0_, eleUncertainty, pat::PATMHTProducer::uncertaintyFunctions::etUncertainty, hcalHBUncertainty, hcalHEUncertainty, hcalHFUncertainty, hcalHOUncertainty, jetEtUncertaintyParameter0_, jetEtUncertaintyParameter1_, jetEtUncertaintyParameter2_, jetPhiUncertaintyParameter0_, jetPhiUncertaintyParameter1_, jetPhiUncertaintyParameter2_, jetUncertainty, muonEtUncertaintyParameter0_, muonPhiUncertaintyParameter0_, muonUncertainty, and pat::PATMHTProducer::uncertaintyFunctions::phiUncertainty.

Referenced by PATMHTProducer().

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

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

Definition at line 164 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

bool pat::PATMHTProducer::controlledUncertainty_
private

Definition at line 93 of file PATMHTProducer.h.

Referenced by getElectrons(), getJets(), getMuons(), and PATMHTProducer().

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

Definition at line 160 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::ecalEBUncertainty
private

Definition at line 105 of file PATMHTProducer.h.

Referenced by setUncertaintyParameters().

uncertaintyFunctions pat::PATMHTProducer::ecalEEUncertainty
private

Definition at line 106 of file PATMHTProducer.h.

Referenced by setUncertaintyParameters().

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

Definition at line 163 of file PATMHTProducer.h.

double pat::PATMHTProducer::eleEtaMax_
private

Definition at line 133 of file PATMHTProducer.h.

Referenced by getElectrons(), and PATMHTProducer().

double pat::PATMHTProducer::eleEtUncertaintyParameter0_
private

Definition at line 153 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

double pat::PATMHTProducer::elePhiUncertaintyParameter0_
private

Definition at line 154 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

double pat::PATMHTProducer::elePtMin_
private

Definition at line 132 of file PATMHTProducer.h.

Referenced by getElectrons(), and PATMHTProducer().

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

Definition at line 85 of file PATMHTProducer.h.

Referenced by getElectrons(), and PATMHTProducer().

uncertaintyFunctions pat::PATMHTProducer::eleUncertainty
private

Definition at line 114 of file PATMHTProducer.h.

Referenced by getElectrons(), and setUncertaintyParameters().

uncertaintyFunctions pat::PATMHTProducer::hcalHBUncertainty
private

Definition at line 107 of file PATMHTProducer.h.

Referenced by setUncertaintyParameters().

uncertaintyFunctions pat::PATMHTProducer::hcalHEUncertainty
private

Definition at line 108 of file PATMHTProducer.h.

Referenced by setUncertaintyParameters().

uncertaintyFunctions pat::PATMHTProducer::hcalHFUncertainty
private

Definition at line 110 of file PATMHTProducer.h.

Referenced by setUncertaintyParameters().

uncertaintyFunctions pat::PATMHTProducer::hcalHOUncertainty
private

Definition at line 109 of file PATMHTProducer.h.

Referenced by setUncertaintyParameters().

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

Definition at line 161 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::jetCorrUncertainty
private

Definition at line 113 of file PATMHTProducer.h.

double pat::PATMHTProducer::jetEMfracMax_
private

Definition at line 130 of file PATMHTProducer.h.

Referenced by getJets(), and PATMHTProducer().

double pat::PATMHTProducer::jetEtaMax_
private

Definition at line 129 of file PATMHTProducer.h.

Referenced by getJets(), and PATMHTProducer().

double pat::PATMHTProducer::jetEtUncertaintyParameter0_
private

Definition at line 145 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

double pat::PATMHTProducer::jetEtUncertaintyParameter1_
private

Definition at line 146 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

double pat::PATMHTProducer::jetEtUncertaintyParameter2_
private

Definition at line 147 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

double pat::PATMHTProducer::jetPhiUncertaintyParameter0_
private

Definition at line 149 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

double pat::PATMHTProducer::jetPhiUncertaintyParameter1_
private

Definition at line 150 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

double pat::PATMHTProducer::jetPhiUncertaintyParameter2_
private

Definition at line 151 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

double pat::PATMHTProducer::jetPtMin_
private

Definition at line 128 of file PATMHTProducer.h.

Referenced by getJets(), and PATMHTProducer().

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

Definition at line 84 of file PATMHTProducer.h.

Referenced by getJets(), and PATMHTProducer().

uncertaintyFunctions pat::PATMHTProducer::jetUncertainty
private

Definition at line 112 of file PATMHTProducer.h.

Referenced by getJets(), and setUncertaintyParameters().

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

Definition at line 165 of file PATMHTProducer.h.

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

Definition at line 83 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonChiSqMax_
private

Definition at line 141 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::muonCorrUncertainty
private

Definition at line 116 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonDPtMax_
private

Definition at line 140 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonEtaMax_
private

Definition at line 136 of file PATMHTProducer.h.

Referenced by getMuons(), and PATMHTProducer().

double pat::PATMHTProducer::muonEtUncertaintyParameter0_
private

Definition at line 156 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

int pat::PATMHTProducer::muonNHitsMin_
private

Definition at line 139 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonPhiUncertaintyParameter0_
private

Definition at line 157 of file PATMHTProducer.h.

Referenced by PATMHTProducer(), and setUncertaintyParameters().

double pat::PATMHTProducer::muonPtMin_
private

Definition at line 135 of file PATMHTProducer.h.

Referenced by getMuons(), and PATMHTProducer().

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

Definition at line 162 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonTrackD0Max_
private

Definition at line 137 of file PATMHTProducer.h.

double pat::PATMHTProducer::muonTrackDzMax_
private

Definition at line 138 of file PATMHTProducer.h.

uncertaintyFunctions pat::PATMHTProducer::muonUncertainty
private

Definition at line 115 of file PATMHTProducer.h.

Referenced by getMuons(), and setUncertaintyParameters().

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

Definition at line 86 of file PATMHTProducer.h.

Referenced by getMuons(), and PATMHTProducer().

bool pat::PATMHTProducer::noHF_
private

Definition at line 126 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

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

Definition at line 88 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

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

Definition at line 90 of file PATMHTProducer.h.

Referenced by getElectrons(), getJets(), getMuons(), and produce().

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

Definition at line 124 of file PATMHTProducer.h.

Referenced by getJets(), and produce().

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

Definition at line 166 of file PATMHTProducer.h.

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

Definition at line 87 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::towerEtThreshold_
private

Definition at line 172 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

double pat::PATMHTProducer::uncertaintyScaleFactor_
private

Definition at line 92 of file PATMHTProducer.h.

Referenced by getElectrons(), getJets(), getMuons(), and PATMHTProducer().

bool pat::PATMHTProducer::useCaloTowers_
private

Definition at line 120 of file PATMHTProducer.h.

bool pat::PATMHTProducer::useElectrons_
private

Definition at line 122 of file PATMHTProducer.h.

bool pat::PATMHTProducer::useHO_
private

Definition at line 173 of file PATMHTProducer.h.

Referenced by PATMHTProducer().

bool pat::PATMHTProducer::useJets_
private

Definition at line 121 of file PATMHTProducer.h.

bool pat::PATMHTProducer::useMuons_
private

Definition at line 123 of file PATMHTProducer.h.

double pat::PATMHTProducer::verbose_
private

Definition at line 80 of file PATMHTProducer.h.

Referenced by getElectrons(), getJets(), getMuons(), PATMHTProducer(), and produce().