CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
PileupJetIdAlgo Class Reference

#include <PileupJetIdAlgo.h>

Public Types

typedef std::map< std::string,
std::pair< float *, float > > 
variables_list_t
 
typedef std::map< std::string,
std::pair< float *, float > > 
variables_list_t
 
enum  version_t { USER =-1, PHILv0 =0, USER =-1, PHILv0 =0 }
 
enum  version_t { USER =-1, PHILv0 =0, USER =-1, PHILv0 =0 }
 

Public Member Functions

int computeCutIDflag (float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta)
 
int computeCutIDflag (float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta)
 
int computeIDflag (float mva, float jetPt, float jetEta)
 
int computeIDflag (float mva, float jetPt, float jetEta)
 
int computeIDflag (float mva, int ptId, int etaId)
 
int computeIDflag (float mva, int ptId, int etaId)
 
PileupJetIdentifier computeIdVariables (const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, bool calculateMva=false)
 
PileupJetIdentifier computeIdVariables (const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, bool calculateMva=false)
 
PileupJetIdentifier computeMva ()
 
PileupJetIdentifier computeMva ()
 
std::string dumpVariables () const
 
std::string dumpVariables () const
 
std::pair< int, int > getJetIdKey (float jetPt, float jetEta)
 
std::pair< int, int > getJetIdKey (float jetPt, float jetEta)
 
const variables_list_tgetVariables () const
 const PileupJetIdentifier::variables_list_t & getVariables() const { return variables_; }; More...
 
const variables_list_tgetVariables () const
 const PileupJetIdentifier::variables_list_t & getVariables() const { return variables_; }; More...
 
const std::string method () const
 
const std::string method () const
 
 PileupJetIdAlgo (int version=PHILv0, const std::string &tmvaWeight="", const std::string &tmvaMethod="", Float_t impactParTkThreshod_=1., const std::vector< std::string > &tmvaVariables=std::vector< std::string >())
 
 PileupJetIdAlgo (int version=PHILv0, const std::string &tmvaWeight="", const std::string &tmvaMethod="", Float_t impactParTkThreshod_=1., const std::vector< std::string > &tmvaVariables=std::vector< std::string >())
 
 PileupJetIdAlgo (const edm::ParameterSet &ps)
 
 PileupJetIdAlgo (const edm::ParameterSet &ps)
 
void set (const PileupJetIdentifier &)
 
void set (const PileupJetIdentifier &)
 
 ~PileupJetIdAlgo ()
 
 ~PileupJetIdAlgo ()
 

Protected Member Functions

void bookReader ()
 
void bookReader ()
 
void initVariables ()
 
void initVariables ()
 
void resetVariables ()
 
void resetVariables ()
 
void runMva ()
 
void runMva ()
 
void setup ()
 
void setup ()
 

Protected Attributes

Float_t betaStarCut_ [3][4][4]
 
bool cutBased_
 
Float_t impactParTkThreshod_
 
PileupJetIdentifier internalId_
 
Float_t mvacut_ [3][4][4]
 
TMVA::Reader * reader_
 
Float_t rmsCut_ [3][4][4]
 
std::string tmvaMethod_
 
std::map< std::string,
std::string > 
tmvaNames_
 
std::vector< std::string > tmvaSpectators_
 
std::vector< std::string > tmvaVariables_
 
std::string tmvaWeights_
 
variables_list_t variables_
 
Int_t version_
 

Detailed Description

Definition at line 25 of file PileupJetIdAlgo.h.

Member Typedef Documentation

typedef std::map<std::string,std::pair<float *,float> > PileupJetIdAlgo::variables_list_t

Definition at line 44 of file PileupJetIdAlgo.h.

typedef std::map<std::string,std::pair<float *,float> > PileupJetIdAlgo::variables_list_t

Definition at line 44 of file PileupJetIdAlgo.h.

Member Enumeration Documentation

Enumerator
USER 
PHILv0 
USER 
PHILv0 

Definition at line 27 of file PileupJetIdAlgo.h.

Enumerator
USER 
PHILv0 
USER 
PHILv0 

Definition at line 27 of file PileupJetIdAlgo.h.

Constructor & Destructor Documentation

PileupJetIdAlgo::PileupJetIdAlgo ( int  version = PHILv0,
const std::string &  tmvaWeight = "",
const std::string &  tmvaMethod = "",
Float_t  impactParTkThreshod_ = 1.,
const std::vector< std::string > &  tmvaVariables = std::vector<std::string>() 
)

Definition at line 72 of file PileupJetIdAlgo.cc.

References impactParTkThreshod_, reader_, setup(), tmvaMethod_, tmvaVariables_, tmvaWeights_, BeamSplash_cfg::version, and version_.

78 {
79  impactParTkThreshod_ = impactParTkThreshod;
80  tmvaWeights_ = tmvaWeights;
81  tmvaMethod_ = tmvaMethod;
82  tmvaVariables_ = tmvaVariables;
83  version_ = version;
84 
85  reader_ = 0;
86 
87  setup();
88 }
Float_t impactParTkThreshod_
std::string tmvaMethod_
std::vector< std::string > tmvaVariables_
TMVA::Reader * reader_
std::string tmvaWeights_
PileupJetIdAlgo::PileupJetIdAlgo ( const edm::ParameterSet ps)

ps.getParameter<double>("impactParTkThreshod");

Definition at line 17 of file PileupJetIdAlgo.cc.

References betaStarCut_, cutBased_, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), impactParTkThreshod_, PileupJetIdentifier::kLoose, PileupJetIdentifier::kMedium, mvacut_, reader_, rmsCut_, setup(), AlCaHLTBitMon_QueryRunRegistry::string, tmvaMethod_, tmvaSpectators_, tmvaVariables_, tmvaWeights_, and version_.

18 {
20  cutBased_ = false;
21  //std::string label = ps.getParameter<std::string>("label");
22  cutBased_ = ps.getParameter<bool>("cutBased");
23  if(!cutBased_)
24  {
26  tmvaMethod_ = ps.getParameter<std::string>("tmvaMethod");
27  tmvaVariables_ = ps.getParameter<std::vector<std::string> >("tmvaVariables");
28  tmvaSpectators_ = ps.getParameter<std::vector<std::string> >("tmvaSpectators");
29  version_ = ps.getParameter<int>("version");
30  }
31  reader_ = 0;
32  edm::ParameterSet jetConfig = ps.getParameter<edm::ParameterSet>("JetIdParams");
33  for(int i0 = 0; i0 < 3; i0++) {
34  std::string lCutType = "Tight";
35  if(i0 == PileupJetIdentifier::kMedium) lCutType = "Medium";
36  if(i0 == PileupJetIdentifier::kLoose) lCutType = "Loose";
37  int nCut = 1;
38  if(cutBased_) nCut++;
39  for(int i1 = 0; i1 < nCut; i1++) {
40  std::string lFullCutType = lCutType;
41  if(cutBased_ && i1 == 0) lFullCutType = "BetaStar"+ lCutType;
42  if(cutBased_ && i1 == 1) lFullCutType = "RMS" + lCutType;
43  std::vector<double> pt010 = jetConfig.getParameter<std::vector<double> >(("Pt010_" +lFullCutType).c_str());
44  std::vector<double> pt1020 = jetConfig.getParameter<std::vector<double> >(("Pt1020_"+lFullCutType).c_str());
45  std::vector<double> pt2030 = jetConfig.getParameter<std::vector<double> >(("Pt2030_"+lFullCutType).c_str());
46  std::vector<double> pt3050 = jetConfig.getParameter<std::vector<double> >(("Pt3050_"+lFullCutType).c_str());
47  if(!cutBased_) {
48  for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][0][i2] = pt010 [i2];
49  for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][1][i2] = pt1020[i2];
50  for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][2][i2] = pt2030[i2];
51  for(int i2 = 0; i2 < 4; i2++) mvacut_[i0][3][i2] = pt3050[i2];
52  }
53  if(cutBased_ && i1 == 0) {
54  for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][0][i2] = pt010 [i2];
55  for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][1][i2] = pt1020[i2];
56  for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][2][i2] = pt2030[i2];
57  for(int i2 = 0; i2 < 4; i2++) betaStarCut_[i0][3][i2] = pt3050[i2];
58  }
59  if(cutBased_ && i1 == 1) {
60  for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][0][i2] = pt010 [i2];
61  for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][1][i2] = pt1020[i2];
62  for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][2][i2] = pt2030[i2];
63  for(int i2 = 0; i2 < 4; i2++) rmsCut_[i0][3][i2] = pt3050[i2];
64  }
65  }
66  }
67  setup();
68 }
T getParameter(std::string const &) const
Float_t impactParTkThreshod_
std::string tmvaMethod_
std::vector< std::string > tmvaVariables_
TMVA::Reader * reader_
Float_t mvacut_[3][4][4]
std::vector< std::string > tmvaSpectators_
Float_t rmsCut_[3][4][4]
Float_t betaStarCut_[3][4][4]
std::string tmvaWeights_
std::string fullPath() const
Definition: FileInPath.cc:165
PileupJetIdAlgo::~PileupJetIdAlgo ( )

Definition at line 165 of file PileupJetIdAlgo.cc.

References reader_.

166 {
167  if( reader_ ) {
168  delete reader_;
169  }
170 }
TMVA::Reader * reader_
PileupJetIdAlgo::PileupJetIdAlgo ( int  version = PHILv0,
const std::string &  tmvaWeight = "",
const std::string &  tmvaMethod = "",
Float_t  impactParTkThreshod_ = 1.,
const std::vector< std::string > &  tmvaVariables = std::vector< std::string >() 
)
PileupJetIdAlgo::PileupJetIdAlgo ( const edm::ParameterSet ps)
PileupJetIdAlgo::~PileupJetIdAlgo ( )

Member Function Documentation

void PileupJetIdAlgo::bookReader ( )
protected

Definition at line 190 of file PileupJetIdAlgo.cc.

References relativeConstraints::empty, first, reader_, tmvaMethod_, tmvaNames_, tmvaSpectators_, tmvaVariables_, tmvaWeights_, and variables_.

Referenced by runMva().

191 {
192  reader_ = new TMVA::Reader("!Color:!Silent");
193  assert( ! tmvaMethod_.empty() && ! tmvaWeights_.empty() );
194  for(std::vector<std::string>::iterator it=tmvaVariables_.begin(); it!=tmvaVariables_.end(); ++it) {
195  if( tmvaNames_[*it].empty() ) {
196  tmvaNames_[*it] = *it;
197  }
198  reader_->AddVariable( *it, variables_[ tmvaNames_[*it] ].first );
199  }
200  for(std::vector<std::string>::iterator it=tmvaSpectators_.begin(); it!=tmvaSpectators_.end(); ++it) {
201  if( tmvaNames_[*it].empty() ) {
202  tmvaNames_[*it] = *it;
203  }
204  reader_->AddSpectator( *it, variables_[ tmvaNames_[*it] ].first );
205  }
206  reader_->BookMVA(tmvaMethod_.c_str(), tmvaWeights_.c_str());
207 }
std::string tmvaMethod_
std::vector< std::string > tmvaVariables_
std::map< std::string, std::string > tmvaNames_
TMVA::Reader * reader_
bool first
Definition: L1TdeRCT.cc:75
std::vector< std::string > tmvaSpectators_
std::string tmvaWeights_
variables_list_t variables_
void PileupJetIdAlgo::bookReader ( )
protected
int PileupJetIdAlgo::computeCutIDflag ( float  betaStarClassic,
float  dR2Mean,
float  nvtx,
float  jetPt,
float  jetEta 
)
int PileupJetIdAlgo::computeCutIDflag ( float  betaStarClassic,
float  dR2Mean,
float  nvtx,
float  jetPt,
float  jetEta 
)

Definition at line 244 of file PileupJetIdAlgo.cc.

References betaStarCut_, getJetIdKey(), PileupJetIdentifier::kLoose, PileupJetIdentifier::kMedium, PileupJetIdentifier::kTight, log, and rmsCut_.

Referenced by runMva().

245 {
246  std::pair<int,int> jetIdKey = getJetIdKey(jetPt,jetEta);
247  float betaStarModified = betaStarClassic/log(nvtx-0.64);
248  int idFlag(0);
249  if(betaStarModified < betaStarCut_[PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second] &&
250  dR2Mean < rmsCut_ [PileupJetIdentifier::kTight ][jetIdKey.first][jetIdKey.second]
251  ) idFlag += 1 << PileupJetIdentifier::kTight;
252 
253  if(betaStarModified < betaStarCut_[PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second] &&
254  dR2Mean < rmsCut_ [PileupJetIdentifier::kMedium ][jetIdKey.first][jetIdKey.second]
255  ) idFlag += 1 << PileupJetIdentifier::kMedium;
256 
257  if(betaStarModified < betaStarCut_[PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second] &&
258  dR2Mean < rmsCut_ [PileupJetIdentifier::kLoose ][jetIdKey.first][jetIdKey.second]
259  ) idFlag += 1 << PileupJetIdentifier::kLoose;
260  return idFlag;
261 }
static std::vector< std::string > checklist log
std::pair< int, int > getJetIdKey(float jetPt, float jetEta)
Float_t rmsCut_[3][4][4]
Float_t betaStarCut_[3][4][4]
int PileupJetIdAlgo::computeIDflag ( float  mva,
float  jetPt,
float  jetEta 
)

Definition at line 263 of file PileupJetIdAlgo.cc.

References getJetIdKey().

Referenced by runMva().

264 {
265  std::pair<int,int> jetIdKey = getJetIdKey(jetPt,jetEta);
266  return computeIDflag(mva,jetIdKey.first,jetIdKey.second);
267 }
std::pair< int, int > getJetIdKey(float jetPt, float jetEta)
int computeIDflag(float mva, float jetPt, float jetEta)
int PileupJetIdAlgo::computeIDflag ( float  mva,
float  jetPt,
float  jetEta 
)
int PileupJetIdAlgo::computeIDflag ( float  mva,
int  ptId,
int  etaId 
)

Definition at line 270 of file PileupJetIdAlgo.cc.

References PileupJetIdentifier::kLoose, PileupJetIdentifier::kMedium, PileupJetIdentifier::kTight, and mvacut_.

271 {
272  int idFlag(0);
273  if(mva > mvacut_[PileupJetIdentifier::kTight ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kTight;
274  if(mva > mvacut_[PileupJetIdentifier::kMedium][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kMedium;
275  if(mva > mvacut_[PileupJetIdentifier::kLoose ][ptId][etaId]) idFlag += 1 << PileupJetIdentifier::kLoose;
276  return idFlag;
277 }
Float_t mvacut_[3][4][4]
int PileupJetIdAlgo::computeIDflag ( float  mva,
int  ptId,
int  etaId 
)
PileupJetIdentifier PileupJetIdAlgo::computeIdVariables ( const reco::Jet jet,
float  jec,
const reco::Vertex ,
const reco::VertexCollection ,
bool  calculateMva = false 
)
PileupJetIdentifier PileupJetIdAlgo::computeIdVariables ( const reco::Jet jet,
float  jec,
const reco::Vertex vtx,
const reco::VertexCollection allvtx,
bool  calculateMva = false 
)

Definition at line 288 of file PileupJetIdAlgo.cc.

References assign, reco::PFJet::chargedEmEnergy(), pat::Jet::chargedEmEnergy(), reco::PFJet::chargedHadronEnergy(), pat::Jet::chargedHadronEnergy(), reco::PFJet::chargedMultiplicity(), pat::Jet::chargedMultiplicity(), PileupJetIdentifier::chFrac01_, PileupJetIdentifier::chFrac02_, PileupJetIdentifier::chFrac03_, PileupJetIdentifier::chFrac04_, PileupJetIdentifier::chFrac05_, PileupJetIdentifier::chFrac06_, PileupJetIdentifier::chFrac07_, PileupJetIdentifier::chgEMfrac_, PileupJetIdentifier::chgHadrfrac_, pat::Jet::correctedJet(), PileupJetIdentifier::d0_, reco::deltaPhi(), reco::deltaR(), PileupJetIdentifier::dRLead2nd_, PileupJetIdentifier::dRLeadCent_, PileupJetIdentifier::dRMeanCh_, PileupJetIdentifier::dRMeanEm_, PileupJetIdentifier::dRMeanNeut_, alignCSCRings::e, PileupJetIdentifier::emFrac01_, PileupJetIdentifier::emFrac02_, PileupJetIdentifier::emFrac03_, PileupJetIdentifier::emFrac04_, PileupJetIdentifier::emFrac05_, PileupJetIdentifier::emFrac06_, PileupJetIdentifier::emFrac07_, reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), PileupJetIdentifier::etaW_, spr::find(), PileupJetIdentifier::fourthChFrac_, PileupJetIdentifier::fourthEmFrac_, PileupJetIdentifier::fourthFrac_, PileupJetIdentifier::fourthNeutFrac_, cropTnPTrees::frac, reco::PFCandidate::gamma, reco::PFJet::getPFConstituents(), pat::Jet::getPFConstituents(), reco::PFCandidate::h0, internalId_, edm::Ptr< T >::isAvailable(), edm::Ref< C, T, F >::isAvailable(), reco::Vertex::isFake(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), edm::Ptr< T >::isNull(), patTestJEC_cfi::jec, metsig::jet, PileupJetIdentifier::jetM_, PileupJetIdentifier::jetPhi_, reco::btau::jetPt, PileupJetIdentifier::jetW_, PileupJetIdentifier::leadChEta_, PileupJetIdentifier::leadChFrac_, PileupJetIdentifier::leadChPhi_, PileupJetIdentifier::leadChPt_, PileupJetIdentifier::leadEmEta_, PileupJetIdentifier::leadEmFrac_, PileupJetIdentifier::leadEmPhi_, PileupJetIdentifier::leadEmPt_, PileupJetIdentifier::leadEta_, PileupJetIdentifier::leadFrac_, PileupJetIdentifier::leadNeutEta_, PileupJetIdentifier::leadNeutFrac_, PileupJetIdentifier::leadNeutPhi_, PileupJetIdentifier::leadNeutPt_, PileupJetIdentifier::leadPhi_, PileupJetIdentifier::leadPt_, PileupJetIdentifier::majW_, reco::LeafCandidate::mass(), min(), PileupJetIdentifier::minW_, reco::Vertex::ndof(), PileupJetIdentifier::neuEMfrac_, PileupJetIdentifier::neuHadrfrac_, PileupJetIdentifier::neutFrac01_, PileupJetIdentifier::neutFrac02_, PileupJetIdentifier::neutFrac03_, PileupJetIdentifier::neutFrac04_, PileupJetIdentifier::neutFrac05_, PileupJetIdentifier::neutFrac06_, PileupJetIdentifier::neutFrac07_, reco::PFJet::neutralEmEnergy(), pat::Jet::neutralEmEnergy(), reco::PFJet::neutralHadronEnergy(), pat::Jet::neutralHadronEnergy(), reco::PFJet::neutralMultiplicity(), pat::Jet::neutralMultiplicity(), PileupJetIdentifier::phiW_, reco::Vertex::position(), RecoTauCleanerPlugins::pt, reco::LeafCandidate::pt(), PileupJetIdentifier::pt2A_, PileupJetIdentifier::ptDCh_, PileupJetIdentifier::ptDNe_, PileupJetIdentifier::ptMean_, PileupJetIdentifier::ptRMS_, alignCSCRings::r, resetVariables(), runMva(), PileupJetIdentifier::secondChFrac_, PileupJetIdentifier::secondEmFrac_, PileupJetIdentifier::secondEta_, PileupJetIdentifier::secondFrac_, PileupJetIdentifier::secondNeutFrac_, PileupJetIdentifier::secondPhi_, PileupJetIdentifier::secondPt_, setPtEtaPhi(), python.multivaluedict::sort(), mathSSE::sqrt(), PileupJetIdentifier::sumChPt_, PileupJetIdentifier::sumNePt_, PileupJetIdentifier::sumPt_, std::swap(), PileupJetIdentifier::thirdChFrac_, PileupJetIdentifier::thirdEmFrac_, PileupJetIdentifier::thirdFrac_, PileupJetIdentifier::thirdNeutFrac_, reco::Vertex::tracks_begin(), and reco::Vertex::tracks_end().

Referenced by PileupJetIdProducer::produce(), and MVAJetIdMaker::SetVars().

291 {
292  //static int printWarning = 10;
293  typedef std::vector <reco::PFCandidatePtr> constituents_type;
294  typedef std::vector <reco::PFCandidatePtr>::iterator constituents_iterator;
295 
296  // initialize all variables to 0
297  resetVariables();
298 
299  // loop over constituents, accumulate sums and find leading candidates
300  const pat::Jet * patjet = dynamic_cast<const pat::Jet *>(jet);
301  const reco::PFJet * pfjet = dynamic_cast<const reco::PFJet *>(jet);
302  assert( patjet != 0 || pfjet != 0 );
303  if( patjet != 0 && jec == 0. ) { // if this is a pat jet and no jec has been passed take the jec from the object
304  jec = patjet->pt()/patjet->correctedJet(0).pt();
305  }
306  if( jec < 0. ) {
307  jec = 1.;
308  }
309  constituents_type constituents = pfjet ? pfjet->getPFConstituents() : patjet->getPFConstituents();
310 
311  reco::PFCandidatePtr lLead, lSecond, lLeadNeut, lLeadEm, lLeadCh, lTrail;
312  std::vector<float> frac, fracCh, fracEm, fracNeut;
313  float cones[] = { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7 };
314  size_t ncones = sizeof(cones)/sizeof(float);
315  float * coneFracs[] = { &internalId_.frac01_, &internalId_.frac02_, &internalId_.frac03_, &internalId_.frac04_,
316  &internalId_.frac05_, &internalId_.frac06_, &internalId_.frac07_ };
323  TMatrixDSym covMatrix(2); covMatrix = 0.;
324 
325  reco::TrackRef impactTrack;
326  float jetPt = jet->pt() / jec; // use uncorrected pt for shape variables
327  float sumPt = 0., sumPt2 = 0., sumTkPt = 0.,sumPtCh=0,sumPtNe = 0;
328  setPtEtaPhi(*jet,internalId_.jetPt_,internalId_.jetEta_,internalId_.jetPhi_); // use corrected pt for jet kinematics
329  internalId_.jetM_ = jet->mass();
330  internalId_.nvtx_ = allvtx.size();
331 
332  for(constituents_iterator it=constituents.begin(); it!=constituents.end(); ++it) {
333  reco::PFCandidatePtr & icand = *it;
334  float candPt = icand->pt();
335  float candPtFrac = candPt/jetPt;
336  float candDr = reco::deltaR(**it,*jet);
337  float candDeta = fabs( (*it)->eta() - jet->eta() );
338  float candDphi = reco::deltaPhi(**it,*jet);
339  float candPtDr = candPt * candDr;
340  size_t icone = std::lower_bound(&cones[0],&cones[ncones],candDr) - &cones[0];
341 
342  // all particles
343  if( lLead.isNull() || candPt > lLead->pt() ) {
344  lSecond = lLead;
345  lLead = icand;
346  } else if( (lSecond.isNull() || candPt > lSecond->pt()) && (candPt < lLead->pt()) ) {
347  lSecond = icand;
348  }
349 
350  // average shapes
351  internalId_.dRMean_ += candPtDr;
352  internalId_.dR2Mean_ += candPtDr*candPtDr;
353  covMatrix(0,0) += candPt*candPt*candDeta*candDeta;
354  covMatrix(0,1) += candPt*candPt*candDeta*candDphi;
355  covMatrix(1,1) += candPt*candPt*candDphi*candDphi;
356  internalId_.ptD_ += candPt*candPt;
357  sumPt += candPt;
358  sumPt2 += candPt*candPt;
359 
360  // single most energetic candiates and jet shape profiles
361  frac.push_back(candPtFrac);
362  if( icone < ncones ) { *coneFracs[icone] += candPt; }
363 
364  // neutrals
365  if( icand->particleId() == reco::PFCandidate::h0 ) {
366  if (lLeadNeut.isNull() || candPt > lLeadNeut->pt()) { lLeadNeut = icand; }
367  internalId_.dRMeanNeut_ += candPtDr;
368  fracNeut.push_back(candPtFrac);
369  if( icone < ncones ) { *coneNeutFracs[icone] += candPt; }
370  internalId_.ptDNe_ += candPt*candPt;
371  sumPtNe += candPt;
372  }
373  // EM candidated
374  if( icand->particleId() == reco::PFCandidate::gamma ) {
375  if(lLeadEm.isNull() || candPt > lLeadEm->pt()) { lLeadEm = icand; }
376  internalId_.dRMeanEm_ += candPtDr;
377  fracEm.push_back(candPtFrac);
378  if( icone < ncones ) { *coneEmFracs[icone] += candPt; }
379  internalId_.ptDNe_ += candPt*candPt;
380  sumPtNe += candPt;
381  }
382  // Charged particles
383  if( icand->trackRef().isNonnull() && icand->trackRef().isAvailable() ) {
384  if (lLeadCh.isNull() || candPt > lLeadCh->pt()) { lLeadCh = icand; }
385  internalId_.dRMeanCh_ += candPtDr;
386  internalId_.ptDCh_ += candPt*candPt;
387  fracCh.push_back(candPtFrac);
388  if( icone < ncones ) { *coneChFracs[icone] += candPt; }
389  sumPtCh += candPt;
390  }
391  // beta and betastar
392  if( icand->trackRef().isNonnull() && icand->trackRef().isAvailable() ) {
393  try {
394  float tkpt = icand->trackRef()->pt();
395  sumTkPt += tkpt;
396  // 'classic' beta definition based on track-vertex association
397  bool inVtx0 = find( vtx->tracks_begin(), vtx->tracks_end(), reco::TrackBaseRef(icand->trackRef()) ) != vtx->tracks_end();
398  bool inAnyOther = false;
399  // alternative beta definition based on track-vertex distance of closest approach
400  double dZ0 = fabs(icand->trackRef()->dz(vtx->position()));
401  double dZ = dZ0;
402  for(reco::VertexCollection::const_iterator vi=allvtx.begin(); vi!=allvtx.end(); ++vi ) {
403  const reco::Vertex & iv = *vi;
404  if( iv.isFake() || iv.ndof() < 4 ) { continue; }
405  // the primary vertex may have been copied by the user: check identity by position
406  bool isVtx0 = (iv.position() - vtx->position()).r() < 0.02;
407  // 'classic' beta definition: check if the track is associated with any vertex other than the primary one
408  if( ! isVtx0 && ! inAnyOther ) {
409  inAnyOther = find( iv.tracks_begin(), iv.tracks_end(), reco::TrackBaseRef(icand->trackRef()) ) != iv.tracks_end();
410  }
411  // alternative beta: find closest vertex to the track
412  dZ = std::min(dZ,fabs(icand->trackRef()->dz(iv.position())));
413  }
414  // classic beta/betaStar
415  if( inVtx0 && ! inAnyOther ) {
416  internalId_.betaClassic_ += tkpt;
417  } else if( ! inVtx0 && inAnyOther ) {
418  internalId_.betaStarClassic_ += tkpt;
419  }
420  // alternative beta/betaStar
421  if( dZ0 < 0.2 ) {
422  internalId_.beta_ += tkpt;
423  } else if( dZ < 0.2 ) {
424  internalId_.betaStar_ += tkpt;
425  }
426  } catch (cms::Exception &e) {
427  //if(printWarning-- > 0) { std::cerr << e << std::endl; }
428  }
429  }
430  // trailing candidate
431  if( lTrail.isNull() || candPt < lTrail->pt() ) {
432  lTrail = icand;
433  }
434  }
435 
436  // Finalize all variables
437  assert( lLead.isNonnull() );
438 
439  if ( lSecond.isNull() ) { lSecond = lTrail; }
440  if ( lLeadNeut.isNull() ) { lLeadNeut = lTrail; }
441  if ( lLeadEm.isNull() ) { lLeadEm = lTrail; }
442  if ( lLeadCh.isNull() ) { lLeadCh = lTrail; }
443  impactTrack = lLeadCh->trackRef();
444 
445  internalId_.nCharged_ = pfjet ? pfjet->chargedMultiplicity() : patjet->chargedMultiplicity();
446  internalId_.nNeutrals_ = pfjet ? pfjet->neutralMultiplicity() : patjet->neutralMultiplicity();
447 
448  internalId_.chgEMfrac_ = ( pfjet ? pfjet->chargedEmEnergy() : patjet->chargedEmEnergy() ) /jet->energy();
449  internalId_.neuEMfrac_ = ( pfjet ? pfjet->neutralEmEnergy() : patjet->neutralEmEnergy() ) /jet->energy();
450  internalId_.chgHadrfrac_ = ( pfjet ? pfjet->chargedHadronEnergy() : patjet->chargedHadronEnergy() ) /jet->energy();
451  internalId_.neuHadrfrac_ = ( pfjet ? pfjet->neutralHadronEnergy() : patjet->neutralHadronEnergy() ) /jet->energy();
452 
453  if( impactTrack.isNonnull() && impactTrack.isAvailable() ) {
454  internalId_.d0_ = fabs(impactTrack->dxy(vtx->position()));
455  internalId_.dZ_ = fabs(impactTrack->dz(vtx->position()));
456  } else {
457  //if(printWarning-- > 0) { std::cerr << "WARNING : did not find any valid track reference attached to the jet " << std::endl; }
458  }
459  internalId_.nParticles_ = constituents.size();
460 
466 
467  std::sort(frac.begin(),frac.end(),std::greater<float>());
468  std::sort(fracCh.begin(),fracCh.end(),std::greater<float>());
469  std::sort(fracEm.begin(),fracEm.end(),std::greater<float>());
470  std::sort(fracNeut.begin(),fracNeut.end(),std::greater<float>());
475 
476  covMatrix(0,0) /= sumPt2;
477  covMatrix(0,1) /= sumPt2;
478  covMatrix(1,1) /= sumPt2;
479  covMatrix(1,0) = covMatrix(0,1);
480  internalId_.etaW_ = sqrt(covMatrix(0,0));
481  internalId_.phiW_ = sqrt(covMatrix(1,1));
483  TVectorD eigVals(2); eigVals = TMatrixDSymEigen(covMatrix).GetEigenValues();
484  internalId_.majW_ = sqrt(fabs(eigVals(0)));
485  internalId_.minW_ = sqrt(fabs(eigVals(1)));
487 
488  internalId_.dRLeadCent_ = reco::deltaR(*jet,*lLead);
489  if( lSecond.isNonnull() ) { internalId_.dRLead2nd_ = reco::deltaR(*jet,*lSecond); }
490  internalId_.dRMean_ /= jetPt;
494  internalId_.dR2Mean_ /= sumPt2;
495 
496  for(size_t ic=0; ic<ncones; ++ic){
497  *coneFracs[ic] /= jetPt;
498  *coneEmFracs[ic] /= jetPt;
499  *coneNeutFracs[ic] /= jetPt;
500  *coneChFracs[ic] /= jetPt;
501  }
502  //http://jets.physics.harvard.edu/qvg/
503  double ptMean = sumPt/internalId_.nParticles_;
504  double ptRMS = 0;
505  for(unsigned int i0 = 0; i0 < frac.size(); i0++) {ptRMS+=(frac[i0]-ptMean)*(frac[i0]-ptMean);}
506  ptRMS/=internalId_.nParticles_;
507  ptRMS=sqrt(ptRMS);
508 
509  internalId_.ptMean_ = ptMean;
510  internalId_.ptRMS_ = ptRMS/jetPt;
511  internalId_.pt2A_ = sqrt( internalId_.ptD_ /internalId_.nParticles_)/jetPt;
512  internalId_.ptD_ = sqrt( internalId_.ptD_) / sumPt;
513  internalId_.ptDCh_ = sqrt( internalId_.ptDCh_) / sumPtCh;
514  internalId_.ptDNe_ = sqrt( internalId_.ptDNe_) / sumPtNe;
515  internalId_.sumPt_ = sumPt;
516  internalId_.sumChPt_ = sumPtCh;
517  internalId_.sumNePt_ = sumPtNe;
518 
519  if( sumTkPt != 0. ) {
520  internalId_.beta_ /= sumTkPt;
521  internalId_.betaStar_ /= sumTkPt;
522  internalId_.betaClassic_ /= sumTkPt;
523  internalId_.betaStarClassic_ /= sumTkPt;
524  } else {
525  assert( internalId_.beta_ == 0. && internalId_.betaStar_ == 0.&& internalId_.betaClassic_ == 0. && internalId_.betaStarClassic_ == 0. );
526  }
527 
528  if( calculateMva ) {
529  runMva();
530  }
531 
533 }
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: Jet.h:551
float chargedEmEnergy() const
chargedEmEnergy
Definition: PFJet.h:138
float neutralEmEnergy() const
neutralEmEnergy
Definition: Jet.h:572
virtual float pt() const
transverse momentum
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
Definition: Jet.cc:302
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: Jet.h:558
#define assign
Definition: vmac.h:53
int neutralMultiplicity() const
neutralMultiplicity
Definition: Jet.h:402
double deltaR(const T1 &t1, const T2 &t2)
Definition: deltaR.h:48
bool isAvailable() const
Definition: Ref.h:276
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
int chargedMultiplicity() const
chargedMultiplicity
Definition: PFJet.h:151
const Point & position() const
position
Definition: Vertex.h:106
Jets made from PFObjects.
Definition: PFJet.h:21
float neutralEmEnergy() const
neutralEmEnergy
Definition: PFJet.h:146
std::vector< reco::PFCandidatePtr > const & getPFConstituents() const
Definition: Jet.cc:172
float chargedEmEnergy() const
chargedEmEnergy
Definition: Jet.h:565
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
virtual double energy() const
energy
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:152
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
Definition: TrackFwd.h:22
PileupJetIdentifier internalId_
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
virtual float eta() const
momentum pseudorapidity
T sqrt(T t)
Definition: SSEVec.h:48
T min(T a, T b)
Definition: MathUtil.h:58
double ndof() const
Definition: Vertex.h:102
int neutralMultiplicity() const
neutralMultiplicity
Definition: PFJet.h:153
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
void setPtEtaPhi(const reco::Candidate &p, float &pt, float &eta, float &phi)
bool isFake() const
Definition: Vertex.h:64
Analysis-level calorimeter jet class.
Definition: Jet.h:73
bool isNull() const
Checks for null.
Definition: Ptr.h:148
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
Definition: PFJet.cc:52
bool isAvailable() const
Definition: Ptr.h:158
float neutralHadronEnergy() const
neutralHadronEnergy
Definition: PFJet.h:98
virtual float mass() const
mass
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39
int chargedMultiplicity() const
chargedMultiplicity
Definition: Jet.h:586
float chargedHadronEnergy() const
chargedHadronEnergy
Definition: PFJet.h:94
PileupJetIdentifier PileupJetIdAlgo::computeMva ( )
PileupJetIdentifier PileupJetIdAlgo::computeMva ( )

Definition at line 281 of file PileupJetIdAlgo.cc.

References internalId_, and runMva().

Referenced by PileupJetIdProducer::produce().

282 {
283  runMva();
285 }
PileupJetIdentifier internalId_
std::string PileupJetIdAlgo::dumpVariables ( ) const

Definition at line 538 of file PileupJetIdAlgo.cc.

References dbtoconf::out, and variables_.

539 {
540  std::stringstream out;
541  for(variables_list_t::const_iterator it=variables_.begin();
542  it!=variables_.end(); ++it ) {
543  out << std::setw(15) << it->first << std::setw(3) << "="
544  << std::setw(5) << *it->second.first
545  << " (" << std::setw(5) << it->second.second << ")" << std::endl;
546  }
547  return out.str();
548 }
tuple out
Definition: dbtoconf.py:99
variables_list_t variables_
std::string PileupJetIdAlgo::dumpVariables ( ) const
std::pair<int,int> PileupJetIdAlgo::getJetIdKey ( float  jetPt,
float  jetEta 
)
std::pair< int, int > PileupJetIdAlgo::getJetIdKey ( float  jetPt,
float  jetEta 
)

Definition at line 229 of file PileupJetIdAlgo.cc.

Referenced by computeCutIDflag(), and computeIDflag().

230 {
231  int ptId = 0;
232  if(jetPt > 10 && jetPt < 20) ptId = 1;
233  if(jetPt > 20 && jetPt < 30) ptId = 2;
234  if(jetPt > 30 ) ptId = 3;
235 
236  int etaId = 0;
237  if(fabs(jetEta) > 2.5 && fabs(jetEta) < 2.75) etaId = 1;
238  if(fabs(jetEta) > 2.75 && fabs(jetEta) < 3.0 ) etaId = 2;
239  if(fabs(jetEta) > 3.0 && fabs(jetEta) < 5.0 ) etaId = 3;
240 
241  return std::pair<int,int>(ptId,etaId);
242 }
const variables_list_t& PileupJetIdAlgo::getVariables ( ) const
inline

const PileupJetIdentifier::variables_list_t & getVariables() const { return variables_; };

Definition at line 52 of file PileupJetIdAlgo.h.

References variables_.

52 { return variables_; };
variables_list_t variables_
const variables_list_t& PileupJetIdAlgo::getVariables ( ) const
inline

const PileupJetIdentifier::variables_list_t & getVariables() const { return variables_; };

Definition at line 52 of file PileupJetIdAlgo.h.

References variables_.

52 { return variables_; };
variables_list_t variables_
void PileupJetIdAlgo::initVariables ( )
protected

Definition at line 566 of file PileupJetIdAlgo.cc.

References beta, PileupJetIdentifier::idFlag_, INIT_VARIABLE, internalId_, reco::btau::jetEta, reco::btau::jetPhi, reco::btau::jetPt, large_val, and reco::tau::helpers::nCharged().

Referenced by setup().

567 {
568  internalId_.idFlag_ = 0;
569  INIT_VARIABLE(mva , "", -100.);
570  INIT_VARIABLE(jetPt , "jspt_1", 0.);
571  INIT_VARIABLE(jetEta , "jseta_1", large_val);
572  INIT_VARIABLE(jetPhi , "jsphi_1", large_val);
573  INIT_VARIABLE(jetM , "jm_1", 0.);
574 
575  INIT_VARIABLE(nCharged , "", 0.);
576  INIT_VARIABLE(nNeutrals , "", 0.);
577 
578  INIT_VARIABLE(chgEMfrac , "", 0.);
579  INIT_VARIABLE(neuEMfrac , "", 0.);
580  INIT_VARIABLE(chgHadrfrac, "", 0.);
581  INIT_VARIABLE(neuHadrfrac, "", 0.);
582 
583  INIT_VARIABLE(d0 , "jd0_1" , -1000.);
584  INIT_VARIABLE(dZ , "jdZ_1" , -1000.);
585  INIT_VARIABLE(nParticles , "npart_1" , 0.);
586 
587  INIT_VARIABLE(leadPt , "lpt_1" , 0.);
588  INIT_VARIABLE(leadEta , "leta_1" , large_val);
589  INIT_VARIABLE(leadPhi , "lphi_1" , large_val);
590  INIT_VARIABLE(secondPt , "spt_1" , 0.);
591  INIT_VARIABLE(secondEta , "seta_1" , large_val);
592  INIT_VARIABLE(secondPhi , "sphi_1" , large_val);
593  INIT_VARIABLE(leadNeutPt , "lnept_1" , 0.);
594  INIT_VARIABLE(leadNeutEta, "lneeta_1" , large_val);
595  INIT_VARIABLE(leadNeutPhi, "lnephi_1" , large_val);
596  INIT_VARIABLE(leadEmPt , "lempt_1" , 0.);
597  INIT_VARIABLE(leadEmEta , "lemeta_1" , large_val);
598  INIT_VARIABLE(leadEmPhi , "lemphi_1" , large_val);
599  INIT_VARIABLE(leadChPt , "lchpt_1" , 0.);
600  INIT_VARIABLE(leadChEta , "lcheta_1" , large_val);
601  INIT_VARIABLE(leadChPhi , "lchphi_1" , large_val);
602  INIT_VARIABLE(leadFrac , "lLfr_1" , 0.);
603 
604  INIT_VARIABLE(dRLeadCent , "drlc_1" , 0.);
605  INIT_VARIABLE(dRLead2nd , "drls_1" , 0.);
606  INIT_VARIABLE(dRMean , "drm_1" , 0.);
607  INIT_VARIABLE(dRMeanNeut , "drmne_1" , 0.);
608  INIT_VARIABLE(dRMeanEm , "drem_1" , 0.);
609  INIT_VARIABLE(dRMeanCh , "drch_1" , 0.);
610  INIT_VARIABLE(dR2Mean , "" , 0.);
611 
612  INIT_VARIABLE(ptD , "", 0.);
613  INIT_VARIABLE(ptMean , "", 0.);
614  INIT_VARIABLE(ptRMS , "", 0.);
615  INIT_VARIABLE(pt2A , "", 0.);
616  INIT_VARIABLE(ptDCh , "", 0.);
617  INIT_VARIABLE(ptDNe , "", 0.);
618  INIT_VARIABLE(sumPt , "", 0.);
619  INIT_VARIABLE(sumChPt , "", 0.);
620  INIT_VARIABLE(sumNePt , "", 0.);
621 
622  INIT_VARIABLE(secondFrac ,"" ,0.);
623  INIT_VARIABLE(thirdFrac ,"" ,0.);
624  INIT_VARIABLE(fourthFrac ,"" ,0.);
625 
626  INIT_VARIABLE(leadChFrac ,"" ,0.);
627  INIT_VARIABLE(secondChFrac ,"" ,0.);
628  INIT_VARIABLE(thirdChFrac ,"" ,0.);
629  INIT_VARIABLE(fourthChFrac ,"" ,0.);
630 
631  INIT_VARIABLE(leadNeutFrac ,"" ,0.);
632  INIT_VARIABLE(secondNeutFrac ,"" ,0.);
633  INIT_VARIABLE(thirdNeutFrac ,"" ,0.);
634  INIT_VARIABLE(fourthNeutFrac ,"" ,0.);
635 
636  INIT_VARIABLE(leadEmFrac ,"" ,0.);
637  INIT_VARIABLE(secondEmFrac ,"" ,0.);
638  INIT_VARIABLE(thirdEmFrac ,"" ,0.);
639  INIT_VARIABLE(fourthEmFrac ,"" ,0.);
640 
641  INIT_VARIABLE(jetW ,"" ,1.);
642  INIT_VARIABLE(etaW ,"" ,1.);
643  INIT_VARIABLE(phiW ,"" ,1.);
644 
645  INIT_VARIABLE(majW ,"" ,1.);
646  INIT_VARIABLE(minW ,"" ,1.);
647 
648  INIT_VARIABLE(frac01 ,"" ,0.);
649  INIT_VARIABLE(frac02 ,"" ,0.);
650  INIT_VARIABLE(frac03 ,"" ,0.);
651  INIT_VARIABLE(frac04 ,"" ,0.);
652  INIT_VARIABLE(frac05 ,"" ,0.);
653  INIT_VARIABLE(frac06 ,"" ,0.);
654  INIT_VARIABLE(frac07 ,"" ,0.);
655 
656  INIT_VARIABLE(chFrac01 ,"" ,0.);
657  INIT_VARIABLE(chFrac02 ,"" ,0.);
658  INIT_VARIABLE(chFrac03 ,"" ,0.);
659  INIT_VARIABLE(chFrac04 ,"" ,0.);
660  INIT_VARIABLE(chFrac05 ,"" ,0.);
661  INIT_VARIABLE(chFrac06 ,"" ,0.);
662  INIT_VARIABLE(chFrac07 ,"" ,0.);
663 
664  INIT_VARIABLE(neutFrac01 ,"" ,0.);
665  INIT_VARIABLE(neutFrac02 ,"" ,0.);
666  INIT_VARIABLE(neutFrac03 ,"" ,0.);
667  INIT_VARIABLE(neutFrac04 ,"" ,0.);
668  INIT_VARIABLE(neutFrac05 ,"" ,0.);
669  INIT_VARIABLE(neutFrac06 ,"" ,0.);
670  INIT_VARIABLE(neutFrac07 ,"" ,0.);
671 
672  INIT_VARIABLE(emFrac01 ,"" ,0.);
673  INIT_VARIABLE(emFrac02 ,"" ,0.);
674  INIT_VARIABLE(emFrac03 ,"" ,0.);
675  INIT_VARIABLE(emFrac04 ,"" ,0.);
676  INIT_VARIABLE(emFrac05 ,"" ,0.);
677  INIT_VARIABLE(emFrac06 ,"" ,0.);
678  INIT_VARIABLE(emFrac07 ,"" ,0.);
679 
680  INIT_VARIABLE(beta ,"" ,0.);
681  INIT_VARIABLE(betaStar ,"" ,0.);
682  INIT_VARIABLE(betaClassic ,"" ,0.);
683  INIT_VARIABLE(betaStarClassic ,"" ,0.);
684 
685  INIT_VARIABLE(nvtx ,"" ,0.);
686 
687 }
const double beta
const float large_val
PileupJetIdentifier internalId_
#define INIT_VARIABLE(NAME, TMVANAME, VAL)
unsigned int nCharged(const GenJet &jet)
void PileupJetIdAlgo::initVariables ( )
protected
const std::string PileupJetIdAlgo::method ( ) const
inline

Definition at line 40 of file PileupJetIdAlgo.h.

References tmvaMethod_.

40 { return tmvaMethod_; }
std::string tmvaMethod_
const std::string PileupJetIdAlgo::method ( ) const
inline

Definition at line 40 of file PileupJetIdAlgo.h.

References tmvaMethod_.

40 { return tmvaMethod_; }
std::string tmvaMethod_
void PileupJetIdAlgo::resetVariables ( )
protected
void PileupJetIdAlgo::resetVariables ( )
protected

Definition at line 551 of file PileupJetIdAlgo.cc.

References PileupJetIdentifier::idFlag_, internalId_, and variables_.

Referenced by computeIdVariables().

552 {
553  internalId_.idFlag_ = 0;
554  for(variables_list_t::iterator it=variables_.begin();
555  it!=variables_.end(); ++it ) {
556  *it->second.first = it->second.second;
557  }
558 }
PileupJetIdentifier internalId_
variables_list_t variables_
void PileupJetIdAlgo::runMva ( )
protected

Definition at line 216 of file PileupJetIdAlgo.cc.

References bookReader(), computeCutIDflag(), computeIDflag(), cutBased_, PileupJetIdentifier::idFlag_, internalId_, PileupJetIdentifier::mva_, reader_, and tmvaMethod_.

Referenced by computeIdVariables(), and computeMva().

217 {
218  if( cutBased_ ) {
219  internalId_.idFlag_ = computeCutIDflag(internalId_.betaStarClassic_,internalId_.dR2Mean_,internalId_.nvtx_,internalId_.jetPt_,internalId_.jetEta_);
220  } else {
221  if( ! reader_ ) { bookReader(); /*std::cerr << "Reader booked" << std::endl;*/ }
222  if(fabs(internalId_.jetEta_) < 5.0) internalId_.mva_ = reader_->EvaluateMVA( tmvaMethod_.c_str() );
223  if(fabs(internalId_.jetEta_) >= 5.0) internalId_.mva_ = -2.;
225  }
226 }
std::string tmvaMethod_
int computeCutIDflag(float betaStarClassic, float dR2Mean, float nvtx, float jetPt, float jetEta)
TMVA::Reader * reader_
PileupJetIdentifier internalId_
int computeIDflag(float mva, float jetPt, float jetEta)
void PileupJetIdAlgo::runMva ( )
protected
void PileupJetIdAlgo::set ( const PileupJetIdentifier )
void PileupJetIdAlgo::set ( const PileupJetIdentifier id)

Definition at line 210 of file PileupJetIdAlgo.cc.

References internalId_.

Referenced by betterConfigParser.BetterConfigParser::getGeneral(), and PileupJetIdProducer::produce().

211 {
212  internalId_ = id;
213 }
PileupJetIdentifier internalId_
void PileupJetIdAlgo::setup ( )
protected
void PileupJetIdAlgo::setup ( void  )
protected

Definition at line 91 of file PileupJetIdAlgo.cc.

References cutBased_, initVariables(), PHILv0, tmvaMethod_, tmvaNames_, tmvaVariables_, USER, and version_.

Referenced by PileupJetIdAlgo().

92 {
93  initVariables();
94 
95  if( version_ == PHILv0 ) {
96  tmvaVariables_.clear();
97  tmvaVariables_.push_back( "jspt_1" );
98  tmvaVariables_.push_back( "jseta_1" );
99  tmvaVariables_.push_back( "jsphi_1" );
100  tmvaVariables_.push_back( "jd0_1" );
101  tmvaVariables_.push_back( "jdZ_1" );
102  tmvaVariables_.push_back( "jm_1" );
103  tmvaVariables_.push_back( "npart_1" );
104  tmvaVariables_.push_back( "lpt_1" );
105  tmvaVariables_.push_back( "leta_1" );
106  tmvaVariables_.push_back( "lphi_1" );
107  tmvaVariables_.push_back( "spt_1" );
108  tmvaVariables_.push_back( "seta_1" );
109  tmvaVariables_.push_back( "sphi_1" );
110  tmvaVariables_.push_back( "lnept_1" );
111  tmvaVariables_.push_back( "lneeta_1");
112  tmvaVariables_.push_back( "lnephi_1");
113  tmvaVariables_.push_back( "lempt_1" );
114  tmvaVariables_.push_back( "lemeta_1");
115  tmvaVariables_.push_back( "lemphi_1");
116  tmvaVariables_.push_back( "lchpt_1" );
117  // tmvaVariables_.push_back( "lcheta_1"); FIXME missing in weights file
118  tmvaVariables_.push_back( "lchphi_1");
119  tmvaVariables_.push_back( "lLfr_1" );
120  tmvaVariables_.push_back( "drlc_1" );
121  tmvaVariables_.push_back( "drls_1" );
122  tmvaVariables_.push_back( "drm_1" );
123  tmvaVariables_.push_back( "drmne_1" );
124  tmvaVariables_.push_back( "drem_1" );
125  tmvaVariables_.push_back( "drch_1" );
126 
127  tmvaNames_["jspt_1"] = "jetPt";
128  tmvaNames_["jseta_1"] = "jetEta";
129  tmvaNames_["jsphi_1"] = "jetPhi";
130  tmvaNames_["jm_1"] = "jetM";
131  tmvaNames_["jd0_1"] = "d0";
132  tmvaNames_["jdZ_1"] = "dZ";
133  tmvaNames_["npart_1"] = "nParticles";
134 
135  tmvaNames_["lpt_1"] = "leadPt";
136  tmvaNames_["leta_1"] = "leadEta";
137  tmvaNames_["lphi_1"] = "leadPhi";
138  tmvaNames_["spt_1"] = "secondPt";
139  tmvaNames_["seta_1"] = "secondEta";
140  tmvaNames_["sphi_1"] = "secondPhi";
141  tmvaNames_["lnept_1"] = "leadNeutPt";
142  tmvaNames_["lneeta_1"] = "leadNeutEta";
143  tmvaNames_["lnephi_1"] = "leadNeutPhi";
144  tmvaNames_["lempt_1"] = "leadEmPt";
145  tmvaNames_["lemeta_1"] = "leadEmEta";
146  tmvaNames_["lemphi_1"] = "leadEmPhi";
147  tmvaNames_["lchpt_1"] = "leadChPt";
148  tmvaNames_["lcheta_1"] = "leadChEta";
149  tmvaNames_["lchphi_1"] = "leadChPhi";
150  tmvaNames_["lLfr_1"] = "leadFrac";
151 
152  tmvaNames_["drlc_1"] = "dRLeadCent";
153  tmvaNames_["drls_1"] = "dRLead2nd";
154  tmvaNames_["drm_1"] = "dRMean";
155  tmvaNames_["drmne_1"] = "dRMeanNeut";
156  tmvaNames_["drem_1"] = "dRMeanEm";
157  tmvaNames_["drch_1"] = "dRMeanCh";
158 
159  } else if( ! cutBased_ ){
160  assert( tmvaMethod_.empty() || (! tmvaVariables_.empty() && version_ == USER) );
161  }
162 }
std::string tmvaMethod_
std::vector< std::string > tmvaVariables_
std::map< std::string, std::string > tmvaNames_

Member Data Documentation

Float_t PileupJetIdAlgo::betaStarCut_
protected

Definition at line 77 of file PileupJetIdAlgo.h.

Referenced by computeCutIDflag(), and PileupJetIdAlgo().

bool PileupJetIdAlgo::cutBased_
protected

Definition at line 74 of file PileupJetIdAlgo.h.

Referenced by PileupJetIdAlgo(), runMva(), and setup().

Float_t PileupJetIdAlgo::impactParTkThreshod_
protected

Definition at line 73 of file PileupJetIdAlgo.h.

Referenced by PileupJetIdAlgo().

PileupJetIdentifier PileupJetIdAlgo::internalId_
protected
Float_t PileupJetIdAlgo::mvacut_
protected

Definition at line 75 of file PileupJetIdAlgo.h.

Referenced by computeIDflag(), and PileupJetIdAlgo().

TMVA::Reader * PileupJetIdAlgo::reader_
protected

Definition at line 66 of file PileupJetIdAlgo.h.

Referenced by bookReader(), PileupJetIdAlgo(), runMva(), and ~PileupJetIdAlgo().

Float_t PileupJetIdAlgo::rmsCut_
protected

Definition at line 76 of file PileupJetIdAlgo.h.

Referenced by computeCutIDflag(), and PileupJetIdAlgo().

std::string PileupJetIdAlgo::tmvaMethod_
protected

Definition at line 67 of file PileupJetIdAlgo.h.

Referenced by bookReader(), method(), PileupJetIdAlgo(), runMva(), and setup().

std::map< std::string, std::string > PileupJetIdAlgo::tmvaNames_
protected

Definition at line 70 of file PileupJetIdAlgo.h.

Referenced by bookReader(), and setup().

std::vector< std::string > PileupJetIdAlgo::tmvaSpectators_
protected

Definition at line 69 of file PileupJetIdAlgo.h.

Referenced by bookReader(), and PileupJetIdAlgo().

std::vector< std::string > PileupJetIdAlgo::tmvaVariables_
protected

Definition at line 68 of file PileupJetIdAlgo.h.

Referenced by bookReader(), PileupJetIdAlgo(), and setup().

std::string PileupJetIdAlgo::tmvaWeights_
protected

Definition at line 67 of file PileupJetIdAlgo.h.

Referenced by bookReader(), and PileupJetIdAlgo().

variables_list_t PileupJetIdAlgo::variables_
protected

Definition at line 64 of file PileupJetIdAlgo.h.

Referenced by bookReader(), dumpVariables(), getVariables(), and resetVariables().

Int_t PileupJetIdAlgo::version_
protected

Definition at line 72 of file PileupJetIdAlgo.h.

Referenced by PileupJetIdAlgo(), and setup().