/* This program reads the DAQ data files passed as argument using the monitoring library. The program reports about its processing progress. Messages on stdout are exported to DAQ log system. DA to write mapping for ADC modules and VME scaler 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 kNModules = 10; int const kNChannels = 24; int const kNScChannels = 32; /* log start of process */ printf("\n ZDC 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;nSelect("ZDC"); // --- Reading event header //UInt_t evtype = reader->GetType(); //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; if(eventT==START_OF_DATA){ Int_t iMod=-1; Int_t modGeo[kNModules], modType[kNModules],modNCh[kNModules]; for(Int_t kl=0; klSetSODReading(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())){ if(rawStreamZDC->IsHeaderMapping()){ // mapping header iMod++; modGeo[iMod] = rawStreamZDC->GetADCModule(); modType[iMod] = rawStreamZDC->GetModType(); modNCh[iMod] = rawStreamZDC->GetADCNChannels(); } if(rawStreamZDC->IsChMapping()){ if(modType[iMod]==1){ // ADC mapping ---------------------- 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++; } else if(modType[iMod]==2){ //VME scaler mapping -------------------- scMod[iScCh] = rawStreamZDC->GetScalerModFromMap(iScCh); scCh[iScCh] = rawStreamZDC->GetScalerChFromMap(iScCh); scSigCode[iScCh] = rawStreamZDC->GetScalerSignFromMap(iScCh); scDet[iScCh] = rawStreamZDC->GetScDetectorFromMap(iScCh); scSec[iScCh] = rawStreamZDC->GetScTowerFromMap(iScCh); iScCh++; } } } // Writing data on output FXS file for(Int_t is=0; is<2*kNChannels; is++){ fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n", is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]); //printf(" Mapping DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n", // is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]); } for(Int_t is=0; is %d Scaler: mod %d ch %d, code %d det %d, sec %d\n", // is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]); } for(Int_t is=0; is Module mapping: geo %d type %d #ch %d\n", // modGeo[is],modType[is],modNCh[is]); } } 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, "MAPPING"); if(status){ printf("Failed to export file : %d\n",status); return -1; } return status; }