CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
egammaisolation::EgammaTrackExtractor Class Reference

#include <EgammaTrackExtractor.h>

Inheritance diagram for egammaisolation::EgammaTrackExtractor:
reco::isodeposit::IsoDepositExtractor

Public Member Functions

virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &muon) const
 
 EgammaTrackExtractor ()
 
 EgammaTrackExtractor (const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
 
 EgammaTrackExtractor (const edm::ParameterSet &par, edm::ConsumesCollector &iC)
 
virtual void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &track)
 
virtual reco::IsoDeposit::Vetos vetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
virtual ~EgammaTrackExtractor ()
 
- Public Member Functions inherited from reco::isodeposit::IsoDepositExtractor
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 make single IsoDeposit based on trackRef as input More...
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 make single IsoDeposit based on a CandidateBaseRef as input More...
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 
virtual void initEvent (const edm::Event &, const edm::EventSetup &)
 perform some constly initialization More...
 
virtual ~IsoDepositExtractor ()
 Destructor. More...
 

Private Member Functions

reco::IsoDeposit::Veto veto (const reco::IsoDeposit::Direction &dir) const
 

Private Attributes

edm::InputTag barrelEcalHitsTag_
 "NONE", "BeamSpotFromEvent" More...
 
int dzOption
 
std::string dzOptionString
 Endcap requirements to determine if isolated for selective filling. More...
 
edm::InputTag endcapEcalHitsTag_
 
double minCandEt_
 name for deposit More...
 
std::vector< double > paramForIsolBarrel_
 min track pt to include into iso deposit More...
 
std::vector< double > paramForIsolEndcap_
 Barrel requirements to determine if isolated for selective filling. More...
 
std::string theBeamlineOption
 Veto cone angle. More...
 
edm::EDGetTokenT< reco::BeamSpottheBeamSpotToken
 
double theChi2Ndof_Max
 trk.numberOfValidHits >= theNHits_Min More...
 
double theChi2Prob_Min
 trk.normalizedChi2 < theChi2Ndof_Max More...
 
std::string theDepositLabel
 Track Collection Label. More...
 
double theDiff_r
 minimum candidate et More...
 
double theDiff_z
 transverse distance to vertex More...
 
double theDR_Max
 z distance to vertex More...
 
double theDR_Veto
 Maximum cone angle for deposits. More...
 
unsigned int theNHits_Min
 BeamSpot name. More...
 
double thePt_Min
 ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min. More...
 
edm::EDGetTokenT< edm::View
< reco::Track > > 
theTrackCollectionToken
 

Detailed Description

Definition at line 19 of file EgammaTrackExtractor.h.

Constructor & Destructor Documentation

egammaisolation::EgammaTrackExtractor::EgammaTrackExtractor ( )
inline

Definition at line 23 of file EgammaTrackExtractor.h.

23 {};
egammaisolation::EgammaTrackExtractor::EgammaTrackExtractor ( const edm::ParameterSet par,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 24 of file EgammaTrackExtractor.h.

EgammaTrackExtractor::EgammaTrackExtractor ( const edm::ParameterSet par,
edm::ConsumesCollector iC 
)

Definition at line 28 of file EgammaTrackExtractor.cc.

References egammaisolation::EgammaTrackSelector::bs, egammaisolation::EgammaTrackSelector::dz, dzOption, dzOptionString, egammaisolation::EgammaTrackSelector::vtx, and egammaisolation::EgammaTrackSelector::vz.

28  :
29  theTrackCollectionToken(iC.consumes<View<Track> >(par.getParameter<edm::InputTag>("inputTrackCollection"))),
31  theDiff_r(par.getParameter<double>("Diff_r")),
32  theDiff_z(par.getParameter<double>("Diff_z")),
33  theDR_Max(par.getParameter<double>("DR_Max")),
34  theDR_Veto(par.getParameter<double>("DR_Veto")),
35  theBeamlineOption(par.getParameter<std::string>("BeamlineOption")),
37  theNHits_Min(par.getParameter<unsigned int>("NHits_Min")),
38  theChi2Ndof_Max(par.getParameter<double>("Chi2Ndof_Max")),
39  theChi2Prob_Min(par.getParameter<double>("Chi2Prob_Min")),
40  thePt_Min(par.getParameter<double>("Pt_Min")),
41  dzOptionString(par.getParameter<std::string>("dzOption"))
42 {
43  if( ! dzOptionString.compare("dz") ) dzOption = EgammaTrackSelector::dz;
44  else if( ! dzOptionString.compare("vz") ) dzOption = EgammaTrackSelector::vz;
45  else if( ! dzOptionString.compare("bs") ) dzOption = EgammaTrackSelector::bs;
46  else if( ! dzOptionString.compare("vtx") )dzOption = EgammaTrackSelector::vtx;
48 
49 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
double theDR_Veto
Maximum cone angle for deposits.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< reco::Track > > theTrackCollectionToken
std::string dzOptionString
Endcap requirements to determine if isolated for selective filling.
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
double theChi2Prob_Min
trk.normalizedChi2 &lt; theChi2Ndof_Max
double theDiff_r
minimum candidate et
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) &gt; theChi2Prob_Min.
std::string theDepositLabel
Track Collection Label.
double theDiff_z
transverse distance to vertex
unsigned int theNHits_Min
BeamSpot name.
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
double theDR_Max
z distance to vertex
double theChi2Ndof_Max
trk.numberOfValidHits &gt;= theNHits_Min
std::string theBeamlineOption
Veto cone angle.
virtual egammaisolation::EgammaTrackExtractor::~EgammaTrackExtractor ( )
inlinevirtual

Definition at line 28 of file EgammaTrackExtractor.h.

28 {}

Member Function Documentation

virtual reco::IsoDeposit egammaisolation::EgammaTrackExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
inlinevirtual

make single IsoDeposit based on track as input purely virtual: have to implement in concrete implementations

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 36 of file EgammaTrackExtractor.h.

Referenced by deposit().

37  {
38  edm::LogWarning("EgammaIsolationAlgos|EgammaTrackExtractor")
39  << "This Function is not implemented, bad IsoDeposit Returned";
41  }
reco::IsoDeposit IsoDeposit
Definition: Isolation.h:7
IsoDeposit EgammaTrackExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Candidate track 
) const
virtual

make single IsoDeposit based on a candidate as input purely virtual: have to implement in concrete implementations

Reimplemented from reco::isodeposit::IsoDepositExtractor.

Definition at line 66 of file EgammaTrackExtractor.cc.

References reco::IsoDeposit::addCandEnergy(), reco::IsoDeposit::addDeposit(), SiPixelRawToDigiRegional_cfi::beamSpot, egammaisolation::EgammaTrackSelector::bs, ChiSquaredProbability(), reco::isodeposit::Direction::deltaR(), deposit(), egammaisolation::EgammaTrackSelector::dz, dzOption, reco::Candidate::et(), reco::Candidate::eta(), reco::GsfElectron::gsfTrack(), reco::Candidate::isElectron(), edm::HandleBase::isValid(), metname, reco::Candidate::phi(), reco::IsoDeposit::setVeto(), AlCaHLTBitMon_QueryRunRegistry::string, theBeamlineOption, theBeamSpotToken, theChi2Ndof_Max, theChi2Prob_Min, theDiff_r, theDiff_z, theDR_Max, theNHits_Min, thePt_Min, theTrackCollectionToken, reco::Candidate::vertex(), veto(), egammaisolation::EgammaTrackSelector::vtx, and egammaisolation::EgammaTrackSelector::vz.

67 {
68  static std::string metname = "EgammaIsolationAlgos|EgammaTrackExtractor";
69 
71  double dzCut=0;
72 
73  reco::TrackBase::Point beamPoint(0,0, 0);
74  if (theBeamlineOption.compare("BeamSpotFromEvent") == 0){
75  //pick beamSpot
78 
79  event.getByToken(theBeamSpotToken,beamSpotH);
80 
81  if (beamSpotH.isValid()){
82  beamPoint = beamSpotH->position();
83  }
84  }
85 
86  Handle<View<Track> > tracksH;
87  event.getByToken(theTrackCollectionToken, tracksH);
88 
89  if( candTk.isElectron() ){
90  const reco::GsfElectron* elec = dynamic_cast<const reco::GsfElectron*>(&candTk);
91  candDir = reco::isodeposit::Direction(elec->gsfTrack()->eta(), elec->gsfTrack()->phi());
92  } else {
93  candDir = reco::isodeposit::Direction(candTk.eta(), candTk.phi());
94  }
95 
96  IsoDeposit deposit(candDir );
97  deposit.setVeto( veto(candDir) );
98  deposit.addCandEnergy(candTk.et());
99 
100  View<Track>::const_iterator itrTr = tracksH->begin();
101  View<Track>::const_iterator trEnd = tracksH->end();
102  for (itrTr = tracksH->begin();itrTr != trEnd; ++itrTr) {
103 
104  if(candDir.deltaR( reco::isodeposit::Direction(itrTr->eta(),itrTr->phi()) ) > theDR_Max )
105  continue;
106 
107  if(itrTr->normalizedChi2() > theChi2Ndof_Max)
108  continue;
109 
110  if(itrTr->pt() < thePt_Min)
111  continue;
112 
113  if(theChi2Prob_Min > 0 && ChiSquaredProbability(itrTr->chi2(), itrTr->ndof()) < theChi2Prob_Min )
114  continue;
115 
116  if(theNHits_Min > 0 && itrTr->numberOfValidHits() < theNHits_Min)
117  continue;
118 
119  if( candTk.isElectron() ){
120  const reco::GsfElectron* elec = dynamic_cast<const reco::GsfElectron*>(&candTk);
121  switch(dzOption) {
122  case EgammaTrackSelector::dz : dzCut = elec->gsfTrack()->dz() - itrTr->dz() ; break;
123  case EgammaTrackSelector::vz : dzCut = elec->gsfTrack()->vz() - itrTr->vz() ; break;
124  case EgammaTrackSelector::bs : dzCut = elec->gsfTrack()->dz(beamPoint) - itrTr->dz(beamPoint) ; break;
125  case EgammaTrackSelector::vtx: dzCut = itrTr->dz(elec->gsfTrack()->vertex()) ; break;
126  default: dzCut = elec->gsfTrack()->vz() - itrTr->vz() ; break;
127  }
128  } else {
129  switch(dzOption) {
130  case EgammaTrackSelector::dz : dzCut = (*itrTr).dz() - candTk.vertex().z() ; break;
131  case EgammaTrackSelector::vz : dzCut = (*itrTr).vz() - candTk.vertex().z() ; break;
132  case EgammaTrackSelector::bs : dzCut = (*itrTr).dz(beamPoint) - candTk.vertex().z() ; break;
133  case EgammaTrackSelector::vtx: dzCut = (*itrTr).dz(candTk.vertex()); break;
134  default : dzCut = (*itrTr).vz() - candTk.vertex().z(); break;
135  }
136  }
137 
138  if(fabs(dzCut) > theDiff_z)
139  continue;
140 
141  if(fabs(itrTr->dxy(beamPoint) ) > theDiff_r)
142  continue;
143 
144  deposit.addDeposit(reco::isodeposit::Direction(itrTr->eta(), itrTr->phi()), itrTr->pt());
145 
146  }
147 
148  return deposit;
149 }
edm::EDGetTokenT< edm::View< reco::Track > > theTrackCollectionToken
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:80
const std::string metname
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double theChi2Prob_Min
trk.normalizedChi2 &lt; theChi2Ndof_Max
double theDiff_r
minimum candidate et
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:23
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) &gt; theChi2Prob_Min.
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:139
float ChiSquaredProbability(double chiSquared, double nrDOF)
math::XYZPoint Point
point in the space
Definition: TrackBase.h:83
bool isValid() const
Definition: HandleBase.h:75
double theDiff_z
transverse distance to vertex
unsigned int theNHits_Min
BeamSpot name.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
double theDR_Max
z distance to vertex
double theChi2Ndof_Max
trk.numberOfValidHits &gt;= theNHits_Min
std::string theBeamlineOption
Veto cone angle.
double deltaR(const Direction &dir2) const
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:183
virtual void egammaisolation::EgammaTrackExtractor::fillVetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::TrackCollection tracks 
)
inlinevirtual

fill vetoes: to exclude deposits at IsoDeposit creation stage check concrete extractors if it's no-op !

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 30 of file EgammaTrackExtractor.h.

31  {}
reco::IsoDeposit::Veto EgammaTrackExtractor::veto ( const reco::IsoDeposit::Direction dir) const
private

Definition at line 58 of file EgammaTrackExtractor.cc.

References dir, reco::IsoDeposit::Veto::dR, mps_fire::result, theDR_Veto, and reco::IsoDeposit::Veto::vetoDir.

Referenced by deposit(), and vetos().

59 {
61  result.vetoDir = dir;
62  result.dR = theDR_Veto;
63  return result;
64 }
double theDR_Veto
Maximum cone angle for deposits.
tuple result
Definition: mps_fire.py:84
dbl *** dir
Definition: mlp_gen.cc:35
reco::IsoDeposit::Vetos EgammaTrackExtractor::vetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
virtual

Definition at line 51 of file EgammaTrackExtractor.cc.

References dir, reco::TrackBase::eta(), reco::TrackBase::phi(), and veto().

53 {
54  reco::isodeposit::Direction dir(track.eta(),track.phi());
55  return reco::IsoDeposit::Vetos(1,veto(dir));
56 }
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:640
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:646
std::vector< Veto > Vetos
Definition: IsoDeposit.h:63
dbl *** dir
Definition: mlp_gen.cc:35

Member Data Documentation

edm::InputTag egammaisolation::EgammaTrackExtractor::barrelEcalHitsTag_
private

"NONE", "BeamSpotFromEvent"

Definition at line 58 of file EgammaTrackExtractor.h.

int egammaisolation::EgammaTrackExtractor::dzOption
private

Definition at line 68 of file EgammaTrackExtractor.h.

Referenced by deposit(), and EgammaTrackExtractor().

std::string egammaisolation::EgammaTrackExtractor::dzOptionString
private

Endcap requirements to determine if isolated for selective filling.

Definition at line 67 of file EgammaTrackExtractor.h.

Referenced by EgammaTrackExtractor().

edm::InputTag egammaisolation::EgammaTrackExtractor::endcapEcalHitsTag_
private

Definition at line 59 of file EgammaTrackExtractor.h.

double egammaisolation::EgammaTrackExtractor::minCandEt_
private

name for deposit

Definition at line 52 of file EgammaTrackExtractor.h.

std::vector<double> egammaisolation::EgammaTrackExtractor::paramForIsolBarrel_
private

min track pt to include into iso deposit

Definition at line 65 of file EgammaTrackExtractor.h.

std::vector<double> egammaisolation::EgammaTrackExtractor::paramForIsolEndcap_
private

Barrel requirements to determine if isolated for selective filling.

Definition at line 66 of file EgammaTrackExtractor.h.

std::string egammaisolation::EgammaTrackExtractor::theBeamlineOption
private

Veto cone angle.

Definition at line 57 of file EgammaTrackExtractor.h.

Referenced by deposit().

edm::EDGetTokenT<reco::BeamSpot> egammaisolation::EgammaTrackExtractor::theBeamSpotToken
private

Definition at line 60 of file EgammaTrackExtractor.h.

Referenced by deposit().

double egammaisolation::EgammaTrackExtractor::theChi2Ndof_Max
private

trk.numberOfValidHits >= theNHits_Min

Definition at line 62 of file EgammaTrackExtractor.h.

Referenced by deposit().

double egammaisolation::EgammaTrackExtractor::theChi2Prob_Min
private

trk.normalizedChi2 < theChi2Ndof_Max

Definition at line 63 of file EgammaTrackExtractor.h.

Referenced by deposit().

std::string egammaisolation::EgammaTrackExtractor::theDepositLabel
private

Track Collection Label.

Definition at line 51 of file EgammaTrackExtractor.h.

double egammaisolation::EgammaTrackExtractor::theDiff_r
private

minimum candidate et

Definition at line 53 of file EgammaTrackExtractor.h.

Referenced by deposit().

double egammaisolation::EgammaTrackExtractor::theDiff_z
private

transverse distance to vertex

Definition at line 54 of file EgammaTrackExtractor.h.

Referenced by deposit().

double egammaisolation::EgammaTrackExtractor::theDR_Max
private

z distance to vertex

Definition at line 55 of file EgammaTrackExtractor.h.

Referenced by deposit().

double egammaisolation::EgammaTrackExtractor::theDR_Veto
private

Maximum cone angle for deposits.

Definition at line 56 of file EgammaTrackExtractor.h.

Referenced by veto().

unsigned int egammaisolation::EgammaTrackExtractor::theNHits_Min
private

BeamSpot name.

Definition at line 61 of file EgammaTrackExtractor.h.

Referenced by deposit().

double egammaisolation::EgammaTrackExtractor::thePt_Min
private

ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min.

Definition at line 64 of file EgammaTrackExtractor.h.

Referenced by deposit().

edm::EDGetTokenT<edm::View<reco::Track> > egammaisolation::EgammaTrackExtractor::theTrackCollectionToken
private

Definition at line 50 of file EgammaTrackExtractor.h.

Referenced by deposit().