49 produces<pat::MHTCollection>();
58 setUncertaintyParameters();
71 while(physobjvector_.size()>0){
72 physobjvector_.erase(physobjvector_.begin(),physobjvector_.end());
76 s_clusteredTowers.clear();
78 double number_of_jets = getJets(iEvent, iSetup);
80 double number_of_electrons = getElectrons(iEvent, iSetup);
82 double number_of_muons = getMuons(iEvent, iSetup);
85 std::cout <<
">>>---> Number of jets: " << number_of_jets << std::endl;
86 std::cout <<
">>>---> Number of electrons: " << number_of_jets << std::endl;
87 std::cout <<
">>>---> Number of muons: " << number_of_muons << std::endl;
99 if(physobjvector_.size() >= 1) {
105 double significance = signifAlgo.
significance(met_et,met_phi,met_set);
107 met_x=met_et*
cos(met_phi);
108 met_y=met_et*
sin(met_phi);
110 if (verbose_ == 1.) {
111 std::cout <<
">>>----> MHT Sgificance = " << significance << std::endl;
122 themetsigcoll->push_back(themetsigobj);
127 iEvent.
put( themetsigcoll);
138 std::string objectname=
"jet";
140 double number_of_jets_ = 0.0;
149 if( (jet_iter->pt() < jetPtMin_) ||
150 (TMath::Abs(jet_iter->eta()) > jetEtaMax_) ||
151 (jet_iter->emEnergyFraction() > jetEMfracMax_ ) )
154 double jet_et = jet_iter->et();
155 double jet_phi = jet_iter->phi();
157 if (verbose_ == 3.) {
158 std::cout <<
"jet pt : " << jet_iter->pt() <<
" eta : " << jet_iter->eta()
159 <<
" EMF: " << jet_iter->emEnergyFraction() << std::endl;
162 double sigma_et, sigma_phi ;
164 if (controlledUncertainty_) {
165 sigma_et = jetUncertainty.etUncertainty->Eval(jet_et);
166 sigma_phi = jetUncertainty.phiUncertainty->Eval(jet_et);
173 if (verbose_ == 3.) {
174 std::cout <<
"jet sigma_et : " << sigma_et <<
", jet sigma_phi : " << sigma_phi << std::endl;
177 if(sigma_et<=0 || sigma_phi<=0)
179 " uncertainties for " << objectname <<
180 " are (et, phi): " << sigma_et <<
"," << sigma_phi <<
" (et,phi): " << jet_et <<
"," << jet_phi;
184 if (uncertaintyScaleFactor_ != 1.0){
185 sigma_et = sigma_et * uncertaintyScaleFactor_;
186 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
192 if (verbose_ == 101.) {
194 std::cout <<
"v101> " << number_of_jets_ <<
" "
195 << jet_et <<
" " << sigma_et <<
" "
196 << jet_phi <<
" " << sigma_phi << std::endl;
201 physobjvector_.push_back(tmp_jet);
205 std::vector<CaloTowerPtr> v_towers = jet_iter->getCaloConstituents();
208 for (
unsigned int ii=0; ii < v_towers.size(); ii++) {
209 s_clusteredTowers.insert( (*v_towers.at(ii)).
id() );
215 if (verbose_ == 101.) {
216 std::cout <<
"v101> --------------------------------------------" << std::endl;
219 return number_of_jets_;
230 std::string objectname=
"electron";
232 double number_of_electrons_ = 0.0;
247 if (electron_iter->et() < elePtMin_ ||
248 TMath::Abs(electron_iter->eta()) > eleEtaMax_ )
continue;
250 if (verbose_ == 3.) {
251 std::cout <<
"electron pt = " << electron_iter->pt() <<
" eta : " << electron_iter->eta()
255 double electron_et = electron_iter->et();
256 double electron_phi = electron_iter->phi();
258 double sigma_et, sigma_phi ;
260 if (controlledUncertainty_) {
261 sigma_et = eleUncertainty.etUncertainty->Eval(electron_et);
262 sigma_phi = eleUncertainty.phiUncertainty->Eval(electron_et);
269 if (verbose_ == 3.) {
270 std::cout <<
"electron sigma_et : " << sigma_et <<
", electron sigma_phi : " << sigma_phi
273 if(sigma_et< 0 || sigma_phi< 0)
274 edm::LogWarning(
"PATMHTProducer") <<
" uncertainties for " << objectname
275 <<
" are (et, phi): " << sigma_et
276 <<
"," << sigma_phi <<
" (et,phi): "
277 << electron_et <<
"," << electron_phi;
279 if (uncertaintyScaleFactor_ != 1.0){
280 sigma_et = sigma_et * uncertaintyScaleFactor_;
281 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
285 physobjvector_.push_back(tmp_electron);
286 number_of_electrons_ ++;
312 return number_of_electrons_;
323 std::string objectname=
"muon";
329 std::cout <<
">>> PATMHTSelector not valid muon Handle!" << std::endl;
334 double number_of_muons_ = 0.0;
338 if (muon_iter->pt() < muonPtMin_ || TMath::Abs(muon_iter->eta()) > muonEtaMax_ )
continue;
340 if (verbose_ == 3.) {
341 std::cout <<
"muon pt = " << muon_iter->pt() <<
" eta : " << muon_iter->eta() << std::endl;
344 double muon_pt = muon_iter->pt();
345 double muon_phi = muon_iter->phi();
347 double sigma_et, sigma_phi ;
349 if (controlledUncertainty_) {
350 sigma_et = muonUncertainty.etUncertainty->Eval(muon_pt);
351 sigma_phi = muonUncertainty.phiUncertainty->Eval(muon_pt);
358 if (verbose_ == 3.) {
359 std::cout <<
"muon sigma_et : " << sigma_et
360 <<
", muon sigma_phi : " << sigma_phi
363 if(sigma_et< 0 || sigma_phi< 0)
365 " uncertainties for " << objectname <<
" are (et, phi): " << sigma_et <<
"," <<
366 sigma_phi <<
" (pt,phi): " << muon_pt <<
"," << muon_phi;
368 if (uncertaintyScaleFactor_ != 1.0){
369 sigma_et = sigma_et * uncertaintyScaleFactor_;
370 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
374 physobjvector_.push_back(tmp_muon);
379 return number_of_muons_;
392 ecalEBUncertainty.etUncertainty =
new TF1(
"ecalEBEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
393 ecalEBUncertainty.etUncertainty->SetParameter(0,0.2);
394 ecalEBUncertainty.etUncertainty->SetParameter(1,0.03);
395 ecalEBUncertainty.etUncertainty->SetParameter(2,0.005);
397 ecalEBUncertainty.phiUncertainty =
new TF1(
"ecalEBphiFunc",
"[0]*x",1);
398 ecalEBUncertainty.phiUncertainty->SetParameter(0,0.0174);
401 ecalEEUncertainty.etUncertainty =
new TF1(
"ecalEEEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
402 ecalEEUncertainty.etUncertainty->SetParameter(0,0.2);
403 ecalEEUncertainty.etUncertainty->SetParameter(1,0.03);
404 ecalEEUncertainty.etUncertainty->SetParameter(2,0.005);
406 ecalEEUncertainty.phiUncertainty =
new TF1(
"ecalEEphiFunc",
"[0]*x",1);
407 ecalEEUncertainty.phiUncertainty->SetParameter(0,0.087);
412 hcalHBUncertainty.etUncertainty =
new TF1(
"hcalHBEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
413 hcalHBUncertainty.etUncertainty->SetParameter(0,0.);
414 hcalHBUncertainty.etUncertainty->SetParameter(1,1.22);
415 hcalHBUncertainty.etUncertainty->SetParameter(2,0.05);
417 hcalHBUncertainty.phiUncertainty =
new TF1(
"ecalHBphiFunc",
"[0]*x",1);
418 hcalHBUncertainty.phiUncertainty->SetParameter(0,0.087);
421 hcalHEUncertainty.etUncertainty =
new TF1(
"hcalHEEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
422 hcalHEUncertainty.etUncertainty->SetParameter(0,0.);
423 hcalHEUncertainty.etUncertainty->SetParameter(1,1.3);
424 hcalHEUncertainty.etUncertainty->SetParameter(2,0.05);
426 hcalHEUncertainty.phiUncertainty =
new TF1(
"ecalHEphiFunc",
"[0]*x",1);
427 hcalHEUncertainty.phiUncertainty->SetParameter(0,0.087);
430 hcalHOUncertainty.etUncertainty =
new TF1(
"hcalHOEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
431 hcalHOUncertainty.etUncertainty->SetParameter(0,0.);
432 hcalHOUncertainty.etUncertainty->SetParameter(1,1.82);
433 hcalHOUncertainty.etUncertainty->SetParameter(2,0.09);
435 hcalHOUncertainty.phiUncertainty =
new TF1(
"ecalHOphiFunc",
"[0]*x",1);
436 hcalHOUncertainty.phiUncertainty->SetParameter(0,0.087);
439 hcalHFUncertainty.etUncertainty =
new TF1(
"hcalHFEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
440 hcalHFUncertainty.etUncertainty->SetParameter(0,0.);
441 hcalHFUncertainty.etUncertainty->SetParameter(1,1.82);
442 hcalHFUncertainty.etUncertainty->SetParameter(2,0.09);
444 hcalHFUncertainty.phiUncertainty =
new TF1(
"ecalHFphiFunc",
"[0]*x",1);
445 hcalHFUncertainty.phiUncertainty->SetParameter(0,0.174);
448 jetUncertainty.etUncertainty =
new TF1(
"jetEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
450 jetUncertainty.etUncertainty->SetParameter(0, jetEtUncertaintyParameter0_);
451 jetUncertainty.etUncertainty->SetParameter(1, jetEtUncertaintyParameter1_);
452 jetUncertainty.etUncertainty->SetParameter(2, jetEtUncertaintyParameter2_);
461 jetUncertainty.phiUncertainty =
new TF1(
"jetPhiFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3);
462 jetUncertainty.phiUncertainty->SetParameter(0, jetPhiUncertaintyParameter0_);
463 jetUncertainty.phiUncertainty->SetParameter(1, jetPhiUncertaintyParameter1_);
464 jetUncertainty.phiUncertainty->SetParameter(2, jetPhiUncertaintyParameter2_);
481 eleUncertainty.etUncertainty =
new TF1(
"eleEtFunc",
"[0] * x",1);
483 eleUncertainty.etUncertainty->SetParameter(0, eleEtUncertaintyParameter0_);
486 eleUncertainty.phiUncertainty =
new TF1(
"elePhiFunc",
"[0] * x",1);
488 eleUncertainty.phiUncertainty->SetParameter(0, elePhiUncertaintyParameter0_);
493 muonUncertainty.etUncertainty =
new TF1(
"muonEtFunc",
"[0] * x",1);
495 muonUncertainty.etUncertainty->SetParameter(0, muonEtUncertaintyParameter0_);
496 muonUncertainty.phiUncertainty =
new TF1(
"muonPhiFunc",
"[0] * x",1);
498 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
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_
double muonPhiUncertaintyParameter0_
#define DEFINE_FWK_MODULE(type)
const double significance(double &met_r, double &met_phi, double &met_set)
void setNumberOfJets(const double &numberOfJets)
Sin< T >::type sin(const T &t)
double jetEtUncertaintyParameter1_
double elePhiUncertaintyParameter0_
double jetEtUncertaintyParameter2_
double jetPhiUncertaintyParameter2_
double getMuons(edm::Event &, const edm::EventSetup &)
virtual void produce(edm::Event &, const edm::EventSetup &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
double muonEtUncertaintyParameter0_
PATMHTProducer(const edm::ParameterSet &)
Cos< T >::type cos(const T &t)
void setUncertaintyParameters()
std::vector< pat::MHT > MHTCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double getElectrons(edm::Event &, const edm::EventSetup &)
double uncertaintyScaleFactor_
edm::InputTag CaloTowerTag_
double jetPhiUncertaintyParameter1_
double jetPhiUncertaintyParameter0_
const_iterator begin() const
const_iterator end() const
double jetEtUncertaintyParameter0_
virtual void beginRun(const edm::EventSetup &)
void setNumberOfElectrons(const double &numberOfElectrons)
math::XYZTLorentzVector LorentzVector
Lorentz vector.