Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

EEventCellStatisticsAdder - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: EEventCellStatisticsAdder.cc,v 1.2 2005/04/15 12:21:53 pesce Exp $
// A.Thea created Oct, 28 2003

#include "EEventCellStatisticsAdder.hh"
#include "EEvent.hh"
#include "EMacroCell.hh"
#include "MacroCellData.hh"
#include "TriggerEngine.hh"

ClassImp(EEventCellStatisticsAdder)

//______________________________________________________________________________
EEventCellStatisticsAdder::EEventCellStatisticsAdder(Int_t cell,
    Int_t nChips, Int_t nPixels, Int_t nCounts, MacroCellData* data)
    : EFiller("EDetector") {
    // ctor
    
    fCell = cell;
    fNumChips = nChips;
    fNumPixels = nPixels;
    fNumCounts = nCounts;
    fData = data;
    
}

//______________________________________________________________________________
EEventCellStatisticsAdder::~EEventCellStatisticsAdder() {
    // dtor
    
}

//______________________________________________________________________________
 void EEventCellStatisticsAdder::Fill( EFillable *f) {
    // filler
    // infos for each macrocell that has seen some photons
    // these infos are partially redundant to EDetector but organized differently
    EDetector *ev = (EDetector*)f; 

    new ( (*(ev->fMacroCell))[ev->fNumCells] ) EMacroCell();
    EMacroCell *p = (EMacroCell*) (*(ev->fMacroCell))[ev->fNumCells];
    ev->fNumCells++;
    p->SetMCId( fCell );
    p->SetNumChips( fNumChips );
    p->SetNumPixels( fNumPixels );
    p->SetNumCounts( fNumCounts );
    
    if ( fData->IsEmpty() ) 
        return;
    
    // add data into EMacroCell object
    if ( TriggerEngine::GetTriggerWord() ) {
        p->SetHasTriggered( kTRUE );
        p->SetGtuTrigger( fData->GtuTrigger() );
        p->SetTriggerWord( TriggerEngine::GetTriggerWord() );
        Int_t fWords[(TriggerEngine::GetTrgWords()).size()];
        Int_t fIds[(TriggerEngine::GetTrgWords()).size()];
        Int_t counter = 0;
        map<Int_t,Int_t>::iterator it = (TriggerEngine::GetTrgWords()).begin();
        for( ; it!=(TriggerEngine::GetTrgWords()).end(); it++ ) {
            fWords[counter] = it->second;
            fIds[counter] = it->first;
            counter++;
        }
        p->SetTrgWords((TriggerEngine::GetTrgWords()).size(), fWords);
        p->SetTrgIds((TriggerEngine::GetTrgWords()).size(), fIds);
    } else {
        p->SetHasTriggered( kFALSE );
        p->SetGtuTrigger( 0 );
        p->SetTriggerWord( 0 );
    }


}

About Us | EUSO Official Website | Web pages created by Roberto Pesce and Alessandro Thea - Last Update 14-May-2005 21:31