]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MONITOR/onlineReco.C
coverity fix
[u/mrichter/AliRoot.git] / MONITOR / onlineReco.C
CommitLineData
5bea0f92 1UInt_t onlineReco(const char* param = "listen",const char *recMacroPath = "$ALICE_ROOT/test/cosmic/rec.C") {
2
3 TString paramStr(param);
4
5 UInt_t run = 0;
6
7 TStopwatch stopwatch;
8 stopwatch.Start();
9
10 if (paramStr.IsDigit()) {
11 run = paramStr.Atoi();
12 } else if (paramStr == "listen") {
3153d9c6 13 gSystem->Load("libMONITOR");
5bea0f92 14 AliOnlineRecoTrigger trigger;
15 run = trigger.Run();
16 } else {
17 cout<<"Bad parameter: "<<param<<endl;
18 cout<<"Parameter options: "<<endl;
19 cout<<"<run> - run online reconstruction for the given run"<<endl;
20 cout<<"listen - start listening for ECS SOR notification"<<endl;
21 cout<<"<empty parameter> - the same as 'listen'"<<endl;
22 }
23
24 if (run > 0) {
03e5ee4f 25 TString gdc;
26 if (grp(run,gdc) > 0) {
5bea0f92 27
28 // "t" stores the token on this disk, otherwise the alien connection is not thread/process-safe
29 TGrid::Connect("alien://", 0, 0, "t");
30
03e5ee4f 31 if (!gdc.IsNull()) {
5bea0f92 32
2b81b7d0 33 gSystem->Setenv("DATE_RUN_NUMBER",Form("%d",run));
34
35 TString dataSource = "*";
5bea0f92 36 dataSource.Prepend("mem://@");
03e5ee4f 37 dataSource.Append(":");
5bea0f92 38
39 // Setting CDB
40 AliCDBManager * man = AliCDBManager::Instance();
03e5ee4f 41 // man->SetDefaultStorage("raw://");
d5409cbf 42 man->SetDefaultStorage("local:///local/cdb");
5bea0f92 43 man->SetSpecificStorage("GRP/GRP/Data",
44 Form("local://%s",gSystem->pwd()));
45 man->SetSpecificStorage("GRP/CTP/Config",
46 Form("local://%s",gSystem->pwd()));
03e5ee4f 47 man->SetLock(kTRUE);
5bea0f92 48
49 gSystem->mkdir(Form("run%d",run));
50 gSystem->cd(Form("run%d",run));
51
52 gROOT->LoadMacro(gSystem->ExpandPathName(recMacroPath));
53 rec(dataSource.Data());
54
55 AliCDBManager::Destroy();
56 }
57 else {
58 cout << "No GDCs defined in the logbook entry for run " << run << endl;
59 }
5bea0f92 60 }
61 }
62
63 printf("Execution time: R:%.2fs C:%.2fs \n",
64 stopwatch.RealTime(),stopwatch.CpuTime());
65
66 return run;
67
68}
69
03e5ee4f 70Int_t grp(UInt_t run, TString &gdc) {
5bea0f92 71
72 Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(run, "aldaqdb", 0, "LOGBOOK", "logbook", "alice",
73 Form("local://%s",gSystem->pwd()),
03e5ee4f 74 gdc);
5bea0f92 75 if(ret>0) cout << "Last run of the same type is: " << ret << endl;
76 else if(ret==0) cout << "No previous run of the same type found" << endl;
77 else if(ret<0) cout << "Error code while retrieving GRP parameters returned: " << ret << endl;
78 return(ret);
79}