/* read adc125 data with random trigger check if a channel is over a given threshold and write those channels with all samples to data file */ #include #include using namespace std; extern "C"{ #include #include #include #include #include #include "f1NEWtdcLib.h" #include "math.h" #include "time.h" #include "sys/types.h" extern int nf1tdc; extern int f1NEWtdcA32Base; extern int tiA32Base; extern int f1NEWAddrList[F1NEW_MAX_BOARDS]; //DMA_MEM_ID vmeIN,vmeOUT; //extern DMANODE *the_event; //extern unsigned int *dma_dabufp; } UINT32 F1TDCData[40000]; #define TI_ADDR (21<<19) #define F1TM_ADDR 0xe100 #define F1NEW_TIME_MASK 0x0000ffff #define BLOCKLEVEL 1 int NTDCS = 1; int TDC_SLOT_START = 3; int TIMETEST = 0; #define F1NEWTDC_BLOCK_MODE 0 int exCounter = 0; ofstream OUTF; ofstream OUTRAW; void myReadoutCode(); unsigned int START; int n; int main(int argc, char *argv[]) { int Nevents = 1000; int iFlag; int stat; char ofnam[128]; char DataDir[128] = "/gluonraid1/Users/hdfdcops/fdcdata"; char CrateName[128] = "One"; char RawFName[128] = "rawdata.dat"; printf("\nJLAB f125ADC pedestal Tests\n"); printf("----------------------------\n"); int k=0; if (argc<1 ) { cout<<"usage: pulserTestNew [Options]"<10){ slot += 2; f1NEWAddrList[k] = slot<<19; } } f1NEWConfigReadFile("./newf1config_lat1400_win1300.dat"); iFlag = (1<<17); /* use f1NEWAddrList */ //iFlag = 0; /* use f1NEWAddrList */ iFlag |= F1NEW_TRIGSRC_VXS; /* Trigger Source */ iFlag |= F1NEW_CLKSRC_VXS; /* Clock Source */ iFlag |= F1NEW_SRSRC_VXS; /* sync source*/ //cout<<"Number of TDCS "< to exit"<10){ S +=2; } int nhits = f1NEWDready(S); dp = tdcData; if( (nhits0) ) { int nwords = f1NEWReadBlock(S, dp, MAXTDC,0); for (int i=0;i>27)&0x1f) == 0x17){ int chip = (data>>19 & 0x7); int chan = (data>>16 & 0x7); int T_chan = chip*8 + chan; int time = (data & 0xFFFF); OUTF<