Back to index

CRichLikeHit.C

 
//----------------------------------------------------------------------------- 
//  $Header: /tmp_mnt/asis/offline/ceres/cool/project/RCS/CRichLikeHit.C,v 3.1 1997/04/25 15:05:31 messer Exp $ 
// 
//  COOL Program Library   
//  Copyright (C) CERES collaboration, 1996 
// 
//  Implementation for CRichLikeHit class. 
// 
//----------------------------------------------------------------------------- 
#include <float.h> 
#include "CRichLikeHit.h" 
#include "CRich.h" 
 
CRichLikeHit::CRichLikeHit()  
{ 
   x = y = 0; 
   amp = 0; 
   ring = 0; 
   cluster = 0; 
} 
 
CRichLikeHit::CRichLikeHit(float xx, float yy, float a)  
{ 
   x = xx; 
   y = yy; 
   amp = a; 
   ring = 0; 
   cluster = 0; 
} 
 
CBoolean CRichLikeHit::operator== (const CRichLikeHit& hit) const  
{ 
   return (x == hit.x && y == hit.y); 
} 
 
void CRichLikeHit::getMCDigiHits(CRich& rich, RWTPtrOrderedVector<CMCDigiHit>& theHits) 
{ 
  int ix, iy, ihit; 
  CPad *thePad; 
 
  int x0 = int( getX() + 0.5 ); 
  int y0 = int( getY() + 0.5 ); 
 
  // loop all pads in 3x3 matrix around center of hit and  
  // get the MC hits contributing to the pad. If not already 
  // in the list, add the MC DigiHit to the list provided. 
 
  for (ix=-1; ix<=1; ix++) { 
    for (iy=-1; iy<=1; iy++) { 
      thePad = rich.getPads()(x0+ix, y0+iy); 
      if ( thePad != 0 && thePad->getMCHits() !=0 ) { 
	for (ihit=0; ihit<thePad->getMCHits()->length(); ihit++) { 
	  if ( !theHits.contains( (*thePad->getMCHits())(ihit) ) )  
	    theHits.insert( (*thePad->getMCHits())(ihit) ); 
	} 
      } 
    } 
  } 
} 

Back to index