#include #include #include #include using namespace std; #include #include #include #include #include #include #include #include #define MAX_TREE_EVENTS 10000 class Hist { public: DRootSpy *rootspy; //--- global vars TH1D *h_px, *h_py, *h_pz, *h_E , *h_Mass; int MAXCHAN; //-- 16 int MAXSLOT; //-- 25 int MAXBIN; //-- 25*16 int MAXCHAN_CAEN; // -- 32 int MAXSLOT_CAEN; //-- 25 int MAXBIN_CAEN; //-- 25*32 int MAXCHAN_F1; // -- 32 int MAXSLOT_F1; //-- 25 int MAXBIN_F1; //-- 25*32 TH1D *FADC[25][16]; TH1D *CTDC[25][32]; TH1D *F1TDC[25][32]; TProfile *ped_prof; TProfile *tdc_prof_caen; TProfile *tdc_prof_f1; TList *ALL_1D_HIST; TList *ALL_2D_HIST; TList *FADC250_HIST; TList *FADC125_HIST; TList *F1TDC_HIST; TList *CAENTDC_HIST; TTree *T ; // Define some local variables double px,py,pz,E,Mass; float data[100]; bool DONE ; TRandom *rndm; TDirectory *main; char hist_name[80]; char host_name[80]; void sigHandler(int sig) { DONE = true; } Hist(); ~Hist() { cout << " Destructor Hist!!! " << "\n"; delete rndm; //rootspy->cMsgSys->stop(); cout << "=====> ROL_2 Dlete rootspy !!! " << "\n"; delete rootspy; } int ped_fill(int ped); int test_fill(); void Fill_FADC(int slot, int chan, int adc); void Fill_CAEN(int slot, int chan, unsigned int tdc); void Fill_F1TDC(int slot, int chan,unsigned int tdc); int Reset(int flag); }; //------------------------------------------------------------------- int analyzeBank_F1_TDC(unsigned int *buffer); int analyzeBank_CEAN_TDC(unsigned int *buffer); int analyzeBank_FA250(unsigned int *buffer); int scan_bank(unsigned int *bank, int size); unsigned int aswap(unsigned int *bank, int len); unsigned int bswap(unsigned int *bank); //------------------------------------------------------------------- class RocHeader { public: unsigned int Size; //: 32; unsigned short Stat; //: 4; unsigned short ID; //: 12; unsigned short Pad; //: 2; unsigned short BOB; //: 6; unsigned short Nev; //: 8; RocHeader(unsigned int *bank) { Size=bank[0]; Stat=(bank[1]>>28)&0xF; ID=(bank[1]>>16)&0xFF; BOB=(bank[1]>>8)&0x3F; Nev=(bank[1])&0xFF; } ~RocHeader() { //cout << " Destructor RocHeader!!! " << "\n"; } void print() { printf(" --> ROC Header: ROC: Stat=0x%X ID=0x%03X bob=0x%02X Nev=%d ::Evt_size=%6d \n" ,Stat ,ID ,BOB ,Nev ,Size ); } }; //------------------------------------------------------------------- class TriggerHeader { public: unsigned int Size: 32; unsigned short Type: 16; unsigned short Pad: 2; unsigned short BOS: 6; unsigned short Nev: 8; TriggerHeader(unsigned int *bank) { Size=bank[0]; Type=(bank[1]>>16)&0xFFFF; BOS=(bank[1]>>8)&0x3F; Nev=(bank[1])&0xFF; } ~TriggerHeader() { //cout << " Destructor TriggerHeader!!! " << "\n"; } void print() { printf(" --> Trigger Header: BankType=0x%04X bos=0x%02X Size=%6d Nev=%d \n" ,Type ,BOS ,Size ,Nev ); } }; //------------------------------------------------------------------- class BankHeader { public: unsigned Header[2]; unsigned int Size;//: 32; unsigned short Tag;//: 16; unsigned short Pad;//: 2; unsigned short Type;//: 6; unsigned short Num;//: 8; BankHeader(unsigned int *bank) { Header[0]=bank[0]; Header[1]=bank[1]; Size=bank[0]; Tag=(bank[1]>>16)&0xFFFF; Pad=(bank[1]>>14)&0x3; Type=(bank[1]>>8)&0x3F; Num=(bank[1])&0xFF; } ~BankHeader() { //cout << " Destructor BankHeader!!! " << "\n"; } void print() { printf(" Bank Header:: Tag=0x%04X Type=0x%02x Num=%3d Pad=%d ::Size=%6d Header:: 0x%X(%d) , 0x%X \n" ,Tag ,Type ,Num , Pad ,Size ,Header[0] ,Header[0] ,Header[1] ); } } ; //------------------------------------------------------------------- /** Defines the container bank types.*/ typedef enum { BANK = 0xe, /**<2-word header, 16-bit tag, 8-bit num, 8-bit type.*/ SEGMENT = 0xd, /**<1-word header, 8-bit tag, no num, 8-bit type.*/ TAGSEGMENT = 0xc /**<1-word header, 12-bit tag, no num, 4-bit type.*/ } DataType;