AliRoot Core  3dc7879 (3dc7879)
onlineReco.C
Go to the documentation of this file.
1 UInt_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
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 
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 
70 Int_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 }
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TROOT * gROOT
static void Destroy()
void SetSpecificStorage(const char *calibType, const char *dbString, Int_t version=-1, Int_t subVersion=-1)
static Int_t ReceivePromptRecoParameters(UInt_t run, const char *dbHost, Int_t dbPort, const char *dbName, const char *user, const char *password, const char *cdbRoot, TString &gdc)
void rec(const char *filename="raw.root")
Definition: rec.C:1
UInt_t onlineReco(const char *param="listen", const char *recMacroPath="$ALICE_ROOT/test/cosmic/rec.C")
Definition: onlineReco.C:1
void SetDefaultStorage(const char *dbString)
Int_t grp(UInt_t run, TString &gdc)
Definition: onlineReco.C:70
ULong64_t SetLock(Bool_t lockFlag=kTRUE, ULong64_t key=0)
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)