Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

EEventCellStatisticsAdder - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: EEventCellStatisticsAdder.cc,v 1.4 2005/06/29 12:52:02 pesce Exp $
// A.Thea created Oct, 28 2003

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

        map<Int_t,Int_t> words = TriggerEngine::GetTrgWords();

        Int_t fWords[words.size()];
        Int_t fIds[words.size()];
        Int_t counter = 0;
        map<Int_t,Int_t>::iterator it = words.begin();
        for( ; it!=words.end(); it++ ) {
            fWords[counter] = it->second;
            fIds[counter] = it->first;
            counter++;
        }
        p->SetTrgWords(words.size(), fWords);
        p->SetTrgIds(words.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 Wed Nov 16 16:57:39 2005 Wed Nov 16 16:29:22 2005