3 This program reads the DAQ data files passed as argument using the monitoring library.
5 It computes the average event size and populates local "./result.txt" file with the
8 The program reports about its processing progress.
10 Messages on stdout are exported to DAQ log system.
12 DA to write mapping for the ZDC ADCs
14 Contact: Chiara.Oppedisano@to.infn.it
16 Run Type: PHYSICS, STANDALONE_BC, STANDALONE_COSMIC, STANDALONE_CENTRAL,
17 STANDALONE_MB, STANDALONE_SEMICENTRAL
19 Number of events needed: 1 (SOD is read)
21 Output Files: ZDCChMapping.dat
22 Trigger Types Used: different trigger types are used
26 #define MAPDATA_FILE "ZDCChMapping.dat"
30 #include <Riostream.h>
41 #include <AliRawReaderDate.h>
42 #include <AliRawEventHeaderBase.h>
43 #include <AliZDCRawStream.h>
45 int main(int argc, char **argv) {
47 const Char_t* tableSOD[] = {"ALL", "no", "SOD", "all", NULL, NULL};
48 monitorDeclareTable(const_cast<char**>(tableSOD));
52 /* log start of process */
53 printf("\nZDC MAPPING program started\n");
55 /* check that we got some arguments = list of files */
57 printf("Wrong number of arguments\n");
61 FILE *mapFile4Shuttle;
63 /* read the data files */
67 status=monitorSetDataSource( argv[n] );
69 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
73 /* declare monitoring program */
74 status=monitorDeclareMp( __FILE__ );
76 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
80 monitorSetNoWaitNetworkTimeout(1000);
82 struct eventHeaderStruct *event;
86 Bool_t sodRead = kFALSE;
87 while(!sodRead && iev<1000){
89 /* check shutdown condition */
90 if (daqDA_checkShutdown()) {break;}
93 status=monitorGetEventDynamic((void **)&event);
94 if(status==MON_ERR_EOF){
95 printf ("End of File detected\n");
96 break; /* end of monitoring file has been reached */
99 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
103 /* retry if got no event */
108 // Initalize raw-data reading and decoding
109 AliRawReader *reader = new AliRawReaderDate((void*)event);
110 // --- Reading event header
111 //UInt_t evtype = reader->GetType();
112 //printf("\n\t ZDCPEDESTALda -> ev. type %d\n",evtype);
113 //printf("\t ZDCPEDESTALda -> run # %d\n",reader->GetRunNumber());
115 AliZDCRawStream *rawStreamZDC = new AliZDCRawStream(reader);
118 /* use event - here, just write event id to result file */
119 eventT=event->eventType;
121 Int_t ich=0, adcMod[48], adcCh[48], sigCode[48], det[48], sec[48];
123 if(eventT==START_OF_DATA){
126 rawStreamZDC->SetSODReading(kTRUE);
128 if(!rawStreamZDC->Next()) printf(" \t No raw data found!! \n");
130 while(rawStreamZDC->Next()){
131 if(rawStreamZDC->IsChMapping()){
132 adcMod[ich] = rawStreamZDC->GetADCModFromMap(ich);
133 adcCh[ich] = rawStreamZDC->GetADCChFromMap(ich);
134 sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich);
135 det[ich] = rawStreamZDC->GetDetectorFromMap(ich);
136 sec[ich] = rawStreamZDC->GetTowerFromMap(ich);
141 // --------------------------------------------------------
142 // --- Writing ascii data file for the Shuttle preprocessor
143 mapFile4Shuttle = fopen(MAPDATA_FILE,"w");
144 for(Int_t i=0; i<ich; i++){
145 fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",i,
146 adcMod[i],adcCh[i],sigCode[i],det[i],sec[i]);
148 //printf("ZDCMAPPING.cxx -> mod %d ch %d, ch %d, code %d det %d, sec %d\n",
149 // i,adcMod[i],adcCh[i],sigCode[i],det[i],sec[i]);
151 fclose(mapFile4Shuttle);
155 printf("\t SOR read -> exiting from DA\n");
168 /* store the result files on FES */
169 status = daqDA_FES_storeFile(MAPDATA_FILE, MAPDATA_FILE);
171 printf("Failed to export file : %d\n",status);