CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackExtractor.cc
Go to the documentation of this file.
1 #include "TrackExtractor.h"
2 
5 #include "TrackSelector.h"
12 
13 using namespace edm;
14 using namespace std;
15 using namespace reco;
16 using namespace muonisolation;
18 
19 TrackExtractor::TrackExtractor( const ParameterSet& par ) :
20  theTrackCollectionTag(par.getParameter<edm::InputTag>("inputTrackCollection")),
21  theDepositLabel(par.getUntrackedParameter<string>("DepositLabel")),
22  theDiff_r(par.getParameter<double>("Diff_r")),
23  theDiff_z(par.getParameter<double>("Diff_z")),
24  theDR_Max(par.getParameter<double>("DR_Max")),
25  theDR_Veto(par.getParameter<double>("DR_Veto")),
26  theBeamlineOption(par.getParameter<string>("BeamlineOption")),
27  theBeamSpotLabel(par.getParameter<edm::InputTag>("BeamSpotLabel")),
28  theNHits_Min(par.getParameter<unsigned int>("NHits_Min")),
29  theChi2Ndof_Max(par.getParameter<double>("Chi2Ndof_Max")),
30  theChi2Prob_Min(par.getParameter<double>("Chi2Prob_Min")),
31  thePt_Min(par.getParameter<double>("Pt_Min"))
32 {
33 }
34 
36  const edm::EventSetup & evSetup, const reco::Track & track) const
37 {
38  reco::isodeposit::Direction dir(track.eta(),track.phi());
39  return reco::IsoDeposit::Vetos(1,veto(dir));
40 }
41 
43 {
45  result.vetoDir = dir;
46  result.dR = theDR_Veto;
47  return result;
48 }
49 
50 IsoDeposit TrackExtractor::deposit(const Event & event, const EventSetup & eventSetup, const Track & muon) const
51 {
52  static std::string metname = "MuonIsolation|TrackExtractor";
53 
54  reco::isodeposit::Direction muonDir(muon.eta(), muon.phi());
55  IsoDeposit deposit(muonDir );
56  deposit.setVeto( veto(muonDir) );
57  deposit.addCandEnergy(muon.pt());
58 
59  Handle<View<Track> > tracksH;
60  event.getByLabel(theTrackCollectionTag, tracksH);
61  // const TrackCollection tracks = *(tracksH.product());
62  LogTrace(metname)<<"***** TRACK COLLECTION SIZE: "<<tracksH->size();
63 
64  double vtx_z = muon.vz();
65  LogTrace(metname)<<"***** Muon vz: "<<vtx_z;
66  reco::TrackBase::Point beamPoint(0,0, 0);
67 
68  if (theBeamlineOption.compare("BeamSpotFromEvent") == 0){
69  //pick beamSpot
72 
73  event.getByLabel(theBeamSpotLabel,beamSpotH);
74 
75  if (beamSpotH.isValid()){
76  beamPoint = beamSpotH->position();
77  LogTrace(metname)<<"Extracted beam point at "<<beamPoint<<std::endl;
78  }
79  }
80 
81  LogTrace(metname)<<"Using beam point at "<<beamPoint<<std::endl;
82 
84  theDiff_r, muonDir, theDR_Max, beamPoint);
85 
86  pars.nHitsMin = theNHits_Min;
87  pars.chi2NdofMax = theChi2Ndof_Max;
88  pars.chi2ProbMin = theChi2Prob_Min;
89  pars.ptMin = thePt_Min;
90 
92  TrackSelector::result_type sel_tracks = selection(*tracksH);
93  LogTrace(metname)<<"all tracks: "<<tracksH->size()<<" selected: "<<sel_tracks.size();
94 
95 
96  TrackSelector::result_type::const_iterator tkI = sel_tracks.begin();
97  for (; tkI != sel_tracks.end(); ++tkI) {
98  const reco::Track* tk = *tkI;
99  LogTrace(metname) << "This track has: pt= " << tk->pt() << ", eta= "
100  << tk->eta() <<", phi= "<<tk->phi();
101  reco::isodeposit::Direction dirTrk(tk->eta(), tk->phi());
102  deposit.addDeposit(dirTrk, tk->pt());
103  }
104 
105  return deposit;
106 }
const std::string metname
std::list< const reco::Track * > result_type
Definition: TrackSelector.h:17
selection
main part
Definition: corrVsCorr.py:98
unsigned int theNHits_Min
BeamSpot name.
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:139
double theDR_Max
z distance to vertex
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
vector< ParameterSet > Parameters
double theDiff_r
name for deposit
double pt() const
track transverse momentum
Definition: TrackBase.h:131
tuple result
Definition: query.py:137
math::XYZPoint Point
point in the space
Definition: TrackBase.h:76
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:76
#define LogTrace(id)
edm::InputTag theBeamSpotLabel
&quot;NONE&quot;, &quot;BeamSpotFromEvent&quot;
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:147
double theChi2Ndof_Max
trk.numberOfValidHits &gt;= theNHits_Min
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.
double thePt_Min
ChiSquaredProbability(trk.chi2,trk.ndof) &gt; theChi2Prob_Min.
std::vector< Veto > Vetos
Definition: IsoDeposit.h:58
double theDR_Veto
Maximum cone angle for deposits.
muonisolation::Range< float > Range
Definition: TrackSelector.h:16
dbl *** dir
Definition: mlp_gen.cc:35
double theChi2Prob_Min
trk.normalizedChi2 &lt; theChi2Ndof_Max
virtual reco::IsoDeposit::Vetos vetos(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const