test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SimpleSecondaryVertexComputer.h
Go to the documentation of this file.
1 #ifndef RecoBTag_SecondaryVertex_SimpleSecondaryVertexComputer_h
2 #define RecoBTag_SecondaryVertex_SimpleSecondaryVertexComputer_h
3 
4 #include <cmath>
5 
6 #include "Math/GenVector/VectorUtil.h"
7 
11 
13 
15 
17  public:
19  use2d(!parameters.getParameter<bool>("use3d")),
20  useSig(parameters.getParameter<bool>("useSignificance")),
21  unBoost(parameters.getParameter<bool>("unBoost")),
22  minTracks(parameters.getParameter<unsigned int>("minTracks")),
23  minVertices_(1)
24  {
25  uses("svTagInfos");
26  minVertices_ = parameters.existsAs<unsigned int>("minVertices") ? parameters.getParameter<unsigned int>("minVertices") : 1 ;
27  }
28 
29  float discriminator(const TagInfoHelper &tagInfos) const
30  {
33  if(info.nVertices() < minVertices_) return -1;
34  unsigned int idx = 0;
35  while(idx < info.nVertices()) {
36  if (info.nVertexTracks(idx) >= minTracks)
37  break;
38  idx++;
39  }
40  if (idx >= info.nVertices())
41  return -1.0;
42 
43  double gamma;
44  if (unBoost) {
45  reco::TrackKinematics kinematics(
46  info.secondaryVertex(idx));
47  gamma = kinematics.vectorSum().Gamma();
48  } else
49  gamma = 1.0;
50 
51  double value;
52  if (useSig)
53  value = info.flightDistance(idx, use2d).significance();
54  else
55  value = info.flightDistance(idx, use2d).value();
56 
57  value /= gamma;
58 
59  if (useSig)
60  value = (value > 0) ? +std::log(1 + value)
61  : -std::log(1 - value);
62 
63  return value;
64  }
65 
66  private:
67  bool use2d;
68  bool useSig;
69  bool unBoost;
70  unsigned int minTracks;
71  unsigned int minVertices_;
72 };
73 
74 #endif // RecoBTag_SecondaryVertex_SimpleSecondaryVertexComputer_h
T getParameter(std::string const &) const
dictionary parameters
Definition: Parameters.py:2
static const TGPicture * info(bool iBackgroundIsBlack)
const T & get(unsigned int index=0) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
Measurement1D flightDistance(unsigned int index, bool in2d=false) const
const Vertex & secondaryVertex(unsigned int index) const
void uses(unsigned int id, const std::string &label)
double significance() const
Definition: Measurement1D.h:32
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
double value() const
Definition: Measurement1D.h:28
const math::XYZTLorentzVector & vectorSum() const
float discriminator(const TagInfoHelper &tagInfos) const
SimpleSecondaryVertexComputer(const edm::ParameterSet &parameters)