dependence on reference point removed
[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");
a8d3b391 5 gSystem->Load("libSpectrum");
dc7ca31d 6
7
a6c2af33 8 AliTestShuttle::SetMainCDB("local://./TestCDB");
9 AliTestShuttle::SetLocalCDB("local://./TestCDB");
10
11 AliTestShuttle::SetMainRefStorage("local://./TestRef");
12 AliTestShuttle::SetLocalRefStorage("local://./TestRef");
dc7ca31d 13
14 AliTestShuttle* shuttle = new AliTestShuttle(0, 0, 1);
15
16 TMap* dcsAliasMap = CreateDCSAliasMap();
17
18 shuttle->SetDCSInput(dcsAliasMap);
19
083f0bec 20 //shuttle->SetInputRunType("STANDALONE");
a8d3b391 21
22 shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "LASER", "LDC0","daLaser.root");
23
083f0bec 24 shuttle->SetInputRunType("PHYSICS");
a8d3b391 25
26 shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "PHYSICS", "LDC0", "daPhys.root");
dc7ca31d 27
a6c2af33 28 AliPreprocessor* start = new AliT0Preprocessor(shuttle);
dc7ca31d 29
30 shuttle->Process();
a6c2af33 31
a8d3b391 32 /* AliCDBManager::Instance()->SetDefaultStorage("local://TestCDB");
dc7ca31d 33
34 AliCDBEntry* entry = AliCDBManager::Instance()->Get("T00/Calib/Data", 0);
35 if (!entry)
36 {
37 printf("The file is not there. Something went wrong.\n");
38 return;
39 }
40
41 AliT0Calc* output = dynamic_cast<AliT0Calc*> (entry->GetObject());
42
43 // output->Print();
a8d3b391 44 */
dc7ca31d 45}
46
47TMap* CreateDCSAliasMap()
48{
49 TMap* aliasMap = new TMap;
50 aliasMap->SetOwner(1);
51
a8d3b391 52 Int_t n_ac_scalers=32;
53
54 for(int nAlias=0;nAlias<n_ac_scalers;nAlias++)
dc7ca31d 55 {
56 TObjArray* valueSet = new TObjArray;
57 valueSet->SetOwner(1);
58
a8d3b391 59 TString aliasName=Form("t00_ac_scaler_%02d",nAlias);
60
61 Int_t nValues=10;
dc7ca31d 62
a8d3b391 63 for (int timeStamp=0;timeStamp<nValues;timeStamp++)
dc7ca31d 64 {
a8d3b391 65 AliDCSValue* dcsVal = new AliDCSValue((Float_t) gRandom->Gaus(3.0e8,50), timeStamp);
dc7ca31d 66 valueSet->Add(dcsVal);
a8d3b391 67 printf("Alias: %s - value n. %d: (val=%d timestamp=%d)\n" ,
68 aliasName.Data(), timeStamp, dcsVal->GetFloat(), dcsVal->GetTimeStamp());
dc7ca31d 69 }
70 aliasMap->Add(new TObjString(aliasName), valueSet);
71 }
72
73 return aliasMap;
74}
75
76TMap* ReadDCSAliasMap()
77{
78 AliCDBEntry *entry = AliCDBManager::Instance()->Get("DET/DCS/Data", 0);
79 return dynamic_cast<TMap*> (entry->GetObject());
80}
81
82void WriteDCSAliasMap()
83{
84 TMap* dcsAliasMap = CreateDCSAliasMap();
85
86 AliCDBMetaData metaData;
87 metaData.SetBeamPeriod(0);
88 metaData.SetResponsible("Responsible person");
89 metaData.SetComment("Test object for TestPreprocessor.C");
90
91 AliCDBId id("DET/DCS/Data", 0, 0);
92
93 // initialize location of CDB
94 AliCDBManager::Instance()->SetDefaultStorage("local://./TestCDB");
95
96 AliCDBManager::Instance()->Put(dcsAliasMap, id, &metaData);
97}