.so cleanup: more gSystem->Load()
[u/mrichter/AliRoot.git] / EMCAL / macros / Shuttle / TestPreprocessor.C
CommitLineData
e2a49750 1/* $Id: TestPreprocessor.C 21848 2007-10-29 18:07:14Z acolla $ */
2
3// This class runs the test preprocessor
4// It uses AliTestShuttle to simulate a full Shuttle process
5
6// The input data is created in the functions
7// CreateDCSAliasMap() creates input that would in the same way come from DCS
8// ReadDCSAliasMap() reads from a file
9// CreateInputFilesMap() creates a list of local files, that can be accessed by the shuttle
10
11void TestPreprocessor(const int physics = 1)
12{
13 // load library
14 // [compiled with: cd $ALICE_ROOT/SHUTTLE/TestShuttle/; make; cd -]
b0635849 15 gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle");
e2a49750 16
17 // create AliTestShuttle instance
18 // The parameters are run, startTime, endTime
19 AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1);
20
21 // TODO if needed, change location of OCDB and Reference test folders
22 // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB and TestReference
23 AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/OCDB");
24 AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/OCDB");
25
26 printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
27 printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
28
29 // TODO(2)
30 //
31 // The shuttle can also process files that originate from DCS, DAQ and HLT.
32 // To test it, we provide some local files and locations where these would be found when
33 // the online machinery would be there.
34 // In real life this functions would be produces by the sub-detectors
35 // calibration programs in DCS, DAQ or HLT. These files can then be retrieved using the Shuttle.
36 //
37 // Files are added with the function AliTestShuttle::AddInputFile. The syntax is:
38 // AddInputFile(<system>, <detector>, <id>, <source>, <local-file>)
39 // In this example we add a file originating from the GDC with the id PEDESTALS
40 // Three files originating from different LDCs but with the same id are also added
41 // Note that the test preprocessor name is TPC. The name of the detector's preprocessor must follow
42 // the "online" naming convention ALICE-INT-2003-039.
43
44 // For now, we only check the files from DAQ
45 if (physics) {
46 shuttle->AddInputFile(AliShuttleInterface::kDAQ, "EMC", "signal", "MON0", "EMCALLED.root");
47 printf("EMCALLED.root added\n");
48 }
49 else {
50 shuttle->AddInputFile(AliShuttleInterface::kDAQ, "EMC", "pedestals", "MON0", "EMCALPED.root");
51 printf("EMCALPED.root added\n");
52 }
53
54 // TODO(3)
55 //
56 // The shuttle can read run type stored in the DAQ logbook.
57 // To test it, we must provide the run type manually. They will be retrieved in the preprocessor
58 // using GetRunType function.
59 if (physics) {
60 shuttle->SetInputRunType("PHYSICS");
61 printf("RunType PHYSICS\n");
62 }
63 else {
64 shuttle->SetInputRunType("PEDESTAL");
65 printf("RunType PEDESTAL\n");
66 }
67
68 // TODO(6)
69 // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
70 AliPreprocessor* test = new AliEMCALPreprocessor(shuttle);
71 printf("AliEMCALPreprocessor created\n");
72
73 // Test the preprocessor
74 shuttle->Process();
75 printf("shuttle->Process() done\n");
76
77 // TODO(7)
78 // In the preprocessor AliShuttleInterface::Store should be called to put the final
79 // data to the CDB. To check if all went fine have a look at the files produced in
80 // $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB/<detector>/SHUTTLE/Data
81 //
82 // Check the file which should have been created
83 AliCDBEntry* chkEntry;
84
85 if (physics) {
86 chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
87 ->Get("EMCAL/Calib/LED", 7);
88 }
89 else {
90 chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainRefStorage())
91 ->Get("EMCAL/Calib/Pedestals", 7);
92 }
93
94 if (!chkEntry)
95 {
96 printf("The file is not there. Something went wrong.\n");
97 return;
98 }
99
100}