CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PFTau3ProngSummary.cc
Go to the documentation of this file.
2 #include "TMatrixT.h"
3 #include "TMatrixTSym.h"
4 #include "TVectorT.h"
5 using namespace reco;
6 
8  TLorentzVector a1,
9  double vertex_chi2,
10  double vertex_ndf) {
11  TIP_ = TIP;
12  for (unsigned int i = 0; i < nsolutions; i++) {
13  has3ProngSolution_.push_back(false);
14  solution_Chi2_.push_back(0);
15  thetaGJsig_.push_back(0);
16  tau_p4_.push_back(TLorentzVector(0, 0, 0, 0));
17  daughter_PDGID_.push_back(std::vector<int>());
18  daughter_charge_.push_back(std::vector<int>());
19  daughter_p4_.push_back(std::vector<TLorentzVector>());
20  }
21  a1_ = a1;
22  sv_ = TVector3(TIP_->secondaryVertex()->x(), TIP_->secondaryVertex()->y(), TIP_->secondaryVertex()->z());
23  svcov_ = TIP_->secondaryVertexCov();
24  vertex_chi2_ = vertex_chi2;
25  vertex_ndf_ = vertex_ndf;
26 }
27 
29  TLorentzVector a1,
30  double vertex_chi2,
31  double vertex_ndf,
32  TVector3 sv,
33  CovMatrix svcov) {
34  TIP_ = TIP;
35  for (unsigned int i = 0; i < nsolutions; i++) {
36  has3ProngSolution_.push_back(false);
37  solution_Chi2_.push_back(0);
38  thetaGJsig_.push_back(0);
39  tau_p4_.push_back(TLorentzVector(0, 0, 0, 0));
40  daughter_PDGID_.push_back(std::vector<int>());
41  daughter_charge_.push_back(std::vector<int>());
42  daughter_p4_.push_back(std::vector<TLorentzVector>());
43  }
44  a1_ = a1;
45  sv_ = sv;
46  svcov_ = svcov;
47  vertex_chi2_ = vertex_chi2;
48  vertex_ndf_ = vertex_ndf;
49 }
50 
52  for (unsigned int i = 0; i < nsolutions; i++) {
53  has3ProngSolution_.push_back(false);
54  solution_Chi2_.push_back(0);
55  thetaGJsig_.push_back(0);
56  tau_p4_.push_back(TLorentzVector(0, 0, 0, 0));
57  daughter_PDGID_.push_back(std::vector<int>());
58  daughter_charge_.push_back(std::vector<int>());
59  daughter_p4_.push_back(std::vector<TLorentzVector>());
60  }
61 }
62 
64 
65 bool PFTau3ProngSummary::AddSolution(unsigned int solution,
66  const TLorentzVector& tau,
67  const std::vector<TLorentzVector>& daughter_p4,
68  const std::vector<int>& daughter_charge,
69  const std::vector<int>& daughter_PDGID,
70  bool has3ProngSolution,
71  double solutionChi2,
72  double thetaGJsig) {
73  if (solution < nsolutions) {
74  has3ProngSolution_[solution] = true;
75  solution_Chi2_[solution] = solutionChi2;
76  thetaGJsig_[solution] = thetaGJsig;
77  tau_p4_[solution] = tau;
78  daughter_PDGID_[solution] = daughter_PDGID;
79  daughter_charge_[solution] = daughter_charge;
80  daughter_p4_[solution] = daughter_p4;
81  return true;
82  }
83  return false;
84 }
85 
86 double PFTau3ProngSummary::M_12() const {
87  for (unsigned int i = 0; i < has3ProngSolution_.size(); i++) {
88  if (has3ProngSolution_[i] == true) {
89  int charge = Tau_Charge();
90  TLorentzVector LV;
91  for (unsigned int j = 0; j < daughter_p4_[i].size(); j++) {
92  if (daughter_charge_[i][j] == charge)
93  LV += daughter_p4_[i][j];
94  }
95  return LV.M();
96  }
97  }
98  return 0.0;
99 }
100 double PFTau3ProngSummary::M_13() const {
101  for (unsigned int i = 0; i < has3ProngSolution_.size(); i++) {
102  if (has3ProngSolution_[i] == true) {
103  int charge = Tau_Charge();
104  TLorentzVector LV_opp;
105  for (unsigned int j = 0; j < daughter_p4_[i].size(); j++) {
106  if (daughter_charge_[i][j] == -1 * charge)
107  LV_opp = daughter_p4_[i][j];
108  }
109  TLorentzVector LV_pair;
110  bool found(false);
111  for (unsigned int j = 0; j < daughter_p4_[i].size(); j++) {
112  if (daughter_charge_[i][j] == charge) {
113  TLorentzVector LV = daughter_p4_[i][j];
114  LV += LV_opp;
115  if (!found)
116  LV_pair = LV;
117  else if (LV_pair.M() > LV.M())
118  LV_pair = LV;
119  found = true;
120  }
121  }
122  if (found)
123  return LV_pair.M();
124  }
125  }
126  return 0.0;
127 }
128 
129 double PFTau3ProngSummary::M_23() const {
130  for (unsigned int i = 0; i < has3ProngSolution_.size(); i++) {
131  if (has3ProngSolution_[i] == true) {
132  int charge = Tau_Charge();
133  TLorentzVector LV_opp;
134  for (unsigned int j = 0; j < daughter_p4_[i].size(); j++) {
135  if (daughter_charge_[i][j] == -1 * charge)
136  LV_opp = daughter_p4_[i][j];
137  }
138  TLorentzVector LV_pair;
139  bool found(false);
140  for (unsigned int j = 0; j < daughter_p4_[i].size(); j++) {
141  if (daughter_charge_[i][j] == charge) {
142  TLorentzVector LV = daughter_p4_[i][j];
143  LV += LV_opp;
144  if (!found)
145  LV_pair = LV;
146  else if (LV_pair.M() < LV.M())
147  LV_pair = LV;
148  found = true;
149  }
150  }
151  if (found)
152  return LV_pair.M();
153  }
154  }
155  return 0.0;
156 }
157 
159  for (unsigned int i = 0; i < has3ProngSolution_.size(); i++) {
160  if (has3ProngSolution_[i] == true) {
161  int charge = 0;
162  for (unsigned int j = 0; j < daughter_p4_[i].size(); j++)
163  charge += daughter_charge_[i][j];
164  return charge;
165  }
166  }
167  return 0;
168 }
PFTau3ProngSummary * clone() const
reco::PFTauTransverseImpactParameterRef TIP_
math::Error< dimension >::type CovMatrix
std::vector< bool > has3ProngSolution_
math::XYZTLorentzVectorD LV
std::vector< double > thetaGJsig_
std::vector< double > solution_Chi2_
std::vector< TLorentzVector > tau_p4_
std::vector< std::vector< int > > daughter_charge_
PFTau3ProngSummary()
constructor from values
virtual bool AddSolution(unsigned int solution, const TLorentzVector &tau, const std::vector< TLorentzVector > &daughter_p4, const std::vector< int > &daughter_charge, const std::vector< int > &daughter_PDGID, bool has3ProngSolution, double solutionChi2, double thetaGJsig)
fixed size matrix
std::vector< std::vector< int > > daughter_PDGID_
std::vector< std::vector< TLorentzVector > > daughter_p4_
reco::Particle::LorentzVector LV