#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"
//_HADES_CLASS_DESCRIPTION
/////////////////////////////////////////////////////////////////////
//
// HShowerDigitizer digitizes data, puts output values into
// HShowerRawMatr data category. The input data are read from the HGeantShower
// category. The Shower digitization 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 | <------------| //
// ------------------ //
// //
// ------------------ -------------> ------------------------ //
// | HShowerHitTrack | <------------ | 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)
//
/////////////////////////////////////////////////////////////////////
ClassImp(HShowerCopy)
HShowerCopy::HShowerCopy(Text_t *name,Text_t *title, Float_t masterOffset) :
HReconstructor(name,title)
{
m_zeroLoc.set(0);
m_nEvents = 0;
fIter = NULL;
mOffset = masterOffset;
}
HShowerCopy::HShowerCopy()
{
m_zeroLoc.set(0);
m_nEvents = 0;
fIter = NULL;
mOffset = 0;
}
HShowerCopy::~HShowerCopy(void) {
if (fIter) delete fIter;
}
Bool_t HShowerCopy::init() {
printf("initialization shower copy reconstructorn");
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;
}
/************** COPY **************/
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)
{
//-------------------------------------------------
// loop over ShowerCal category and check
// if the object was existing in real data.
// if so, just add charge to the existing object
fCalIter->Reset();
while ((pCal=(HShowerCal *)fCalIter->Next())!=0)
{
if(pCal->getAddress()==pMatr->getAddress())
{
// if the object exists already just
// add the charges
pCal->setCharge(pCal->getCharge() + fCharge);
found=kTRUE;
break;
}
}
//-------------------------------------------------
}
if(!found)
{
// if cal object did not exist before (always true
// if not in embedding mode)
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;
}
ROOT page - Class index - Class Hierarchy - Top of the page
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.