ROOT logo
#include "hshowerhit.h"
#include "hshowerhitsim.h"
#include "hshowerpid.h"
#include "hshowerhitheader.h"
#include "hshowerhitfinder.h"
#include "hshowercriterium.h"

#include "TArrayI.h"
#include "hruntimedb.h"
#include "hevent.h"
#include "heventheader.h"
#include "hspectrometer.h"
#include "hdetector.h"
#include "hshowerdetector.h"
#include "hratreeext.h"
#include "hcategory.h"
#include "hmatrixcategory.h"
#include "hlinearcatiter.h"
#include "hlocation.h"
#include "hshowercal.h"
#include "hshowerhitfpar.h"
#include "hshowergeometry.h"
#include "hshowerpad.h"
#include "hiterator.h"
#include "hdebug.h"
#include "hades.h"
#include "hgeomvector.h"
#include "hgeomvector2.h"
#include "hspecgeompar.h"
#include "hgeomvolume.h"
#include "showerdef.h"
#include "hgeantdef.h"

#include <cmath>

using namespace std;
ClassImp(HShowerHitFinder)

    //_HADES_CLASS_DESCRIPTION
    ///////////////////////////////////////////////////////////////////////
    //HShowerHitFinder
    //
    // HShowerHitFinder reconstructor searches local maxima in CAL level
    // The Shower task is split into several tasks as shown
    // in the flow diagram below.
    //
    //   ----------------------
    //  |     HShowerUnpacker  |                                                                              //
    //  |   (embedding mode)   | \                                                                            //
    //  |                      |  \      ------------------                                                   //
    //   ----------------------   |     |  HGeantShower    |                                                  //
    //                            |      ------------------\                                                  //
    //                            |                         \                                                 //
    //                            |      ------------------  \------------->  ----------------------          //
    //                            |     |  HGeantWire      |   <------------ |  HShowerHitDigitizer |         //
    //                            |      ------------------\                  ----------------------          //
    //                            |                         \                                                 //
    //                 -------------     ------------------  \------------->  -----------------------         //
    //             -- | HShowerRaw  |   |  HShowerRawMatr  |   <------------ |  HShowerPadDigitizer  |        //
    //            |    -------------     ------------------\                 |( creates track objects|        //
    //            |                                         \                |  for real tracks in   |        //
    //   ----------------------          ------------------  \               |  embedding mode too)  |        //
    //  |   HShowerCalibrater  |        |  HShowerTrack    |  \<------------  -----------------------         //
    //  |   (embedding mode)   |         ------------------\   \                                              //
    //   ----------------------                             \   \             -----------------------         //
    //            |                      ------------------  \   ----------> |   HShowerCopy         |        //
    //             -------------------> |  HShowerCal      |  \<------------ |(add charge of real hit|        //
    //                                   ------------------\   \             | in embedding too )    |        //
    //                                                      \   \             -----------------------         //
    //                                   ------------------  ----\--------->  -----------------------         //
    //                                  |  HShowerHitHdr   |   <--\--------- |  HShowerHitFinder     |        //
    //                                   ------------------        \          -----------------------         //
    //                                   ------------------         \        |                                //
    //                                  |  HShowerPID      |   <-----\-------|                                //
    //                                   ------------------           \      |                                //
    //                                   ------------------            \     |                                //
    //                                  |  HShowerHit      |   <--------\----|                                //
    //                                   ------------------ <            \                                    //
    //                                                       \            \                                   //
    //                                                        \-------------> ------------------------        //
    //                                                                       | HShowerHitTrackMatcher |       //
    //                                                                        ------------------------        //
    //
    //
    //  In the case of TRACK EMBEDDING of simulated tracks into
    //  experimental data the real data are written by the HShowerUnpacker into
    //  HShowerRaw category. The real hits are taken into
    //  account by the digitizer (adding of charges). The embedding mode is recognized
    //  automatically by analyzing the
    //  gHades->getEmbeddingMode() flag.
    //            Mode ==0 means no embedding
    //                 ==1 realistic embedding (first real or sim hit makes the game)
    //                 ==2 keep GEANT tracks   (as 1, but GEANT track numbers will always
    //                     win against real data. besides the tracknumber the output will
    //                     be the same as in 1)
    //
    //////////////////////////////////////////////////////////////////////

    HShowerHitFinder::HShowerHitFinder(const Text_t *name,const Text_t *title) :
HReconstructor(name,title)
{
    fIter = NULL;
    m_Loc.set(4, 0, 0, 0, 0);
    setFillPID();
    setSortFlag(kTRUE);
    m_pCriterium = new HShowerCriterium;


}

HShowerHitFinder::HShowerHitFinder()
{
    fIter = NULL;
    m_Loc.set(4, 0, 0, 0, 0);
    setFillPID();
    setSortFlag(kTRUE);
    m_pCriterium = new HShowerCriterium;
}


HShowerHitFinder::~HShowerHitFinder(void) {
    if (m_pCellArr) {
	delete m_pCellArr;
    }
    if (fIter) delete fIter;
    if (m_pCriterium) delete m_pCriterium;
}

Bool_t HShowerHitFinder::init()
{

    if(gHades->getCurrentEvent()->getCategory(catGeantKine)) isSim = kTRUE ;
    else                                                     isSim = kFALSE;


    TArrayI arr(4);
    TArrayI arr1(1);
    HShowerDetector *pShowerDet = (HShowerDetector*)gHades->getSetup()->getDetector("Shower");

    arr[0] = pShowerDet->getMaxSectors();
    arr[1] = pShowerDet->getMaxModules();
    arr[2] = pShowerDet->getRows();
    arr[3] = pShowerDet->getColumns();
    arr1[0] = arr[0] * arr[1] * arr[2] * arr[3];

    m_pCalCat=gHades->getCurrentEvent()->getCategory(catShowerCal);
    if (m_pCalCat) {
	fIter = (HIterator*)getCalCat()->MakeIterator("native");
    }


    m_pHitCat=gHades->getCurrentEvent()->getCategory(catShowerHit);
    if (!m_pHitCat) {

	if(isSim) m_pHitCat = pShowerDet->buildLinearCat("HShowerHitSim");
        else      m_pHitCat = pShowerDet->buildLinearCat("HShowerHit");

	if (!m_pHitCat) return kFALSE;
	else gHades->getCurrentEvent()->addCategory(catShowerHit, m_pHitCat, "Shower");
    }

    m_pHitHdrCat=gHades->getCurrentEvent()->getCategory(catShowerHitHdr);
    if (!m_pHitHdrCat) {
	m_pHitHdrCat=pShowerDet->buildCategory(catShowerHitHdr);

	if (!m_pHitHdrCat) return kFALSE;
	else gHades->getCurrentEvent()->addCategory(catShowerHitHdr, m_pHitHdrCat, "Shower");
    }

    if (IsFillPID()) {
	m_pPIDCat=gHades->getCurrentEvent()->getCategory(catShowerPID);
	if (!m_pPIDCat) {
	    m_pPIDCat=pShowerDet->buildCategory(catShowerPID);

	    if (!m_pPIDCat) return kFALSE;
	    else gHades->getCurrentEvent()->addCategory(catShowerPID, m_pPIDCat, "Shower");
	}
    }
    else m_pPIDCat = NULL;

    m_pCellArr = new HRaTreeExt(m_pCalCat, &arr);
   

    return initParameters();
}

Bool_t HShowerHitFinder::initParameters()
{
    HRuntimeDb* rtdb=gHades->getRuntimeDb();

    m_pGeometry = (HShowerGeometry*)rtdb->getContainer("ShowerGeometry");
    if(!m_pGeometry) return kFALSE;

    m_pHitFPar = (HShowerHitFPar*)rtdb->getContainer("ShowerHitFPar");
    if (!m_pHitFPar) return kFALSE;
    m_pCriterium->setParams(m_pHitFPar);

    m_pHSpecGeomPar = (HSpecGeomPar *)rtdb->getContainer("SpecGeomPar");
    if(!m_pHSpecGeomPar) return kFALSE;

    return kTRUE;
}

void HShowerHitFinder::setCriterium(HShowerCriterium* pCrit) {
    if (m_pCriterium) delete m_pCriterium;
    m_pCriterium = pCrit;
}

Bool_t HShowerHitFinder::finalize() {
    return kTRUE;
}

HShowerHitFinder& HShowerHitFinder::operator=(HShowerHitFinder &c) {

    return c;
}

Int_t HShowerHitFinder::execute()
{

    if(!fIter) return 0; // no input

    HShowerCal *pCal;
    m_pCellArr->update();

    Int_t n = 0;
    Int_t hits = 0;

    fIter->Reset();
    while((pCal = (HShowerCal *)fIter->Next()))
    {
	m_Loc[0] = pCal->getSector();
	m_Loc[1] = pCal->getModule();
	m_Loc[2] = pCal->getRow();
	m_Loc[3] = pCal->getCol();

	if (lookForHit(pCal, m_Loc)) hits++;
	n++;
    }

    if (IsSortFlagSet()) {
	m_pHitCat->sort();
	if(m_pPIDCat) m_pPIDCat->sort();
    }

    return 0;
}

Bool_t HShowerHitFinder::lookForHit(HShowerCal* cal, HLocation& fLoc) {
#if DEBUG_LEVEL>2
    gDebuger->enterFunc("HShowerHitFinder::execute");
    gDebuger->message("Cal cat points to %p",cal);
#endif
    HShowerHit *hit  = NULL;
    HShowerPID *pid  = NULL;
    Bool_t isHit = kFALSE;

    if (cal && isLocalMax(fLoc)) {
	Float_t fCharge, fShower = 0.0;
	Int_t ret = 0;


	hit=(HShowerHit *)m_pHitCat->getNewSlot(fLoc);
	if (hit) {

	    if(isSim){
		hit = new (hit) HShowerHitSim;
	    } else {
		hit = new (hit) HShowerHit;
	    }
	    fillSums(hit, fLoc);
	    //calcCoord(hit, fLoc);
	    calcCoordWithSigma(hit, fLoc,1);

	    fCharge = cal->getCharge();

	    hit->setCharge(fCharge);
	    hit->setSector(cal->getSector());
	    hit->setModule(cal->getModule());
	    hit->setRow(cal->getRow());
	    hit->setCol(cal->getCol());

	    if (IsSortFlagSet()) hit->calcAddress();
	    hit->copyToTrueAddress();  // later used in low efficiency mode!

	    fShower = m_pCriterium->showerCriterium(hit, ret,m_pHitFPar);

	    hit->setShower(fShower);

	    if (m_pPIDCat && fShower > 0) {
		pid=(HShowerPID *)m_pPIDCat->getNewSlot(fLoc);
		if (pid) {
		    pid=new(pid) HShowerPID;
		    fillPID(hit, pid);
		}
	    }

	    isHit = kTRUE;
	    updateLocalMax(fLoc);
	}
    }
#if DEBUG_LEVEL>2
    gDebuger->leaveFunc("HShowerHitFinder::execute");
#endif
    updateFiredCells(fLoc);
    return isHit;
}

void HShowerHitFinder::fillPID(HShowerHit* hit, HShowerPID* pid) {
    Float_t fX, fY, fZ;
    Float_t fR, fPhi, fTheta;

    pid->setCharge(hit->getCharge());
    pid->setSector(hit->getSector());
    pid->setModule(hit->getModule());
    pid->setRow(hit->getRow());
    pid->setCol(hit->getCol());
    pid->setAddress(hit->getAddress());
    pid->setShower(hit->getShower());

    hit->getLabXYZ(&fX, &fY, &fZ);
    pid->setXYZ(fX, fY, fZ);
    hit->getSphereCoord(&fR, &fPhi, &fTheta);
    pid->setSphereCoord(fR, fPhi, fTheta);

    //   if (IsSortFlagSet())
    //       getPIDCat()->sort();
}

void HShowerHitFinder::fillSums(HShowerHit* hit, HLocation &fLoc) {
    HLocation fTmpLoc;
    Int_t nModules = m_pHitFPar->getModules();
    Float_t sum, var;
    Int_t cs;

    fTmpLoc = fLoc;
    for(fTmpLoc[1] = 0; fTmpLoc[1] < nModules; fTmpLoc[1]++) {
	sum = calculateSum(fTmpLoc, 1, &cs);
	var = calculateVar(fTmpLoc, 1, sum/9.0);
	hit->setSum(fTmpLoc[1], sum);
	hit->setVar(fTmpLoc[1], var);
	hit->setClusterSize(fTmpLoc[1], cs);
    }

    calculateSum(fLoc, 1, &cs);
    if (cs > 1) updateClusters(fLoc);

    if (nModules == 3) {
	fTmpLoc[1] = 2;
	hit->setSum25(calculateSum(fTmpLoc, 2));
    }

    hit->updateCalc();
}

void HShowerHitFinder::calcCoord(HShowerHit* hit, HLocation &fLoc) {
    HGeomVector vLocalCoord;
    HGeomVector2 vLabCoord;

    HGeomVector targetPos = m_pHSpecGeomPar->getTarget(0)->getTransform().getTransVector();

    m_pGeometry->getLocalCoord(fLoc, vLocalCoord);
    m_pGeometry->getLabCoord(fLoc, vLabCoord);
    m_pGeometry->getSphereCoord(fLoc, vLabCoord, &targetPos);
    hit->setXY(vLocalCoord.getX(), vLocalCoord.getY());
    hit->setLabXYZ(vLabCoord.getX(), vLabCoord.getY(), vLabCoord.getZ());
    hit->setSphereCoord(vLabCoord.getRad(), vLabCoord.getPhi(), vLabCoord.getTheta());
}

////////////////////////////////////////////////////////////////////////////
//
//			 		HShowerHitFinder::calcCoordWithSigma
// 		Calculate the Position of the hit and SigmaX,SigmaY.
//      SigmaX,SigmaY are determined based on the geometry of the pad.
//  	Weighted mean value for X,Y position determination is used.
//      Procedure:
//		1.) calculate weighted X_Loc, Y_Loc in local coord. system
//		2.) determine Sigma_X, Sigma_Y (based on geometry of the pad)
//		3.) transform X_Loc, Y_Loc -> X_Lab, Y_Lab, Z_Lab
// 		4.) transform X_Lab, Y_Lab, Z_Lab -> Sphere Coord. Sys.
//
///////////////////////////////////////////////////////////////////////////
void HShowerHitFinder::calcCoordWithSigma(HShowerHit* hit, HLocation &fLoc, Int_t nRange) {
    HGeomVector vLocalCoord;

    HShowerPadTab *pPads = m_pGeometry->getPadParam(fLoc[1]); // Access to the pad plane (module== fLoc[1])

    Int_t rowL, rowU, colL, colR,iRow1, iRow2, iCol1, iCol2;

    Int_t row = fLoc[2];
    Int_t col = fLoc[3];
    // Check pads around Loc_Max
    m_pHitFPar->getRowBord(fLoc[0], fLoc[1], &rowL, &rowU);
    m_pHitFPar->getColBord(fLoc[0], fLoc[1], &colL, &colR);
    if((row < rowL) || (row > rowU) || (col < colL) || (col > colR))
	cout<<"--We are outside of the detector. "<<endl;
    //return 0.0f;

    if((iRow1 = row - nRange) < rowL)
	iRow1 = rowL;

    if((iRow2 = row + nRange) > rowU)
	iRow2 = rowU;

    if((iCol1 = col - nRange) < colL)
	iCol1 = colL;

    if((iCol2 = col + nRange) > colR)
	iCol2 = colR;

    Float_t fSum = 0;
    Float_t fWSumX_Loc = 0;
    Float_t fWSumY_Loc = 0;
    Float_t sigma_X_tmp = 0;
    Float_t sigma_X = 0;
    Float_t sigma_Y_tmp = 0;
    Float_t sigma_Y = 0;

    HLocation fTmpLoc;
    fTmpLoc = fLoc;

    HShowerCal* pCell;
    /////////////////////////////////////////////////////////////
    // actual calculation of weighted_X_Loc and weighted_Y_Loc //
    /////////////////////////////////////////////////////////////
    for(fTmpLoc[2] = iRow1; fTmpLoc[2] <= iRow2; fTmpLoc[2]++)
	for(fTmpLoc[3] = iCol1; fTmpLoc[3] <= iCol2; fTmpLoc[3]++)
	{
	    pCell =  (HShowerCal*)m_pCellArr->getObject(fTmpLoc);
	    if((float)pCell->getCharge()<=0.0) continue;

	    // position of the pad in Local coord. sys.
	    m_pGeometry->getLocalCoord(fTmpLoc, vLocalCoord); //position in Local Sys.

	    fSum  = fSum +  pCell->getCharge();
	    fWSumX_Loc = fWSumX_Loc +  ((pCell->getCharge()) * (vLocalCoord.getX()) ); //weighted X_Loc
	    fWSumY_Loc = fWSumY_Loc +  ((pCell->getCharge()) * (vLocalCoord.getY()) ); //weighted Y_Loc

	    // Determine Sigma_X (geometry), pad_size/sqrt(12), sqrt(12)-standard deviation of a uniform density
	    Float_t fXLD = pPads->getPad(fTmpLoc[2],fTmpLoc[3])->getXld_mm();
	    Float_t fXRD = pPads->getPad(fTmpLoc[2],fTmpLoc[3])->getXrd_mm();
	    Float_t fXLU = pPads->getPad(fTmpLoc[2],fTmpLoc[3])->getXlu_mm();
	    Float_t fXRU = pPads->getPad(fTmpLoc[2],fTmpLoc[3])->getXru_mm();

	    Float_t x1=fabs(fXLU-fXRD);
	    Float_t x2=fabs(fXLD-fXRU);
	    sigma_X_tmp = (x1>x2)? x1:x2;

	    sigma_X_tmp = sigma_X_tmp/sqrt(12.);
	    sigma_X_tmp = ((float)pCell->getCharge()) * sigma_X_tmp;
	    sigma_X_tmp = sigma_X_tmp * sigma_X_tmp;  // so I have Q(i)^2 * Sigma(i)^2
	    sigma_X =  sigma_X + sigma_X_tmp;  // and here: Q(i)^2 * Sigma(i)^2 + Q(j)^2 * Sigma(j)^2

	    // Determine Sigma_Y (geometry)
	    Float_t fYLD = pPads->getPad(fTmpLoc[2],fTmpLoc[3])->getYld_mm();
	    Float_t fYRD = pPads->getPad(fTmpLoc[2],fTmpLoc[3])->getYrd_mm();
	    Float_t fYLU = pPads->getPad(fTmpLoc[2],fTmpLoc[3])->getYlu_mm();
	    Float_t fYRU = pPads->getPad(fTmpLoc[2],fTmpLoc[3])->getYru_mm();

	    x1=fabs(fYLU-fYRD);
	    x2=fabs(fYLD-fYRU);
	    sigma_Y_tmp = (x1>x2)? x1:x2;

	    sigma_Y_tmp = sigma_Y_tmp/sqrt(12.);
	    sigma_Y_tmp = ((float)pCell->getCharge()) * sigma_Y_tmp;
	    sigma_Y_tmp = sigma_Y_tmp * sigma_Y_tmp;  // so I have Q(i)^2 * Sigma(i)^2
	    sigma_Y =  sigma_Y + sigma_Y_tmp;  //and here: Q(i)^2 * Sigma(i)^2 + Q(j)^2 * Sigma(j)^2
	}
    if(fSum<=0.0) cout<<"--Shw_Hit_F-- Chagrge = 0, should not happen"<<endl;
    // transform X_Loc,Y_Loc to Lab. coord. system
    HGeomVector vv; 		// hit pos. in local coord. system
    HGeomVector2 vvv; 	// hit pos. in lab. coord. syss.
    vv.setX(fWSumX_Loc/fSum);
    vv.setY(fWSumY_Loc/fSum);
    vv.setZ(0.0);

    // get Lab position of the hit (vvv) from Local position (vv)
    m_pGeometry->transVectToLab(fLoc, vv, vvv);

    hit->setXY((float)fWSumX_Loc/fSum,(float)fWSumY_Loc/fSum ); //  Hit in Local System.
    hit->setSigmaXY(sqrt(sigma_X/(fSum*fSum)),sqrt(sigma_Y/(fSum*fSum)));
    hit->setLabXYZ(vvv.getX(), vvv.getY(), vvv.getZ());  // Hit in Lab. Sysstem

    HGeomVector2 sphereOut; // Sphere coordin.
    HGeomVector targetPos = m_pHSpecGeomPar->getTarget(0)->getTransform().getTransVector();
    m_pGeometry->transLabToSphereCoord(vvv, sphereOut, &targetPos);
    hit->setSphereCoord(sphereOut.getRad(), sphereOut.getPhi(), sphereOut.getTheta());

    /*      if(0){ // create control file
     Int_t nEvt=gHades->getCurrentEvent()->getHeader()->getEventSeqNumber(); // get Event Seq. Nb.
     ofstream out1("results.txt", ios::app);

     HGeomVector vLocalCoord_Tmp;
     m_pGeometry->getLocalCoord(fLoc, vLocalCoord_Tmp);
     HGeomVector2 vLabCoord;
     m_pGeometry->getSphereCoord(fLoc, vLabCoord, &targetPos);
     out1<<" evnt_Nb "<<nEvt<<" Sec "<<fLoc[0]<<" mod "<<fLoc[1]<<" cluSize "
     //cout<<" evnt_Nb "<<nEvt<<" Sec "<<fLoc[0]<<" mod "<<fLoc[1]<<" cluSize "
     <<hit->getClusterSize(fLoc[1])<<
     " old_X "<<(float)(vLocalCoord_Tmp.getX())<<" new_X "<< (float)fWSumX_Loc/fSum<<
     " old_Y "<<(float)(vLocalCoord_Tmp.getY())<<" new_Y "<< ((float)fWSumY_Loc/fSum)<<
     " sig_X "<<hit->getSigmaX()<<" sigY "<<hit->getSigmaY()<<
     //" sig_X "<<sqrt(sigma_X/(fSum*fSum))<<" sigY "<<sqrt(sigma_Y/(fSum*fSum))<<
     " X_Lab "<<vvv.getX()<<" Y_Lab "<<vvv.getY()<<" Z_Lab "<< vvv.getZ()<<
     " Rad_old "<<vLabCoord.getRad()<<" Rad_new "<<sphereOut.getRad()<<
     " Phi_old "<<vLabCoord.getPhi()<<" Phi_new "<<sphereOut.getPhi()<<
     " Theta_old "<<vLabCoord.getTheta()<<" Theta_new "<<sphereOut.getTheta()<<
     endl;
     out1.close();
     }
     */
}

Bool_t HShowerHitFinder::isLocalMax(HLocation &fLoc) {
    HShowerCal* pCell;
    HShowerCal* pRefCell = (HShowerCal*)m_pCellArr->getObject(fLoc);
    Float_t charge, charge1;
    Int_t rowL, rowU, colL, colR, iRow1, iRow2, iCol1, iCol2;;

    Int_t row = fLoc[2];
    Int_t col = fLoc[3];
    HLocation fTmpLoc;

    m_pHitFPar->getRowBord(fLoc[0], fLoc[1], &rowL, &rowU);
    m_pHitFPar->getColBord(fLoc[0], fLoc[1], &colL, &colR);
    if((row < rowL) || (row > rowU) || (col < colL) || (col > colR))
	return 0;

    if((iRow1 = row - 1) < rowL)
	iRow1 = rowL;

    if((iRow2 = row + 1) > rowU)
	iRow2 = rowU;

    if((iCol1 = col - 1) < colL)
	iCol1 = colL;

    if((iCol2 = col + 1) > colR)
	iCol2 = colR;


    fTmpLoc = fLoc;

    charge = pRefCell->getCharge();

    for(fTmpLoc[2] = iRow1; fTmpLoc[2] <= iRow2; fTmpLoc[2]++)
	for(fTmpLoc[3] = iCol1; fTmpLoc[3] <= iCol2; fTmpLoc[3]++)
	{
	    if((fTmpLoc[2] == row) && (fTmpLoc[3] == col))
		continue;

	    pCell =  (HShowerCal*)m_pCellArr->getObject(fTmpLoc);

	    if (pCell->isLocalMax() != 0)
		return 0;

	    charge1 =  pCell->getCharge();
	    if(charge < charge1)
		return 0;

	}

    pRefCell->setLocalMax();
    return 1;
}

Float_t HShowerHitFinder::calculateVar(HLocation &fLoc, Int_t nRange, Float_t avg)
{
    Int_t rowL, rowU, colL, colR, iRow1, iRow2, iCol1, iCol2;

    Int_t row = fLoc[2];
    Int_t col = fLoc[3];
    m_pHitFPar->getRowBord(fLoc[0], fLoc[1], &rowL, &rowU);
    m_pHitFPar->getColBord(fLoc[0], fLoc[1], &colL, &colR);

    if((row < rowL) || (row > rowU) || (col < colL) || (col > colR))
	return 0.0f;

    if((iRow1 = row - nRange) < rowL)
	iRow1 = rowL;

    if((iRow2 = row + nRange) > rowU)
	iRow2 = rowU;

    if((iCol1 = col - nRange) < colL)
	iCol1 = colL;

    if((iCol2 = col + nRange) > colR)
	iCol2 = colR;

    Float_t fDiff = 0.0, fVar = 0.0;
    HLocation fTmpLoc;
    fTmpLoc = fLoc;

    HShowerCal* pCell;

    //  for(fTmpLoc[2] = row - nRange; fTmpLoc[2] <= row + nRange; fTmpLoc[2]++)
    //    for(fTmpLoc[3] = col - nRange; fTmpLoc[3] <= col + nRange; fTmpLoc[3]++)
    for(fTmpLoc[2] = iRow1; fTmpLoc[2] <= iRow2; fTmpLoc[2]++)
	for(fTmpLoc[3] = iCol1; fTmpLoc[3] <= iCol2; fTmpLoc[3]++)
	{
	    pCell =  (HShowerCal*)m_pCellArr->getObject(fTmpLoc);
	    fDiff +=  (pCell->getCharge() - avg);
	    fVar += fDiff * fDiff;
	}

    return fVar;
}

Float_t HShowerHitFinder::calculateSum(HLocation &fLoc, Int_t nRange, Int_t* pncs)
{
    Int_t nThreshold = m_pHitFPar->getThreshold();
    Int_t rowL, rowU, colL, colR,iRow1, iRow2, iCol1, iCol2;

    Int_t row = fLoc[2];
    Int_t col = fLoc[3];
    m_pHitFPar->getRowBord(fLoc[0], fLoc[1], &rowL, &rowU);
    m_pHitFPar->getColBord(fLoc[0], fLoc[1], &colL, &colR);

    if((row < rowL) || (row > rowU) || (col < colL) || (col > colR))
	return 0.0f;

    if((iRow1 = row - nRange) < rowL)
	iRow1 = rowL;

    if((iRow2 = row + nRange) > rowU)
	iRow2 = rowU;

    if((iCol1 = col - nRange) < colL)
	iCol1 = colL;

    if((iCol2 = col + nRange) > colR)
	iCol2 = colR;

    Float_t fSum = 0;
    HLocation fTmpLoc;
    fTmpLoc = fLoc;

    Int_t cs = 0;
    HShowerCal* pCell;

    //  for(fTmpLoc[2] = row - nRange; fTmpLoc[2] <= row + nRange; fTmpLoc[2]++)
    //   for(fTmpLoc[3] = col - nRange; fTmpLoc[3] <= col + nRange; fTmpLoc[3]++)
    for(fTmpLoc[2] = iRow1; fTmpLoc[2] <= iRow2; fTmpLoc[2]++)
	for(fTmpLoc[3] = iCol1; fTmpLoc[3] <= iCol2; fTmpLoc[3]++)
	{
	    pCell =  (HShowerCal*)m_pCellArr->getObject(fTmpLoc);
	    fSum +=  pCell->getCharge();
	    if (pCell->getCharge() > nThreshold)
		cs++;
	}

    if (pncs)
	*pncs = cs;

    return fSum;
}

HShowerHitHeader* HShowerHitFinder::getHitHeader(HLocation &fLoc) {
    HLocation fTmpLoc;

    fTmpLoc.set(2, fLoc.getIndex(0), fLoc.getIndex(1));
    fTmpLoc[0] = fLoc[0];
    fTmpLoc[1] = fLoc[1];

    HShowerHitHeader *pHitHdr = (HShowerHitHeader*)
	((HMatrixCategory*)m_pHitHdrCat)->getObject(fTmpLoc);
    if (!pHitHdr) {
	pHitHdr = (HShowerHitHeader*)((HMatrixCategory*)m_pHitHdrCat)
	    ->getSlot(fTmpLoc);
	if (pHitHdr != NULL) {
	    pHitHdr = new(pHitHdr) HShowerHitHeader;
	    pHitHdr->setSector(fTmpLoc[0]);
	    pHitHdr->setModule(fTmpLoc[1]);
	}

    }

    return pHitHdr;
}

void HShowerHitFinder::updateClusters(HLocation &fLoc) {
    HShowerHitHeader *pHitHdr = getHitHeader(fLoc);
    if (pHitHdr)
	pHitHdr->incClusters();
}

void HShowerHitFinder::updateLocalMax(HLocation &fLoc) {
    HShowerHitHeader *pHitHdr = getHitHeader(fLoc);
    if (pHitHdr)
	pHitHdr->incLocalMax();
}

void HShowerHitFinder::updateFiredCells(HLocation &fLoc) {
    HShowerHitHeader *pHitHdr = getHitHeader(fLoc);
    if (pHitHdr)
	pHitHdr->incFiredCells();
}


 hshowerhitfinder.cc:1
 hshowerhitfinder.cc:2
 hshowerhitfinder.cc:3
 hshowerhitfinder.cc:4
 hshowerhitfinder.cc:5
 hshowerhitfinder.cc:6
 hshowerhitfinder.cc:7
 hshowerhitfinder.cc:8
 hshowerhitfinder.cc:9
 hshowerhitfinder.cc:10
 hshowerhitfinder.cc:11
 hshowerhitfinder.cc:12
 hshowerhitfinder.cc:13
 hshowerhitfinder.cc:14
 hshowerhitfinder.cc:15
 hshowerhitfinder.cc:16
 hshowerhitfinder.cc:17
 hshowerhitfinder.cc:18
 hshowerhitfinder.cc:19
 hshowerhitfinder.cc:20
 hshowerhitfinder.cc:21
 hshowerhitfinder.cc:22
 hshowerhitfinder.cc:23
 hshowerhitfinder.cc:24
 hshowerhitfinder.cc:25
 hshowerhitfinder.cc:26
 hshowerhitfinder.cc:27
 hshowerhitfinder.cc:28
 hshowerhitfinder.cc:29
 hshowerhitfinder.cc:30
 hshowerhitfinder.cc:31
 hshowerhitfinder.cc:32
 hshowerhitfinder.cc:33
 hshowerhitfinder.cc:34
 hshowerhitfinder.cc:35
 hshowerhitfinder.cc:36
 hshowerhitfinder.cc:37
 hshowerhitfinder.cc:38
 hshowerhitfinder.cc:39
 hshowerhitfinder.cc:40
 hshowerhitfinder.cc:41
 hshowerhitfinder.cc:42
 hshowerhitfinder.cc:43
 hshowerhitfinder.cc:44
 hshowerhitfinder.cc:45
 hshowerhitfinder.cc:46
 hshowerhitfinder.cc:47
 hshowerhitfinder.cc:48
 hshowerhitfinder.cc:49
 hshowerhitfinder.cc:50
 hshowerhitfinder.cc:51
 hshowerhitfinder.cc:52
 hshowerhitfinder.cc:53
 hshowerhitfinder.cc:54
 hshowerhitfinder.cc:55
 hshowerhitfinder.cc:56
 hshowerhitfinder.cc:57
 hshowerhitfinder.cc:58
 hshowerhitfinder.cc:59
 hshowerhitfinder.cc:60
 hshowerhitfinder.cc:61
 hshowerhitfinder.cc:62
 hshowerhitfinder.cc:63
 hshowerhitfinder.cc:64
 hshowerhitfinder.cc:65
 hshowerhitfinder.cc:66
 hshowerhitfinder.cc:67
 hshowerhitfinder.cc:68
 hshowerhitfinder.cc:69
 hshowerhitfinder.cc:70
 hshowerhitfinder.cc:71
 hshowerhitfinder.cc:72
 hshowerhitfinder.cc:73
 hshowerhitfinder.cc:74
 hshowerhitfinder.cc:75
 hshowerhitfinder.cc:76
 hshowerhitfinder.cc:77
 hshowerhitfinder.cc:78
 hshowerhitfinder.cc:79
 hshowerhitfinder.cc:80
 hshowerhitfinder.cc:81
 hshowerhitfinder.cc:82
 hshowerhitfinder.cc:83
 hshowerhitfinder.cc:84
 hshowerhitfinder.cc:85
 hshowerhitfinder.cc:86
 hshowerhitfinder.cc:87
 hshowerhitfinder.cc:88
 hshowerhitfinder.cc:89
 hshowerhitfinder.cc:90
 hshowerhitfinder.cc:91
 hshowerhitfinder.cc:92
 hshowerhitfinder.cc:93
 hshowerhitfinder.cc:94
 hshowerhitfinder.cc:95
 hshowerhitfinder.cc:96
 hshowerhitfinder.cc:97
 hshowerhitfinder.cc:98
 hshowerhitfinder.cc:99
 hshowerhitfinder.cc:100
 hshowerhitfinder.cc:101
 hshowerhitfinder.cc:102
 hshowerhitfinder.cc:103
 hshowerhitfinder.cc:104
 hshowerhitfinder.cc:105
 hshowerhitfinder.cc:106
 hshowerhitfinder.cc:107
 hshowerhitfinder.cc:108
 hshowerhitfinder.cc:109
 hshowerhitfinder.cc:110
 hshowerhitfinder.cc:111
 hshowerhitfinder.cc:112
 hshowerhitfinder.cc:113
 hshowerhitfinder.cc:114
 hshowerhitfinder.cc:115
 hshowerhitfinder.cc:116
 hshowerhitfinder.cc:117
 hshowerhitfinder.cc:118
 hshowerhitfinder.cc:119
 hshowerhitfinder.cc:120
 hshowerhitfinder.cc:121
 hshowerhitfinder.cc:122
 hshowerhitfinder.cc:123
 hshowerhitfinder.cc:124
 hshowerhitfinder.cc:125
 hshowerhitfinder.cc:126
 hshowerhitfinder.cc:127
 hshowerhitfinder.cc:128
 hshowerhitfinder.cc:129
 hshowerhitfinder.cc:130
 hshowerhitfinder.cc:131
 hshowerhitfinder.cc:132
 hshowerhitfinder.cc:133
 hshowerhitfinder.cc:134
 hshowerhitfinder.cc:135
 hshowerhitfinder.cc:136
 hshowerhitfinder.cc:137
 hshowerhitfinder.cc:138
 hshowerhitfinder.cc:139
 hshowerhitfinder.cc:140
 hshowerhitfinder.cc:141
 hshowerhitfinder.cc:142
 hshowerhitfinder.cc:143
 hshowerhitfinder.cc:144
 hshowerhitfinder.cc:145
 hshowerhitfinder.cc:146
 hshowerhitfinder.cc:147
 hshowerhitfinder.cc:148
 hshowerhitfinder.cc:149
 hshowerhitfinder.cc:150
 hshowerhitfinder.cc:151
 hshowerhitfinder.cc:152
 hshowerhitfinder.cc:153
 hshowerhitfinder.cc:154
 hshowerhitfinder.cc:155
 hshowerhitfinder.cc:156
 hshowerhitfinder.cc:157
 hshowerhitfinder.cc:158
 hshowerhitfinder.cc:159
 hshowerhitfinder.cc:160
 hshowerhitfinder.cc:161
 hshowerhitfinder.cc:162
 hshowerhitfinder.cc:163
 hshowerhitfinder.cc:164
 hshowerhitfinder.cc:165
 hshowerhitfinder.cc:166
 hshowerhitfinder.cc:167
 hshowerhitfinder.cc:168
 hshowerhitfinder.cc:169
 hshowerhitfinder.cc:170
 hshowerhitfinder.cc:171
 hshowerhitfinder.cc:172
 hshowerhitfinder.cc:173
 hshowerhitfinder.cc:174
 hshowerhitfinder.cc:175
 hshowerhitfinder.cc:176
 hshowerhitfinder.cc:177
 hshowerhitfinder.cc:178
 hshowerhitfinder.cc:179
 hshowerhitfinder.cc:180
 hshowerhitfinder.cc:181
 hshowerhitfinder.cc:182
 hshowerhitfinder.cc:183
 hshowerhitfinder.cc:184
 hshowerhitfinder.cc:185
 hshowerhitfinder.cc:186
 hshowerhitfinder.cc:187
 hshowerhitfinder.cc:188
 hshowerhitfinder.cc:189
 hshowerhitfinder.cc:190
 hshowerhitfinder.cc:191
 hshowerhitfinder.cc:192
 hshowerhitfinder.cc:193
 hshowerhitfinder.cc:194
 hshowerhitfinder.cc:195
 hshowerhitfinder.cc:196
 hshowerhitfinder.cc:197
 hshowerhitfinder.cc:198
 hshowerhitfinder.cc:199
 hshowerhitfinder.cc:200
 hshowerhitfinder.cc:201
 hshowerhitfinder.cc:202
 hshowerhitfinder.cc:203
 hshowerhitfinder.cc:204
 hshowerhitfinder.cc:205
 hshowerhitfinder.cc:206
 hshowerhitfinder.cc:207
 hshowerhitfinder.cc:208
 hshowerhitfinder.cc:209
 hshowerhitfinder.cc:210
 hshowerhitfinder.cc:211
 hshowerhitfinder.cc:212
 hshowerhitfinder.cc:213
 hshowerhitfinder.cc:214
 hshowerhitfinder.cc:215
 hshowerhitfinder.cc:216
 hshowerhitfinder.cc:217
 hshowerhitfinder.cc:218
 hshowerhitfinder.cc:219
 hshowerhitfinder.cc:220
 hshowerhitfinder.cc:221
 hshowerhitfinder.cc:222
 hshowerhitfinder.cc:223
 hshowerhitfinder.cc:224
 hshowerhitfinder.cc:225
 hshowerhitfinder.cc:226
 hshowerhitfinder.cc:227
 hshowerhitfinder.cc:228
 hshowerhitfinder.cc:229
 hshowerhitfinder.cc:230
 hshowerhitfinder.cc:231
 hshowerhitfinder.cc:232
 hshowerhitfinder.cc:233
 hshowerhitfinder.cc:234
 hshowerhitfinder.cc:235
 hshowerhitfinder.cc:236
 hshowerhitfinder.cc:237
 hshowerhitfinder.cc:238
 hshowerhitfinder.cc:239
 hshowerhitfinder.cc:240
 hshowerhitfinder.cc:241
 hshowerhitfinder.cc:242
 hshowerhitfinder.cc:243
 hshowerhitfinder.cc:244
 hshowerhitfinder.cc:245
 hshowerhitfinder.cc:246
 hshowerhitfinder.cc:247
 hshowerhitfinder.cc:248
 hshowerhitfinder.cc:249
 hshowerhitfinder.cc:250
 hshowerhitfinder.cc:251
 hshowerhitfinder.cc:252
 hshowerhitfinder.cc:253
 hshowerhitfinder.cc:254
 hshowerhitfinder.cc:255
 hshowerhitfinder.cc:256
 hshowerhitfinder.cc:257
 hshowerhitfinder.cc:258
 hshowerhitfinder.cc:259
 hshowerhitfinder.cc:260
 hshowerhitfinder.cc:261
 hshowerhitfinder.cc:262
 hshowerhitfinder.cc:263
 hshowerhitfinder.cc:264
 hshowerhitfinder.cc:265
 hshowerhitfinder.cc:266
 hshowerhitfinder.cc:267
 hshowerhitfinder.cc:268
 hshowerhitfinder.cc:269
 hshowerhitfinder.cc:270
 hshowerhitfinder.cc:271
 hshowerhitfinder.cc:272
 hshowerhitfinder.cc:273
 hshowerhitfinder.cc:274
 hshowerhitfinder.cc:275
 hshowerhitfinder.cc:276
 hshowerhitfinder.cc:277
 hshowerhitfinder.cc:278
 hshowerhitfinder.cc:279
 hshowerhitfinder.cc:280
 hshowerhitfinder.cc:281
 hshowerhitfinder.cc:282
 hshowerhitfinder.cc:283
 hshowerhitfinder.cc:284
 hshowerhitfinder.cc:285
 hshowerhitfinder.cc:286
 hshowerhitfinder.cc:287
 hshowerhitfinder.cc:288
 hshowerhitfinder.cc:289
 hshowerhitfinder.cc:290
 hshowerhitfinder.cc:291
 hshowerhitfinder.cc:292
 hshowerhitfinder.cc:293
 hshowerhitfinder.cc:294
 hshowerhitfinder.cc:295
 hshowerhitfinder.cc:296
 hshowerhitfinder.cc:297
 hshowerhitfinder.cc:298
 hshowerhitfinder.cc:299
 hshowerhitfinder.cc:300
 hshowerhitfinder.cc:301
 hshowerhitfinder.cc:302
 hshowerhitfinder.cc:303
 hshowerhitfinder.cc:304
 hshowerhitfinder.cc:305
 hshowerhitfinder.cc:306
 hshowerhitfinder.cc:307
 hshowerhitfinder.cc:308
 hshowerhitfinder.cc:309
 hshowerhitfinder.cc:310
 hshowerhitfinder.cc:311
 hshowerhitfinder.cc:312
 hshowerhitfinder.cc:313
 hshowerhitfinder.cc:314
 hshowerhitfinder.cc:315
 hshowerhitfinder.cc:316
 hshowerhitfinder.cc:317
 hshowerhitfinder.cc:318
 hshowerhitfinder.cc:319
 hshowerhitfinder.cc:320
 hshowerhitfinder.cc:321
 hshowerhitfinder.cc:322
 hshowerhitfinder.cc:323
 hshowerhitfinder.cc:324
 hshowerhitfinder.cc:325
 hshowerhitfinder.cc:326
 hshowerhitfinder.cc:327
 hshowerhitfinder.cc:328
 hshowerhitfinder.cc:329
 hshowerhitfinder.cc:330
 hshowerhitfinder.cc:331
 hshowerhitfinder.cc:332
 hshowerhitfinder.cc:333
 hshowerhitfinder.cc:334
 hshowerhitfinder.cc:335
 hshowerhitfinder.cc:336
 hshowerhitfinder.cc:337
 hshowerhitfinder.cc:338
 hshowerhitfinder.cc:339
 hshowerhitfinder.cc:340
 hshowerhitfinder.cc:341
 hshowerhitfinder.cc:342
 hshowerhitfinder.cc:343
 hshowerhitfinder.cc:344
 hshowerhitfinder.cc:345
 hshowerhitfinder.cc:346
 hshowerhitfinder.cc:347
 hshowerhitfinder.cc:348
 hshowerhitfinder.cc:349
 hshowerhitfinder.cc:350
 hshowerhitfinder.cc:351
 hshowerhitfinder.cc:352
 hshowerhitfinder.cc:353
 hshowerhitfinder.cc:354
 hshowerhitfinder.cc:355
 hshowerhitfinder.cc:356
 hshowerhitfinder.cc:357
 hshowerhitfinder.cc:358
 hshowerhitfinder.cc:359
 hshowerhitfinder.cc:360
 hshowerhitfinder.cc:361
 hshowerhitfinder.cc:362
 hshowerhitfinder.cc:363
 hshowerhitfinder.cc:364
 hshowerhitfinder.cc:365
 hshowerhitfinder.cc:366
 hshowerhitfinder.cc:367
 hshowerhitfinder.cc:368
 hshowerhitfinder.cc:369
 hshowerhitfinder.cc:370
 hshowerhitfinder.cc:371
 hshowerhitfinder.cc:372
 hshowerhitfinder.cc:373
 hshowerhitfinder.cc:374
 hshowerhitfinder.cc:375
 hshowerhitfinder.cc:376
 hshowerhitfinder.cc:377
 hshowerhitfinder.cc:378
 hshowerhitfinder.cc:379
 hshowerhitfinder.cc:380
 hshowerhitfinder.cc:381
 hshowerhitfinder.cc:382
 hshowerhitfinder.cc:383
 hshowerhitfinder.cc:384
 hshowerhitfinder.cc:385
 hshowerhitfinder.cc:386
 hshowerhitfinder.cc:387
 hshowerhitfinder.cc:388
 hshowerhitfinder.cc:389
 hshowerhitfinder.cc:390
 hshowerhitfinder.cc:391
 hshowerhitfinder.cc:392
 hshowerhitfinder.cc:393
 hshowerhitfinder.cc:394
 hshowerhitfinder.cc:395
 hshowerhitfinder.cc:396
 hshowerhitfinder.cc:397
 hshowerhitfinder.cc:398
 hshowerhitfinder.cc:399
 hshowerhitfinder.cc:400
 hshowerhitfinder.cc:401
 hshowerhitfinder.cc:402
 hshowerhitfinder.cc:403
 hshowerhitfinder.cc:404
 hshowerhitfinder.cc:405
 hshowerhitfinder.cc:406
 hshowerhitfinder.cc:407
 hshowerhitfinder.cc:408
 hshowerhitfinder.cc:409
 hshowerhitfinder.cc:410
 hshowerhitfinder.cc:411
 hshowerhitfinder.cc:412
 hshowerhitfinder.cc:413
 hshowerhitfinder.cc:414
 hshowerhitfinder.cc:415
 hshowerhitfinder.cc:416
 hshowerhitfinder.cc:417
 hshowerhitfinder.cc:418
 hshowerhitfinder.cc:419
 hshowerhitfinder.cc:420
 hshowerhitfinder.cc:421
 hshowerhitfinder.cc:422
 hshowerhitfinder.cc:423
 hshowerhitfinder.cc:424
 hshowerhitfinder.cc:425
 hshowerhitfinder.cc:426
 hshowerhitfinder.cc:427
 hshowerhitfinder.cc:428
 hshowerhitfinder.cc:429
 hshowerhitfinder.cc:430
 hshowerhitfinder.cc:431
 hshowerhitfinder.cc:432
 hshowerhitfinder.cc:433
 hshowerhitfinder.cc:434
 hshowerhitfinder.cc:435
 hshowerhitfinder.cc:436
 hshowerhitfinder.cc:437
 hshowerhitfinder.cc:438
 hshowerhitfinder.cc:439
 hshowerhitfinder.cc:440
 hshowerhitfinder.cc:441
 hshowerhitfinder.cc:442
 hshowerhitfinder.cc:443
 hshowerhitfinder.cc:444
 hshowerhitfinder.cc:445
 hshowerhitfinder.cc:446
 hshowerhitfinder.cc:447
 hshowerhitfinder.cc:448
 hshowerhitfinder.cc:449
 hshowerhitfinder.cc:450
 hshowerhitfinder.cc:451
 hshowerhitfinder.cc:452
 hshowerhitfinder.cc:453
 hshowerhitfinder.cc:454
 hshowerhitfinder.cc:455
 hshowerhitfinder.cc:456
 hshowerhitfinder.cc:457
 hshowerhitfinder.cc:458
 hshowerhitfinder.cc:459
 hshowerhitfinder.cc:460
 hshowerhitfinder.cc:461
 hshowerhitfinder.cc:462
 hshowerhitfinder.cc:463
 hshowerhitfinder.cc:464
 hshowerhitfinder.cc:465
 hshowerhitfinder.cc:466
 hshowerhitfinder.cc:467
 hshowerhitfinder.cc:468
 hshowerhitfinder.cc:469
 hshowerhitfinder.cc:470
 hshowerhitfinder.cc:471
 hshowerhitfinder.cc:472
 hshowerhitfinder.cc:473
 hshowerhitfinder.cc:474
 hshowerhitfinder.cc:475
 hshowerhitfinder.cc:476
 hshowerhitfinder.cc:477
 hshowerhitfinder.cc:478
 hshowerhitfinder.cc:479
 hshowerhitfinder.cc:480
 hshowerhitfinder.cc:481
 hshowerhitfinder.cc:482
 hshowerhitfinder.cc:483
 hshowerhitfinder.cc:484
 hshowerhitfinder.cc:485
 hshowerhitfinder.cc:486
 hshowerhitfinder.cc:487
 hshowerhitfinder.cc:488
 hshowerhitfinder.cc:489
 hshowerhitfinder.cc:490
 hshowerhitfinder.cc:491
 hshowerhitfinder.cc:492
 hshowerhitfinder.cc:493
 hshowerhitfinder.cc:494
 hshowerhitfinder.cc:495
 hshowerhitfinder.cc:496
 hshowerhitfinder.cc:497
 hshowerhitfinder.cc:498
 hshowerhitfinder.cc:499
 hshowerhitfinder.cc:500
 hshowerhitfinder.cc:501
 hshowerhitfinder.cc:502
 hshowerhitfinder.cc:503
 hshowerhitfinder.cc:504
 hshowerhitfinder.cc:505
 hshowerhitfinder.cc:506
 hshowerhitfinder.cc:507
 hshowerhitfinder.cc:508
 hshowerhitfinder.cc:509
 hshowerhitfinder.cc:510
 hshowerhitfinder.cc:511
 hshowerhitfinder.cc:512
 hshowerhitfinder.cc:513
 hshowerhitfinder.cc:514
 hshowerhitfinder.cc:515
 hshowerhitfinder.cc:516
 hshowerhitfinder.cc:517
 hshowerhitfinder.cc:518
 hshowerhitfinder.cc:519
 hshowerhitfinder.cc:520
 hshowerhitfinder.cc:521
 hshowerhitfinder.cc:522
 hshowerhitfinder.cc:523
 hshowerhitfinder.cc:524
 hshowerhitfinder.cc:525
 hshowerhitfinder.cc:526
 hshowerhitfinder.cc:527
 hshowerhitfinder.cc:528
 hshowerhitfinder.cc:529
 hshowerhitfinder.cc:530
 hshowerhitfinder.cc:531
 hshowerhitfinder.cc:532
 hshowerhitfinder.cc:533
 hshowerhitfinder.cc:534
 hshowerhitfinder.cc:535
 hshowerhitfinder.cc:536
 hshowerhitfinder.cc:537
 hshowerhitfinder.cc:538
 hshowerhitfinder.cc:539
 hshowerhitfinder.cc:540
 hshowerhitfinder.cc:541
 hshowerhitfinder.cc:542
 hshowerhitfinder.cc:543
 hshowerhitfinder.cc:544
 hshowerhitfinder.cc:545
 hshowerhitfinder.cc:546
 hshowerhitfinder.cc:547
 hshowerhitfinder.cc:548
 hshowerhitfinder.cc:549
 hshowerhitfinder.cc:550
 hshowerhitfinder.cc:551
 hshowerhitfinder.cc:552
 hshowerhitfinder.cc:553
 hshowerhitfinder.cc:554
 hshowerhitfinder.cc:555
 hshowerhitfinder.cc:556
 hshowerhitfinder.cc:557
 hshowerhitfinder.cc:558
 hshowerhitfinder.cc:559
 hshowerhitfinder.cc:560
 hshowerhitfinder.cc:561
 hshowerhitfinder.cc:562
 hshowerhitfinder.cc:563
 hshowerhitfinder.cc:564
 hshowerhitfinder.cc:565
 hshowerhitfinder.cc:566
 hshowerhitfinder.cc:567
 hshowerhitfinder.cc:568
 hshowerhitfinder.cc:569
 hshowerhitfinder.cc:570
 hshowerhitfinder.cc:571
 hshowerhitfinder.cc:572
 hshowerhitfinder.cc:573
 hshowerhitfinder.cc:574
 hshowerhitfinder.cc:575
 hshowerhitfinder.cc:576
 hshowerhitfinder.cc:577
 hshowerhitfinder.cc:578
 hshowerhitfinder.cc:579
 hshowerhitfinder.cc:580
 hshowerhitfinder.cc:581
 hshowerhitfinder.cc:582
 hshowerhitfinder.cc:583
 hshowerhitfinder.cc:584
 hshowerhitfinder.cc:585
 hshowerhitfinder.cc:586
 hshowerhitfinder.cc:587
 hshowerhitfinder.cc:588
 hshowerhitfinder.cc:589
 hshowerhitfinder.cc:590
 hshowerhitfinder.cc:591
 hshowerhitfinder.cc:592
 hshowerhitfinder.cc:593
 hshowerhitfinder.cc:594
 hshowerhitfinder.cc:595
 hshowerhitfinder.cc:596
 hshowerhitfinder.cc:597
 hshowerhitfinder.cc:598
 hshowerhitfinder.cc:599
 hshowerhitfinder.cc:600
 hshowerhitfinder.cc:601
 hshowerhitfinder.cc:602
 hshowerhitfinder.cc:603
 hshowerhitfinder.cc:604
 hshowerhitfinder.cc:605
 hshowerhitfinder.cc:606
 hshowerhitfinder.cc:607
 hshowerhitfinder.cc:608
 hshowerhitfinder.cc:609
 hshowerhitfinder.cc:610
 hshowerhitfinder.cc:611
 hshowerhitfinder.cc:612
 hshowerhitfinder.cc:613
 hshowerhitfinder.cc:614
 hshowerhitfinder.cc:615
 hshowerhitfinder.cc:616
 hshowerhitfinder.cc:617
 hshowerhitfinder.cc:618
 hshowerhitfinder.cc:619
 hshowerhitfinder.cc:620
 hshowerhitfinder.cc:621
 hshowerhitfinder.cc:622
 hshowerhitfinder.cc:623
 hshowerhitfinder.cc:624
 hshowerhitfinder.cc:625
 hshowerhitfinder.cc:626
 hshowerhitfinder.cc:627
 hshowerhitfinder.cc:628
 hshowerhitfinder.cc:629
 hshowerhitfinder.cc:630
 hshowerhitfinder.cc:631
 hshowerhitfinder.cc:632
 hshowerhitfinder.cc:633
 hshowerhitfinder.cc:634
 hshowerhitfinder.cc:635
 hshowerhitfinder.cc:636
 hshowerhitfinder.cc:637
 hshowerhitfinder.cc:638
 hshowerhitfinder.cc:639
 hshowerhitfinder.cc:640
 hshowerhitfinder.cc:641
 hshowerhitfinder.cc:642
 hshowerhitfinder.cc:643
 hshowerhitfinder.cc:644
 hshowerhitfinder.cc:645
 hshowerhitfinder.cc:646
 hshowerhitfinder.cc:647
 hshowerhitfinder.cc:648
 hshowerhitfinder.cc:649
 hshowerhitfinder.cc:650
 hshowerhitfinder.cc:651
 hshowerhitfinder.cc:652
 hshowerhitfinder.cc:653
 hshowerhitfinder.cc:654
 hshowerhitfinder.cc:655
 hshowerhitfinder.cc:656
 hshowerhitfinder.cc:657
 hshowerhitfinder.cc:658
 hshowerhitfinder.cc:659
 hshowerhitfinder.cc:660
 hshowerhitfinder.cc:661
 hshowerhitfinder.cc:662
 hshowerhitfinder.cc:663
 hshowerhitfinder.cc:664
 hshowerhitfinder.cc:665
 hshowerhitfinder.cc:666
 hshowerhitfinder.cc:667
 hshowerhitfinder.cc:668
 hshowerhitfinder.cc:669
 hshowerhitfinder.cc:670
 hshowerhitfinder.cc:671
 hshowerhitfinder.cc:672
 hshowerhitfinder.cc:673
 hshowerhitfinder.cc:674
 hshowerhitfinder.cc:675
 hshowerhitfinder.cc:676
 hshowerhitfinder.cc:677
 hshowerhitfinder.cc:678
 hshowerhitfinder.cc:679
 hshowerhitfinder.cc:680
 hshowerhitfinder.cc:681
 hshowerhitfinder.cc:682
 hshowerhitfinder.cc:683
 hshowerhitfinder.cc:684
 hshowerhitfinder.cc:685
 hshowerhitfinder.cc:686
 hshowerhitfinder.cc:687
 hshowerhitfinder.cc:688
 hshowerhitfinder.cc:689
 hshowerhitfinder.cc:690
 hshowerhitfinder.cc:691
 hshowerhitfinder.cc:692
 hshowerhitfinder.cc:693
 hshowerhitfinder.cc:694
 hshowerhitfinder.cc:695
 hshowerhitfinder.cc:696
 hshowerhitfinder.cc:697
 hshowerhitfinder.cc:698
 hshowerhitfinder.cc:699
 hshowerhitfinder.cc:700