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