4 #include "FWCore/Framework/interface/Event.h" 6 #include "FWCore/ParameterSet/interface/ParameterSet.h" 64 std::vector< std::shared_ptr<GenParticle> >\
115 std::shared_ptr<GenJet> cand =
nullptr;
116 std::shared_ptr<GenJet> nearcand =
nullptr;
118 float minDeltaR = 100.;
119 for (
size_t i = 0; i <
genjets_.size() ; ++i )
122 if(this->
deltaR(*cand) < minDeltaR)
124 minDeltaR = this->
deltaR(*cand);
150 float sf = this->
jerSF();
168 c += n*sqrt(std::max(sf*sf-1.,0.));
169 cup += n*sqrt(std::max(sfup*sfup-1.,0.));
170 cdown += n*sqrt(std::max(sfdown*sfdown-1.,0.));
183 std::transform(v.begin(), v.end(), v.begin(), ::tolower);
215 this ->
jerInfo(jerinfo,drmin);
244 p4_.SetPtEtaPhiE(pt,eta,phi,e);
256 if ( wp ==
"none" )
id =
true;
289 double Jet::btagSFsys(std::shared_ptr<BTagCalibrationReader> reader,
const std::string & systype,
const std::string & flavalgo)
const 293 if ( reader ==
nullptr )
return sf;
307 double Jet::btagSF(std::shared_ptr<BTagCalibrationReader> reader,
const std::string & flavalgo)
const 309 return this ->
btagSFsys(reader,
"central",flavalgo);
311 double Jet::btagSFup(std::shared_ptr<BTagCalibrationReader> reader,
const float & nsig,
const std::string & flavalgo)
const 313 double sf =
this ->
btagSFsys(reader,
"central",flavalgo);
314 double sfup =
this ->
btagSFsys(reader,
"up",flavalgo);
315 double sig1 = fabs(sfup - sf);
316 sfup = sf+(nsig*sig1);
320 double Jet::btagSFdown(std::shared_ptr<BTagCalibrationReader> reader,
const float & nsig,
const std::string & flavalgo)
const 322 double sf =
this ->
btagSFsys(reader,
"central",flavalgo);
323 double sfdown =
this ->
btagSFsys(reader,
"down",flavalgo);
324 double sig1 = fabs(sfdown - sf);
325 sfdown = sf-(nsig*sig1);
333 std::string wplow = wp;
334 std::transform(wplow.begin(), wplow.end(), wplow.begin(), ::tolower);
337 std::cout <<
"analysis:tools::Jet *W* Pileup Jet ID FullId is negative; the collection may not have this information." << std::endl;
338 std::cout <<
" All jets are accepted." << std::endl;
341 if ( wplow ==
"none" )
return true;
342 if ( wplow ==
"loose" && (
puJetIdFullId_ & (1 << 2)) )
return true;
343 if ( wplow ==
"medium" && (
puJetIdFullId_ & (1 << 1)) )
return true;
344 if ( wplow ==
"tight" && (
puJetIdFullId_ & (1 << 0)) )
return true;
398 if ( abs(flav) == flavour ) ++flavCounter;
416 if ( j ==
nullptr )
return;
417 if (
fsr_ !=
nullptr )
419 std::cout <<
"FSR jet will not be added because FSR already exists" << std::endl;
439 if ( m ==
nullptr )
return;
440 if (
muon_ !=
nullptr )
442 std::cout <<
"A muon is already associated to this jet" << std::endl;
448 void Jet::addMuon(std::vector< std::shared_ptr<Muon> > muons,
const float & dr)
450 if ( muons.size() == 0 )
return;
452 for (
auto m : muons )
472 void Jet::genJets(
const std::vector< std::shared_ptr<GenJet> > & genjets)
477 void Jet::associatePartons(
const std::vector< std::shared_ptr<GenParticle> > & particles,
const float & dRmax,
const float & ptMin,
const bool & pythia8 )
485 for (
auto & particle : particles )
487 int pdg = particle->pdgId();
488 int status = particle->status();
489 float pt = particle->pt();
490 if ( pt < ptMin )
continue;
493 if ( status != 71 && status != 72 )
continue;
497 if ( status != 3 )
continue;
499 if ( abs(pdg) > 5 && pdg != 21 )
continue;
500 if ( this->
p4().DeltaR(particle->p4()) > dRmax )
continue;
504 if ( abs(pdg) == flavour ) ++flavCounter;
519 const float & nEmFrac ,
520 const float & nMult ,
521 const float & cHadFrac,
522 const float & cEmFrac ,
523 const float & cMult ,
524 const float & muFrac ,
525 const float & puppi )
542 numConst = round(nM + cM);
555 if ( fabs(
p4_.Eta()) <= 2.7 )
558 idtight_ = ((nHadFrac<0.90 && nEmFrac<0.90 && numConst>1) && ((abs(
p4_.Eta())<=2.4 && cHadFrac>0 && cM>0 ) || fabs(
p4_.Eta())>2.4) && fabs(
p4_.Eta())<=2.7);
560 else if ( fabs(
p4_.Eta()) > 2.7 && fabs(
p4_.Eta()) <= 3. )
569 idtight_ = (nEmFrac>0.02 && nEmFrac<0.99 && nM>2);
577 idtight_ = (nHadFrac>0.02 && nEmFrac<0.90 && nM>10);
581 idtight_ = (nHadFrac>0.02 && nEmFrac<0.90 && nM>10);
def status(submission_dir, failed_only=False)
float getResolution(const JetParameters ¶meters) const
float getScaleFactor(const JetParameters ¶meters, Variation variation=Variation::NOMINAL, std::string uncertaintySource="") const