// ESAF : Euso Simulation and Analysis Framework
// $Id: EEventFrontEndDataAdder.cc,v 1.6 2005/10/20 12:44:18 pesce Exp $
// A.Thea created Oct, 26 2003
#include "EEventFrontEndDataAdder.hh"
#include "EEvent.hh"
#include "EDetector.hh"
#include "Photomultiplier.hh"
#include "ChipGtuData.hh"
#include "FrontEndChip.hh"
#include "MacroCell.hh"
#include "EFee.hh"
#include "EAFee.hh"
ClassImp(EEventFrontEndDataAdder)
using namespace TMath;
//______________________________________________________________________________
EEventFrontEndDataAdder::EEventFrontEndDataAdder( ChipGtuData* chip)
: EFiller("EDetector") {
// ctor
fChip = chip;
}
//______________________________________________________________________________
EEventFrontEndDataAdder::~EEventFrontEndDataAdder() {
// dtor
}
//______________________________________________________________________________
void EEventFrontEndDataAdder::Fill( EFillable* f) {
// filler
// copy data related to Front End chip into root file
// both DFEE and AFEE data are copied
// there are two objects: EFee and EAFee
// EFee contains both digital electronics data (counts for each channel
// and for each GTU) and FULL AFEE (charge per channel and per GTU)
// AFee contains the minimal analog info (dynode charge) and
// possibly the Cerenkov trigger signals simulation
EDetector *det = (EDetector*)f;
if (!fChip) {
Msg(EsafMsg::Panic) << "Invalid ChipGtuData. Null pointer!" << MsgDispatch;
}
if ( fChip->IsEmpty() && !det->IsNightGlowFillable() ) return;
if ( fChip->GetTotalCounts() == 0) return;
FrontEndChip *fe = fChip->FrontEnd();
if (!fe) {
Msg(EsafMsg::Panic) << "Invalid ChipGtuData. No Front End attached!" << MsgDispatch;
}
// FIXME! to be changed to take into account many pmts mapping...
// right now not dangerous
Photomultiplier *pmt = fe->Pmt();
if (!pmt) {
Msg(EsafMsg::Panic) << "Invalid ChipGtuData. No Pmt attached!" << MsgDispatch;
return;
}
// get the detector status
EDetStatus *status = &(det->fStatus);
Int_t size = (status->fMaxSignals).GetSize();
Int_t gtu = fChip->Gtu();
if ( (gtu+1)>size ) {
(status->fMaxSignals).Set(gtu+1);
(status->fMaxHits).Set(gtu+1);
(status->fMaxBkg).Set(gtu+1);
size = gtu+1;
}
Int_t *maxsign = (status->fMaxSignals).GetArray();
Int_t *maxhits = (status->fMaxHits).GetArray();
Int_t *maxbkg = (status->fMaxBkg).GetArray();
// for each channel one EFee object is created
for( int nch=0; nch<fe->Channels(); nch++) {
if ( fChip->GetCounter(nch) == 0 ) continue;
// creates a new EFee object and store it into the TClonesArray
new ( (*(det->fFee))[det->fNumFee] ) EFee();
EFee *pFee = (EFee*) (*(det->fFee))[det->fNumFee];
// fill data
pFee->SetGtu(gtu); // gtu id
pFee->SetFEId(fe->Id()); // front end chip id
pFee->SetChUId(fe->UniqueChanId(nch)); // pixel identifier
pFee->SetNumSignals(fChip->GetPureSignal(nch)); // number of signal photons
pFee->SetNumHits(fChip->GetCounter(nch)); // number of detected photons
pFee->SetHasTriggered(fChip->CheckCounter(nch)); // above threshold ?
if ( pFee->fHasTriggered )
pFee->SetChCharge(fChip->Charge(nch)); // full AFEE charge for this channel/gtu
else
pFee->SetChCharge(-1.);
det->fNumFee++;
// fill detector status
Int_t nbkg = fChip->GetCounter(nch) - fChip->GetPureSignal(nch);
if ( fChip->GetPureSignal(nch) ) {
status->fNumHits += fChip->GetCounter(nch);
status->fNumSignals += fChip->GetPureSignal(nch);
maxsign[gtu] = Max(maxsign[gtu], fChip->GetPureSignal(nch));
maxhits[gtu] = Max(maxhits[gtu], fChip->GetCounter(nch));
maxbkg[gtu] = Max(maxbkg[gtu], nbkg);
}
status->fNumBkg += nbkg;
}
(status->fMaxSignals).Set(size, maxsign);
(status->fMaxHits).Set(size, maxhits);
(status->fMaxBkg).Set(size, maxbkg);
// fill the number of active gtus
Int_t numgtu = 0;
for( Int_t i(0); i<size; i++ )
if (maxsign[i]) numgtu++;
status->fNumGtu = numgtu;
// analog front end data (gtu related, dynode charge and trigger if any)
// this is minimal AFEE
// FULL AFEE is in the EFee object above
new ( (*(det->fAFee))[det->fNumAFee] ) EAFee();
EAFee *pa = (EAFee*) (*(det->fAFee))[det->fNumAFee];
pa->SetMCId(pmt->Cell()->Id()); // macrocell id
pa->SetGtu(fChip->Gtu()); // gtu id
pa->SetFEId(fe->Id()); // front end fChip id
pa->SetDyCharge(fChip->DynodeCharge()); // dynode charge
pa->SetCherTrigg(kFALSE); // Cerenkov trigger to be done
det->fNumAFee++;
}
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.