Removing additional 0MQ dependency
[u/mrichter/AliRoot.git] / MONITOR / onlineReco.C
... / ...
CommitLineData
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") {
13 gSystem->Load("libMONITOR");
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) {
25 TString gdc;
26 if (grp(run,gdc) > 0) {
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
31 if (!gdc.IsNull()) {
32
33 gSystem->Setenv("DATE_RUN_NUMBER",Form("%d",run));
34
35 TString dataSource = "*";
36 dataSource.Prepend("mem://@");
37 dataSource.Append(":");
38
39 // Setting CDB
40 AliCDBManager * man = AliCDBManager::Instance();
41 // man->SetDefaultStorage("raw://");
42 man->SetDefaultStorage("local:///local/cdb");
43 man->SetSpecificStorage("GRP/GRP/Data",
44 Form("local://%s",gSystem->pwd()));
45 man->SetSpecificStorage("GRP/CTP/Config",
46 Form("local://%s",gSystem->pwd()));
47 man->SetLock(kTRUE);
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 }
60 }
61 }
62
63 printf("Execution time: R:%.2fs C:%.2fs \n",
64 stopwatch.RealTime(),stopwatch.CpuTime());
65
66 return run;
67
68}
69
70Int_t grp(UInt_t run, TString &gdc) {
71
72 Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(run, "aldaqdb", 0, "LOGBOOK", "logbook", "alice",
73 Form("local://%s",gSystem->pwd()),
74 gdc);
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}