/* 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 to write mapping for the ZDC ADCs Contact: Chiara.Oppedisano@to.infn.it Link: Run Type: PHYSICS, CALIBRATION_BC, CALIBRATION_CENTRAL, CALIBRATION_MB, CALIBRATION_SEMICENTRAL, CALIBRATION_COSMIC DA Type: MON Number of events needed: 1 (SOD is read) Input Files: none Output Files: ZDCChMapping.dat Trigger Types Used: different trigger types are used */ #define MAPDATA_FILE "ZDCChMapping.dat" #include #include #include // DATE #include #include #include //ROOT #include //AliRoot #include #include #include int main(int argc, char **argv) { const Char_t* tableSOD[] = {"ALL", "no", "SOD", "all", NULL, NULL}; monitorDeclareTable(const_cast(tableSOD)); int status = 0; int const kNChannels = 24; /* log start of process */ printf("\nZDC MAPPING program started\n"); /* check that we got some arguments = list of files */ if (argc<2) { printf("Wrong number of arguments\n"); return -1; } FILE *mapFile4Shuttle; /* read the data files */ int n; for(n=1;nGetType(); //printf("\t ZDCMAPPINGda -> 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; Int_t adcMod[2*kNChannels], adcCh[2*kNChannels], sigCode[2*kNChannels]; Int_t det[2*kNChannels], sec[2*kNChannels]; if(eventT==START_OF_DATA){ sodRead = kTRUE; rawStreamZDC->SetSODReading(kTRUE); // -------------------------------------------------------- // --- Writing ascii data file for the Shuttle preprocessor mapFile4Shuttle = fopen(MAPDATA_FILE,"w"); if(!rawStreamZDC->Next()) printf(" \t No raw data found!! \n"); else{ while((rawStreamZDC->Next()) && (ich<2*kNChannels)){ 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); // fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n", ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]); // //printf("ZDCMAPPINGda.cxx -> %d mod %d ch %d code %d det %d sec %d\n", // ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]); // ich++; } } } fclose(mapFile4Shuttle); } // SOD event else{ if(sodRead){ printf("\t SOR read -> exiting from DA\n"); break; } else continue; } iev++; } /* free resources */ //free(event); } /* store the result files on FES */ status = daqDA_FES_storeFile(MAPDATA_FILE, MAPDATA_FILE); if(status){ printf("Failed to export file : %d\n",status); return -1; } return status; }