Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-09-01 08:21:04

0001 /**
0002  * @file trackbase/LaserClusterv3.cc
0003  * @author Ben Kimelman
0004  * @date July 2026
0005  * @brief Implementation of LaserClusterv3
0006  */
0007 #include "LaserClusterv3.h"
0008 
0009 #include <cmath>
0010 #include <utility>          // for swap
0011 
0012 void LaserClusterv3::identify(std::ostream& os) const
0013 {
0014   os << "---LaserClusterv3--------------------" << std::endl;
0015 
0016   os << " " << m_hits.size() << " hits";
0017   os << " fit? " << m_fitMode;
0018   os << " (layer, iphi, it) =  (" << m_posHardware[0];
0019   os << ", " << m_posHardware[1] << ", ";
0020   os << m_posHardware[2] << ")";
0021   os << " adc = " << getAdc() << std::endl;
0022 
0023   os << std::endl;
0024   os << "-----------------------------------------------" << std::endl;
0025 
0026   return;
0027 }
0028 
0029 int LaserClusterv3::isValid() const
0030 {
0031   if(getNhits() == 0)
0032   {
0033     return 0;
0034   }
0035 
0036   return 1;
0037 }
0038 
0039 unsigned int LaserClusterv3::getAdc() const
0040 {
0041   unsigned int adc = 0;
0042   for(const auto &LCHI : m_hits)
0043   {
0044     adc += (unsigned int) LCHI.adc;
0045   }
0046   return adc;
0047 }
0048 
0049 void LaserClusterv3::CopyFrom( const LaserCluster& source )
0050 {
0051   // do nothing if copying onto oneself
0052   if( this == &source )
0053     {
0054       return;
0055     }
0056  
0057   // parent class method
0058   LaserCluster::CopyFrom( source );
0059   setLayerInt( source.getLayerInt() );
0060   setIPhiInt( source.getIPhiInt() );
0061   setITInt( source.getITInt() );
0062   setNLayers( source.getNLayers() );
0063   setNIPhi( source.getNIPhi() );
0064   setNIT( source.getNIT() );
0065   setSDLayer( source.getSDLayer() );
0066   setSDIPhi( source.getSDIPhi() );
0067   setSDIT( source.getSDIT() );
0068   setSDWeightedLayer( source.getSDWeightedLayer() );
0069   setSDWeightedIPhi( source.getSDWeightedIPhi() );
0070   setSDWeightedIT( source.getSDWeightedIT() );
0071 
0072 
0073   for(int i=0; i<(int)source.getNhits(); i++){
0074     LaserClusterHitInfo LCHI = source.getHit(i);
0075     addHit(LCHI.hitsetkey, LCHI.hitkey, LCHI.adc);
0076   }
0077 }
0078