// ESAF : Euso Simulation and Analysis Framework
// $Id: EDetectorPhotonDataAdder.cc,v 1.2 2005/02/12 18:17:43 thea Exp $
// A.Thea created Oct, 28 2003
#include "EDetectorPhotonDataAdder.hh"
#include "EEvent.hh"
#include "EDetPhoton.hh"
ClassImp(EDetectorPhotonDataAdder)
//______________________________________________________________________________
EDetectorPhotonDataAdder::EDetectorPhotonDataAdder(Int_t s_id, Int_t mc, Int_t fe,
Int_t gtu, Bool_t madecount, Bool_t madefo, Int_t mx, Int_t my)
: EFiller( "EDetector" ) {
// ctor
fSignalID = s_id;
fMacroCell = mc;
fFrontEnd = fe;
fGtu = gtu;
fMadeCount = madecount;
fMadeFastOR = madefo;
fMacroCellX = mx;
fMacroCellY = my;
}
//______________________________________________________________________________
EDetectorPhotonDataAdder::~EDetectorPhotonDataAdder() {
// dtor
}
//______________________________________________________________________________
void EDetectorPhotonDataAdder::Fill( EFillable* f ) {
// filler
// associate electronics chain to a pmt signal
EDetector *det = (EDetector*)f;
bool go_on = kTRUE;
int i=0;
EDetPhoton* p;
while( go_on ) {
p = (EDetPhoton*)(*(det->fPhotons))[i];
if ( p && i!= det->fNumPhotons ) {
if ( p->fSignalId == fSignalID )
go_on = kFALSE;
else
i++;
}
else
go_on = kFALSE;
}
if ( i < det->fNumPhotons ) {
p->fMacroCell = fMacroCell;
p->fFe = fFrontEnd;
p->fGtu = fGtu;
if ( fMadeCount ) p->SetMadeCount();
else p->ClearMadeCount();
if ( fMadeFastOR ) {
p->SetMadeFastOR();
p->fXCell = fMacroCellX;
p->fYCell = fMacroCellY;
}
else p->ClearMadeFastOR();
}
}