ATLAS Offline Software
TauPi0Candidate.icc
Go to the documentation of this file.
1 // dear emacs, this is -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
8 //using namespace CLHEP;
9 
10 namespace Analysis{
11 
12  //-------------------------------------------------------------------------
13  // clusters
14  //-------------------------------------------------------------------------
15 
16  inline const TauPi0Cluster* TauPi0Candidate::pi0Cluster(unsigned int i) const
17  {
18  return m_pi0ClusterVector[i];
19  }
20 
21  inline const std::vector<TauPi0Cluster*>& TauPi0Candidate::pi0ClusterVec() const
22  {
23  return m_pi0ClusterVector ;
24  }
25 
26  inline std::vector<TauPi0Cluster*>& TauPi0Candidate::pi0ClusterVec()
27  {
28  return m_pi0ClusterVector;
29  }
30 
31  inline unsigned int TauPi0Candidate::nPi0Cluster() const
32  {
33  return m_pi0ClusterVector.size();
34  }
35 
36  inline CLHEP::HepLorentzVector TauPi0Candidate::hlv() const
37  {
38  CLHEP::HepLorentzVector cand4Mom(0., 0., 0., 0.);
39  double mPi0 = 134.98*CLHEP::MeV;
40  if(this->nPi0Cluster() == 1){
41 
42  // Cluster E has been measured in Calo. Cluster Pt has been calculated using a 0 mass hypthesis.
43  // Therefore recalculate Cluster Pt using pi0 mass hypothesis
44  double clusterE = this->pi0Cluster( 0 )->cluster()->e();
45  double clusterEta = this->pi0Cluster( 0 )->cluster()->eta();
46  // Make sure clusterE>=mPi0, since sqrt(clusterE*clusterE-mPi0*mPi0) is used
47  if(clusterE<mPi0) clusterE = mPi0;
48  double clusterPt = std::sqrt(clusterE*clusterE-mPi0*mPi0)/std::cosh(clusterEta);
49 
50  // Set hlv. Steps are copied from /atlas/Trigger/TrigAlgorithms/TrigDiMuon/src/TrigDiMuonFast.cxx
51  double clusterPhi = this->pi0Cluster( 0 )->cluster()->phi();
52 
53  double cot=1/std::tan(2*std::atan(std::exp(-clusterEta)));
54  double px=std::cos(clusterPhi)*clusterPt;
55  double py=std::sin(clusterPhi)*clusterPt;
56  double pz=cot*clusterPt;
57 
58  cand4Mom = CLHEP::HepLorentzVector(px,py,pz,clusterE);
59  }
60  // TODO: Reconsider how to define the hlv for nPi0Cluster!=1.
61  else if(this->nPi0Cluster() != 0){
62  for(unsigned iCluster=0; iCluster<this->nPi0Cluster();++iCluster){
63  cand4Mom+=this->pi0Cluster( iCluster )->cluster()->hlv();
64  }
65  // Recalculate Candidate Pt using pi0 mass hypothesis
66  double candidatePt = std::sqrt(cand4Mom.e()*cand4Mom.e()-mPi0*mPi0)/std::cosh(cand4Mom.eta());
67 
68  // Set hlv. Steps are copied from /atlas/Trigger/TrigAlgorithms/TrigDiMuon/src/TrigDiMuonFast.cxx
69  double cot=1/std::tan(2*std::atan(std::exp(-cand4Mom.eta())));
70  double px=std::cos(cand4Mom.phi())*candidatePt;
71  double py=std::sin(cand4Mom.phi())*candidatePt;
72  double pz=cot*candidatePt;
73 
74  cand4Mom = CLHEP::HepLorentzVector(px,py,pz,cand4Mom.e());
75  }
76  return cand4Mom;
77  }
78 
79  inline void TauPi0Candidate ::addPi0Cluster( TauPi0Cluster *pi0Cluster )
80  {
81  m_pi0ClusterVector.push_back( pi0Cluster );
82  }
83 } //end of namespace analysis