CMS 3D CMS Logo

ImpactParameterAlgorithm.cc
Go to the documentation of this file.
2 
5 
8 
10  ip_min = -9999;
11  ip_max = 9999;
12  sip_min = 0;
13  use_sign = false;
14  use3D = false;
15 }
16 
18  ip_min = parameters.getParameter<double>("TauImpactParameterMin");
19  ip_max = parameters.getParameter<double>("TauImpactParameterMax");
20  sip_min = parameters.getParameter<double>("TauImpactParameterSignificanceMin");
21  use_sign = parameters.getParameter<bool>("UseTauImpactParameterSign");
22  use3D = parameters.getParameter<bool>("UseTau3DImpactParameter");
23 
24 }
25 
27  transientTrackBuilder = builder;
28 }
29 
30 
31 std::pair<float,reco::TauImpactParameterInfo> ImpactParameterAlgorithm::tag(const reco::IsolatedTauTagInfoRef & tauRef, const reco::Vertex & pv) {
32 
33  if(transientTrackBuilder == nullptr){
34  throw cms::Exception("NullTransientTrackBuilder") << "Transient track builder is 0. ";
35  }
36 
37  reco::TauImpactParameterInfo resultExtended;
38  resultExtended.setIsolatedTauTag(tauRef);
39 
40  const reco::Jet* jet = tauRef->jet().get();
41  GlobalVector direction(jet->px(),jet->py(),jet->pz());
42 
43  const reco::TrackRefVector& tracks = tauRef->selectedTracks();
44 
46  for(iTrack = tracks.begin(); iTrack!= tracks.end(); iTrack++){
47 
48  const reco::TransientTrack transientTrack = (transientTrackBuilder->build(&(**iTrack)));
49 
51  Measurement1D ip = stip.apply(transientTrack,direction,pv).second;
52 
53  SignedImpactParameter3D signed_ip3D;
54  Measurement1D ip3D = signed_ip3D.apply(transientTrack,direction,pv).second;
55  LogDebug("ImpactParameterAlgorithm::tag") << "check pv,ip3d " << pv.z() << " " << ip3D.value() ;
56  if(!use_sign){
57  Measurement1D tmp2D(fabs(ip.value()),ip.error());
58  ip = tmp2D;
59 
60  Measurement1D tmp3D(fabs(ip3D.value()),ip3D.error());
61  ip3D = tmp3D;
62  }
63 
65 
66  theData.transverseIp = ip;
67  theData.ip3D = ip3D;
68  resultExtended.storeTrackData(*iTrack,theData);
69 
70  }
71 
73 
74  return std::make_pair( discriminator, resultExtended );
75 }
#define LogDebug(id)
T getParameter(std::string const &) const
void setIsolatedTauTag(const IsolatedTauTagInfoRef &)
std::pair< bool, Measurement1D > apply(const reco::TransientTrack &, const GlobalVector &, const reco::Vertex &) const
Base class for all types of Jets.
Definition: Jet.h:20
double px() const final
x coordinate of momentum vector
float discriminator(double, double, double, bool, bool) const
reco::TransientTrack build(const reco::Track *p) const
double error() const
Definition: Measurement1D.h:27
void setTransientTrackBuilder(const TransientTrackBuilder *)
double pz() const final
z coordinate of momentum vector
def pv(vc)
Definition: MetAnalyzer.py:7
double z() const
z coordinate
Definition: Vertex.h:115
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:243
const TransientTrackBuilder * transientTrackBuilder
double py() const final
y coordinate of momentum vector
double value() const
Definition: Measurement1D.h:25
std::pair< float, reco::TauImpactParameterInfo > tag(const reco::IsolatedTauTagInfoRef &, const reco::Vertex &)
void storeTrackData(const reco::TrackRef &, const TauImpactParameterTrackData &)
std::pair< bool, Measurement1D > apply(const reco::TransientTrack &, const GlobalVector &direction, const reco::Vertex &vertex) const