Run type field added in SHUTTLE framework. Run type is read from "run type" logbook...
[u/mrichter/AliRoot.git] / SHUTTLE / Shuttle.C
1 Bool_t Shuttle(const char* param = "listen", const char* dets=0) {
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("libRAliEn.so");
8         gSystem->Load("libRLDAP.so");
9         gSystem->Load("libMonaLisa");
10         gSystem->Load("libSHUTTLE");
11         gSystem->Load("libThread");
12 //      gSystem->Load("$ALICE_ROOT/SHUTTLE/test/libTest.so");
13
14         AliLog::SetGlobalDebugLevel(2);
15
16 //      Setting local CDB and reference storage locations
17           AliShuttle::SetMainCDB("alien://user=aliprod?folder=testShuttle/OCDB");
18           AliShuttle::SetMainRefStorage("alien://user=aliprod?folder=testShuttle/Reference");
19
20 //        AliShuttle::SetMainCDB("local://$SHUTTLE_DIR/LocalShuttleCDB");
21 //        AliShuttle::SetMainRefStorage("local://$SHUTTLE_DIR/LocalShuttleRefStorage");
22
23         AliShuttle::SetLocalCDB("local://$SHUTTLE_DIR/LocalShuttleCDB");
24         AliShuttle::SetLocalRefStorage("local://$SHUTTLE_DIR/LocalShuttleRefStorage");
25
26 //      Setting Shuttle log and temp folders
27         AliShuttle::SetShuttleLogDir("$SHUTTLE_DIR/log");
28         AliShuttle::SetShuttleTempDir("$SHUTTLE_DIR/temp");
29         
30         
31         
32         AliShuttle::SetProcessDCS(kTRUE);
33
34 //      AliShuttleConfig config("pcalice290.cern.ch", 389, "o=alice,dc=cern,dc=ch");
35         AliShuttleConfig config("pcalishuttle01.cern.ch", 389, "", "", "o=alice,dc=cern,dc=ch");
36         config.SetProcessAll(kTRUE);
37         config.Print();
38
39         AliShuttleTrigger trigger(&config, 100000);
40
41         AliShuttle* shuttle = trigger.GetShuttle();
42
43         // Add here detectors preprocessor ...
44
45         TString detector = dets;
46         
47         printf ("Processing detectors: %s \n", detector.Data());
48
49         if (detector.Contains("SPD")) 
50                 new AliITSPreprocessorSPD(shuttle);
51         if (detector.Contains("SDD")) 
52                 new AliITSPreprocessorSDD(shuttle);
53         if (detector.Contains("SSD")) 
54                 new AliITSPreprocessorSSD(shuttle);
55         if (detector.Contains("TPC")) 
56                 new AliTPCPreprocessor(shuttle);
57         if (detector.Contains("TRD")) 
58                 new AliTRDPreprocessor(shuttle);
59         if (detector.Contains("TOF")) 
60                 new AliTOFPreprocessor(shuttle);
61         if (detector.Contains("PHS")) 
62         {
63                 gSystem->Load("libPHOSshuttle");
64                 new AliPHOSPreprocessor(shuttle);
65         }
66         if (detector.Contains("CPV")) 
67                 new AliCPVPreprocessor(shuttle);
68         if (detector.Contains("HMP")) 
69                 new AliHMPIDPreprocessor(shuttle);
70         if (detector.Contains("EMC")) 
71                 new AliEMCALPreprocessor(shuttle);
72         if (detector.Contains("MCH")) 
73                 new AliMUONPreprocessor(shuttle);
74         if (detector.Contains("MTR")) 
75                 new AliMTRPreprocessor(shuttle);
76         if (detector.Contains("FMD")) 
77                 new AliFMDPreprocessor(shuttle);
78         if (detector.Contains("ZDC")) 
79                 new AliZDCPreprocessor(shuttle);
80         if (detector.Contains("PMD")) 
81                 new AliPMDPreprocessor("PMD", shuttle);
82         if (detector.Contains("T00")) 
83         {
84                 gSystem->Load("libT0shuttle");
85                 new AliT0Preprocessor("T00", shuttle);
86         }
87         if (detector.Contains("V00")) 
88                 new AliVZEROPreprocessor(shuttle);
89         if (detector.Contains("GRP")) 
90                 new AliGRPPreprocessor(shuttle);
91
92 //      AliTOFPreprocessor *tofPrep = new AliTOFPreprocessor(shuttle);
93 //      AliTRDPreprocessor *trdPrep = new AliTRDPreprocessor(shuttle);
94 //      AliGRPPreprocessor *grpPrep = new AliGRPPreprocessor(shuttle);
95         
96         TString paramStr(param);
97         
98         TStopwatch stopwatch;
99         stopwatch.Start();
100
101       if (paramStr.IsDigit() || paramStr == "-1") {
102               Int_t run = paramStr.Atoi();
103               trigger.Collect(run);
104       } else if (paramStr == "new") {
105               Bool_t result = trigger.Collect();
106       } else if (paramStr == "listen") {
107               trigger.Run();
108       } else {
109               cout<<"Bad parameter: "<<param<<endl;
110               cout<<"Parameter options: "<<endl;
111               cout<<"<run> - collect data for the given run"<<endl;
112               cout<<"new - collect data only for the new runs"<<endl;
113               cout<<"listen - start listening for DAQ notification"<<endl;
114               cout<<"<empty parameter> - the same as 'listen'"<<endl;
115       }
116
117         printf("Execution time: R:%.2fs C:%.2fs \n",
118                stopwatch.RealTime(),stopwatch.CpuTime());
119
120         AliCDBManager::Destroy();
121 }
122
123