50 produces<pat::MHTCollection>();
62 while(physobjvector_.size()>0){
63 physobjvector_.erase(physobjvector_.begin(),physobjvector_.end());
67 s_clusteredTowers.clear();
69 double number_of_jets = getJets(iEvent, iSetup);
71 double number_of_electrons = getElectrons(iEvent, iSetup);
73 double number_of_muons = getMuons(iEvent, iSetup);
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;
90 if(physobjvector_.size() >= 1) {
96 double significance = signifAlgo.
significance(met_et,met_phi,met_set);
98 met_x=met_et*
cos(met_phi);
99 met_y=met_et*
sin(met_phi);
101 if (verbose_ == 1.) {
102 std::cout <<
">>>----> MHT Sgificance = " << significance << std::endl;
113 themetsigcoll->push_back(themetsigobj);
118 iEvent.
put( themetsigcoll);
131 double number_of_jets_ = 0.0;
140 if( (jet_iter->pt() < jetPtMin_) ||
142 (jet_iter->emEnergyFraction() > jetEMfracMax_ ) )
145 double jet_et = jet_iter->et();
146 double jet_phi = jet_iter->phi();
148 if (verbose_ == 3.) {
149 std::cout <<
"jet pt : " << jet_iter->pt() <<
" eta : " << jet_iter->eta()
150 <<
" EMF: " << jet_iter->emEnergyFraction() << std::endl;
153 double sigma_et, sigma_phi ;
155 if (controlledUncertainty_) {
156 sigma_et = jetUncertainty.etUncertainty->Eval(jet_et);
157 sigma_phi = jetUncertainty.phiUncertainty->Eval(jet_et);
164 if (verbose_ == 3.) {
165 std::cout <<
"jet sigma_et : " << sigma_et <<
", jet sigma_phi : " << sigma_phi << std::endl;
168 if(sigma_et<=0 || sigma_phi<=0)
170 " uncertainties for " << objectname <<
171 " are (et, phi): " << sigma_et <<
"," << sigma_phi <<
" (et,phi): " << jet_et <<
"," << jet_phi;
175 if (uncertaintyScaleFactor_ != 1.0){
176 sigma_et = sigma_et * uncertaintyScaleFactor_;
177 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
183 if (verbose_ == 101.) {
185 std::cout <<
"v101> " << number_of_jets_ <<
" "
186 << jet_et <<
" " << sigma_et <<
" "
187 << jet_phi <<
" " << sigma_phi << std::endl;
192 physobjvector_.push_back(tmp_jet);
196 std::vector<CaloTowerPtr> v_towers = jet_iter->getCaloConstituents();
199 for (
unsigned int ii=0;
ii < v_towers.size();
ii++) {
200 s_clusteredTowers.insert( (*v_towers.at(
ii)).
id() );
206 if (verbose_ == 101.) {
207 std::cout <<
"v101> --------------------------------------------" << std::endl;
210 return number_of_jets_;
223 double number_of_electrons_ = 0.0;
238 if (electron_iter->et() < elePtMin_ ||
239 TMath::Abs(electron_iter->eta()) > eleEtaMax_ )
continue;
241 if (verbose_ == 3.) {
242 std::cout <<
"electron pt = " << electron_iter->pt() <<
" eta : " << electron_iter->eta()
246 double electron_et = electron_iter->et();
247 double electron_phi = electron_iter->phi();
249 double sigma_et, sigma_phi ;
251 if (controlledUncertainty_) {
252 sigma_et = eleUncertainty.etUncertainty->Eval(electron_et);
253 sigma_phi = eleUncertainty.phiUncertainty->Eval(electron_et);
260 if (verbose_ == 3.) {
261 std::cout <<
"electron sigma_et : " << sigma_et <<
", electron sigma_phi : " << sigma_phi
264 if(sigma_et< 0 || sigma_phi< 0)
265 edm::LogWarning(
"PATMHTProducer") <<
" uncertainties for " << objectname
266 <<
" are (et, phi): " << sigma_et
267 <<
"," << sigma_phi <<
" (et,phi): "
268 << electron_et <<
"," << electron_phi;
270 if (uncertaintyScaleFactor_ != 1.0){
271 sigma_et = sigma_et * uncertaintyScaleFactor_;
272 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
276 physobjvector_.push_back(tmp_electron);
277 number_of_electrons_ ++;
303 return number_of_electrons_;
320 std::cout <<
">>> PATMHTSelector not valid muon Handle!" << std::endl;
325 double number_of_muons_ = 0.0;
329 if (muon_iter->pt() < muonPtMin_ ||
TMath::Abs(muon_iter->eta()) > muonEtaMax_ )
continue;
331 if (verbose_ == 3.) {
332 std::cout <<
"muon pt = " << muon_iter->pt() <<
" eta : " << muon_iter->eta() << std::endl;
335 double muon_pt = muon_iter->pt();
336 double muon_phi = muon_iter->phi();
338 double sigma_et, sigma_phi ;
340 if (controlledUncertainty_) {
341 sigma_et = muonUncertainty.etUncertainty->Eval(muon_pt);
342 sigma_phi = muonUncertainty.phiUncertainty->Eval(muon_pt);
349 if (verbose_ == 3.) {
350 std::cout <<
"muon sigma_et : " << sigma_et
351 <<
", muon sigma_phi : " << sigma_phi
354 if(sigma_et< 0 || sigma_phi< 0)
356 " uncertainties for " << objectname <<
" are (et, phi): " << sigma_et <<
"," <<
357 sigma_phi <<
" (pt,phi): " << muon_pt <<
"," << muon_phi;
359 if (uncertaintyScaleFactor_ != 1.0){
360 sigma_et = sigma_et * uncertaintyScaleFactor_;
361 sigma_phi = sigma_phi * uncertaintyScaleFactor_;
365 physobjvector_.push_back(tmp_muon);
370 return number_of_muons_;
383 ecalEBUncertainty.etUncertainty.reset(
new TF1(
"ecalEBEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3) );
384 ecalEBUncertainty.etUncertainty->SetParameter(0,0.2);
385 ecalEBUncertainty.etUncertainty->SetParameter(1,0.03);
386 ecalEBUncertainty.etUncertainty->SetParameter(2,0.005);
388 ecalEBUncertainty.phiUncertainty.reset(
new TF1(
"ecalEBphiFunc",
"[0]*x",1) );
389 ecalEBUncertainty.phiUncertainty->SetParameter(0,0.0174);
392 ecalEEUncertainty.etUncertainty.reset(
new TF1(
"ecalEEEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3) );
393 ecalEEUncertainty.etUncertainty->SetParameter(0,0.2);
394 ecalEEUncertainty.etUncertainty->SetParameter(1,0.03);
395 ecalEEUncertainty.etUncertainty->SetParameter(2,0.005);
397 ecalEEUncertainty.phiUncertainty.reset(
new TF1(
"ecalEEphiFunc",
"[0]*x",1) );
398 ecalEEUncertainty.phiUncertainty->SetParameter(0,0.087);
403 hcalHBUncertainty.etUncertainty.reset(
new TF1(
"hcalHBEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3) );
404 hcalHBUncertainty.etUncertainty->SetParameter(0,0.);
405 hcalHBUncertainty.etUncertainty->SetParameter(1,1.22);
406 hcalHBUncertainty.etUncertainty->SetParameter(2,0.05);
408 hcalHBUncertainty.phiUncertainty.reset(
new TF1(
"ecalHBphiFunc",
"[0]*x",1) );
409 hcalHBUncertainty.phiUncertainty->SetParameter(0,0.087);
412 hcalHEUncertainty.etUncertainty.reset(
new TF1(
"hcalHEEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3) );
413 hcalHEUncertainty.etUncertainty->SetParameter(0,0.);
414 hcalHEUncertainty.etUncertainty->SetParameter(1,1.3);
415 hcalHEUncertainty.etUncertainty->SetParameter(2,0.05);
417 hcalHEUncertainty.phiUncertainty.reset(
new TF1(
"ecalHEphiFunc",
"[0]*x",1) );
418 hcalHEUncertainty.phiUncertainty->SetParameter(0,0.087);
421 hcalHOUncertainty.etUncertainty.reset(
new TF1(
"hcalHOEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3) );
422 hcalHOUncertainty.etUncertainty->SetParameter(0,0.);
423 hcalHOUncertainty.etUncertainty->SetParameter(1,1.82);
424 hcalHOUncertainty.etUncertainty->SetParameter(2,0.09);
426 hcalHOUncertainty.phiUncertainty.reset(
new TF1(
"ecalHOphiFunc",
"[0]*x",1) );
427 hcalHOUncertainty.phiUncertainty->SetParameter(0,0.087);
430 hcalHFUncertainty.etUncertainty.reset(
new TF1(
"hcalHFEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3) );
431 hcalHFUncertainty.etUncertainty->SetParameter(0,0.);
432 hcalHFUncertainty.etUncertainty->SetParameter(1,1.82);
433 hcalHFUncertainty.etUncertainty->SetParameter(2,0.09);
435 hcalHFUncertainty.phiUncertainty.reset(
new TF1(
"ecalHFphiFunc",
"[0]*x",1) );
436 hcalHFUncertainty.phiUncertainty->SetParameter(0,0.174);
439 jetUncertainty.etUncertainty.reset(
new TF1(
"jetEtFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3) );
441 jetUncertainty.etUncertainty->SetParameter(0, jetEtUncertaintyParameter0_);
442 jetUncertainty.etUncertainty->SetParameter(1, jetEtUncertaintyParameter1_);
443 jetUncertainty.etUncertainty->SetParameter(2, jetEtUncertaintyParameter2_);
452 jetUncertainty.phiUncertainty.reset(
new TF1(
"jetPhiFunc",
"x*sqrt(([0]*[0]/(x*x))+([1]*[1]/x)+([2]*[2]))",3) );
453 jetUncertainty.phiUncertainty->SetParameter(0, jetPhiUncertaintyParameter0_);
454 jetUncertainty.phiUncertainty->SetParameter(1, jetPhiUncertaintyParameter1_);
455 jetUncertainty.phiUncertainty->SetParameter(2, jetPhiUncertaintyParameter2_);
472 eleUncertainty.etUncertainty.reset(
new TF1(
"eleEtFunc",
"[0] * x",1) );
474 eleUncertainty.etUncertainty->SetParameter(0, eleEtUncertaintyParameter0_);
477 eleUncertainty.phiUncertainty.reset(
new TF1(
"elePhiFunc",
"[0] * x",1) );
479 eleUncertainty.phiUncertainty->SetParameter(0, elePhiUncertaintyParameter0_);
484 muonUncertainty.etUncertainty.reset(
new TF1(
"muonEtFunc",
"[0] * x",1) );
486 muonUncertainty.etUncertainty->SetParameter(0, muonEtUncertaintyParameter0_);
487 muonUncertainty.phiUncertainty.reset(
new TF1(
"muonPhiFunc",
"[0] * x",1) );
489 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_
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 &)
const_iterator begin() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< edm::View< pat::Tau > > tauToken_
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_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< edm::View< pat::Jet > > jetToken_
const_iterator end() const
double jetEtUncertaintyParameter0_
void setNumberOfElectrons(const double &numberOfElectrons)
math::XYZTLorentzVector LorentzVector
Lorentz vector.