]> git.uio.no Git - u/mrichter/AliRoot.git/blame - SHUTTLE/TestShuttle/TestPreprocessor.C
MSTU(16) = 2 for all processes.
[u/mrichter/AliRoot.git] / SHUTTLE / TestShuttle / TestPreprocessor.C
CommitLineData
5c6b40ae 1// This class runs the test preprocessor
2// It uses AliTestShuttle to simulate a full Shuttle process
3
4// The input data is created in the functions
5// CreateDCSAliasMap() creates input that would in the same way come from DCS
6// ReadDCSAliasMap() reads from a file
7// CreateInputFilesMap() creates a list of local files, that can be accessed by the shuttle
8
9void TestPreprocessor()
10{
11 gSystem->Load("libTestShuttle");
12
13 // initialize location of CDB
14 AliCDBManager *man = AliCDBManager::Instance();
15 man->SetDefaultStorage("local://TestCDB");
16
17 // TODO decide where to read the data
18 TMap* dcsAliasMap = 0;
19 //dcsAliasMap = CreateDCSAliasMap();
20 dcsAliasMap = ReadDCSAliasMap();
21
22 // create TMap of available files
23 TMap* inputFiles = CreateInputFilesMap();
24
25 // create AliTestShuttle instance
26 AliTestShuttle* shuttle = new AliTestShuttle(inputFiles);
27 TestShuttle(shuttle);
28
29 // create preprocessor
30 AliPreprocessor* pp = new AliTestPreprocessor("TPC", shuttle);
31
32 // call preprocessor
33 pp->Initialize(0, 0, 1);
34 pp->Process(dcsAliasMap);
35}
36
37TMap* CreateDCSAliasMap()
38{
39 // fill fake DCS object
40
41 TObjArray* valueSet1 = new TObjArray;
42
43
44 valueSet1->Add();
45
46 TObjArray* valueSet2 = new TObjArray;
47 valueSet2->Add();
48
49 TMap* aliasMap = new TMap;
50 aliasMap->Add(new TObjString("DCSAlias1"), valueSet1);
51 aliasMap->Add(new TObjString("DCSAlias2"), valueSet2);
52
53 return aliasMap;
54}
55
56TMap* ReadDCSAliasMap()
57{
58 // open the file
59 AliCDBEntry *entry = AliCDBManager::Instance()->Get("TPC/DCS/Data",21200);
60 return dynamic_cast<TMap*> (entry->GetObject());
61}
62
63TMap* CreateInputFilesMap()
64{
65 // create a list of files which will be available from the AliTestShuttle
66
67 inputFile1 = new TMap;
68 inputFile1->Add(new TObjString("GDC"), new TObjString("file1.root"));
69
70 inputFile2 = new TMap;
71 inputFile2->Add(new TObjString("LDC0"), new TObjString("file2a.root"));
72 inputFile2->Add(new TObjString("LDC1"), new TObjString("file2b.root"));
73 inputFile2->Add(new TObjString("LDC2"), new TObjString("file2c.root"));
74
75 TMap* inputFiles = new TMap;
76 inputFiles->Add(new TObjString("DAQ-TPC-PEDESTALS"), inputFile1);
77 inputFiles->Add(new TObjString("DAQ-TPC-DRIFTVELOCITY"), inputFile2);
78
79 return inputFiles;
80}
81
82void TestShuttle(AliShuttleInterface* shuttle)
83{
84 const char* file = shuttle->GetFile(AliShuttleInterface::kDAQ, "TPC", "PEDESTALS", "GDC");
85 cout << "GetFile: " << file << endl;
86 cout << "GetFileSources: " << endl;
87 shuttle->GetFileSources(AliShuttleInterface::kDAQ, "TPC", "DRIFTVELOCITY")->Print();
88
89 shuttle->Log("TPC", "Log test");
90
91 //shuttle->Store();
92}