Print

Print


Commit in lcio/src/cpp on MAIN
src/IMPL/SimCalorimeterHitImpl.cc+31-301.15 -> 1.16
include/IMPL/SimCalorimeterHitImpl.h+10-101.16 -> 1.17
+41-40
2 modified files
added copy constructor

lcio/src/cpp/src/IMPL
SimCalorimeterHitImpl.cc 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- SimCalorimeterHitImpl.cc	15 Apr 2005 08:37:47 -0000	1.15
+++ SimCalorimeterHitImpl.cc	26 Apr 2007 16:39:53 -0000	1.16
@@ -12,38 +12,39 @@
     _position[2] = 0. ; 
   }
 
-// // deep copy of the SimCalorimeterHit hit
-// SimCalorimeterHitImpl::SimCalorimeterHitImpl(const SimCalorimeterHit& hit) :
-//   _cellID0( hit.getCellID0() ),
-//   _cellID1( hit.getCellID1() ),
-//   _energy( hit.getEnergy() ) {
-  
-//   const float* p = hit.getPosition() ;
-//   _position[0] = p[0] ;
-//   _position[1] = p[1] ;
-//   _position[2] = p[2] ;
-  
-//   int nMC = hit.getNMCContributions() ;
-  
-//   // now copy all the MCParticle contributions
-//   for(int i=0; i<nMC ;i++){
-    
-//     MCParticleCont* con = new  MCParticleCont ;
-    
-//     con->Particle = hit.getParticleCont(i) ;
-//     con->Energy = hit.getEnergyCont(i) ;
-//     con->Time = hit.getTimeCont(i) ;
-//     con->PDG = hit.getPDGCont(i) ;
-    
-//     _vec.push_back( con ) ;
-//   }  
-// }
-
-  EVENT::LCObject* SimCalorimeterHitImpl::clone() const{
-    // shallow copy ... more thought needed
-    return new SimCalorimeterHitImpl( *this ) ;
+//   // copy of the SimCalorimeterHit hit
+  SimCalorimeterHitImpl::SimCalorimeterHitImpl(const SimCalorimeterHit& hit) :
+    
+    _cellID0( hit.getCellID0() ),
+    _cellID1( hit.getCellID1() ),
+    _energy( hit.getEnergy() ) {
+    
+    const float* p = hit.getPosition() ;
+    _position[0] = p[0] ;
+    _position[1] = p[1] ;
+    _position[2] = p[2] ;
+    
+    int nMC = hit.getNMCContributions() ;
+    
+    // now copy all the MCParticle contributions
+    for(int i=0; i<nMC ;i++){
+      
+      MCParticleCont* con = new  MCParticleCont ;
+      
+      con->Particle = hit.getParticleCont(i) ;
+      con->Energy = hit.getEnergyCont(i) ;
+      con->Time = hit.getTimeCont(i) ;
+      con->PDG = hit.getPDGCont(i) ;
+      
+      _vec.push_back( con ) ;
+    }  
   }
   
+//   EVENT::LCObject* SimCalorimeterHitImpl::clone() const{
+//     // shallow copy ... more thought needed
+//     return new SimCalorimeterHitImpl( *this ) ;
+//   }
+  
 
   SimCalorimeterHitImpl::~SimCalorimeterHitImpl(){
     // delete all MCParticle contributions

lcio/src/cpp/include/IMPL
SimCalorimeterHitImpl.h 1.16 -> 1.17
diff -u -r1.16 -r1.17
--- SimCalorimeterHitImpl.h	4 Aug 2006 16:52:46 -0000	1.16
+++ SimCalorimeterHitImpl.h	26 Apr 2007 16:39:53 -0000	1.17
@@ -34,23 +34,23 @@
      */
     SimCalorimeterHitImpl() ;
 
-    /** Copy constructor. Not yet - needs pointer chasing ... 
+    /** Copy constructor - shallow copy. 
      */
-    //    SimCalorimeterHitImpl(const SimCalorimeterHit& hit) ;
+    SimCalorimeterHitImpl(const SimCalorimeterHit& hit) ;
 
     /// Destructor.
     virtual ~SimCalorimeterHitImpl() ;
     
     virtual int id() const { return simpleUID() ; }
 
-    /** Create a deep copy of itself.
-     * Overwrites return type in LCObject::clone().
-     * Not yet - as AID genereates virtual inheritance and
-     * g++ doesn't support virtual constructors with virtual inheritance
-     * TODO - change org.freehep.aid.CPPHeaderGenerator !
-     */
-    //virtual  SimCalorimeterHit* clone() const;
-    virtual LCObject* clone() const;
+//     /** Create a deep copy of itself.
+//      * Overwrites return type in LCObject::clone().
+//      * Not yet - as AID genereates virtual inheritance and
+//      * g++ doesn't support virtual constructors with virtual inheritance
+//      * TODO - change org.freehep.aid.CPPHeaderGenerator !
+//      */
+//     //virtual  SimCalorimeterHit* clone() const;
+//     virtual LCObject* clone() const;
     
     /**Returns the detector specific (geometrical) cell id.
      */
CVSspam 0.2.8