2 Contact: cvetan.cheshkov@cern.ch
6 Number of events needed: 10000
9 Trigger types used: PHYSICS
12 #define OUTPUT_FILE "SPDVertexDiamondDA.root"
13 #define CDB_STORAGE "local://$ALICE_ROOT"
14 #define N_EVENTS_AUTOSAVE 50
25 //int amore::da::Updated(char const*) {}
28 #include <TPluginManager.h>
31 #include "AliRawReaderDate.h"
32 #include "AliCDBManager.h"
34 int main(int argc, char **argv) {
36 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
44 printf("Wrong number of arguments\n");
48 /* define data source : this is argument 1 */
49 status=monitorSetDataSource( argv[1] );
51 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
55 /* declare monitoring program */
56 status=monitorDeclareMp( __FILE__ );
58 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
62 /* define wait event timeout - 1s max */
64 monitorSetNoWaitNetworkTimeout(1000);
66 /* log start of process */
67 printf("Vertex-Diamond SPD DA started\n");
69 /* init some counters */
70 int nevents_with_vertex = 0;
71 int nevents_physics=0;
74 struct eventHeaderStruct *event;
78 if (getenv("DATE_RUN_NUMBER")==0) {
79 printf("DATE_RUN_NUMBER not properly set.\n");
82 int runNr = atoi(getenv("DATE_RUN_NUMBER"));
84 // Global initializations
85 AliCDBManager *man = AliCDBManager::Instance();
86 man->SetDefaultStorage(CDB_STORAGE);
90 AliITSMeanVertexer *mv = new AliITSMeanVertexer();
92 printf("Initialization of mean vertexer object failed ! Check the log for details");
96 // Initialization of AMORE sender
98 amore::da::AmoreDA vtxAmore(amore::da::AmoreDA::kSender);
100 /* main loop (infinite) */
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==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 */
124 eventT=event->eventType;
125 switch (event->eventType){
130 /* END START OF RUN */
138 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
140 // Run mean-vertexer reco
141 if (mv->Reconstruct(rawReader)) nevents_with_vertex++;
144 if ((nevents_physics%N_EVENTS_AUTOSAVE) == 0)
145 mv->WriteVertices(OUTPUT_FILE);
153 /* exit when last event received, no need to wait for TERM signal */
154 if (eventT==END_OF_RUN) {
155 printf("EOR event detected\n");
160 mv->WriteVertices(OUTPUT_FILE);
163 // send the histos to AMORE pool
164 printf("AMORE send status: %d",vtxAmore.Send(mv->GetVertexXY()->GetName(),mv->GetVertexXY()));
165 printf("AMORE send status: %d",vtxAmore.Send(mv->GetVertexZ()->GetName(),mv->GetVertexZ()));
171 printf("Run #%s, received %d events with vertex, out of %d physics and out of %d total events\n",getenv("DATE_RUN_NUMBER"),nevents_with_vertex,nevents_physics,nevents_total);
175 /* export file to FXS */
176 if (daqDA_FES_storeFile(OUTPUT_FILE, "VertexDiamond")) {