Back to home page

sPhenix code displayed by LXR

 
 

    


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

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