CMS 3D CMS Logo

EgammaTrackExtractor.cc
Go to the documentation of this file.
2 
20 
21 using namespace edm;
22 using namespace std;
23 using namespace reco;
24 using namespace egammaisolation;
26 
27 EgammaTrackExtractor::EgammaTrackExtractor(const ParameterSet& par, edm::ConsumesCollector& iC)
28  : theTrackCollectionToken(iC.consumes<View<Track> >(par.getParameter<edm::InputTag>("inputTrackCollection"))),
29  theDepositLabel(par.getUntrackedParameter<std::string>("DepositLabel")),
30  theDiff_r(par.getParameter<double>("Diff_r")),
31  theDiff_z(par.getParameter<double>("Diff_z")),
32  theDR_Max(par.getParameter<double>("DR_Max")),
33  theDR_Veto(par.getParameter<double>("DR_Veto")),
34  theBeamlineOption(par.getParameter<std::string>("BeamlineOption")),
35  theBeamSpotToken(iC.mayConsume<reco::BeamSpot>(par.getParameter<edm::InputTag>("BeamSpotLabel"))),
36  theNHits_Min(par.getParameter<unsigned int>("NHits_Min")),
37  theChi2Ndof_Max(par.getParameter<double>("Chi2Ndof_Max")),
38  theChi2Prob_Min(par.getParameter<double>("Chi2Prob_Min")),
39  thePt_Min(par.getParameter<double>("Pt_Min")),
40  dzOptionString(par.getParameter<std::string>("dzOption")) {
41  if (!dzOptionString.compare("dz"))
43  else if (!dzOptionString.compare("vz"))
45  else if (!dzOptionString.compare("bs"))
47  else if (!dzOptionString.compare("vtx"))
49  else
51 }
52 
54  const edm::EventSetup& evSetup,
55  const reco::Track& track) const {
57  return reco::IsoDeposit::Vetos(1, veto(dir));
58 }
59 
62  result.vetoDir = dir;
63  result.dR = theDR_Veto;
64  return result;
65 }
66 
68  const EventSetup& eventSetup,
69  const Candidate& candTk) const {
70  static const std::string metname = "EgammaIsolationAlgos|EgammaTrackExtractor";
71 
73  double dzCut = 0;
74 
75  reco::TrackBase::Point beamPoint(0, 0, 0);
76  if (theBeamlineOption == "BeamSpotFromEvent") {
77  //pick beamSpot
80 
81  event.getByToken(theBeamSpotToken, beamSpotH);
82 
83  if (beamSpotH.isValid()) {
84  beamPoint = beamSpotH->position();
85  }
86  }
87 
88  Handle<View<Track> > tracksH;
89  event.getByToken(theTrackCollectionToken, tracksH);
90 
91  if (candTk.isElectron()) {
92  const reco::GsfElectron* elec = dynamic_cast<const reco::GsfElectron*>(&candTk);
93  candDir = reco::isodeposit::Direction(elec->gsfTrack()->eta(), elec->gsfTrack()->phi());
94  } else {
95  candDir = reco::isodeposit::Direction(candTk.eta(), candTk.phi());
96  }
97 
98  IsoDeposit deposit(candDir);
99  deposit.setVeto(veto(candDir));
100  deposit.addCandEnergy(candTk.et());
101 
102  View<Track>::const_iterator itrTr = tracksH->begin();
103  View<Track>::const_iterator trEnd = tracksH->end();
104  for (itrTr = tracksH->begin(); itrTr != trEnd; ++itrTr) {
105  if (candDir.deltaR(reco::isodeposit::Direction(itrTr->eta(), itrTr->phi())) > theDR_Max)
106  continue;
107 
108  if (itrTr->normalizedChi2() > theChi2Ndof_Max)
109  continue;
110 
111  if (itrTr->pt() < thePt_Min)
112  continue;
113 
114  if (theChi2Prob_Min > 0 && ChiSquaredProbability(itrTr->chi2(), itrTr->ndof()) < theChi2Prob_Min)
115  continue;
116 
117  if (theNHits_Min > 0 && itrTr->numberOfValidHits() < theNHits_Min)
118  continue;
119 
120  if (candTk.isElectron()) {
121  const reco::GsfElectron* elec = dynamic_cast<const reco::GsfElectron*>(&candTk);
122  switch (dzOption) {
124  dzCut = elec->gsfTrack()->dz() - itrTr->dz();
125  break;
127  dzCut = elec->gsfTrack()->vz() - itrTr->vz();
128  break;
130  dzCut = elec->gsfTrack()->dz(beamPoint) - itrTr->dz(beamPoint);
131  break;
133  dzCut = itrTr->dz(elec->gsfTrack()->vertex());
134  break;
135  default:
136  dzCut = elec->gsfTrack()->vz() - itrTr->vz();
137  break;
138  }
139  } else {
140  switch (dzOption) {
142  dzCut = (*itrTr).dz() - candTk.vertex().z();
143  break;
145  dzCut = (*itrTr).vz() - candTk.vertex().z();
146  break;
148  dzCut = (*itrTr).dz(beamPoint) - candTk.vertex().z();
149  break;
151  dzCut = (*itrTr).dz(candTk.vertex());
152  break;
153  default:
154  dzCut = (*itrTr).vz() - candTk.vertex().z();
155  break;
156  }
157  }
158 
159  if (fabs(dzCut) > theDiff_z)
160  continue;
161 
162  if (fabs(itrTr->dxy(beamPoint)) > theDiff_r)
163  continue;
164 
165  deposit.addDeposit(reco::isodeposit::Direction(itrTr->eta(), itrTr->phi()), itrTr->pt());
166  }
167 
168  return deposit;
169 }
Handle.h
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
reco::GsfElectron::gsfTrack
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:164
MessageLogger.h
egammaisolation
Definition: EgammaTrackSelector.h:11
egammaisolation::EgammaTrackSelector::dz
Definition: EgammaTrackSelector.h:20
reco::Candidate::eta
virtual double eta() const =0
momentum pseudorapidity
ChiSquaredProbability
float ChiSquaredProbability(double chiSquared, double nrDOF)
Definition: ChiSquaredProbability.cc:13
edm
HLT enums.
Definition: AlignableModifier.h:19
egammaisolation::EgammaTrackExtractor::theBeamSpotToken
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
Definition: EgammaTrackExtractor.h:59
reco::IsoDeposit::addDeposit
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:19
egammaisolation::EgammaTrackSelector::bs
Definition: EgammaTrackSelector.h:20
ChiSquaredProbability.h
reco::IsoDeposit::Veto
Definition: IsoDeposit.h:59
egammaisolation::EgammaTrackSelector::vz
Definition: EgammaTrackSelector.h:20
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
egammaisolation::EgammaTrackExtractor::theDR_Max
double theDR_Max
z distance to vertex
Definition: EgammaTrackExtractor.h:54
edm::Handle< reco::BeamSpot >
RecoCandidate.h
IsoDepositDirection.h
egammaisolation::EgammaTrackExtractor::theChi2Ndof_Max
double theChi2Ndof_Max
trk.numberOfValidHits >= theNHits_Min
Definition: EgammaTrackExtractor.h:61
EgammaTrackExtractor.h
Track.h
TrackFwd.h
BeamSpot.h
egammaisolation::EgammaTrackExtractor::deposit
reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const override
Definition: EgammaTrackExtractor.h:32
reco::BeamSpot
Definition: BeamSpot.h:21
TrackSplittingMonitor_cfi.dzCut
dzCut
Definition: TrackSplittingMonitor_cfi.py:20
egammaisolation::EgammaTrackExtractor::dzOption
int dzOption
Definition: EgammaTrackExtractor.h:67
reco::Track
Definition: Track.h:27
reco::GsfElectron
Definition: GsfElectron.h:35
reco::BeamSpot::position
const Point & position() const
position
Definition: BeamSpot.h:59
GsfElectron.h
CaloGeometryRecord.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
egammaisolation::EgammaTrackExtractor::theChi2Prob_Min
double theChi2Prob_Min
trk.normalizedChi2 < theChi2Ndof_Max
Definition: EgammaTrackExtractor.h:62
egammaisolation::EgammaTrackExtractor::theDiff_r
double theDiff_r
minimum candidate et
Definition: EgammaTrackExtractor.h:52
edm::View
Definition: CaloClusterFwd.h:14
GsfElectronFwd.h
edm::ParameterSet
Definition: ParameterSet.h:47
reco::isodeposit::Direction::deltaR
double deltaR(const Direction &dir2) const
Definition: IsoDepositDirection.h:47
egammaisolation::EgammaTrackExtractor::theNHits_Min
unsigned int theNHits_Min
BeamSpot name.
Definition: EgammaTrackExtractor.h:60
egammaisolation::EgammaTrackExtractor::theDR_Veto
double theDR_Veto
Maximum cone angle for deposits.
Definition: EgammaTrackExtractor.h:55
egammaisolation::EgammaTrackExtractor::theDiff_z
double theDiff_z
transverse distance to vertex
Definition: EgammaTrackExtractor.h:53
reco::Candidate::vertex
virtual const Point & vertex() const =0
vertex position
egammaisolation::EgammaTrackSelector::vtx
Definition: EgammaTrackSelector.h:20
createfilelist.int
int
Definition: createfilelist.py:10
GsfTrack.h
egammaisolation::EgammaTrackExtractor::thePt_Min
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min.
Definition: EgammaTrackExtractor.h:63
edm::EventSetup
Definition: EventSetup.h:57
EgammaTrackSelector.h
reco::Candidate
Definition: Candidate.h:27
egammaisolation::EgammaTrackExtractor::vetos
virtual reco::IsoDeposit::Vetos vetos(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
Definition: EgammaTrackExtractor.cc:53
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
reco::IsoDeposit::addCandEnergy
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:132
reco::Candidate::isElectron
virtual bool isElectron() const =0
std
Definition: JetResolutionObject.h:76
GsfTrackFwd.h
egammaisolation::EgammaTrackExtractor::theBeamlineOption
std::string theBeamlineOption
Veto cone angle.
Definition: EgammaTrackExtractor.h:56
SuperClusterFwd.h
egammaisolation::EgammaTrackExtractor::dzOptionString
std::string dzOptionString
Endcap requirements to determine if isolated for selective filling.
Definition: EgammaTrackExtractor.h:66
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
EgammaRecHitIsolation.h
SuperCluster.h
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
reco::IsoDeposit
Definition: IsoDeposit.h:49
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
egammaisolation::EgammaTrackExtractor::theTrackCollectionToken
edm::EDGetTokenT< edm::View< reco::Track > > theTrackCollectionToken
Definition: EgammaTrackExtractor.h:49
mps_fire.result
result
Definition: mps_fire.py:311
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
reco::Candidate::phi
virtual double phi() const =0
momentum azimuthal angle
reco::IsoDeposit::Vetos
std::vector< Veto > Vetos
Definition: IsoDeposit.h:65
egammaisolation::EgammaTrackExtractor::veto
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
Definition: EgammaTrackExtractor.cc:60
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
reco::IsoDeposit::setVeto
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:82
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:40
reco::Candidate::et
virtual double et() const =0
transverse energy