CMS 3D CMS Logo

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 
7 PFTau3ProngSummary::PFTau3ProngSummary(reco::PFTauTransverseImpactParameterRef TIP,TLorentzVector a1,double vertex_chi2,double vertex_ndf){
8  TIP_=TIP;
9  for(unsigned int i=0;i<nsolutions;i++){
10  has3ProngSolution_.push_back(false);
11  solution_Chi2_.push_back(0);
12  thetaGJsig_.push_back(0);
13  tau_p4_.push_back(TLorentzVector(0,0,0,0));
14  daughter_PDGID_.push_back(std::vector<int>());
15  daughter_charge_.push_back(std::vector<int>());
16  daughter_p4_.push_back(std::vector<TLorentzVector>());
17  }
18  a1_=a1;
19  sv_=TVector3(TIP_->secondaryVertex()->x(),TIP_->secondaryVertex()->y(),TIP_->secondaryVertex()->z());
20  svcov_=TIP_->secondaryVertexCov();
21  vertex_chi2_=vertex_chi2;
22  vertex_ndf_=vertex_ndf;
23 }
24 
25 PFTau3ProngSummary::PFTau3ProngSummary(reco::PFTauTransverseImpactParameterRef TIP,TLorentzVector a1,double vertex_chi2,double vertex_ndf,TVector3 sv,CovMatrix svcov){
26  TIP_=TIP;
27  for(unsigned int i=0;i<nsolutions;i++){
28  has3ProngSolution_.push_back(false);
29  solution_Chi2_.push_back(0);
30  thetaGJsig_.push_back(0);
31  tau_p4_.push_back(TLorentzVector(0,0,0,0));
32  daughter_PDGID_.push_back(std::vector<int>());
33  daughter_charge_.push_back(std::vector<int>());
34  daughter_p4_.push_back(std::vector<TLorentzVector>());
35  }
36  a1_=a1;
37  sv_=sv;
38  svcov_=svcov;
39  vertex_chi2_=vertex_chi2;
40  vertex_ndf_=vertex_ndf;
41 }
42 
43 
45  for(unsigned int i=0;i<nsolutions;i++){
46  has3ProngSolution_.push_back(false);
47  solution_Chi2_.push_back(0);
48  thetaGJsig_.push_back(0);
49  tau_p4_.push_back(TLorentzVector(0,0,0,0));
50  daughter_PDGID_.push_back(std::vector<int>());
51  daughter_charge_.push_back(std::vector<int>());
52  daughter_p4_.push_back(std::vector<TLorentzVector>());
53  }
54 }
55 
57  return new PFTau3ProngSummary(*this);
58 }
59 
60 
61 bool PFTau3ProngSummary::AddSolution(unsigned int solution, const TLorentzVector& tau, const std::vector<TLorentzVector>& daughter_p4,
62  const std::vector<int>& daughter_charge, const std::vector<int>& daughter_PDGID,
63  bool has3ProngSolution, double solutionChi2, double thetaGJsig){
64  if(solution<nsolutions){
65  has3ProngSolution_[solution]=true;
66  solution_Chi2_[solution]=solutionChi2;
67  thetaGJsig_[solution]=thetaGJsig;
68  tau_p4_[solution]=tau;
69  daughter_PDGID_[solution]=daughter_PDGID;
70  daughter_charge_[solution]=daughter_charge;
71  daughter_p4_[solution]=daughter_p4;
72  return true;
73  }
74  return false;
75 }
76 
77 
79  for(unsigned int i=0;i<has3ProngSolution_.size();i++){
80  if(has3ProngSolution_[i]==true){
81  int charge=Tau_Charge();
82  TLorentzVector LV;
83  for(unsigned int j=0;j<daughter_p4_[i].size();j++){
84  if(daughter_charge_[i][j]==charge)LV+=daughter_p4_[i][j];
85  }
86  return LV.M();
87  }
88  }
89  return 0.0;
90 }
92  for(unsigned int i=0;i<has3ProngSolution_.size();i++){
93  if(has3ProngSolution_[i]==true){
94  int charge=Tau_Charge();
95  TLorentzVector LV_opp;
96  for(unsigned int j=0;j<daughter_p4_[i].size();j++){
97  if(daughter_charge_[i][j]==-1*charge)LV_opp=daughter_p4_[i][j];
98  }
99  TLorentzVector LV_pair;
100  bool found(false);
101  for(unsigned int j=0;j<daughter_p4_[i].size();j++){
102  if(daughter_charge_[i][j]==charge){
103  TLorentzVector LV=daughter_p4_[i][j];
104  LV+=LV_opp;
105  if(!found)LV_pair=LV;
106  else if(LV_pair.M()>LV.M())LV_pair=LV;
107  found=true;
108  }
109  }
110  if(found)return LV_pair.M();
111  }
112  }
113  return 0.0;
114 }
115 
117  for(unsigned int i=0;i<has3ProngSolution_.size();i++){
118  if(has3ProngSolution_[i]==true){
119  int charge=Tau_Charge();
120  TLorentzVector LV_opp;
121  for(unsigned int j=0;j<daughter_p4_[i].size();j++){
122  if(daughter_charge_[i][j]==-1*charge)LV_opp=daughter_p4_[i][j];
123  }
124  TLorentzVector LV_pair;
125  bool found(false);
126  for(unsigned int j=0;j<daughter_p4_[i].size();j++){
127  if(daughter_charge_[i][j]==charge){
128  TLorentzVector LV=daughter_p4_[i][j];
129  LV+=LV_opp;
130  if(!found)LV_pair=LV;
131  else if(LV_pair.M()<LV.M())LV_pair=LV;
132  found=true;
133  }
134  }
135  if(found)return LV_pair.M();
136  }
137  }
138  return 0.0;
139 }
140 
142  for(unsigned int i=0;i<has3ProngSolution_.size();i++){
143  if(has3ProngSolution_[i]==true){
144  int charge = 0;
145  for(unsigned int j=0;j<daughter_p4_[i].size();j++)charge+=daughter_charge_[i][j];
146  return charge;
147  }
148  }
149  return 0;
150 }
reco::PFTauTransverseImpactParameterRef TIP_
math::Error< dimension >::type CovMatrix
std::vector< bool > has3ProngSolution_
std::vector< double > thetaGJsig_
std::vector< double > solution_Chi2_
math::XYZTLorentzVectorD LV
bool has3ProngSolution(unsigned int i) const
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)
PFTau3ProngSummary * clone() const
fixed size matrix
std::vector< std::vector< int > > daughter_PDGID_
std::vector< std::vector< TLorentzVector > > daughter_p4_