Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /**
0002  * @file trackbase/LaserClusterv1.cc
0003  * @author Ben Kimelman
0004  * @date February 2024
0005  * @brief Implementation of LaserClusterv1
0006  */
0007 #include "LaserClusterv1.h"
0008 
0009 #include <cmath>
0010 #include <utility>          // for swap
0011 
0012 void LaserClusterv1::identify(std::ostream& os) const
0013 {
0014   os << "---LaserClusterv1--------------------" << 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 LaserClusterv1::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 LaserClusterv1::CopyFrom( const LaserCluster& source )
0052 {
0053   // do nothing if copying onto oneself
0054   if( this == &source )
0055     {
0056       return;
0057     }
0058  
0059   // parent class method
0060   LaserCluster::CopyFrom( source );
0061 
0062   setX( source.getX() );
0063   setY( source.getY() );
0064   setZ( source.getZ() );
0065   setAdc( source.getAdc() );
0066   setLayer( source.getLayer() );
0067   setIPhi( source.getIPhi() );
0068   setIT( source.getIT() );
0069   setNhits( source.getNhits() );
0070   setNLayers( source.getNLayers() );
0071   setNIPhi( source.getNIPhi() );
0072   setNIT( source.getNIT() );
0073   setSDLayer( source.getSDLayer() );
0074   setSDIPhi( source.getSDIPhi() );
0075   setSDIT( source.getSDIT() );
0076   setSDWeightedLayer( source.getSDWeightedLayer() );
0077   setSDWeightedIPhi( source.getSDWeightedIPhi() );
0078   setSDWeightedIT( source.getSDWeightedIT() );
0079 
0080 
0081   for(int i=0; i<(int)source.getNhits(); i++){
0082     addHit();
0083     setHitLayer(i, source.getHitLayer(i));
0084     setHitIPhi(i, source.getHitIPhi(i));
0085     setHitIT(i, source.getHitIT(i));
0086 
0087     setHitX(i, source.getHitX(i));
0088     setHitY(i, source.getHitY(i));
0089     setHitZ(i, source.getHitZ(i));
0090     setHitAdc(i, source.getHitAdc(i));
0091   }
0092 
0093 
0094 }
0095