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
muonisolation::PixelTrackExtractor Class Reference

#include <PixelTrackExtractor.h>

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

Public Member Functions

virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
 
virtual void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &track)
 
 PixelTrackExtractor ()
 
 PixelTrackExtractor (const edm::ParameterSet &par)
 
virtual reco::IsoDeposit::Vetos vetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
virtual ~PixelTrackExtractor ()
 
- 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::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 ~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::InputTag theBeamSpotLabel
 "NONE", "BeamSpotFromEvent" More...
 
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
 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...
 
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::InputTag theTrackCollectionTag
 
bool theVetoLeadingTrack
 ... this radius More...
 

Detailed Description

Definition at line 15 of file PixelTrackExtractor.h.

Constructor & Destructor Documentation

muonisolation::PixelTrackExtractor::PixelTrackExtractor ( )
inline

Definition at line 19 of file PixelTrackExtractor.h.

19 {};
PixelTrackExtractor::PixelTrackExtractor ( const edm::ParameterSet par)

Definition at line 24 of file PixelTrackExtractor.cc.

24  :
25  theTrackCollectionTag(par.getParameter<edm::InputTag>("inputTrackCollection")),
26  theDepositLabel(par.getUntrackedParameter<string>("DepositLabel")),
27  theDiff_r(par.getParameter<double>("Diff_r")),
28  theDiff_z(par.getParameter<double>("Diff_z")),
29  theDR_Max(par.getParameter<double>("DR_Max")),
30  theDR_Veto(par.getParameter<double>("DR_Veto")),
31  theBeamlineOption(par.getParameter<string>("BeamlineOption")),
32  theBeamSpotLabel(par.getParameter<edm::InputTag>("BeamSpotLabel")),
33  theNHits_Min(par.getParameter<unsigned int>("NHits_Min")),
34  theChi2Ndof_Max(par.getParameter<double>("Chi2Ndof_Max")),
35  theChi2Prob_Min(par.getParameter<double>("Chi2Prob_Min")),
36  thePt_Min(par.getParameter<double>("Pt_Min")),
37  thePropagateTracksToRadius(par.getParameter<bool>("PropagateTracksToRadius")),
38  theReferenceRadius(par.getParameter<double>("ReferenceRadius")),
39  theVetoLeadingTrack(par.getParameter<bool>("VetoLeadingTrack")),
40  thePtVeto_Min(par.getParameter<double>("PtVeto_Min")),
41  theDR_VetoPt(par.getParameter<double>("DR_VetoPt"))
42 {
43 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double theReferenceRadius
If set to true will compare track eta-phi at ...
double theChi2Ndof_Max
trk.numberOfValidHits &gt;= theNHits_Min
double theDR_Veto
Maximum cone angle for deposits.
bool thePropagateTracksToRadius
min track pt to include into iso deposit
double thePtVeto_Min
will veto leading track if
double theDR_Max
z distance to vertex
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) &gt; theChi2Prob_Min.
std::string theDepositLabel
Track Collection Label.
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 &lt; theChi2Ndof_Max
edm::InputTag theBeamSpotLabel
&quot;NONE&quot;, &quot;BeamSpotFromEvent&quot;
virtual muonisolation::PixelTrackExtractor::~PixelTrackExtractor ( )
inlinevirtual

Definition at line 22 of file PixelTrackExtractor.h.

22 {}

Member Function Documentation

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

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 76 of file PixelTrackExtractor.cc.

References reco::IsoDeposit::addCandEnergy(), reco::IsoDeposit::addDeposit(), SiPixelRawToDigiRegional_cfi::beamSpot, ecalTB2006H4_GenSimDigiReco_cfg::bField, deltaR(), directionAtPresetRadius(), reco::isodeposit::Direction::eta(), reco::TrackBase::eta(), edm::EventSetup::get(), edm::HandleBase::isValid(), LogTrace, metname, reco::isodeposit::Direction::phi(), reco::TrackBase::phi(), reco::TrackBase::pt(), corrVsCorr::selection, reco::IsoDeposit::setVeto(), theBeamlineOption, theBeamSpotLabel, theChi2Ndof_Max, theChi2Prob_Min, theDiff_r, theDiff_z, theDR_Max, theDR_VetoPt, theNHits_Min, thePt_Min, thePtVeto_Min, theTrackCollectionTag, theVetoLeadingTrack, veto(), and reco::TrackBase::vz().

77 {
78  static std::string metname = "MuonIsolation|PixelTrackExtractor";
79 
81  eventSetup.get<IdealMagneticFieldRecord>().get(bField);
82  double bz = bField->inInverseGeV(GlobalPoint(0.,0.,0.)).z();
83 
85  IsoDeposit deposit(muonDir );
87  deposit.setVeto( veto(muonDir) );
88 
90 
91  Handle<View<Track> > tracksH;
92  event.getByLabel(theTrackCollectionTag, tracksH);
93  // const TrackCollection tracks = *(tracksH.product());
94  LogTrace(metname)<<"***** TRACK COLLECTION SIZE: "<<tracksH->size();
95 
96  double vtx_z = muon.vz();
97  LogTrace(metname)<<"***** Muon vz: "<<vtx_z;
98  reco::TrackBase::Point beamPoint(0,0, 0);
99 
100  if (theBeamlineOption.compare("BeamSpotFromEvent") == 0){
101  //pick beamSpot
103  edm::Handle<reco::BeamSpot> beamSpotH;
104 
105  event.getByLabel(theBeamSpotLabel,beamSpotH);
106 
107  if (beamSpotH.isValid()){
108  beamPoint = beamSpotH->position();
109  LogTrace(metname)<<"Extracted beam point at "<<beamPoint<<std::endl;
110  }
111  }
112 
113  LogTrace(metname)<<"Using beam point at "<<beamPoint<<std::endl;
114 
116  theDiff_r, muonDir, theDR_Max, beamPoint);
117 
118  pars.nHitsMin = theNHits_Min;
119  pars.chi2NdofMax = theChi2Ndof_Max;
120  pars.chi2ProbMin = theChi2Prob_Min;
121  pars.ptMin = thePt_Min;
122 
123  TrackSelector selection(pars);
124  TrackSelector::result_type sel_tracks = selection(*tracksH);
125  LogTrace(metname)<<"all tracks: "<<tracksH->size()<<" selected: "<<sel_tracks.size();
126 
127 
128  double maxPt = -1;
129  Direction maxPtDir;
130  TrackSelector::result_type::const_iterator tkI = sel_tracks.begin();
131  for (; tkI != sel_tracks.end(); ++tkI) {
132  const reco::Track* tk = *tkI;
133  LogTrace(metname) << "This track has: pt= " << tk->pt() << ", eta= "
134  << tk->eta() <<", phi= "<<tk->phi();
135  Direction dirTrk(directionAtPresetRadius(*tk, bz));
136  deposit.addDeposit(dirTrk, tk->pt());
137  double tkDr = (muonDir-dirTrk).deltaR;
138  double tkPt = tk->pt();
139  if (theVetoLeadingTrack && tkPt > thePtVeto_Min
140  && tkDr < theDR_VetoPt
141  && maxPt < tkPt ){
142  maxPt = tkPt;
143  maxPtDir = dirTrk;
144  }
145  }
146  if (maxPt > 0){
147  deposit.setVeto(veto(maxPtDir));
148  LogTrace(metname)<<" Set track veto the leading track with pt "
149  <<maxPt<<" in direction (eta,phi) "
150  <<maxPtDir.eta()<<", "<<maxPtDir.phi();
151  }
152 
153  return deposit;
154 }
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:75
double theChi2Ndof_Max
trk.numberOfValidHits &gt;= theNHits_Min
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
const std::string metname
std::list< const reco::Track * > result_type
Definition: TrackSelector.h:17
selection
main part
Definition: corrVsCorr.py:98
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:139
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:23
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
vector< ParameterSet > Parameters
double thePtVeto_Min
will veto leading track if
double pt() const
track transverse momentum
Definition: TrackBase.h:131
double theDR_Max
z distance to vertex
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:134
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) &gt; theChi2Prob_Min.
math::XYZPoint Point
point in the space
Definition: TrackBase.h:76
bool isValid() const
Definition: HandleBase.h:76
#define LogTrace(id)
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double theDiff_z
transverse distance to vertex
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
std::string theBeamlineOption
Veto cone angle.
reco::isodeposit::Direction directionAtPresetRadius(const reco::Track &tk, double bz) const
double theDR_VetoPt
.. it is above this threshold
unsigned int theNHits_Min
BeamSpot name.
muonisolation::Range< float > Range
Definition: TrackSelector.h:16
double theChi2Prob_Min
trk.normalizedChi2 &lt; theChi2Ndof_Max
edm::InputTag theBeamSpotLabel
&quot;NONE&quot;, &quot;BeamSpotFromEvent&quot;
Direction PixelTrackExtractor::directionAtPresetRadius ( const reco::Track tk,
double  bz 
) const
private

Definition at line 60 of file PixelTrackExtractor.cc.

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

Referenced by deposit().

60  {
62  return Direction(tk.eta(), tk.phi());
63  }
64 
65  // this should represent a cylinder in global frame at R=refRadius cm, roughly where mid-layer of pixels is
66  double psRadius = theReferenceRadius;
67  double tkDxy = tk.dxy();
68  double s2D = fabs(tk.dxy()) < psRadius ? sqrt(psRadius*psRadius - tkDxy*tkDxy) : 0;
69 
70  // the field we get from the caller is already in units of GeV/cm
71  double dPhi = -s2D*tk.charge()*bz/tk.pt();
72 
73  return Direction(tk.eta(), tk.phi()+dPhi);
74 }
double theReferenceRadius
If set to true will compare track eta-phi at ...
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:139
bool thePropagateTracksToRadius
min track pt to include into iso deposit
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
T sqrt(T t)
Definition: SSEVec.h:46
double pt() const
track transverse momentum
Definition: TrackBase.h:131
int charge() const
track electric charge
Definition: TrackBase.h:113
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:121
virtual void muonisolation::PixelTrackExtractor::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 24 of file PixelTrackExtractor.h.

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

Definition at line 52 of file PixelTrackExtractor.cc.

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

Referenced by deposit(), and vetos().

53 {
55  result.vetoDir = dir;
56  result.dR = theDR_Veto;
57  return result;
58 }
double theDR_Veto
Maximum cone angle for deposits.
tuple result
Definition: query.py:137
dbl *** dir
Definition: mlp_gen.cc:35
reco::IsoDeposit::Vetos PixelTrackExtractor::vetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
virtual

Definition at line 45 of file PixelTrackExtractor.cc.

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

47 {
48  Direction dir(track.eta(),track.phi());
49  return reco::IsoDeposit::Vetos(1,veto(dir));
50 }
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:139
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
std::vector< Veto > Vetos
Definition: IsoDeposit.h:58
dbl *** dir
Definition: mlp_gen.cc:35

Member Data Documentation

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

Veto cone angle.

Definition at line 45 of file PixelTrackExtractor.h.

Referenced by deposit().

edm::InputTag muonisolation::PixelTrackExtractor::theBeamSpotLabel
private

"NONE", "BeamSpotFromEvent"

Definition at line 46 of file PixelTrackExtractor.h.

Referenced by deposit().

double muonisolation::PixelTrackExtractor::theChi2Ndof_Max
private

trk.numberOfValidHits >= theNHits_Min

Definition at line 48 of file PixelTrackExtractor.h.

Referenced by deposit().

double muonisolation::PixelTrackExtractor::theChi2Prob_Min
private

trk.normalizedChi2 < theChi2Ndof_Max

Definition at line 49 of file PixelTrackExtractor.h.

Referenced by deposit().

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

Track Collection Label.

Definition at line 40 of file PixelTrackExtractor.h.

double muonisolation::PixelTrackExtractor::theDiff_r
private

name for deposit

Definition at line 41 of file PixelTrackExtractor.h.

Referenced by deposit().

double muonisolation::PixelTrackExtractor::theDiff_z
private

transverse distance to vertex

Definition at line 42 of file PixelTrackExtractor.h.

Referenced by deposit().

double muonisolation::PixelTrackExtractor::theDR_Max
private

z distance to vertex

Definition at line 43 of file PixelTrackExtractor.h.

Referenced by deposit().

double muonisolation::PixelTrackExtractor::theDR_Veto
private

Maximum cone angle for deposits.

Definition at line 44 of file PixelTrackExtractor.h.

Referenced by veto().

double muonisolation::PixelTrackExtractor::theDR_VetoPt
private

.. it is above this threshold

Definition at line 57 of file PixelTrackExtractor.h.

Referenced by deposit().

unsigned int muonisolation::PixelTrackExtractor::theNHits_Min
private

BeamSpot name.

Definition at line 47 of file PixelTrackExtractor.h.

Referenced by deposit().

bool muonisolation::PixelTrackExtractor::thePropagateTracksToRadius
private

min track pt to include into iso deposit

Definition at line 52 of file PixelTrackExtractor.h.

Referenced by directionAtPresetRadius().

double muonisolation::PixelTrackExtractor::thePt_Min
private

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

Definition at line 50 of file PixelTrackExtractor.h.

Referenced by deposit().

double muonisolation::PixelTrackExtractor::thePtVeto_Min
private

will veto leading track if

Definition at line 56 of file PixelTrackExtractor.h.

Referenced by deposit().

double muonisolation::PixelTrackExtractor::theReferenceRadius
private

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

Definition at line 53 of file PixelTrackExtractor.h.

Referenced by directionAtPresetRadius().

edm::InputTag muonisolation::PixelTrackExtractor::theTrackCollectionTag
private

Definition at line 39 of file PixelTrackExtractor.h.

Referenced by deposit().

bool muonisolation::PixelTrackExtractor::theVetoLeadingTrack
private

... this radius

Definition at line 55 of file PixelTrackExtractor.h.

Referenced by deposit().