48 produces<pat::MHTCollection>();
57 setUncertaintyParameters();
67 while(physobjvector_.size()>0){
68 physobjvector_.erase(physobjvector_.begin(),physobjvector_.end());
72 s_clusteredTowers.clear();
74 double number_of_jets =
getJets(iEvent, iSetup);
76 double number_of_electrons = getElectrons(iEvent, iSetup);
78 double number_of_muons = getMuons(iEvent, iSetup);
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;
95 if(physobjvector_.size() >= 1) {
101 double significance = signifAlgo.
significance(met_et,met_phi,met_set);
103 met_x=met_et*
cos(met_phi);
104 met_y=met_et*
sin(met_phi);
106 if (verbose_ == 1.) {
107 std::cout <<
">>>----> MHT Sgificance = " << significance << std::endl;
118 themetsigcoll->push_back(themetsigobj);
123 iEvent.
put( themetsigcoll);
136 double number_of_jets_ = 0.0;
145 if( (jet_iter->pt() < jetPtMin_) ||
147 (jet_iter->emEnergyFraction() > jetEMfracMax_ ) )
150 double jet_et = jet_iter->et();
151 double jet_phi = jet_iter->phi();
153 if (verbose_ == 3.) {
154 std::cout <<
"jet pt : " << jet_iter->pt() <<
" eta : " << jet_iter->eta()
155 <<
" EMF: " << jet_iter->emEnergyFraction() << std::endl;
158 double sigma_et, sigma_phi ;
160 if (controlledUncertainty_) {
161 sigma_et = jetUncertainty.etUncertainty->Eval(jet_et);
162 sigma_phi = jetUncertainty.phiUncertainty->Eval(jet_et);
169 if (verbose_ == 3.) {
170 std::cout <<
"jet sigma_et : " << sigma_et <<
", jet sigma_phi : " << sigma_phi << std::endl;
173 if(sigma_et<=0 || sigma_phi<=0)
175 " uncertainties for " << objectname <<
176 " are (et, phi): " << sigma_et <<
"," << sigma_phi <<
" (et,phi): " << jet_et <<
"," << jet_phi;
180 if (uncertaintyScaleFactor_ != 1.0){
181 sigma_et = sigma_et * uncertaintyScaleFactor_;
182 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
188 if (verbose_ == 101.) {
190 std::cout <<
"v101> " << number_of_jets_ <<
" "
191 << jet_et <<
" " << sigma_et <<
" "
192 << jet_phi <<
" " << sigma_phi << std::endl;
197 physobjvector_.push_back(tmp_jet);
201 std::vector<CaloTowerPtr> v_towers = jet_iter->getCaloConstituents();
204 for (
unsigned int ii=0;
ii < v_towers.size();
ii++) {
205 s_clusteredTowers.insert( (*v_towers.at(
ii)).
id() );
211 if (verbose_ == 101.) {
212 std::cout <<
"v101> --------------------------------------------" << std::endl;
215 return number_of_jets_;
228 double number_of_electrons_ = 0.0;
243 if (electron_iter->et() < elePtMin_ ||
244 TMath::Abs(electron_iter->eta()) > eleEtaMax_ )
continue;
246 if (verbose_ == 3.) {
247 std::cout <<
"electron pt = " << electron_iter->pt() <<
" eta : " << electron_iter->eta()
251 double electron_et = electron_iter->et();
252 double electron_phi = electron_iter->phi();
254 double sigma_et, sigma_phi ;
256 if (controlledUncertainty_) {
257 sigma_et = eleUncertainty.etUncertainty->Eval(electron_et);
258 sigma_phi = eleUncertainty.phiUncertainty->Eval(electron_et);
265 if (verbose_ == 3.) {
266 std::cout <<
"electron sigma_et : " << sigma_et <<
", electron sigma_phi : " << sigma_phi
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;
275 if (uncertaintyScaleFactor_ != 1.0){
276 sigma_et = sigma_et * uncertaintyScaleFactor_;
277 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
281 physobjvector_.push_back(tmp_electron);
282 number_of_electrons_ ++;
308 return number_of_electrons_;
325 std::cout <<
">>> PATMHTSelector not valid muon Handle!" << std::endl;
330 double number_of_muons_ = 0.0;
334 if (muon_iter->pt() < muonPtMin_ ||
TMath::Abs(muon_iter->eta()) > muonEtaMax_ )
continue;
336 if (verbose_ == 3.) {
337 std::cout <<
"muon pt = " << muon_iter->pt() <<
" eta : " << muon_iter->eta() << std::endl;
340 double muon_pt = muon_iter->pt();
341 double muon_phi = muon_iter->phi();
343 double sigma_et, sigma_phi ;
345 if (controlledUncertainty_) {
346 sigma_et = muonUncertainty.etUncertainty->Eval(muon_pt);
347 sigma_phi = muonUncertainty.phiUncertainty->Eval(muon_pt);
354 if (verbose_ == 3.) {
355 std::cout <<
"muon sigma_et : " << sigma_et
356 <<
", muon sigma_phi : " << sigma_phi
359 if(sigma_et< 0 || sigma_phi< 0)
361 " uncertainties for " << objectname <<
" are (et, phi): " << sigma_et <<
"," <<
362 sigma_phi <<
" (pt,phi): " << muon_pt <<
"," << muon_phi;
364 if (uncertaintyScaleFactor_ != 1.0){
365 sigma_et = sigma_et * uncertaintyScaleFactor_;
366 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
370 physobjvector_.push_back(tmp_muon);
375 return number_of_muons_;
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);
393 ecalEBUncertainty.phiUncertainty =
new TF1(
"ecalEBphiFunc",
"[0]*x",1);
394 ecalEBUncertainty.phiUncertainty->SetParameter(0,0.0174);
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);
402 ecalEEUncertainty.phiUncertainty =
new TF1(
"ecalEEphiFunc",
"[0]*x",1);
403 ecalEEUncertainty.phiUncertainty->SetParameter(0,0.087);
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);
413 hcalHBUncertainty.phiUncertainty =
new TF1(
"ecalHBphiFunc",
"[0]*x",1);
414 hcalHBUncertainty.phiUncertainty->SetParameter(0,0.087);
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);
422 hcalHEUncertainty.phiUncertainty =
new TF1(
"ecalHEphiFunc",
"[0]*x",1);
423 hcalHEUncertainty.phiUncertainty->SetParameter(0,0.087);
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);
431 hcalHOUncertainty.phiUncertainty =
new TF1(
"ecalHOphiFunc",
"[0]*x",1);
432 hcalHOUncertainty.phiUncertainty->SetParameter(0,0.087);
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);
440 hcalHFUncertainty.phiUncertainty =
new TF1(
"ecalHFphiFunc",
"[0]*x",1);
441 hcalHFUncertainty.phiUncertainty->SetParameter(0,0.174);
444 jetUncertainty.etUncertainty =
new TF1(
"jetEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
446 jetUncertainty.etUncertainty->SetParameter(0, jetEtUncertaintyParameter0_);
447 jetUncertainty.etUncertainty->SetParameter(1, jetEtUncertaintyParameter1_);
448 jetUncertainty.etUncertainty->SetParameter(2, jetEtUncertaintyParameter2_);
457 jetUncertainty.phiUncertainty =
new TF1(
"jetPhiFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
458 jetUncertainty.phiUncertainty->SetParameter(0, jetPhiUncertaintyParameter0_);
459 jetUncertainty.phiUncertainty->SetParameter(1, jetPhiUncertaintyParameter1_);
460 jetUncertainty.phiUncertainty->SetParameter(2, jetPhiUncertaintyParameter2_);
477 eleUncertainty.etUncertainty =
new TF1(
"eleEtFunc",
"[0] * x",1);
479 eleUncertainty.etUncertainty->SetParameter(0, eleEtUncertaintyParameter0_);
482 eleUncertainty.phiUncertainty =
new TF1(
"elePhiFunc",
"[0] * x",1);
484 eleUncertainty.phiUncertainty->SetParameter(0, elePhiUncertaintyParameter0_);
489 muonUncertainty.etUncertainty =
new TF1(
"muonEtFunc",
"[0] * x",1);
491 muonUncertainty.etUncertainty->SetParameter(0, muonEtUncertaintyParameter0_);
492 muonUncertainty.phiUncertainty =
new TF1(
"muonPhiFunc",
"[0] * x",1);
494 muonUncertainty.phiUncertainty->SetParameter(0, muonPhiUncertaintyParameter0_);
T getParameter(std::string const &) const
const void addObjects(const std::vector< metsig::SigInputObj > &EventVec)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< pat::Photon > > phoToken_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
double eleEtUncertaintyParameter0_
void setNumberOfMuons(const double &numberOfMuons)
double getJets(edm::Event &, const edm::EventSetup &)
bool controlledUncertainty_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double muonPhiUncertaintyParameter0_
#define DEFINE_FWK_MODULE(type)
const double significance(double &met_r, double &met_phi, double &met_set)
void setNumberOfJets(const double &numberOfJets)
edm::EDGetTokenT< edm::View< pat::Muon > > muoToken_
Sin< T >::type sin(const T &t)
double jetEtUncertaintyParameter1_
double elePhiUncertaintyParameter0_
double jetEtUncertaintyParameter2_
double jetPhiUncertaintyParameter2_
double getMuons(edm::Event &, const edm::EventSetup &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< edm::View< pat::Tau > > tauToken_
std::vector< JetPair > getJets(HWW &hww, int, double, double, bool, bool)
double muonEtUncertaintyParameter0_
PATMHTProducer(const edm::ParameterSet &)
Cos< T >::type cos(const T &t)
void setUncertaintyParameters()
std::vector< pat::MHT > MHTCollection
double getElectrons(edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< edm::View< pat::Electron > > eleToken_
double uncertaintyScaleFactor_
edm::InputTag CaloTowerTag_
double jetPhiUncertaintyParameter1_
virtual void produce(edm::Event &, const edm::EventSetup &) override
double jetPhiUncertaintyParameter0_
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
const_iterator begin() const
const_iterator end() const
double jetEtUncertaintyParameter0_
void setNumberOfElectrons(const double &numberOfElectrons)
math::XYZTLorentzVector LorentzVector
Lorentz vector.