Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /**
0002  * @file trackbase/CMFlashClusterv3.cc
0003  * @author Ben Kimelman
0004  * @date March 2023
0005  * @brief Implementation of CMFlashClusterv3
0006  */
0007 #include "CMFlashClusterv3.h"
0008 
0009 #include <cmath>
0010 #include <utility>  // for swap
0011 
0012 void CMFlashClusterv3::identify(std::ostream& os) const
0013 {
0014   os << "---CMFlashClusterv3--------------------" << 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 CMFlashClusterv3::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 (std::isnan(getX1()))
0044   {
0045     return 0;
0046   }
0047   if (std::isnan(getY1()))
0048   {
0049     return 0;
0050   }
0051   if (std::isnan(getZ1()))
0052   {
0053     return 0;
0054   }
0055 
0056   if (std::isnan(getX2()))
0057   {
0058     return 0;
0059   }
0060   if (std::isnan(getY2()))
0061   {
0062     return 0;
0063   }
0064   if (std::isnan(getZ2()))
0065   {
0066     return 0;
0067   }
0068 
0069   if (m_adc == 0xFFFFFFFF)
0070   {
0071     return 0;
0072   }
0073   if (m_adc1 == 0xFFFFFFFF)
0074   {
0075     return 0;
0076   }
0077   if (m_adc2 == 0xFFFFFFFF)
0078   {
0079     return 0;
0080   }
0081 
0082   return 1;
0083 }
0084 
0085 void CMFlashClusterv3::CopyFrom(const CMFlashCluster& source)
0086 {
0087   // do nothing if copying onto oneself
0088   if (this == &source)
0089   {
0090     return;
0091   }
0092 
0093   // parent class method
0094   CMFlashCluster::CopyFrom(source);
0095 
0096   setX(source.getX());
0097   setY(source.getY());
0098   setZ(source.getZ());
0099 
0100   setX1(source.getX1());
0101   setY1(source.getY1());
0102   setZ1(source.getZ1());
0103 
0104   setX2(source.getX2());
0105   setY2(source.getY2());
0106   setZ2(source.getZ2());
0107 
0108   setLayer1(source.getLayer1());
0109   setLayer2(source.getLayer2());
0110 
0111   setAdc(source.getAdc());
0112   setAdc1(source.getAdc1());
0113   setAdc2(source.getAdc2());
0114   setIsRGap(source.getIsRGap());
0115   setIsPhiGap(source.getIsPhiGap());
0116 }