/*! \file \version $Id: TAGactDatFbus.cxx,v 1.3 2003/07/08 18:56:32 mueller Exp $ \brief Implementation of TATOFactDatFbus. */ #include "TATOFparFbusCal.h" //#include "TATOFmbsEvent.h" // peut-etre a enlever (inutile) #include "TATOFdatFbus.h" #include "TATOFactDatFbus.h" /*! \class TATOFactDatFbus TATOFactDatFbus.h "TATOFactDatFbus.h" \brief Get FastBus raw data. ** */ ClassImp(TATOFactDatFbus); //------------------------------------------+----------------------------------- //! Default constructor. TATOFactDatFbus::TATOFactDatFbus(const char* name, TATOFdataDsc* p_datraw, //TATOFdataDsc* p_datmbs, - ALF TATOFparaDsc* p_parcal) : TATOFaction(name), fpDatRaw(p_datraw), // fpDatMbs(p_datmbs), - ALF fpParCal(p_parcal) { /*if (gTATOFactDatFbus) { // ALF Error("TATOFactDatFbus()", "only one instance of TATOFactDatFbus allowed"); return; } gTATOFactDatFbus = this; // ALF */ AddDataOut(p_datraw, "TATOFdatFbus"); // AddDataIn(p_datmbs, "TATOFmbsEvent"); - ALF AddPara(p_parcal, "TATOFparFbusCal"); } //------------------------------------------+----------------------------------- //! Destructor. TATOFactDatFbus::~TATOFactDatFbus() { // gTATOFactDatFbus = 0; // ALF } //------------------------------------------+----------------------------------- //! Action. Bool_t TATOFactDatFbus::Action(Int_t* p_se,Int_t i_nw) // ALF // Inputs: size of ATOF sub-event, pointer on ATOF sub-event //Bool_t TATOFactDatFbus::Action() { TATOFdatFbus* p_datraw = (TATOFdatFbus*) fpDatRaw->Object(); //TATOFmbsEvent* p_datmbs = (TATOFmbsEvent*) fpDatMbs->Object(); TATOFparFbusCal* p_parcal = (TATOFparFbusCal*) fpParCal->Object(); // Here, the loop over MBS sub-events has been removed, because it is done // in the unpacker. We just keep the treatment of the ALADiN ToF-Wall sub-event - ALF //Int_t i_nse = p_datmbs->NSubEvent(); //for (Int_t i_se = 0; i_se < i_nse; i_se++) { //if (p_datmbs->SubEventType(i_se) == 32) { //Int_t i_nw = p_datmbs->SubEventSize(i_se); //Int_t i_sestyp = p_datmbs->SubEventSubType(i_se); //const UInt_t* p_se = p_datmbs->SubEventData(i_se); Int_t i_ndrop = 0; Int_t i_glast = -1; Int_t i_clast = -1; /* ALF if (i_sestyp == 1100 || i_sestyp == 1120 || i_sestyp == 1130){ } else if (i_sestyp == 3100 || i_sestyp == 3120 || i_sestyp == 3130) { p_se += 1; // skip first data word i_nw -= 1; // is crate number in LAND events } else { continue; } */ for (Int_t i = 0; i < i_nw; i++) { UInt_t i_data = p_se[i]; Int_t i_g = (i_data>>27) & 0x001f; // geographical address (slot) on fastbus Int_t i_c = (i_data>>16) & 0x007f; // channel fired on that slot Int_t i_addr = TATOFdatFbus::PackAddress(i_g, i_c); printf("i_g=%d i_c=%d i_addr=%d\n",i_g,i_c,i_addr); // test if (i_g > 0 && i_g != i_glast) { i_glast = i_g; i_clast = i_c; } else { if (i_c <= i_clast) { Warning("Action()", "Non-increasing channel number g,c = %2d,%2d -> %2d,%2d", i_glast, i_clast, i_g, i_c); } i_clast = i_c; } const TATOFparFbusCalInfo* p_calinfo = p_parcal->Find(i_addr); if (p_calinfo) { Int_t i_val = i_data & 0x00000fff; // value read in that channel (0-4095) Bool_t b_ran = i_data & 0x00800000; // range (low or high) Int_t i_combo = TATOFdatFbus::PackCombo(b_ran, i_val); p_datraw->AddHit(i_addr, i_combo, p_calinfo->Calibrate(i_combo)); } else { i_ndrop += 1; } } p_datraw->SetCounter(i_ndrop); //} //} fpDatRaw->SetBit(kValid); return kTRUE; } /*------------------------------------------+---------------------------------*/ //TATOFactDatFbus* gTATOFactDatFbus=0; // ALF