for compile lookup
[u/mrichter/AliRoot.git] / T0 / TestPreprocessor.C
CommitLineData
dc7ca31d 1void TestPreprocessor()
2{
3 gSystem->Load("libT0shuttle.so");
4 gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle.so");
5
6
7 AliCDBManager::Instance()->SetDefaultStorage("local://./TestCDB");
8
9 AliTestShuttle* shuttle = new AliTestShuttle(0, 0, 1);
10
11 TMap* dcsAliasMap = CreateDCSAliasMap();
12
13 shuttle->SetDCSInput(dcsAliasMap);
14
15 shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "TIME", "LDC0", "DAQfile.root");
16
17 AliPreprocessor* start = new AliT0Preprocessor("T00", shuttle);
18
19 shuttle->Process();
20
21 AliCDBEntry* entry = AliCDBManager::Instance()->Get("T00/Calib/Data", 0);
22 if (!entry)
23 {
24 printf("The file is not there. Something went wrong.\n");
25 return;
26 }
27
28 AliT0Calc* output = dynamic_cast<AliT0Calc*> (entry->GetObject());
29
30 // output->Print();
31}
32
33TMap* CreateDCSAliasMap()
34{
35 TMap* aliasMap = new TMap;
36 aliasMap->SetOwner(1);
37
38 for(int nAlias=0;nAlias<24;nAlias++)
39 {
40 TObjArray* valueSet = new TObjArray;
41 valueSet->SetOwner(1);
42
43 TString aliasName="T0HV";
44 aliasName += nAlias;
45
46 for (int timeStamp=0;timeStamp<1;timeStamp++)
47 {
48 AliDCSValue* dcsVal = new AliDCSValue((Float_t) nAlias, timeStamp);
49 valueSet->Add(dcsVal);
50// printf("hello! dcsVal= %d %d\n" ,dcsVal->GetFloat(), dcsVal->GetTimeStamp());
51 }
52 aliasMap->Add(new TObjString(aliasName), valueSet);
53 }
54
55 return aliasMap;
56}
57
58TMap* ReadDCSAliasMap()
59{
60 AliCDBEntry *entry = AliCDBManager::Instance()->Get("DET/DCS/Data", 0);
61 return dynamic_cast<TMap*> (entry->GetObject());
62}
63
64void WriteDCSAliasMap()
65{
66 TMap* dcsAliasMap = CreateDCSAliasMap();
67
68 AliCDBMetaData metaData;
69 metaData.SetBeamPeriod(0);
70 metaData.SetResponsible("Responsible person");
71 metaData.SetComment("Test object for TestPreprocessor.C");
72
73 AliCDBId id("DET/DCS/Data", 0, 0);
74
75 // initialize location of CDB
76 AliCDBManager::Instance()->SetDefaultStorage("local://./TestCDB");
77
78 AliCDBManager::Instance()->Put(dcsAliasMap, id, &metaData);
79}