/* This program reads the DAQ data files passed as argument using the monitoring library. It computes the average event size and populates local "./result.txt" file with the result. The program reports about its processing progress. Messages on stdout are exported to DAQ log system. DA for ZDC standalone pedestal runs Contact: Chiara.Oppedisano@to.infn.it Link: Run Type: PHYSICS, STANDALONE_BC, STANDALONE_COSMIC, STANDALONE_CENTRAL, STANDALONE_MB, STANDALONE_SEMICENTRAL DA Type: LDC Number of events needed: no constraint Input Files: Output Files: ZDCChMapping.dat Trigger Types Used: */ #include #include #include // DATE #include #include #include //ROOT #include //AliRoot #include #include #include /* Main routine Arguments: list of DATE raw data files */ int main(int argc, char **argv) { int status = 0; /* log start of process */ printf("ZDC PEDESTAL program started\n"); /* check that we got some arguments = list of files */ if (argc<2) { printf("Wrong number of arguments\n"); return -1; } /* open result file */ FILE *fp=NULL; fp=fopen("./result.txt","a"); if (fp==NULL) { printf("Failed to open file\n"); return -1; } FILE *mapFile4Shuttle; const char *mapfName = "ZDCChMapping.dat"; /* report progress */ daqDA_progressReport(10); /* init some counters */ int nevents_physics=0; int nevents_total=0; /* read the data files */ int n; for(n=1;nSelect("ZDC"); // --- Reading event header //UInt_t evtype = reader->GetType(); //printf("\n\t ZDCPEDESTALda -> ev. type %d\n",evtype); //printf("\t ZDCPEDESTALda -> run # %d\n",reader->GetRunNumber()); // AliZDCRawStream *rawStreamZDC = new AliZDCRawStream(reader); /* use event - here, just write event id to result file */ eventT=event->eventType; Int_t ich=0, adcMod[48], adcCh[48], sigCode[48], det[48], sec[48]; if(eventT==START_OF_DATA){ if(!rawStreamZDC->Next()) printf(" \t No raw data found!! \n"); else{ while(rawStreamZDC->Next()){ if(rawStreamZDC->IsChMapping()){ adcMod[ich] = rawStreamZDC->GetADCModFromMap(ich); adcCh[ich] = rawStreamZDC->GetADCChFromMap(ich); sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich); det[ich] = rawStreamZDC->GetDetectorFromMap(ich); sec[ich] = rawStreamZDC->GetTowerFromMap(ich); ich++; } } } // -------------------------------------------------------- // --- Writing ascii data file for the Shuttle preprocessor mapFile4Shuttle = fopen(mapfName,"w"); for(Int_t i=0; i ch.%d mod %d, ch %d, code %d det %d, sec %d\n", // i,adcMod[i],adcCh[i],sigCode[i],det[i],sec[i]); } fclose(mapFile4Shuttle); } nevents_total++; /* free resources */ free(event); } } /* write report */ fprintf(fp,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total); /* close result file */ fclose(fp); /* report progress */ daqDA_progressReport(90); /* store the result files on FES */ status = daqDA_FES_storeFile(mapfName,"ZDCCHMAPPING_data"); if(status){ printf("Failed to export file : %d\n",status); return -1; } /* report progress */ daqDA_progressReport(100); return status; }