//----------------------------------------------------------------------------- // Jan 11 2001 P.Murat: STNTUPLE utility routines //----------------------------------------------------------------------------- #include "evt/Event.hh" #include "Bbos/bank_interface.hh" #include "Stntuple/base/TStnArrayI.hh" #include "Stntuple/data/TTl1d.hh" #include "Stntuple/mod/StntupleUtilities.hh" //_____________________________________________________________________________ Int_t StntupleUnpackTriggerBank(TRYBOS_BANK* bank, void** a) { // unpack YBOS TRIGGER bank into a list of blocks assuming // that the person who unpacks it knows what to do next... int iblock, loc, nblk, nw, nw_blk, n_boards, loc_blk, loc_data; if (! bank) return 0; // now loop over the data blocks // another time and copy the data // 1block per crate nblk = bank->iw(0); iblock = 0; for (int iblk=0; iblkiw(iblk+1); nw_blk = bank->iw(iblk+2)-loc_blk; if (nw_blk > 0) { n_boards = bank->iw(loc_blk); for (int itdc=0; itdciw(loc+1)-bank->iw(loc); // forget about the redundancy if (nw > 0) { loc_data = loc_blk+bank->iw(loc); memcpy(a[iblock],&bank->iw(loc_data),nw*sizeof(Int_t)); } iblock++; } } } return 0; } //_____________________________________________________________________________ Int_t StntupleUnpackTL1DBank(TRYBOS_BANK* bank, TTl1d* tl1d) { // unpack TL1D bank into TTL1d STNTUPLE structure. Difference between those: // in STNTUPLE all the blocks have fixed addresses, which is convenient for // histogramming, TL1D format is supposed to be floating - different cards // may appear in different slots, number of cards may vary and so on int iblock, loc, nblk, nw, nw_blk, n_boards, loc_blk, loc_data; if (! bank) return 0; // now loop over the data blocks // another time and copy the data // 1 block per crate TPreFred *prefred, *module; nblk = bank->iw(0); iblock = 0; for (int iblk=0; iblkiw(iblk+1); nw_blk = bank->iw(iblk+2)-loc_blk; if (nw_blk > 0) { n_boards = bank->iw(loc_blk); for (int itdc=0; itdciw(loc+1)-bank->iw(loc); if (nw > 0) { // check which card is it loc_data = loc_blk+bank->iw(loc); prefred = (TPreFred*) &bank->iw(loc_data); module = tl1d->Module(prefred->SlotNumber()); memcpy(module,prefred,nw*sizeof(Int_t)); } iblock++; } } } return 0; }