CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
egammaisolation::EgammaTrackExtractor Class Reference
Inheritance diagram for egammaisolation::EgammaTrackExtractor:
reco::isodeposit::IsoDepositExtractor

Public Member Functions

reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const override
 
reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &muon) const override
 
 EgammaTrackExtractor ()
 
 EgammaTrackExtractor (const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
 
 EgammaTrackExtractor (const edm::ParameterSet &par, edm::ConsumesCollector &iC)
 
void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &track) override
 
virtual reco::IsoDeposit::Vetos vetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
 ~EgammaTrackExtractor () override
 
- 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::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual std::vector< reco::IsoDepositdeposits (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 29 of file EgammaTrackExtractor.cc.

Constructor & Destructor Documentation

◆ EgammaTrackExtractor() [1/3]

egammaisolation::EgammaTrackExtractor::EgammaTrackExtractor ( )
inline

Definition at line 31 of file EgammaTrackExtractor.cc.

31 {};

◆ EgammaTrackExtractor() [2/3]

egammaisolation::EgammaTrackExtractor::EgammaTrackExtractor ( const edm::ParameterSet par,
edm::ConsumesCollector &&  iC 
)
inline

◆ EgammaTrackExtractor() [3/3]

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

Definition at line 93 of file EgammaTrackExtractor.cc.

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

94  : theTrackCollectionToken(iC.consumes<View<Track> >(par.getParameter<edm::InputTag>("inputTrackCollection"))),
96  theDiff_r(par.getParameter<double>("Diff_r")),
97  theDiff_z(par.getParameter<double>("Diff_z")),
98  theDR_Max(par.getParameter<double>("DR_Max")),
99  theDR_Veto(par.getParameter<double>("DR_Veto")),
100  theBeamlineOption(par.getParameter<std::string>("BeamlineOption")),
102  theNHits_Min(par.getParameter<unsigned int>("NHits_Min")),
103  theChi2Ndof_Max(par.getParameter<double>("Chi2Ndof_Max")),
104  theChi2Prob_Min(par.getParameter<double>("Chi2Prob_Min")),
105  thePt_Min(par.getParameter<double>("Pt_Min")),
106  dzOptionString(par.getParameter<std::string>("dzOption")) {
107  if (!dzOptionString.compare("dz"))
109  else if (!dzOptionString.compare("vz"))
111  else if (!dzOptionString.compare("bs"))
113  else if (!dzOptionString.compare("vtx"))
115  else
117 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
double theDR_Veto
Maximum cone angle for deposits.
edm::EDGetTokenT< edm::View< reco::Track > > theTrackCollectionToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string dzOptionString
Endcap requirements to determine if isolated for selective filling.
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
double theChi2Prob_Min
trk.normalizedChi2 < theChi2Ndof_Max
T getUntrackedParameter(std::string const &, T const &) const
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) > 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 theChi2Ndof_Max
trk.numberOfValidHits >= theNHits_Min
std::string theBeamlineOption
Veto cone angle.

◆ ~EgammaTrackExtractor()

egammaisolation::EgammaTrackExtractor::~EgammaTrackExtractor ( )
inlineoverride

Definition at line 35 of file EgammaTrackExtractor.cc.

35 {}

Member Function Documentation

◆ deposit() [1/2]

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

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

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 43 of file EgammaTrackExtractor.cc.

Referenced by deposit().

45  {
46  edm::LogWarning("EgammaIsolationAlgos|EgammaTrackExtractor")
47  << "This Function is not implemented, bad IsoDeposit Returned";
49  }
reco::IsoDeposit IsoDeposit
Definition: Isolation.h:7
Log< level::Warning, false > LogWarning

◆ deposit() [2/2]

IsoDeposit EgammaTrackExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Candidate track 
) const
overridevirtual

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 133 of file EgammaTrackExtractor.cc.

References reco::IsoDeposit::addCandEnergy(), reco::IsoDeposit::addDeposit(), egammaisolation::EgammaTrackSelector::bs, ChiSquaredProbability(), reco::isodeposit::Direction::deltaR(), deposit(), egammaisolation::EgammaTrackSelector::dz, TrackSplittingMonitor_cfi::dzCut, dzOption, reco::Candidate::et(), reco::Candidate::eta(), reco::GsfElectron::gsfTrack(), reco::Candidate::isElectron(), 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.

135  {
136  static const std::string metname = "EgammaIsolationAlgos|EgammaTrackExtractor";
137 
139  double dzCut = 0;
140 
141  reco::TrackBase::Point beamPoint(0, 0, 0);
142  if (theBeamlineOption == "BeamSpotFromEvent") {
143  //pick beamSpot
144  auto beamSpotH = event.getHandle(theBeamSpotToken);
145 
146  if (beamSpotH.isValid()) {
147  beamPoint = beamSpotH->position();
148  }
149  }
150 
151  if (candTk.isElectron()) {
152  const reco::GsfElectron* elec = dynamic_cast<const reco::GsfElectron*>(&candTk);
153  candDir = reco::isodeposit::Direction(elec->gsfTrack()->eta(), elec->gsfTrack()->phi());
154  } else {
155  candDir = reco::isodeposit::Direction(candTk.eta(), candTk.phi());
156  }
157 
158  IsoDeposit deposit(candDir);
159  deposit.setVeto(veto(candDir));
160  deposit.addCandEnergy(candTk.et());
161 
162  for (auto const& itrTr : event.get(theTrackCollectionToken)) {
163  if (candDir.deltaR(reco::isodeposit::Direction(itrTr.eta(), itrTr.phi())) > theDR_Max)
164  continue;
165 
166  if (itrTr.normalizedChi2() > theChi2Ndof_Max)
167  continue;
168 
169  if (itrTr.pt() < thePt_Min)
170  continue;
171 
172  if (theChi2Prob_Min > 0 && ChiSquaredProbability(itrTr.chi2(), itrTr.ndof()) < theChi2Prob_Min)
173  continue;
174 
175  if (theNHits_Min > 0 && itrTr.numberOfValidHits() < theNHits_Min)
176  continue;
177 
178  if (candTk.isElectron()) {
179  const reco::GsfElectron* elec = dynamic_cast<const reco::GsfElectron*>(&candTk);
180  switch (dzOption) {
182  dzCut = elec->gsfTrack()->dz() - itrTr.dz();
183  break;
185  dzCut = elec->gsfTrack()->vz() - itrTr.vz();
186  break;
188  dzCut = elec->gsfTrack()->dz(beamPoint) - itrTr.dz(beamPoint);
189  break;
191  dzCut = itrTr.dz(elec->gsfTrack()->vertex());
192  break;
193  default:
194  dzCut = elec->gsfTrack()->vz() - itrTr.vz();
195  break;
196  }
197  } else {
198  switch (dzOption) {
200  dzCut = itrTr.dz() - candTk.vertex().z();
201  break;
203  dzCut = itrTr.vz() - candTk.vertex().z();
204  break;
206  dzCut = itrTr.dz(beamPoint) - candTk.vertex().z();
207  break;
209  dzCut = itrTr.dz(candTk.vertex());
210  break;
211  default:
212  dzCut = itrTr.vz() - candTk.vertex().z();
213  break;
214  }
215  }
216 
217  if (fabs(dzCut) > theDiff_z)
218  continue;
219 
220  if (fabs(itrTr.dxy(beamPoint)) > theDiff_r)
221  continue;
222 
223  deposit.addDeposit(reco::isodeposit::Direction(itrTr.eta(), itrTr.phi()), itrTr.pt());
224  }
225 
226  return deposit;
227 }
edm::EDGetTokenT< edm::View< reco::Track > > theTrackCollectionToken
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:82
const std::string metname
double theChi2Prob_Min
trk.normalizedChi2 < theChi2Ndof_Max
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:19
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min.
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:132
float ChiSquaredProbability(double chiSquared, double nrDOF)
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double theDiff_z
transverse distance to vertex
unsigned int theNHits_Min
BeamSpot name.
reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const override
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
double deltaR(const Direction &dir2) const
double theChi2Ndof_Max
trk.numberOfValidHits >= theNHits_Min
std::string theBeamlineOption
Veto cone angle.
Definition: event.py:1

◆ fillVetos()

void egammaisolation::EgammaTrackExtractor::fillVetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::TrackCollection tracks 
)
inlineoverridevirtual

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

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 37 of file EgammaTrackExtractor.cc.

37 {}

◆ veto()

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

Definition at line 126 of file EgammaTrackExtractor.cc.

References DeadROC_duringRun::dir, mps_fire::result, and theDR_Veto.

Referenced by deposit(), and vetos().

126  {
128  result.vetoDir = dir;
129  result.dR = theDR_Veto;
130  return result;
131 }
double theDR_Veto
Maximum cone angle for deposits.

◆ vetos()

reco::IsoDeposit::Vetos EgammaTrackExtractor::vetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
virtual

Definition at line 119 of file EgammaTrackExtractor.cc.

References DeadROC_duringRun::dir, HLT_2022v12_cff::track, and veto().

121  {
123  return reco::IsoDeposit::Vetos(1, veto(dir));
124 }
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
std::vector< Veto > Vetos
Definition: IsoDeposit.h:65

Member Data Documentation

◆ barrelEcalHitsTag_

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

"NONE", "BeamSpotFromEvent"

Definition at line 68 of file EgammaTrackExtractor.cc.

◆ dzOption

int egammaisolation::EgammaTrackExtractor::dzOption
private

Definition at line 78 of file EgammaTrackExtractor.cc.

Referenced by deposit(), and EgammaTrackExtractor().

◆ dzOptionString

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

Endcap requirements to determine if isolated for selective filling.

Definition at line 77 of file EgammaTrackExtractor.cc.

Referenced by EgammaTrackExtractor().

◆ endcapEcalHitsTag_

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

Definition at line 69 of file EgammaTrackExtractor.cc.

◆ minCandEt_

double egammaisolation::EgammaTrackExtractor::minCandEt_
private

name for deposit

Definition at line 62 of file EgammaTrackExtractor.cc.

◆ paramForIsolBarrel_

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

min track pt to include into iso deposit

Definition at line 75 of file EgammaTrackExtractor.cc.

◆ paramForIsolEndcap_

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

Barrel requirements to determine if isolated for selective filling.

Definition at line 76 of file EgammaTrackExtractor.cc.

◆ theBeamlineOption

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

Veto cone angle.

Definition at line 67 of file EgammaTrackExtractor.cc.

Referenced by deposit().

◆ theBeamSpotToken

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

Definition at line 70 of file EgammaTrackExtractor.cc.

Referenced by deposit().

◆ theChi2Ndof_Max

double egammaisolation::EgammaTrackExtractor::theChi2Ndof_Max
private

trk.numberOfValidHits >= theNHits_Min

Definition at line 72 of file EgammaTrackExtractor.cc.

Referenced by deposit().

◆ theChi2Prob_Min

double egammaisolation::EgammaTrackExtractor::theChi2Prob_Min
private

trk.normalizedChi2 < theChi2Ndof_Max

Definition at line 73 of file EgammaTrackExtractor.cc.

Referenced by deposit().

◆ theDepositLabel

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

Track Collection Label.

Definition at line 61 of file EgammaTrackExtractor.cc.

◆ theDiff_r

double egammaisolation::EgammaTrackExtractor::theDiff_r
private

minimum candidate et

Definition at line 63 of file EgammaTrackExtractor.cc.

Referenced by deposit().

◆ theDiff_z

double egammaisolation::EgammaTrackExtractor::theDiff_z
private

transverse distance to vertex

Definition at line 64 of file EgammaTrackExtractor.cc.

Referenced by deposit().

◆ theDR_Max

double egammaisolation::EgammaTrackExtractor::theDR_Max
private

z distance to vertex

Definition at line 65 of file EgammaTrackExtractor.cc.

Referenced by deposit().

◆ theDR_Veto

double egammaisolation::EgammaTrackExtractor::theDR_Veto
private

Maximum cone angle for deposits.

Definition at line 66 of file EgammaTrackExtractor.cc.

Referenced by veto().

◆ theNHits_Min

unsigned int egammaisolation::EgammaTrackExtractor::theNHits_Min
private

BeamSpot name.

Definition at line 71 of file EgammaTrackExtractor.cc.

Referenced by deposit().

◆ thePt_Min

double egammaisolation::EgammaTrackExtractor::thePt_Min
private

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

Definition at line 74 of file EgammaTrackExtractor.cc.

Referenced by deposit().

◆ theTrackCollectionToken

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

Definition at line 60 of file EgammaTrackExtractor.cc.

Referenced by deposit().