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, CALIBRATION_BC, CALIBRATION_CENTRAL,
17 CALIBRATION_MB, CALIBRATION_SEMICENTRAL, CALIBRATION_COSMIC
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));
51 int const kNChannels = 24;
53 /* log start of process */
54 printf("\nZDC MAPPING program started\n");
56 /* check that we got some arguments = list of files */
58 printf("Wrong number of arguments\n");
62 FILE *mapFile4Shuttle;
64 /* read the data files */
68 status=monitorSetDataSource( argv[n] );
70 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
74 /* declare monitoring program */
75 status=monitorDeclareMp( __FILE__ );
77 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
81 monitorSetNoWaitNetworkTimeout(1000);
83 struct eventHeaderStruct *event;
87 Bool_t sodRead = kFALSE;
88 while(!sodRead && iev<1000){
90 /* check shutdown condition */
91 if (daqDA_checkShutdown()) {break;}
94 status=monitorGetEventDynamic((void **)&event);
95 if(status==MON_ERR_EOF){
96 printf ("End of File detected\n");
97 break; /* end of monitoring file has been reached */
100 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
104 /* retry if got no event */
105 if(event==NULL) continue;
107 // Initalize raw-data reading and decoding
108 AliRawReader *reader = new AliRawReaderDate((void*)event);
109 // --- Reading event header
110 //UInt_t evtype = reader->GetType();
111 //printf("\t ZDCMAPPINGda -> run # %d\n",reader->GetRunNumber());
113 AliZDCRawStream *rawStreamZDC = new AliZDCRawStream(reader);
116 /* use event - here, just write event id to result file */
117 eventT=event->eventType;
120 Int_t adcMod[2*kNChannels], adcCh[2*kNChannels], sigCode[2*kNChannels];
121 Int_t det[2*kNChannels], sec[2*kNChannels];
123 if(eventT==START_OF_DATA){
125 rawStreamZDC->SetSODReading(kTRUE);
127 // --------------------------------------------------------
128 // --- Writing ascii data file for the Shuttle preprocessor
129 mapFile4Shuttle = fopen(MAPDATA_FILE,"w");
130 if(!rawStreamZDC->Next()) printf(" \t No raw data found!! \n");
132 while((rawStreamZDC->Next()) && (ich<2*kNChannels)){
133 if(rawStreamZDC->IsChMapping()){
134 adcMod[ich] = rawStreamZDC->GetADCModFromMap(ich);
135 adcCh[ich] = rawStreamZDC->GetADCChFromMap(ich);
136 sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich);
137 det[ich] = rawStreamZDC->GetDetectorFromMap(ich);
138 sec[ich] = rawStreamZDC->GetTowerFromMap(ich);
140 fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
141 ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
143 //printf("ZDCMAPPINGda.cxx -> %d mod %d ch %d code %d det %d sec %d\n",
144 // ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
150 fclose(mapFile4Shuttle);
154 printf("\t SOR read -> exiting from DA\n");
167 /* store the result files on FES */
168 status = daqDA_FES_storeFile(MAPDATA_FILE, MAPDATA_FILE);
170 printf("Failed to export file : %d\n",status);