Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

EDetectorPhotonDataAdder - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: EDetectorPhotonDataAdder.cc,v 1.5 2005/10/20 12:44:18 pesce Exp $
// A.Thea created Oct, 28 2003

#include "EDetectorPhotonDataAdder.hh"
#include "EEvent.hh"
#include "EDetector.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;

    if ( !(det = dynamic_cast<EDetector*>(f)) ) {
        MsgForm(EsafMsg::Warning,"Fill(): f is not an EDetector* ");
        return; 
    }

    // fill photons info in the detector status


    // if photons are disabled return
    if ( !det->IsPhotonFillable() ) return;
    
    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();
    }
}
About Us | EUSO Official Website | Web pages created by Roberto Pesce and Alessandro Thea - Last Update Wed Nov 16 16:57:39 2005 Wed Nov 16 16:29:22 2005