2 Contact: cvetan.cheshkov@cern.ch
3 Link: http://alisoft.cern.ch/viewvc/trunk/ITS/ITSSPDVertexDiamondda.cxx?root=AliRoot&view=log , /afs/cern.ch/user/c/cheshkov/public/08000058338016.30.root.date.gz
7 Number of events needed: 100
8 Input Files: GRP/Geometry/Data , ITS/Align/Data , spd_noisy_ocdb , spd_dead_ocdb
9 Output Files: SPDVertexDiamondDA.root
10 Trigger types used: PHYSICS
13 #define OUTPUT_FILE "SPDVertexDiamondDA.root"
14 #define N_EVENTS_AUTOSAVE 50
25 //int amore::da::Updated(char const*) {}
28 #include <TPluginManager.h>
35 #include "AliRawReaderDate.h"
36 #include "AliCDBManager.h"
37 #include "AliITSMeanVertexer.h"
39 int main(int argc, char **argv) {
41 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
49 printf("Wrong number of arguments\n");
53 /* define data source : this is argument 1 */
54 status=monitorSetDataSource( argv[1] );
56 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
60 /* declare monitoring program */
61 status=monitorDeclareMp( __FILE__ );
63 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
67 /* define wait event timeout - 1s max */
69 monitorSetNoWaitNetworkTimeout(1000);
71 /* log start of process */
72 printf("Vertex-Diamond SPD DA started\n");
74 /* init some counters */
75 int nevents_with_vertex = 0;
76 int nevents_physics=0;
79 struct eventHeaderStruct *event;
83 if (getenv("DATE_RUN_NUMBER")==0) {
84 printf("DATE_RUN_NUMBER not properly set.\n");
87 int runNr = atoi(getenv("DATE_RUN_NUMBER"));
89 // Get the necessary OCDB files from the DAQ detector DB
90 if (gSystem->AccessPathName("localOCDB/GRP/Geometry/Data",kFileExists)) {
91 if (gSystem->mkdir("localOCDB/GRP/Geometry/Data",kTRUE) != 0) {
92 printf("Failed to create directory: localOCDB/GRP/Geometry/Data");
96 status = daqDA_DB_getFile("GRP/Geometry/Data","localOCDB/GRP/Geometry/Data/Run0_999999999_v0_s0.root");
98 printf("Failed to get geometry file (GRP/Geometry/Data) from DAQdetDB, status=%d\n", status);
102 if (gSystem->AccessPathName("localOCDB/ITS/Align/Data",kFileExists)) {
103 if (gSystem->mkdir("localOCDB/ITS/Align/Data",kTRUE) != 0) {
104 printf("Failed to create directory: localOCDB/ITS/Align/Data");
108 status = daqDA_DB_getFile("ITS/Align/Data","localOCDB/ITS/Align/Data/Run0_999999999_v0_s0.root");
110 printf("Failed to get its-alignment file (ITS/Align/Data) from DAQdetDB, status=%d\n", status);
114 if (gSystem->AccessPathName("localOCDB/ITS/Calib/SPDNoisy",kFileExists)) {
115 if (gSystem->mkdir("localOCDB/ITS/Calib/SPDNoisy",kTRUE) != 0) {
116 printf("Failed to create directory: localOCDB/ITS/Calib/SPDNoisy");
120 status = daqDA_DB_getFile("spd_noisy_ocdb","localOCDB/ITS/Calib/SPDNoisy/Run0_999999999_v0_s0.root");
122 printf("Failed to get spd file (spd_noisy_ocdb) from DAQdetDB, status=%d\n", status);
126 if (gSystem->AccessPathName("localOCDB/ITS/Calib/SPDDead",kFileExists)) {
127 if (gSystem->mkdir("localOCDB/ITS/Calib/SPDDead",kTRUE) != 0) {
128 printf("Failed to create directory: localOCDB/ITS/Calib/SPDDead");
132 status = daqDA_DB_getFile("spd_dead_ocdb","localOCDB/ITS/Calib/SPDDead/Run0_999999999_v0_s0.root");
134 printf("Failed to get spd file (spd_dead_ocdb) from DAQdetDB, status=%d\n", status);
138 // Global initializations
139 AliLog::SetGlobalLogLevel(AliLog::kError);
140 AliCDBManager *man = AliCDBManager::Instance();
141 man->SetDefaultStorage("local://localOCDB");
144 // Init mean vertexer
145 AliITSMeanVertexer *mv = new AliITSMeanVertexer();
147 printf("Initialization of mean vertexer object failed ! Check the log for details");
151 // Initialization of AMORE sender
153 amore::da::AmoreDA vtxAmore(amore::da::AmoreDA::kSender);
155 /* main loop (infinite) */
158 /* check shutdown condition */
159 if (daqDA_checkShutdown()) {break;}
161 /* get next event (blocking call until timeout) */
162 status=monitorGetEventDynamic((void **)&event);
163 if (status==MON_ERR_EOF) {
164 printf ("End of File detected\n");
165 break; /* end of monitoring file has been reached */
169 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
173 /* retry if got no event */
179 eventT=event->eventType;
180 switch (event->eventType){
185 /* END START OF RUN */
193 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
195 // Run mean-vertexer reco
196 if (mv->Reconstruct(rawReader)) nevents_with_vertex++;
199 if ((nevents_physics%N_EVENTS_AUTOSAVE) == 0) {
200 mv->WriteVertices(OUTPUT_FILE);
203 // send the histos to AMORE pool
204 printf("AMORE send status: %d\n",vtxAmore.Send(mv->GetVertexXY()->GetName(),mv->GetVertexXY()));
205 printf("AMORE send status: %d\n",vtxAmore.Send(mv->GetVertexZ()->GetName(),mv->GetVertexZ()));
215 /* exit when last event received, no need to wait for TERM signal */
216 if (eventT==END_OF_RUN) {
217 printf("EOR event detected\n");
222 mv->WriteVertices(OUTPUT_FILE);
225 // send the histos to AMORE pool
226 printf("AMORE send status: %d\n",vtxAmore.Send(mv->GetVertexXY()->GetName(),mv->GetVertexXY()));
227 printf("AMORE send status: %d\n",vtxAmore.Send(mv->GetVertexZ()->GetName(),mv->GetVertexZ()));
233 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);
237 /* export file to FXS */
238 if (daqDA_FES_storeFile(OUTPUT_FILE, "VertexDiamond")) {