#include "hshowerdigitizer.h"
#include "hiterator.h"
#include "hruntimedb.h"
#include "hevent.h"
#include "hspectrometer.h"
#include "hdetector.h"
#include "hshowerdetector.h"
#include "hcategory.h"
#include "hlinearcatiter.h"
#include "hlocation.h"
#include "hshowerdigidetpar.h"
#include "hshowergeometry.h"
#include "hdebug.h"
#include "hades.h"
#include "showerdef.h"
#include "hshowercal.h"
#include "hshowercopy.h"
ClassImp(HShowerCopy)
HShowerCopy::HShowerCopy(const Text_t *name,const Text_t *title, Float_t masterOffset) :
HReconstructor(name,title)
{
m_zeroLoc.set(0);
m_nEvents = 0;
fIter = NULL;
fCalIter = NULL;
mOffset = masterOffset;
}
HShowerCopy::HShowerCopy()
{
m_zeroLoc.set(0);
m_nEvents = 0;
fIter = NULL;
fCalIter = NULL;
mOffset = 0;
}
HShowerCopy::~HShowerCopy(void) {
if (fIter) { delete fIter ; fIter = NULL;}
if (fCalIter) { delete fCalIter; fCalIter = NULL;}
}
Bool_t HShowerCopy::init() {
printf("initialization shower copy reconstructor\n");
HCategory *pCatMatr;
HShowerDetector *pShowerDet = (HShowerDetector*)gHades->getSetup()
->getDetector("Shower");
pCatMatr=gHades->getCurrentEvent()->getCategory(catShowerRawMatr);
if (!pCatMatr) {
pCatMatr=pShowerDet->buildCategory(catShowerRawMatr);
if (!pCatMatr) return kFALSE;
else gHades->getCurrentEvent()
->addCategory(catShowerRawMatr,pCatMatr,"Shower");
}
setInCat(pCatMatr);
fIter = (HIterator*)pCatMatr->MakeIterator("native");
pCatMatr=gHades->getCurrentEvent()->getCategory(catShowerCal);
if (!pCatMatr) {
pCatMatr=pShowerDet->buildCategory(catShowerCal);
if (!pCatMatr) return kFALSE;
else gHades->getCurrentEvent()->addCategory(catShowerCal,pCatMatr,"Shower");
}
setOutCat(pCatMatr);
fCalIter = (HIterator*)pCatMatr->MakeIterator("native");
return kTRUE;
}
Bool_t HShowerCopy::copy(HShowerRawMatr *pMatr)
{
HShowerCal *pCal = NULL;
if (pMatr)
{
Float_t fCharge;
Int_t iChamber;
fCharge = pMatr->getCharge();
iChamber = pMatr->getSector()+pMatr->getModule()*6;
if (fCharge >= mOffset)
{
Bool_t found=kFALSE;
if(gHades->getEmbeddingMode()>0)
{
fCalIter->Reset();
while ((pCal=(HShowerCal *)fCalIter->Next())!=0)
{
if(pCal->getAddress()==pMatr->getAddress())
{
pCal->setCharge(pCal->getCharge() + fCharge);
found=kTRUE;
break;
}
}
}
if(!found)
{
pCal=(HShowerCal *)m_pOutCat->getNewSlot(m_zeroLoc);
if (pCal != NULL){
pCal=new(pCal) HShowerCal;
pCal->setCharge( fCharge );
pCal->setSector( pMatr->getSector() );
pCal->setModule( pMatr->getModule() );
pCal->setRow( pMatr->getRow() );
pCal->setCol( pMatr->getCol() );
}
}
}
}
return kTRUE;
}
Int_t HShowerCopy::execute()
{
HShowerRawMatr *pMatr;
Int_t n = 0;
fIter->Reset();
while((pMatr = (HShowerRawMatr*)fIter->Next()))
{
copy(pMatr);
n++;
}
m_nEvents++;
return 0;
}
Last change: Sat May 22 13:13:23 2010
Last generated: 2010-05-22 13:13
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.