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/ITS/VD_da_test.date , /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 , TRIGGER/SPD/PITConditions (all the files are taken from SPD daqDetDB)
9 Output Files: SPDVertexDiamondDA.root
10 Trigger types used: PHYSICS, SPD-F0
13 #define OUTPUT_FILE "SPDVertexDiamondDA.root"
14 #define N_EVENTS_AUTOSAVE 50
25 //int amore::da::Updated(char const*) {}
28 #include <TPluginManager.h>
33 #include <TGeoGlobalMagField.h>
37 #include "AliRawReaderDate.h"
38 #include "AliCDBManager.h"
39 #include "AliITSMeanVertexer.h"
41 int main(int argc, char **argv) {
43 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
51 printf("Wrong number of arguments\n");
55 /* define data source : this is argument 1 */
56 status=monitorSetDataSource( argv[1] );
58 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
62 /* declare monitoring program */
63 status=monitorDeclareMp( __FILE__ );
65 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
69 /* define wait event timeout - 1s max */
71 monitorSetNoWaitNetworkTimeout(1000);
73 /* log start of process */
74 printf("Vertex-Diamond SPD DA started\n");
76 /* init some counters */
77 int nevents_with_vertex = 0;
78 int nevents_physics=0;
81 struct eventHeaderStruct *event;
85 if (getenv("DATE_RUN_NUMBER")==0) {
86 printf("DATE_RUN_NUMBER not properly set.\n");
89 int runNr = atoi(getenv("DATE_RUN_NUMBER"));
91 // Get the necessary OCDB files from the DAQ detector DB
92 if (gSystem->AccessPathName("localOCDB/GRP/Geometry/Data",kFileExists)) {
93 if (gSystem->mkdir("localOCDB/GRP/Geometry/Data",kTRUE) != 0) {
94 printf("Failed to create directory: localOCDB/GRP/Geometry/Data");
98 status = daqDA_DB_getFile("GRP/Geometry/Data","localOCDB/GRP/Geometry/Data/Run0_999999999_v0_s0.root");
100 printf("Failed to get geometry file (GRP/Geometry/Data) from DAQdetDB, status=%d\n", status);
104 if (gSystem->AccessPathName("localOCDB/ITS/Align/Data",kFileExists)) {
105 if (gSystem->mkdir("localOCDB/ITS/Align/Data",kTRUE) != 0) {
106 printf("Failed to create directory: localOCDB/ITS/Align/Data");
110 status = daqDA_DB_getFile("ITS/Align/Data","localOCDB/ITS/Align/Data/Run0_999999999_v0_s0.root");
112 printf("Failed to get its-alignment file (ITS/Align/Data) from DAQdetDB, status=%d\n", status);
116 if (gSystem->AccessPathName("localOCDB/ITS/Calib/SPDNoisy",kFileExists)) {
117 if (gSystem->mkdir("localOCDB/ITS/Calib/SPDNoisy",kTRUE) != 0) {
118 printf("Failed to create directory: localOCDB/ITS/Calib/SPDNoisy");
122 status = daqDA_DB_getFile("spd_noisy_ocdb","localOCDB/ITS/Calib/SPDNoisy/Run0_999999999_v0_s0.root");
124 printf("Failed to get spd file (spd_noisy_ocdb) from DAQdetDB, status=%d\n", status);
128 if (gSystem->AccessPathName("localOCDB/ITS/Calib/SPDDead",kFileExists)) {
129 if (gSystem->mkdir("localOCDB/ITS/Calib/SPDDead",kTRUE) != 0) {
130 printf("Failed to create directory: localOCDB/ITS/Calib/SPDDead");
134 status = daqDA_DB_getFile("spd_dead_ocdb","localOCDB/ITS/Calib/SPDDead/Run0_999999999_v0_s0.root");
136 printf("Failed to get spd file (spd_dead_ocdb) from DAQdetDB, status=%d\n", status);
140 if (gSystem->AccessPathName("localOCDB/TRIGGER/SPD/PITConditions",kFileExists)) {
141 if (gSystem->mkdir("localOCDB/TRIGGER/SPD/PITConditions",kTRUE) != 0) {
142 printf("Failed to create directory: localOCDB/TRIGGER/SPD/PITConditions");
146 status = daqDA_DB_getFile("TRIGGER/SPD/PITConditions","localOCDB/TRIGGER/SPD/PITConditions/Run0_999999999_v0_s0.root");
148 printf("Failed to get spd trigger file (TRIGGER/SPD/PITConditions) from DAQdetDB, status=%d\n", status);
152 status = daqDA_DB_getFile("mfchebKGI_sym.root","localOCDB/mfchebKGI_sym.root");
154 printf("Failed to get spd file (mfchebKGI_sym.root) from DAQdetDB, status=%d\n", status);
158 // Global initializations
160 // The B filed is required in AliITSClusterFinderV2SPD
161 // for the Lorentz angle correction. B set to 0.
162 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 0., 0., AliMagF::k5kGUniform,AliMagF::kBeamTypeAA,-1,2,15,"localOCDB/mfchebKGI_sym.root"));
163 AliLog::SetGlobalLogLevel(AliLog::kError);
164 AliCDBManager *man = AliCDBManager::Instance();
165 man->SetDefaultStorage("local://localOCDB");
168 // Init mean vertexer
169 AliITSMeanVertexer *mv = new AliITSMeanVertexer();
171 printf("Initialization of mean vertexer object failed ! Check the log for details");
175 // Initialization of AMORE sender
177 amore::da::AmoreDA vtxAmore(amore::da::AmoreDA::kSender);
179 /* main loop (infinite) */
182 /* check shutdown condition */
183 if (daqDA_checkShutdown()) {break;}
185 /* get next event (blocking call until timeout) */
186 status=monitorGetEventDynamic((void **)&event);
187 if (status==MON_ERR_EOF) {
188 printf ("End of File detected\n");
189 break; /* end of monitoring file has been reached */
193 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
197 /* retry if got no event */
203 eventT=event->eventType;
204 switch (event->eventType){
209 /* END START OF RUN */
217 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
219 // Run mean-vertexer reco
220 if (mv->Reconstruct(rawReader)) nevents_with_vertex++;
223 if ((nevents_physics%N_EVENTS_AUTOSAVE) == 0) {
224 mv->WriteVertices(OUTPUT_FILE);
227 // send the histos to AMORE pool
228 printf("AMORE send status: %d\n",vtxAmore.Send(mv->GetVertexXY()->GetName(),mv->GetVertexXY()));
229 printf("AMORE send status: %d\n",vtxAmore.Send(mv->GetVertexZ()->GetName(),mv->GetVertexZ()));
239 /* exit when last event received, no need to wait for TERM signal */
240 if (eventT==END_OF_RUN) {
241 printf("EOR event detected\n");
246 mv->WriteVertices(OUTPUT_FILE);
249 // send the histos to AMORE pool
250 printf("AMORE send status: %d\n",vtxAmore.Send(mv->GetVertexXY()->GetName(),mv->GetVertexXY()));
251 printf("AMORE send status: %d\n",vtxAmore.Send(mv->GetVertexZ()->GetName(),mv->GetVertexZ()));
257 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);
261 /* export file to FXS */
262 if (daqDA_FES_storeFile(OUTPUT_FILE, "VertexDiamond")) {