Updating T00 configuration for the test and P2.
[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;
955ef7d2 53 Int_t n_T0aliases=191;
19fb06bd 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 }
955ef7d2 124 else if (nAlias < 184)
125 {
126 aliasName=Form("t00_ac_atten");
127 }
128 else if(nAlias < 185)
129 {
130 aliasName=Form("t00_a_mpd_cent");
131 }
132 else if(nAlias < 186)
133 {
134 aliasName=Form("t00_c_mpd_cent");
135 }
136 else if(nAlias < 187)
137 {
138 aliasName=Form("t00_a_mpd_scent");
139 }
140 else if(nAlias < 188)
141 {
142 aliasName=Form("t00_c_mpd_scent");
143 }
144 else if(nAlias < 189)
145 {
146 aliasName=Form("t00_ac_tvdc_top");
147 }
148 else if(nAlias < 190)
149 {
150 aliasName=Form("t00_ac_tvdc_bottom");
151 }
19fb06bd 152 else
153 {
955ef7d2 154 aliasName=Form("t00_ac_mpd_mode");
19fb06bd 155 }
dc7ca31d 156
a8d3b391 157 for (int timeStamp=0;timeStamp<nValues;timeStamp++)
dc7ca31d 158 {
a8d3b391 159 AliDCSValue* dcsVal = new AliDCSValue((Float_t) gRandom->Gaus(3.0e8,50), timeStamp);
dc7ca31d 160 valueSet->Add(dcsVal);
a8d3b391 161 printf("Alias: %s - value n. %d: (val=%d timestamp=%d)\n" ,
162 aliasName.Data(), timeStamp, dcsVal->GetFloat(), dcsVal->GetTimeStamp());
dc7ca31d 163 }
164 aliasMap->Add(new TObjString(aliasName), valueSet);
165 }
166
167 return aliasMap;
168}
169
170TMap* ReadDCSAliasMap()
171{
172 AliCDBEntry *entry = AliCDBManager::Instance()->Get("DET/DCS/Data", 0);
173 return dynamic_cast<TMap*> (entry->GetObject());
174}
175
176void WriteDCSAliasMap()
177{
178 TMap* dcsAliasMap = CreateDCSAliasMap();
179
180 AliCDBMetaData metaData;
181 metaData.SetBeamPeriod(0);
955ef7d2 182 metaData.SetResponsible("Tomek");
dc7ca31d 183 metaData.SetComment("Test object for TestPreprocessor.C");
184
185 AliCDBId id("DET/DCS/Data", 0, 0);
186
187 // initialize location of CDB
188 AliCDBManager::Instance()->SetDefaultStorage("local://./TestCDB");
189
190 AliCDBManager::Instance()->Put(dcsAliasMap, id, &metaData);
191}