o) Adding time out to the execution of the preprocessors: The Shuttle forks and the...
[u/mrichter/AliRoot.git] / SHUTTLE / Shuttle.C
1 Bool_t Shuttle(const char* param = "listen") {
2
3         // WARNING: if ldap is built with ssl support it may cause confilcts with the 
4         // AliEn interface. If this happens, grid storage activation must be done BEFORE 
5         // loading LDAP libraries!!!
6
7         gSystem->Load("libRLDAP.so");
8         gSystem->Load("libSHUTTLE");
9         gSystem->Load("$ROOTSYS/lib/libThread");
10         gSystem->Load("$ALICE_ROOT/SHUTTLE/test/libTest.so");
11
12 //      AliLog::SetGlobalDebugLevel(1);
13
14         // Setting local CDB and reference storage locations
15         AliShuttle::SetMainCDB("alien://user=aliprod?folder=colla/GridShuttleCDB");
16         AliShuttle::SetMainRefStorage("alien://user=aliprod?folder=colla/GridShuttleRefStorage");
17
18 //      AliShuttle::SetMainCDB("local://testLeakCDB");
19 //      AliShuttle::SetMainRefStorage("local://testLeakRef");
20
21         AliShuttle::SetLocalCDB("local://LocalShuttleCDB");
22         AliShuttle::SetLocalRefStorage("local://LocalShuttleRefStorage");
23
24         AliShuttle::SetProcessDCS(kFALSE);
25
26
27 //      AliCDBManager *man = AliCDBManager::Instance();
28 //      man->SetDefaultStorage("local://MainCDB");
29 //      man->SetDefaultStorage("alien://DBFolder=ShuttleMainCDB");
30
31
32         AliShuttleConfig config("pcalice290.cern.ch", 389, "o=alice,dc=cern,dc=ch");
33         config.SetProcessAll(kTRUE);
34         config.Print();
35
36         AliShuttleTrigger trigger(&config);
37
38         AliShuttle* shuttle = trigger.GetShuttle();
39
40         // Add here detectors preprocessor ...
41         TestTPCPreprocessor *tpcPrep = new TestTPCPreprocessor("TPC",shuttle);
42         TestITSPreprocessor *itsPrep = new TestITSPreprocessor("ITS",shuttle);
43         TestRICHPreprocessor *richPrep = new TestRICHPreprocessor("RICH",shuttle);
44
45         TString paramStr(param);
46         
47         if (paramStr.IsDigit()) {
48                 Int_t run = paramStr.Atoi();
49                 trigger.Collect(run);
50         } else if (paramStr == "new") {
51                 Bool_t result = trigger.Collect();
52         } else if (paramStr == "listen") {
53                 trigger.Run();
54         } else {
55                 cout<<"Bad parameter: "<<param<<endl;
56                 cout<<"Parameter options: "<<endl;
57                 cout<<"<run> - collect data for the given run"<<endl;
58                 cout<<"new - collect data only for the new runs"<<endl;
59                 cout<<"listen - start listening for DAQ notification"<<endl;
60                 cout<<"<empty parameter> - the same as 'listen'"<<endl;
61         }
62
63         AliCDBManager::Destroy();
64 }
65
66