CMS 3D CMS Logo

TrackExtractor.cc
Go to the documentation of this file.
1 #include "TrackExtractor.h"
2 
5 #include "TrackSelector.h"
8 
9 using namespace edm;
10 using namespace std;
11 using namespace reco;
12 using namespace muonisolation;
14 
15 TrackExtractor::TrackExtractor(const ParameterSet& par, edm::ConsumesCollector&& iC)
16  : theTrackCollectionToken(iC.consumes<TrackCollection>(par.getParameter<edm::InputTag>("inputTrackCollection"))),
17  theDepositLabel(par.getUntrackedParameter<string>("DepositLabel")),
18  theDiff_r(par.getParameter<double>("Diff_r")),
19  theDiff_z(par.getParameter<double>("Diff_z")),
20  theDR_Max(par.getParameter<double>("DR_Max")),
21  theDR_Veto(par.getParameter<double>("DR_Veto")),
22  theBeamlineOption(par.getParameter<string>("BeamlineOption")),
23  theBeamSpotToken(iC.consumes<reco::BeamSpot>(par.getParameter<edm::InputTag>("BeamSpotLabel"))),
24  theNHits_Min(par.getParameter<unsigned int>("NHits_Min")),
25  theChi2Ndof_Max(par.getParameter<double>("Chi2Ndof_Max")),
26  theChi2Prob_Min(par.getParameter<double>("Chi2Prob_Min")),
27  thePt_Min(par.getParameter<double>("Pt_Min")) {}
28 
30  const edm::EventSetup& evSetup,
31  const reco::Track& track) const {
33  return reco::IsoDeposit::Vetos(1, veto(dir));
34 }
35 
38  result.vetoDir = dir;
39  result.dR = theDR_Veto;
40  return result;
41 }
42 
44  static const std::string metname = "MuonIsolation|TrackExtractor";
45 
46  reco::isodeposit::Direction muonDir(muon.eta(), muon.phi());
47  IsoDeposit deposit(muonDir);
48  deposit.setVeto(veto(muonDir));
50 
52  event.getByToken(theTrackCollectionToken, tracksH);
53  // const TrackCollection tracks = *(tracksH.product());
54  LogTrace(metname) << "***** TRACK COLLECTION SIZE: " << tracksH->size();
55 
56  double vtx_z = muon.vz();
57  LogTrace(metname) << "***** Muon vz: " << vtx_z;
58  reco::TrackBase::Point beamPoint(0, 0, 0);
59 
60  if (theBeamlineOption == "BeamSpotFromEvent") {
61  //pick beamSpot
64 
65  event.getByToken(theBeamSpotToken, beamSpotH);
66 
67  if (beamSpotH.isValid()) {
68  beamPoint = beamSpotH->position();
69  LogTrace(metname) << "Extracted beam point at " << beamPoint << std::endl;
70  }
71  }
72 
73  LogTrace(metname) << "Using beam point at " << beamPoint << std::endl;
74 
76  TrackSelector::Range(vtx_z - theDiff_z, vtx_z + theDiff_z), theDiff_r, muonDir, theDR_Max, beamPoint);
77 
78  pars.nHitsMin = theNHits_Min;
79  pars.chi2NdofMax = theChi2Ndof_Max;
80  pars.chi2ProbMin = theChi2Prob_Min;
81  pars.ptMin = thePt_Min;
82 
84  TrackSelector::result_type sel_tracks = selection(*tracksH);
85  LogTrace(metname) << "all tracks: " << tracksH->size() << " selected: " << sel_tracks.size();
86 
87  TrackSelector::result_type::const_iterator tkI = sel_tracks.begin();
88  for (; tkI != sel_tracks.end(); ++tkI) {
89  const reco::Track* tk = *tkI;
90  LogTrace(metname) << "This track has: pt= " << tk->pt() << ", eta= " << tk->eta() << ", phi= " << tk->phi();
91  reco::isodeposit::Direction dirTrk(tk->eta(), tk->phi());
92  deposit.addDeposit(dirTrk, tk->pt());
93  }
94 
95  return deposit;
96 }
Range.h
Handle.h
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
muonisolation::TrackExtractor::theNHits_Min
unsigned int theNHits_Min
BeamSpot name.
Definition: TrackExtractor.h:48
MessageLogger.h
muon
Definition: MuonCocktails.h:17
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::IsoDeposit::addDeposit
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:19
reco::IsoDeposit::Veto
Definition: IsoDeposit.h:59
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
muonisolation::TrackExtractor::theDR_Veto
double theDR_Veto
Maximum cone angle for deposits.
Definition: TrackExtractor.h:45
edm::Handle
Definition: AssociativeIterator.h:50
IsoDepositDirection.h
muonisolation::TrackExtractor::deposit
reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const override
Definition: TrackExtractor.cc:43
reco::TrackBase::pt
double pt() const
track transverse momentum
Definition: TrackBase.h:608
muonisolation::TrackExtractor::theDiff_r
double theDiff_r
name for deposit
Definition: TrackExtractor.h:42
reco::BeamSpot
Definition: BeamSpot.h:21
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
reco::Track
Definition: Track.h:27
muonisolation::TrackExtractor::veto
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
Definition: TrackExtractor.cc:36
reco::BeamSpot::position
const Point & position() const
position
Definition: BeamSpot.h:59
reco::TrackBase::phi
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:620
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
reco::TrackBase::eta
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:623
createfilelist.int
int
Definition: createfilelist.py:10
muonisolation::TrackExtractor::theTrackCollectionToken
edm::EDGetTokenT< reco::TrackCollection > theTrackCollectionToken
Definition: TrackExtractor.h:40
muonisolation::TrackExtractor::theDiff_z
double theDiff_z
transverse distance to vertex
Definition: TrackExtractor.h:43
TrackSelector.h
muonisolation::TrackExtractor::vetos
virtual reco::IsoDeposit::Vetos vetos(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
Definition: TrackExtractor.cc:29
edm::EventSetup
Definition: EventSetup.h:57
muonisolation::TrackExtractor::theChi2Ndof_Max
double theChi2Ndof_Max
trk.numberOfValidHits >= theNHits_Min
Definition: TrackExtractor.h:49
muonisolation
Definition: CandViewExtractor.h:16
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
muonisolation::TrackExtractor::theDR_Max
double theDR_Max
z distance to vertex
Definition: TrackExtractor.h:44
reco::IsoDeposit::addCandEnergy
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:132
TrackExtractor.h
std
Definition: JetResolutionObject.h:76
muonisolation::TrackSelector::result_type
std::list< const reco::Track * > result_type
Definition: TrackSelector.h:16
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
options_cfi.eventSetup
eventSetup
Definition: options_cfi.py:12
reco::IsoDeposit
Definition: IsoDeposit.h:49
muonisolation::TrackSelector::Range
muonisolation::Range< float > Range
Definition: TrackSelector.h:15
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
mps_fire.result
result
Definition: mps_fire.py:303
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
event
Definition: event.py:1
muonisolation::TrackExtractor::theBeamSpotToken
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
"NONE", "BeamSpotFromEvent"
Definition: TrackExtractor.h:47
edm::Event
Definition: Event.h:73
Parameters
vector< ParameterSet > Parameters
Definition: HLTMuonPlotter.cc:25
reco::IsoDeposit::Vetos
std::vector< Veto > Vetos
Definition: IsoDeposit.h:65
muonisolation::TrackExtractor::theChi2Prob_Min
double theChi2Prob_Min
trk.normalizedChi2 < theChi2Ndof_Max
Definition: TrackExtractor.h:50
muonisolation::TrackSelector
Definition: TrackSelector.h:13
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
muonisolation::TrackExtractor::thePt_Min
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) > theChi2Prob_Min.
Definition: TrackExtractor.h:51
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
reco::IsoDeposit::setVeto
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:82
muonisolation::TrackExtractor::theBeamlineOption
std::string theBeamlineOption
Veto cone angle.
Definition: TrackExtractor.h:46
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43