#include "hrichanalysispar.h"
#include "hrichanalysissim.h"
#include "hrichhitsim.h"
#include "hrichringfindsim.h"
using namespace std;
ClassImp(HRichRingFindSim)
HRichRingFindSim::HRichRingFindSim()
{
maxRings = 0;
pRings = NULL;
}
HRichRingFindSim::~HRichRingFindSim()
{
if ( NULL != pRings )
{
delete [] pRings;
pRings = NULL;
}
}
Bool_t
HRichRingFindSim::init(HRichAnalysisSim* showMe)
{
maxRings = 0;
HRichRingFind::init(showMe);
if ( pRings )
delete [] pRings;
if (pAnalysisParams->isActiveRingFindFitMatrix)
maxRings += pAnalysisParams->iHowManyFitMatrixRings;
if (pAnalysisParams->isActiveRingHoughTransf)
maxRings += pAnalysisParams->iHowManyHoughTransfRings;
pRings = new HRichHitSim[maxRings];
showMe->pRings = pRings;
return kTRUE;
}
void
HRichRingFindSim::LookForTrack(HRichAnalysisSim *showMe)
{
Int_t n = 0;
Int_t j = 0;
Int_t k = 0;
Int_t z = 0;
const Int_t ringHalfSize = iRingImageSize / 2;
for ( n = 0; n < iRingNr; ++n )
{
Int_t trackCount = 0;
HRichHitSim& ring = pRings[n];
Int_t iNowX = ring.iRingX;
Int_t iNowY = ring.iRingY;
for ( Int_t row = iNowY-ringHalfSize; row <=iNowY+ringHalfSize; ++row )
{
for ( Int_t col = iNowX-ringHalfSize; col <= iNowX+ringHalfSize; ++col )
{
if ( !showMe->IsOut(col, row) )
{
if ( showMe->GetPad(col, row)->getAmplitude() > 0 &&
1 == pAnalysisParams->iRingMask[col-(iNowX-ringHalfSize) +
(pAnalysisParams->iRingMaskSize) *
(row-(iNowY-ringHalfSize))] )
{
ring.iRingPadNTrack1[trackCount] = showMe->getPadsNTrack1(col, row, showMe->GetActiveSector());
ring.iRingPadNTrack2[trackCount] = showMe->getPadsNTrack2();
trackCount++;
}
}
}
}
ring.iRingPadNTrack1[trackCount] = -1;
ring.iRingPadNTrack2[trackCount] = -1;
j = k = z = 0;
while ( ring.iRingPadNTrack1[j] >= 0 )
{
ring.iRingTrack[k]=showMe->getTrack(ring.iRingPadNTrack1[j]);
ring.iRingFlag[k]=showMe->getFlag(ring.iRingPadNTrack1[j]);
k++;
if( k >= 254 )
{
Warning("LookForTrack","Boundary reached. Additional tracks will be skipped");
break;
}
z = ring.iRingPadNTrack2[j] - ring.iRingPadNTrack1[j];
for ( Int_t tmp = 1; tmp <= z; ++tmp )
{
ring.iRingTrack[k]=showMe->getTrack(ring.iRingPadNTrack1[j] + tmp);
ring.iRingFlag[k] =showMe->getFlag(ring.iRingPadNTrack1[j] + tmp);
k++;
if( k >= 254 )
{
Warning("LookForTrack","Boundary reached. Additional tracks will be skipped");
break;
}
}
j++;
}
ring.iRingTrack[k] = 0;
}
}
Int_t HRichRingFindSim::Execute(HRichAnalysisSim *giveMe)
{
iRingNr = HRichRingFind::Execute(giveMe);
if ( iRingNr >= maxRings )
{
Warning("Execute",
"Number of found rings (%d) exceeds the array size, only firs %d rings are taken",
iRingNr, maxRings);
iRingNr = maxRings;
}
for ( Int_t i = 0; i < iRingNr; ++i )
{
pRings[i] = HRichRingFind::pRings[i];
}
if( iRingNr > 0 )
LookForTrack(giveMe);
return (iRingNr);
}
Last change: Sat May 22 13:10:00 2010
Last generated: 2010-05-22 13:10
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.