1 // dear emacs, this is -*- C++ -*-
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
8 //using namespace CLHEP;
10 #include "TruthUtils/ParticleConstants.h"
14 //-------------------------------------------------------------------------
16 //-------------------------------------------------------------------------
18 inline const TauPi0Cluster* TauPi0Candidate::pi0Cluster(unsigned int i) const
20 return m_pi0ClusterVector[i];
23 inline const std::vector<TauPi0Cluster*>& TauPi0Candidate::pi0ClusterVec() const
25 return m_pi0ClusterVector ;
28 inline std::vector<TauPi0Cluster*>& TauPi0Candidate::pi0ClusterVec()
30 return m_pi0ClusterVector;
33 inline unsigned int TauPi0Candidate::nPi0Cluster() const
35 return m_pi0ClusterVector.size();
38 inline CLHEP::HepLorentzVector TauPi0Candidate::hlv() const
40 CLHEP::HepLorentzVector cand4Mom(0., 0., 0., 0.);
41 double mPi0 = ParticleConstants::piZeroMassInMeV;
42 if(this->nPi0Cluster() == 1){
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);
52 // Set hlv. Steps are copied from /atlas/Trigger/TrigAlgorithms/TrigDiMuon/src/TrigDiMuonFast.cxx
53 double clusterPhi = this->pi0Cluster( 0 )->cluster()->phi();
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;
60 cand4Mom = CLHEP::HepLorentzVector(px,py,pz,clusterE);
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();
67 // Recalculate Candidate Pt using pi0 mass hypothesis
68 double candidatePt = std::sqrt(cand4Mom.e()*cand4Mom.e()-mPi0*mPi0)/std::cosh(cand4Mom.eta());
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;
76 cand4Mom = CLHEP::HepLorentzVector(px,py,pz,cand4Mom.e());
81 inline void TauPi0Candidate ::addPi0Cluster( TauPi0Cluster *pi0Cluster )
83 m_pi0ClusterVector.push_back( pi0Cluster );
85 } //end of namespace analysis