VZERO DAs + Object target dependencies
[u/mrichter/AliRoot.git] / T0 / TestPreprocessor.C
... / ...
CommitLineData
1void TestPreprocessor()
2{
3 gSystem->Load("libT0shuttle.so");
4 gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle.so");
5 gSystem->Load("libSpectrum");
6
7
8 AliTestShuttle::SetMainCDB("local://./TestCDB");
9 AliTestShuttle::SetLocalCDB("local://./TestCDB");
10
11 AliTestShuttle::SetMainRefStorage("local://./TestRef");
12 AliTestShuttle::SetLocalRefStorage("local://./TestRef");
13
14 AliTestShuttle* shuttle = new AliTestShuttle(104890, 0, 1);
15
16 TMap* dcsAliasMap = CreateDCSAliasMap();
17
18
19
20 shuttle->SetDCSInput(dcsAliasMap);
21
22 shuttle->SetInputRunType("AMPLITUDE_CALIBRATION");
23
24 //shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "AMPLITUDE_CALIBRATION", "LDC0","daLaser.root");
25 shuttle->SetInputRunType("PHYSICS");
26
27 shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "PHYSICS", "LDC0", "daPhys.root");
28
29 AliPreprocessor* start = new AliT0Preprocessor(shuttle);
30
31 shuttle->Process();
32}
33
34TMap* CreateDCSAliasMap()
35{
36 TMap* aliasMap = new TMap;
37 aliasMap->SetOwner(1);
38
39 TString aliasName;
40 Int_t n_T0aliases=201;
41 Int_t nValues=10;
42
43 for(int nAlias=0;nAlias<n_T0aliases;nAlias++)
44 {
45 TObjArray* valueSet = new TObjArray;
46 valueSet->SetOwner(1);
47 if(nAlias < 32)
48 {
49 aliasName=Form("t00_ac_scaler_%02d",nAlias);
50 }
51 else if(nAlias < 64)
52 {
53 aliasName=Form("t00_ac_scaler_sec_%02d",nAlias-32);
54 }
55 else if(nAlias < 76)
56 {
57 aliasName=Form("t00_a_hv_imon_%02d",nAlias-64);
58 }
59 else if(nAlias < 88)
60 {
61 aliasName=Form("t00_a_hv_vmon_%02d",nAlias-76);
62 }
63 else if(nAlias < 90)
64 {
65 aliasName=Form("t00_a_lv_imon_%01d",nAlias-88);
66 }
67 else if(nAlias < 92)
68 {
69 aliasName=Form("t00_a_lv_vmon_%01d",nAlias-90);
70 }
71 else if(nAlias < 104)
72 {
73 aliasName=Form("t00_c_hv_imon_%02d",nAlias-92);
74 }
75 else if(nAlias < 116)
76 {
77 aliasName=Form("t00_c_hv_vmon_%02d",nAlias-104);
78 }
79 else if(nAlias < 118)
80 {
81 aliasName=Form("t00_c_lv_imon_%01d",nAlias-116);
82 }
83 else if(nAlias < 120)
84 {
85 aliasName=Form("t00_c_lv_vmon_%01d",nAlias-118);
86 }
87 else if(nAlias < 132)
88 {
89 aliasName=Form("t00_a_cfd_thre_%02d",nAlias-120);
90 }
91 else if(nAlias < 144)
92 {
93 aliasName=Form("t00_a_cfd_walk_%02d",nAlias-132);
94 }
95 else if(nAlias < 156)
96 {
97 aliasName=Form("t00_c_cfd_thre_%02d",nAlias-144);
98 }
99 else if(nAlias < 168)
100 {
101 aliasName=Form("t00_c_cfd_walk_%02d",nAlias-156);
102 }
103 else if(nAlias < 188)
104 {
105 aliasName=Form("t00_ac_trm_%02d",nAlias-168);
106 }
107 else if(nAlias < 193)
108 {
109 aliasName=Form("t00_ac_drm_%02d",nAlias-188);
110 }
111 else if (nAlias < 194)
112 {
113 aliasName=Form("t00_ac_atten");
114 }
115 else if(nAlias < 195)
116 {
117 aliasName=Form("t00_a_mpd_cent");
118 }
119 else if(nAlias < 196)
120 {
121 aliasName=Form("t00_c_mpd_cent");
122 }
123 else if(nAlias < 197)
124 {
125 aliasName=Form("t00_a_mpd_scent");
126 }
127 else if(nAlias < 198)
128 {
129 aliasName=Form("t00_c_mpd_scent");
130 }
131 else if(nAlias < 199)
132 {
133 aliasName=Form("t00_ac_tvdc_top");
134 }
135 else if(nAlias < 200)
136 {
137 aliasName=Form("t00_ac_tvdc_bottom");
138 }
139 else
140 {
141 aliasName=Form("t00_ac_mpd_mode");
142 }
143
144 for (int timeStamp=0;timeStamp<nValues;timeStamp++)
145 {
146 //CHIARA's original // AliDCSValue* dcsVal = new AliDCSValue((Float_t) gRandom->Gaus(3.0e8,50), timeStamp);
147 AliDCSValue* dcsVal = new AliDCSValue((Float_t) gRandom->Gaus(3.0e3,50), timeStamp);
148 valueSet->Add(dcsVal);
149
150 printf("Alias: %s - value n. %d: (val=%d timestamp=%d)\n" ,
151 aliasName.Data(), timeStamp, dcsVal->GetFloat(), dcsVal->GetTimeStamp());
152 }
153 aliasMap->Add(new TObjString(aliasName), valueSet);
154
155 }
156
157 return aliasMap;
158}
159
160TMap* ReadDCSAliasMap()
161{
162 AliCDBEntry *entry = AliCDBManager::Instance()->Get("DET/DCS/Data", 0);
163 return dynamic_cast<TMap*> (entry->GetObject());
164}
165
166void WriteDCSAliasMap()
167{
168 TMap* dcsAliasMap = CreateDCSAliasMap();
169
170 AliCDBMetaData metaData;
171 metaData.SetBeamPeriod(0);
172 metaData.SetResponsible("Tomek");
173 metaData.SetComment("Test object for TestPreprocessor.C");
174
175 AliCDBId id("DET/DCS/Data", 0, 0);
176
177 // initialize location of CDB
178 AliCDBManager::Instance()->SetDefaultStorage("local://./TestCDB");
179
180 AliCDBManager::Instance()->Put(dcsAliasMap, id, &metaData);
181}