bug fix. thanks to Axel Naumann.
[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
1db75895 26 shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "PHYSICS", "LDC0", "daCosmic.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
19fb06bd 52 TString aliasName;
53 Int_t n_T0aliases=184;
54 Int_t nValues=10;
a8d3b391 55
19fb06bd 56 for(int nAlias=0;nAlias<n_T0aliases;nAlias++)
dc7ca31d 57 {
58 TObjArray* valueSet = new TObjArray;
59 valueSet->SetOwner(1);
19fb06bd 60 if(nAlias < 32)
61 {
62 aliasName=Form("t00_ac_scaler_%02d",nAlias);
63 }
64 else if(nAlias < 64)
65 {
1db75895 66 aliasName=Form("t00_ac_scaler_sec_%02d",nAlias-32);
19fb06bd 67 }
68 else if(nAlias < 76)
69 {
1db75895 70 aliasName=Form("t00_a_hv_imon_%02d",nAlias-64);
19fb06bd 71 }
72 else if(nAlias < 88)
73 {
1db75895 74 aliasName=Form("t00_a_hv_vmon_%02d",nAlias-76);
19fb06bd 75 }
76 else if(nAlias < 90)
77 {
1db75895 78 aliasName=Form("t00_a_lv_imon_%02d",nAlias-88);
19fb06bd 79 }
80 else if(nAlias < 92)
81 {
1db75895 82 aliasName=Form("t00_a_lv_vmon_%02d",nAlias-90);
19fb06bd 83 }
84 else if(nAlias < 104)
85 {
1db75895 86 aliasName=Form("t00_c_hv_imon_%02d",nAlias-92);
19fb06bd 87 }
88 else if(nAlias < 116)
89 {
1db75895 90 aliasName=Form("t00_c_hv_vmon_%02d",nAlias-104);
19fb06bd 91 }
92 else if(nAlias < 118)
93 {
1db75895 94 aliasName=Form("t00_c_lv_imon_%02d",nAlias-116);
19fb06bd 95 }
96 else if(nAlias < 120)
97 {
1db75895 98 aliasName=Form("t00_c_lv_vmon_%02d",nAlias-118);
19fb06bd 99 }
100 else if(nAlias < 132)
101 {
1db75895 102 aliasName=Form("t00_a_cfd_thre_%02d",nAlias-120);
19fb06bd 103 }
104 else if(nAlias < 144)
105 {
1db75895 106 aliasName=Form("t00_a_cfd_walk_%02d",nAlias-132);
19fb06bd 107 }
108 else if(nAlias < 156)
109 {
1db75895 110 aliasName=Form("t00_c_cfd_thre_%02d",nAlias-144);
19fb06bd 111 }
112 else if(nAlias < 168)
113 {
1db75895 114 aliasName=Form("t00_c_cfd_walk_%02d",nAlias-156);
19fb06bd 115 }
116 else if(nAlias < 178)
117 {
1db75895 118 aliasName=Form("t00_ac_trm_%02d",nAlias-168);
19fb06bd 119 }
120 else if(nAlias < 183)
121 {
1db75895 122 aliasName=Form("t00_ac_drm_%02d",nAlias-178);
19fb06bd 123 }
124 else
125 {
1db75895 126 aliasName=Form("t00_ac_atten",nAlias-183);
19fb06bd 127 }
dc7ca31d 128
a8d3b391 129 for (int timeStamp=0;timeStamp<nValues;timeStamp++)
dc7ca31d 130 {
a8d3b391 131 AliDCSValue* dcsVal = new AliDCSValue((Float_t) gRandom->Gaus(3.0e8,50), timeStamp);
dc7ca31d 132 valueSet->Add(dcsVal);
a8d3b391 133 printf("Alias: %s - value n. %d: (val=%d timestamp=%d)\n" ,
134 aliasName.Data(), timeStamp, dcsVal->GetFloat(), dcsVal->GetTimeStamp());
dc7ca31d 135 }
136 aliasMap->Add(new TObjString(aliasName), valueSet);
137 }
138
139 return aliasMap;
140}
141
142TMap* ReadDCSAliasMap()
143{
144 AliCDBEntry *entry = AliCDBManager::Instance()->Get("DET/DCS/Data", 0);
145 return dynamic_cast<TMap*> (entry->GetObject());
146}
147
148void WriteDCSAliasMap()
149{
150 TMap* dcsAliasMap = CreateDCSAliasMap();
151
152 AliCDBMetaData metaData;
153 metaData.SetBeamPeriod(0);
154 metaData.SetResponsible("Responsible person");
155 metaData.SetComment("Test object for TestPreprocessor.C");
156
157 AliCDBId id("DET/DCS/Data", 0, 0);
158
159 // initialize location of CDB
160 AliCDBManager::Instance()->SetDefaultStorage("local://./TestCDB");
161
162 AliCDBManager::Instance()->Put(dcsAliasMap, id, &metaData);
163}