Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:08

0001 /**
0002  * @file trackbase/CMFlashClusterv1.cc
0003  * @author Tony Frawley
0004  * @date January 2022
0005  * @brief Implementation of CMFlashClusterv1
0006  */
0007 #include "CMFlashClusterv1.h"
0008 
0009 #include <cmath>
0010 #include <utility>  // for swap
0011 
0012 void CMFlashClusterv1::identify(std::ostream& os) const
0013 {
0014   os << "---CMFlashClusterv1--------------------" << std::endl;
0015 
0016   os << " (x,y,z) =  (" << m_pos[0];
0017   os << ", " << m_pos[1] << ", ";
0018   os << m_pos[2] << ") cm";
0019 
0020   os << " adc = " << getAdc() << std::endl;
0021 
0022   os << std::endl;
0023   os << "-----------------------------------------------" << std::endl;
0024 
0025   return;
0026 }
0027 
0028 int CMFlashClusterv1::isValid() const
0029 {
0030   if (std::isnan(getX()))
0031   {
0032     return 0;
0033   }
0034   if (std::isnan(getY()))
0035   {
0036     return 0;
0037   }
0038   if (std::isnan(getZ()))
0039   {
0040     return 0;
0041   }
0042 
0043   if (m_adc == 0xFFFFFFFF)
0044   {
0045     return 0;
0046   }
0047 
0048   return 1;
0049 }
0050 
0051 void CMFlashClusterv1::CopyFrom(const CMFlashCluster& source)
0052 {
0053   // do nothing if copying onto oneself
0054   if (this == &source)
0055   {
0056     return;
0057   }
0058 
0059   // parent class method
0060   CMFlashCluster::CopyFrom(source);
0061 
0062   setX(source.getX());
0063   setY(source.getY());
0064   setZ(source.getZ());
0065   setAdc(source.getAdc());
0066 }