Back to index

See source file

CPad.h

 
//----------------------------------------------------------------------------- 
//  $Header: /tmp_mnt/asis/offline/ceres/cool/project/RCS/CPad.h,v 2.1 1996/10/04 08:45:55 voigt Exp $ 
// 
//  COOL Program Library   
//  Copyright (C) CERES collaboration, 1996 
// 
//  Declarations for CPad class. 
// 
//  Node that the operators new and delete are overloaded 
//  in order to provide a more efficient memory management 
//  (see class CMemoryPool). 
// 
//----------------------------------------------------------------------------- 
#ifndef CPAD_H 
#define CPAD_H 
 
#include <rw/tpordvec.h> 
#include "cool.h" 
#include "CMemoryPool.h" 
 
#include "CMCDigiHit.h" 
 
class CPad { 
public: 
   inline CPad();                        // dummy pad with illegal coordinates 
   inline CPad(int, int, float);         // create pad with (x,y,amp) 
public: 
   inline ~CPad(); 
 
public: 
   CBoolean operator== (const CPad& pad) const;        // needed for collection list 
    
public: 
   inline int   getX()   const             { return (int)x; }        // to get back the coordinates 
   inline int   getY()   const             { return (int)y; }  
   inline float getAmp() const             { return amp; }           // ... and the amplitude 
   inline int   getClusterNumber() const { return clusterNumber; }  
   inline char  getIsLocalMax()    const { return isLocalMax; }  
   inline int   getTmp()           const { return tmp; }  
    
public: 
   inline void setAmp(float newamp) { amp = newamp; }                // modify the amplitude 
   inline void setClusterNumber(int n) { clusterNumber = n; } 
   inline void setIsLocalMax(char c) { isLocalMax = c; } 
   inline void setTmp(int t) { tmp = t; } 
    
public:  
   void addMCDigiHit(CMCDigiHit*); 
   inline const RWTPtrOrderedVector<CMCDigiHit>* getMCHits() const { return mcHits; } 
 
 
public: 
   void* operator new(size_t) { return mempool.alloc(); }    
   void  operator delete(void* p)  { mempool.free(p); } 
    
protected: 
   short x; 
   short y; 
   float amp; 
   short clusterNumber; // impossible to have more than 144*144 cluster 
   char  isLocalMax; 
   int   tmp; 
 
   RWTPtrOrderedVector<CMCDigiHit>* mcHits; 
    
private: 
   static CMemoryPool mempool; 
}; 
 
 
CPad::CPad()  
{ 
   x = y = 0; 
   amp = 0; 
   clusterNumber = 0; 
   isLocalMax = 0; 
   tmp = 0; 
   mcHits = 0; 
} 
 
CPad::CPad(int ix, int iy, float a)  
{ 
   x = (short)ix; 
   y = (short)iy; 
   amp = a; 
   clusterNumber = 0; 
   isLocalMax = 0; 
   tmp = 0; 
   mcHits = 0; 
} 
 
CPad::~CPad()  
{ 
  if (mcHits != 0) { 
    mcHits->clear(); 
    delete mcHits; 
  } 
} 
 
#endif /* CPAD_H */ 

Back to index

See source file