13 #include <AliRawReaderDate.h>
14 #include <AliRawReader.h>
15 #include <AliT0RawReader.h>
16 #include <AliCDBManager.h>
23 #include "TBenchmark.h"
30 #include "TSpectrum.h"
31 #include "TVirtualFitter.h"
37 1- monitoring data source
39 int main(int argc, char **argv) {
45 printf("Wrong number of arguments\n");
50 /* define data source : this is argument 1 */
51 status=monitorSetDataSource( argv[1] );
53 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
58 /* declare monitoring program */
59 status=monitorDeclareMp( __FILE__ );
61 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
66 /* define wait event timeout - 1s max */
68 monitorSetNoWaitNetworkTimeout(1000);
71 /* log start of process */
72 printf("T0 monitoring program started\n");
74 // Allocation of histograms - start
78 Char_t buf1[15], buf2[15],buf3[15],buf4[15];
80 for(Int_t ic=0; ic<24; ic++) {
82 sprintf(buf1,"CFD1-CFD%i",ic+1);
83 hCFD1_CFD[ic] = new TH1F(buf1,"CFD-CFD",200000,-100000,100000);
84 sprintf(buf3,"CFD%i",ic+1);
85 hCFD[ic] = new TH1F(buf3,"CFD",100000,0,100000);
88 sprintf(buf2,"CFD13-CFD%i",ic+1);
89 hCFD1_CFD[ic] = new TH1F(buf2,"CFD-CFD",200000,-100000,100000);
90 sprintf(buf4,"CFD%i",ic+1);
91 hCFD[ic] = new TH1F(buf4,"CFD",100000,0,100000);
95 // Allocation of histograms - end
98 /* main loop (infinite) */
100 struct eventHeaderStruct *event;
101 eventTypeType eventT;
103 /* check shutdown condition */
104 if (daqDA_checkShutdown()) {break;}
106 /* get next event (blocking call until timeout) */
107 status=monitorGetEventDynamic((void **)&event);
108 if (status==(int)MON_ERR_EOF) {
109 printf ("End of File detected\n");
110 break; /* end of monitoring file has been reached */
114 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
118 /* retry if got no event */
125 /* use event - here, just write event id to result file */
126 eventT=event->eventType;
128 switch (event->eventType){
137 printf(" event number = %i \n",iev);
140 // Initalize raw-data reading and decoding
141 AliRawReader *reader = new AliRawReaderDate((void*)event);
143 // Enable the following two lines in case of real-data
144 // reader->LoadEquipmentIdsMap("T0map.txt");
145 // reader->RequireHeader(kFALSE);
146 // reader->RequireHeader(kTRUE);
147 AliT0RawReader *start = new AliT0RawReader(reader, kTRUE);
150 Int_t allData[105][5];
151 for(Int_t i0=0;i0<105;i0++)
152 for(Int_t j0=0;j0<5;j0++)
157 for (Int_t i=0; i<105; i++) {
158 for(Int_t iHit=0;iHit<5;iHit++){
159 allData[i][iHit]= start->GetData(i,iHit);
163 printf("No T0 data found!!\n");
165 // Fill the histograms
167 for (Int_t ik = 0; ik<24; ik+=2)
168 for (Int_t iHt=0; iHt<5; iHt++){
170 if(allData[cc+1][iHt]!=0 ){
171 hCFD1_CFD[cc]->Fill(allData[cc+1][iHt]-allData[1][iHt]);
172 hCFD[cc]->Fill(allData[cc+13][iHt]);
176 for (Int_t ik = 24; ik<48; ik+=2)
177 for (Int_t iHt=0; iHt<5; iHt++){
179 if(allData[cc+45][iHt]!=0 ){
180 hCFD1_CFD[cc]->Fill(allData[cc+45][iHt]-allData[57][iHt]);
181 hCFD[cc]->Fill(allData[cc+45][iHt]);
188 // End of fill histograms
197 /* exit when last event received, no need to wait for TERM signal */
198 if (eventT==END_OF_RUN) {
199 printf("EOR event detected\n");
203 printf("After loop, before writing histos\n");
204 // write a file with the histograms
206 sprintf(filehist,"daPhys.root");
207 TFile *hist = new TFile(filehist,"RECREATE");
209 for(Int_t j=0;j<24;j++){
210 hCFD1_CFD[j]->Write();