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