CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
muonisolation::PixelTrackExtractor Class Reference

#include <PixelTrackExtractor.h>

Inheritance diagram for muonisolation::PixelTrackExtractor:
reco::isodeposit::IsoDepositExtractor

Public Member Functions

reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const override
 
void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &track) override
 
 PixelTrackExtractor ()
 
 PixelTrackExtractor (const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
 
virtual reco::IsoDeposit::Vetos vetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
 ~PixelTrackExtractor () 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::Candidate &track) const
 
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::Direction directionAtPresetRadius (const reco::Track &tk, double bz) const
 
reco::IsoDeposit::Veto veto (const reco::IsoDeposit::Direction &dir) const
 

Private Attributes

std::string theBeamlineOption
 Veto cone angle. More...
 
edm::EDGetTokenT< reco::BeamSpottheBeamSpotToken
 "NONE", "BeamSpotFromEvent" More...
 
double theChi2Ndof_Max
 trk.numberOfValidHits >= theNHits_Min More...
 
double theChi2Prob_Min
 trk.normalizedChi2 < theChi2Ndof_Max More...
 
std::string theDepositLabel
 Track Collection Token. More...
 
double theDiff_r
 name for deposit 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...
 
double theDR_VetoPt
 .. it is above this threshold More...
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordtheFieldToken
 
unsigned int theNHits_Min
 BeamSpot name. More...
 
bool thePropagateTracksToRadius
 min track pt to include into iso deposit More...
 
double thePt_Min
 ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min. More...
 
double thePtVeto_Min
 will veto leading track if More...
 
double theReferenceRadius
 If set to true will compare track eta-phi at ... More...
 
edm::EDGetTokenT< reco::TrackCollectiontheTrackCollectionToken
 
bool theVetoLeadingTrack
 ... this radius More...
 

Detailed Description

Definition at line 20 of file PixelTrackExtractor.h.

Constructor & Destructor Documentation

◆ PixelTrackExtractor() [1/2]

muonisolation::PixelTrackExtractor::PixelTrackExtractor ( )
inline

Definition at line 22 of file PixelTrackExtractor.h.

22 {};

◆ PixelTrackExtractor() [2/2]

PixelTrackExtractor::PixelTrackExtractor ( const edm::ParameterSet par,
edm::ConsumesCollector &&  iC 
)

Definition at line 17 of file PixelTrackExtractor.cc.

18  : theFieldToken(iC.esConsumes()),
20  theDepositLabel(par.getUntrackedParameter<string>("DepositLabel")),
21  theDiff_r(par.getParameter<double>("Diff_r")),
22  theDiff_z(par.getParameter<double>("Diff_z")),
23  theDR_Max(par.getParameter<double>("DR_Max")),
24  theDR_Veto(par.getParameter<double>("DR_Veto")),
25  theBeamlineOption(par.getParameter<string>("BeamlineOption")),
27  theNHits_Min(par.getParameter<unsigned int>("NHits_Min")),
28  theChi2Ndof_Max(par.getParameter<double>("Chi2Ndof_Max")),
29  theChi2Prob_Min(par.getParameter<double>("Chi2Prob_Min")),
30  thePt_Min(par.getParameter<double>("Pt_Min")),
31  thePropagateTracksToRadius(par.getParameter<bool>("PropagateTracksToRadius")),
32  theReferenceRadius(par.getParameter<double>("ReferenceRadius")),
33  theVetoLeadingTrack(par.getParameter<bool>("VetoLeadingTrack")),
34  thePtVeto_Min(par.getParameter<double>("PtVeto_Min")),
35  theDR_VetoPt(par.getParameter<double>("DR_VetoPt"))
36 {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
double theReferenceRadius
If set to true will compare track eta-phi at ...
double theChi2Ndof_Max
trk.numberOfValidHits >= theNHits_Min
double theDR_Veto
Maximum cone angle for deposits.
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
T getUntrackedParameter(std::string const &, T const &) const
bool thePropagateTracksToRadius
min track pt to include into iso deposit
double thePtVeto_Min
will veto leading track if
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
"NONE", "BeamSpotFromEvent"
double theDR_Max
z distance to vertex
edm::EDGetTokenT< reco::TrackCollection > theTrackCollectionToken
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min.
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
std::string theDepositLabel
Track Collection Token.
double theDiff_z
transverse distance to vertex
std::string theBeamlineOption
Veto cone angle.
double theDR_VetoPt
.. it is above this threshold
unsigned int theNHits_Min
BeamSpot name.
double theChi2Prob_Min
trk.normalizedChi2 < theChi2Ndof_Max

◆ ~PixelTrackExtractor()

muonisolation::PixelTrackExtractor::~PixelTrackExtractor ( )
inlineoverride

Definition at line 25 of file PixelTrackExtractor.h.

25 {}

Member Function Documentation

◆ deposit()

IsoDeposit PixelTrackExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
overridevirtual

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

Note, this can be reset below if theVetoLeadingTrack is set and conditions are met

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 68 of file PixelTrackExtractor.cc.

References reco::IsoDeposit::addCandEnergy(), reco::IsoDeposit::addDeposit(), pwdgSkimBPark_cfi::beamSpot, Calorimetry_cff::bField, PbPb_ZMuSkimMuonDPG_cff::deltaR, directionAtPresetRadius(), reco::isodeposit::Direction::eta(), reco::TrackBase::eta(), options_cfi::eventSetup, edm::HandleBase::isValid(), LogTrace, PV_cfg::maxPt, metname, reco::isodeposit::Direction::phi(), reco::TrackBase::phi(), reco::BeamSpot::position(), reco::TrackBase::pt(), corrVsCorr::selection, reco::IsoDeposit::setVeto(), AlCaHLTBitMon_QueryRunRegistry::string, theBeamlineOption, theBeamSpotToken, theChi2Ndof_Max, theChi2Prob_Min, theDiff_r, theDiff_z, theDR_Max, theDR_VetoPt, theFieldToken, theNHits_Min, thePt_Min, thePtVeto_Min, theTrackCollectionToken, theVetoLeadingTrack, and veto().

68  {
69  static const std::string metname = "MuonIsolation|PixelTrackExtractor";
70 
71  auto const& bField = eventSetup.getData(theFieldToken);
72  double bz = bField.inInverseGeV(GlobalPoint(0., 0., 0.)).z();
73 
75  IsoDeposit deposit(muonDir);
77  deposit.setVeto(veto(muonDir));
78 
80 
82  event.getByToken(theTrackCollectionToken, tracksH);
83  // const TrackCollection tracks = *(tracksH.product());
84  LogTrace(metname) << "***** TRACK COLLECTION SIZE: " << tracksH->size();
85 
86  double vtx_z = muon.vz();
87  LogTrace(metname) << "***** Muon vz: " << vtx_z;
88  reco::TrackBase::Point beamPoint(0, 0, 0);
89 
90  if (theBeamlineOption == "BeamSpotFromEvent") {
91  //pick beamSpot
94 
95  event.getByToken(theBeamSpotToken, beamSpotH);
96 
97  if (beamSpotH.isValid()) {
98  beamPoint = beamSpotH->position();
99  LogTrace(metname) << "Extracted beam point at " << beamPoint << std::endl;
100  }
101  }
102 
103  LogTrace(metname) << "Using beam point at " << beamPoint << std::endl;
104 
106  TrackSelector::Range(vtx_z - theDiff_z, vtx_z + theDiff_z), theDiff_r, muonDir, theDR_Max, beamPoint);
107 
108  pars.nHitsMin = theNHits_Min;
109  pars.chi2NdofMax = theChi2Ndof_Max;
110  pars.chi2ProbMin = theChi2Prob_Min;
111  pars.ptMin = thePt_Min;
112 
113  TrackSelector selection(pars);
114  TrackSelector::result_type sel_tracks = selection(*tracksH);
115  LogTrace(metname) << "all tracks: " << tracksH->size() << " selected: " << sel_tracks.size();
116 
117  double maxPt = -1;
118  Direction maxPtDir;
119  TrackSelector::result_type::const_iterator tkI = sel_tracks.begin();
120  for (; tkI != sel_tracks.end(); ++tkI) {
121  const reco::Track* tk = *tkI;
122  LogTrace(metname) << "This track has: pt= " << tk->pt() << ", eta= " << tk->eta() << ", phi= " << tk->phi();
123  Direction dirTrk(directionAtPresetRadius(*tk, bz));
124  deposit.addDeposit(dirTrk, tk->pt());
125  double tkDr = (muonDir - dirTrk).deltaR;
126  double tkPt = tk->pt();
127  if (theVetoLeadingTrack && tkPt > thePtVeto_Min && tkDr < theDR_VetoPt && maxPt < tkPt) {
128  maxPt = tkPt;
129  maxPtDir = dirTrk;
130  }
131  }
132  if (maxPt > 0) {
133  deposit.setVeto(veto(maxPtDir));
134  LogTrace(metname) << " Set track veto the leading track with pt " << maxPt << " in direction (eta,phi) "
135  << maxPtDir.eta() << ", " << maxPtDir.phi();
136  }
137 
138  return deposit;
139 }
reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const override
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:82
const Point & position() const
position
Definition: BeamSpot.h:59
double theChi2Ndof_Max
trk.numberOfValidHits >= theNHits_Min
const std::string metname
std::list< const reco::Track * > result_type
Definition: TrackSelector.h:16
selection
main part
Definition: corrVsCorr.py:100
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:19
#define LogTrace(id)
double pt() const
track transverse momentum
Definition: TrackBase.h:637
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double thePtVeto_Min
will veto leading track if
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
"NONE", "BeamSpotFromEvent"
double theDR_Max
z distance to vertex
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:132
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
edm::EDGetTokenT< reco::TrackCollection > theTrackCollectionToken
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min.
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theFieldToken
maxPt
Definition: PV_cfg.py:224
double theDiff_z
transverse distance to vertex
bool isValid() const
Definition: HandleBase.h:70
std::string theBeamlineOption
Veto cone angle.
std::vector< AlignmentParameters * > Parameters
Definition: Utilities.h:32
double theDR_VetoPt
.. it is above this threshold
unsigned int theNHits_Min
BeamSpot name.
muonisolation::Range< float > Range
Definition: TrackSelector.h:15
double theChi2Prob_Min
trk.normalizedChi2 < theChi2Ndof_Max
reco::isodeposit::Direction directionAtPresetRadius(const reco::Track &tk, double bz) const

◆ directionAtPresetRadius()

Direction PixelTrackExtractor::directionAtPresetRadius ( const reco::Track tk,
double  bz 
) const
private

Definition at line 52 of file PixelTrackExtractor.cc.

References reco::TrackBase::charge(), reco::TrackBase::dxy(), reco::TrackBase::eta(), reco::TrackBase::phi(), reco::TrackBase::pt(), mathSSE::sqrt(), thePropagateTracksToRadius, and theReferenceRadius.

Referenced by deposit().

52  {
54  return Direction(tk.eta(), tk.phi());
55  }
56 
57  // this should represent a cylinder in global frame at R=refRadius cm, roughly where mid-layer of pixels is
58  double psRadius = theReferenceRadius;
59  double tkDxy = tk.dxy();
60  double s2D = fabs(tk.dxy()) < psRadius ? sqrt(psRadius * psRadius - tkDxy * tkDxy) : 0;
61 
62  // the field we get from the caller is already in units of GeV/cm
63  double dPhi = -s2D * tk.charge() * bz / tk.pt();
64 
65  return Direction(tk.eta(), tk.phi() + dPhi);
66 }
double theReferenceRadius
If set to true will compare track eta-phi at ...
bool thePropagateTracksToRadius
min track pt to include into iso deposit
double pt() const
track transverse momentum
Definition: TrackBase.h:637
int charge() const
track electric charge
Definition: TrackBase.h:596
T sqrt(T t)
Definition: SSEVec.h:19
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:608

◆ fillVetos()

void muonisolation::PixelTrackExtractor::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 27 of file PixelTrackExtractor.h.

27 {}

◆ veto()

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

Definition at line 45 of file PixelTrackExtractor.cc.

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

Referenced by deposit(), and vetos().

45  {
47  result.vetoDir = dir;
48  result.dR = theDR_Veto;
49  return result;
50 }
double theDR_Veto
Maximum cone angle for deposits.

◆ vetos()

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

Definition at line 38 of file PixelTrackExtractor.cc.

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

40  {
41  Direction dir(track.eta(), track.phi());
42  return reco::IsoDeposit::Vetos(1, veto(dir));
43 }
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
std::vector< Veto > Vetos
Definition: IsoDeposit.h:65

Member Data Documentation

◆ theBeamlineOption

std::string muonisolation::PixelTrackExtractor::theBeamlineOption
private

Veto cone angle.

Definition at line 51 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theBeamSpotToken

edm::EDGetTokenT<reco::BeamSpot> muonisolation::PixelTrackExtractor::theBeamSpotToken
private

"NONE", "BeamSpotFromEvent"

Definition at line 52 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theChi2Ndof_Max

double muonisolation::PixelTrackExtractor::theChi2Ndof_Max
private

trk.numberOfValidHits >= theNHits_Min

Definition at line 54 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theChi2Prob_Min

double muonisolation::PixelTrackExtractor::theChi2Prob_Min
private

trk.normalizedChi2 < theChi2Ndof_Max

Definition at line 55 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theDepositLabel

std::string muonisolation::PixelTrackExtractor::theDepositLabel
private

Track Collection Token.

Definition at line 46 of file PixelTrackExtractor.h.

◆ theDiff_r

double muonisolation::PixelTrackExtractor::theDiff_r
private

name for deposit

Definition at line 47 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theDiff_z

double muonisolation::PixelTrackExtractor::theDiff_z
private

transverse distance to vertex

Definition at line 48 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theDR_Max

double muonisolation::PixelTrackExtractor::theDR_Max
private

z distance to vertex

Definition at line 49 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theDR_Veto

double muonisolation::PixelTrackExtractor::theDR_Veto
private

Maximum cone angle for deposits.

Definition at line 50 of file PixelTrackExtractor.h.

Referenced by veto().

◆ theDR_VetoPt

double muonisolation::PixelTrackExtractor::theDR_VetoPt
private

.. it is above this threshold

Definition at line 63 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theFieldToken

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> muonisolation::PixelTrackExtractor::theFieldToken
private

Definition at line 44 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theNHits_Min

unsigned int muonisolation::PixelTrackExtractor::theNHits_Min
private

BeamSpot name.

Definition at line 53 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ thePropagateTracksToRadius

bool muonisolation::PixelTrackExtractor::thePropagateTracksToRadius
private

min track pt to include into iso deposit

Definition at line 58 of file PixelTrackExtractor.h.

Referenced by directionAtPresetRadius().

◆ thePt_Min

double muonisolation::PixelTrackExtractor::thePt_Min
private

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

Definition at line 56 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ thePtVeto_Min

double muonisolation::PixelTrackExtractor::thePtVeto_Min
private

will veto leading track if

Definition at line 62 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theReferenceRadius

double muonisolation::PixelTrackExtractor::theReferenceRadius
private

If set to true will compare track eta-phi at ...

Definition at line 59 of file PixelTrackExtractor.h.

Referenced by directionAtPresetRadius().

◆ theTrackCollectionToken

edm::EDGetTokenT<reco::TrackCollection> muonisolation::PixelTrackExtractor::theTrackCollectionToken
private

Definition at line 45 of file PixelTrackExtractor.h.

Referenced by deposit().

◆ theVetoLeadingTrack

bool muonisolation::PixelTrackExtractor::theVetoLeadingTrack
private

... this radius

Definition at line 61 of file PixelTrackExtractor.h.

Referenced by deposit().