2 PMD DA for online calibration
4 contact: basanta@phy.iitb.ac.in
5 Link:/afs/cern.ch/user/a/alicepmd/public/pedestaldata/run31270.raw
8 Number of events needed: 1000
10 Output Files: pmd_ped.root, to be exported to the DAQ FXS
11 Trigger types used: PULSER
22 #include <Riostream.h>
27 #include "AliRawReaderDate.h"
28 #include "AliPMDCalibPedestal.h"
33 #include "TBenchmark.h"
36 #include "TPluginManager.h"
42 1- monitoring data source
44 int main(int argc, char **argv) {
46 /* magic line from Rene */
47 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
54 AliPMDCalibPedestal calibped;
56 TTree *ped = new TTree("ped","PMD Pedestal tree");
58 TH1F::AddDirectory(0);
61 // decoding the events
66 printf("Wrong number of arguments\n");
72 /* define data source : this is argument 1 */
73 status=monitorSetDataSource( argv[1] );
75 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
79 /* declare monitoring program */
80 status=monitorDeclareMp( __FILE__ );
82 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
86 /* define wait event timeout - 1s max */
88 monitorSetNoWaitNetworkTimeout(1000);
90 /* log start of process */
91 printf("DA example case2 monitoring program started\n");
93 /* init some counters */
94 int nevents_physics=0;
97 struct eventHeaderStruct *event;
101 /* main loop (infinite) */
104 /* check shutdown condition */
105 if (daqDA_checkShutdown()) {break;}
107 /* get next event (blocking call until timeout) */
108 status=monitorGetEventDynamic((void **)&event);
109 if (status==MON_ERR_EOF) {
110 printf ("End of File detected\n");
111 break; /* end of monitoring file has been reached */
115 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
119 /* retry if got no event */
126 /* use event - here, just write event id to result file */
127 eventT=event->eventType;
128 switch (event->eventType){
133 /* END START OF RUN */
140 printf(" event number = %i \n",iev);
141 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
142 calibped.ProcessEvent(rawReader);
151 /* exit when last event received, no need to wait for TERM signal */
152 if (eventT==END_OF_RUN) {
153 printf("EOR event detected\n");
154 calibped.Analyse(ped);
160 TFile * pedRun = new TFile ("pmd_ped.root","RECREATE");
165 /* close result file */