CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ImpactParameterAlgorithm.cc
Go to the documentation of this file.
2 
5 
7 
9  ip_min = -9999;
10  ip_max = 9999;
11  sip_min = 0;
12  use_sign = false;
13  use3D = false;
14 }
15 
17  ip_min = parameters.getParameter<double>("TauImpactParameterMin");
18  ip_max = parameters.getParameter<double>("TauImpactParameterMax");
19  sip_min = parameters.getParameter<double>("TauImpactParameterSignificanceMin");
20  use_sign = parameters.getParameter<bool>("UseTauImpactParameterSign");
21  use3D = parameters.getParameter<bool>("UseTau3DImpactParameter");
22 
23 }
24 
26  transientTrackBuilder = builder;
27 }
28 
29 
30 std::pair<float,reco::TauImpactParameterInfo> ImpactParameterAlgorithm::tag(const reco::IsolatedTauTagInfoRef & tauRef, const reco::Vertex & pv) {
31 
32  if(transientTrackBuilder == 0){
33  std::cout << "Transient track builder is 0. abort!" << std::endl;
34  abort(); //FIXME: trow an exception here
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  //std::cout << "check pv,ip3d,track z " << pv.z() << " " << ip3D.value() << " " << transientTrack->dz() << std::endl;
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 
72  float discriminator = resultExtended.discriminator(ip_min,ip_max,sip_min,use_sign,use3D);
73 
74  return std::make_pair( discriminator, resultExtended );
75 }
T getParameter(std::string const &) const
void setIsolatedTauTag(const IsolatedTauTagInfoRef &)
dictionary parameters
Definition: Parameters.py:2
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
float discriminator(double, double, double, bool, bool) const
reco::TransientTrack build(const reco::Track *p) const
double error() const
Definition: Measurement1D.h:30
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
void setTransientTrackBuilder(const TransientTrackBuilder *)
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
const TransientTrackBuilder * transientTrackBuilder
tuple tracks
Definition: testEve_cfg.py:39
double value() const
Definition: Measurement1D.h:28
tuple cout
Definition: gather_cfg.py:121
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