Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:20:31

0001 /**
0002  * @file trackbase/CMFlashDifferencev1.cc
0003  * @author Tony Frawley
0004  * @date January 2022
0005  * @brief Implementation of CMFlashDifferencev1
0006  */
0007 #include "CMFlashDifferencev1.h"
0008 
0009 #include <cmath>
0010 #include <utility>  // for swap
0011 
0012 void CMFlashDifferencev1::identify(std::ostream& os) const
0013 {
0014   os << "---CMFlashDifferencev1--------------------" << std::endl;
0015 
0016   os << "nclusters: " << m_nclusters << std::dec << std::endl;
0017 
0018   os << " truth Phi =  " << m_Phi[0];
0019   os << ",  reco Phi = " << m_Phi[1] << ") rad";
0020 
0021   os << " truth R =  " << m_R[0];
0022   os << ",  reco R = " << m_R[1] << ") cm";
0023 
0024   os << " truth Z =  " << m_Z[0];
0025   os << ",  reco Z = " << m_Z[1] << ") cm";
0026 
0027   os << std::endl;
0028   os << "-----------------------------------------------" << std::endl;
0029 
0030   return;
0031 }
0032 
0033 int CMFlashDifferencev1::isValid() const
0034 {
0035   if (m_nclusters == UINT_MAX)
0036   {
0037     return 0;
0038   }
0039 
0040   if (std::isnan(getTruthPhi()))
0041   {
0042     return 0;
0043   }
0044   if (std::isnan(getTruthR()))
0045   {
0046     return 0;
0047   }
0048   if (std::isnan(getTruthZ()))
0049   {
0050     return 0;
0051   }
0052 
0053   if (std::isnan(getRecoPhi()))
0054   {
0055     return 0;
0056   }
0057   if (std::isnan(getRecoR()))
0058   {
0059     return 0;
0060   }
0061   if (std::isnan(getRecoZ()))
0062   {
0063     return 0;
0064   }
0065 
0066   return 1;
0067 }
0068 
0069 void CMFlashDifferencev1::CopyFrom(const CMFlashDifference& source)
0070 {
0071   // do nothing if copying onto oneself
0072   if (this == &source)
0073   {
0074     return;
0075   }
0076 
0077   // parent class method
0078   CMFlashDifference::CopyFrom(source);
0079 
0080   setNclusters(source.getNclusters());
0081 
0082   setTruthPhi(source.getTruthPhi());
0083   setTruthR(source.getTruthR());
0084   setTruthZ(source.getTruthZ());
0085 
0086   setRecoPhi(source.getRecoPhi());
0087   setRecoR(source.getRecoR());
0088   setRecoZ(source.getRecoZ());
0089 }