Update master to aliroot
[u/mrichter/AliRoot.git] / T0 / TestPreprocessor.C
CommitLineData
dc7ca31d 1void TestPreprocessor()
2{
4070f709 3 gSystem->Load("libT0shuttle");
b0635849 4 gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle");
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
5bdebf6a 14 AliTestShuttle* shuttle = new AliTestShuttle(104890, 0, 1);
15
16 TMap* dcsAliasMap = CreateDCSAliasMap();
dc7ca31d 17
dc7ca31d 18
dc7ca31d 19
5bdebf6a 20 shuttle->SetDCSInput(dcsAliasMap);
a8d3b391 21
5bdebf6a 22 shuttle->SetInputRunType("AMPLITUDE_CALIBRATION");
a8d3b391 23
5bdebf6a 24 //shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "AMPLITUDE_CALIBRATION", "LDC0","daLaser.root");
25 shuttle->SetInputRunType("PHYSICS");
a8d3b391 26
5bdebf6a 27 shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "PHYSICS", "LDC0", "daPhys.root");
dc7ca31d 28
a6c2af33 29 AliPreprocessor* start = new AliT0Preprocessor(shuttle);
dc7ca31d 30
31 shuttle->Process();
dc7ca31d 32}
33
34TMap* CreateDCSAliasMap()
35{
36 TMap* aliasMap = new TMap;
37 aliasMap->SetOwner(1);
38
19fb06bd 39 TString aliasName;
19682e7d 40 Int_t n_T0aliases=201;
19fb06bd 41 Int_t nValues=10;
a8d3b391 42
19fb06bd 43 for(int nAlias=0;nAlias<n_T0aliases;nAlias++)
dc7ca31d 44 {
45 TObjArray* valueSet = new TObjArray;
46 valueSet->SetOwner(1);
19fb06bd 47 if(nAlias < 32)
48 {
49 aliasName=Form("t00_ac_scaler_%02d",nAlias);
50 }
51 else if(nAlias < 64)
52 {
1db75895 53 aliasName=Form("t00_ac_scaler_sec_%02d",nAlias-32);
19fb06bd 54 }
55 else if(nAlias < 76)
56 {
1db75895 57 aliasName=Form("t00_a_hv_imon_%02d",nAlias-64);
19fb06bd 58 }
59 else if(nAlias < 88)
60 {
1db75895 61 aliasName=Form("t00_a_hv_vmon_%02d",nAlias-76);
19fb06bd 62 }
63 else if(nAlias < 90)
64 {
19682e7d 65 aliasName=Form("t00_a_lv_imon_%01d",nAlias-88);
19fb06bd 66 }
67 else if(nAlias < 92)
68 {
19682e7d 69 aliasName=Form("t00_a_lv_vmon_%01d",nAlias-90);
19fb06bd 70 }
71 else if(nAlias < 104)
72 {
1db75895 73 aliasName=Form("t00_c_hv_imon_%02d",nAlias-92);
19fb06bd 74 }
75 else if(nAlias < 116)
76 {
1db75895 77 aliasName=Form("t00_c_hv_vmon_%02d",nAlias-104);
19fb06bd 78 }
79 else if(nAlias < 118)
80 {
19682e7d 81 aliasName=Form("t00_c_lv_imon_%01d",nAlias-116);
19fb06bd 82 }
83 else if(nAlias < 120)
84 {
19682e7d 85 aliasName=Form("t00_c_lv_vmon_%01d",nAlias-118);
19fb06bd 86 }
87 else if(nAlias < 132)
88 {
1db75895 89 aliasName=Form("t00_a_cfd_thre_%02d",nAlias-120);
19fb06bd 90 }
91 else if(nAlias < 144)
92 {
1db75895 93 aliasName=Form("t00_a_cfd_walk_%02d",nAlias-132);
19fb06bd 94 }
95 else if(nAlias < 156)
96 {
1db75895 97 aliasName=Form("t00_c_cfd_thre_%02d",nAlias-144);
19fb06bd 98 }
99 else if(nAlias < 168)
100 {
1db75895 101 aliasName=Form("t00_c_cfd_walk_%02d",nAlias-156);
19fb06bd 102 }
19682e7d 103 else if(nAlias < 188)
19fb06bd 104 {
1db75895 105 aliasName=Form("t00_ac_trm_%02d",nAlias-168);
19fb06bd 106 }
19682e7d 107 else if(nAlias < 193)
19fb06bd 108 {
19682e7d 109 aliasName=Form("t00_ac_drm_%02d",nAlias-188);
19fb06bd 110 }
19682e7d 111 else if (nAlias < 194)
955ef7d2 112 {
113 aliasName=Form("t00_ac_atten");
114 }
19682e7d 115 else if(nAlias < 195)
955ef7d2 116 {
117 aliasName=Form("t00_a_mpd_cent");
118 }
19682e7d 119 else if(nAlias < 196)
955ef7d2 120 {
121 aliasName=Form("t00_c_mpd_cent");
122 }
19682e7d 123 else if(nAlias < 197)
955ef7d2 124 {
125 aliasName=Form("t00_a_mpd_scent");
126 }
19682e7d 127 else if(nAlias < 198)
955ef7d2 128 {
129 aliasName=Form("t00_c_mpd_scent");
130 }
19682e7d 131 else if(nAlias < 199)
955ef7d2 132 {
133 aliasName=Form("t00_ac_tvdc_top");
134 }
19682e7d 135 else if(nAlias < 200)
955ef7d2 136 {
137 aliasName=Form("t00_ac_tvdc_bottom");
138 }
19fb06bd 139 else
140 {
955ef7d2 141 aliasName=Form("t00_ac_mpd_mode");
19fb06bd 142 }
dc7ca31d 143
a8d3b391 144 for (int timeStamp=0;timeStamp<nValues;timeStamp++)
dc7ca31d 145 {
5bdebf6a 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);
dc7ca31d 148 valueSet->Add(dcsVal);
5bdebf6a 149
a8d3b391 150 printf("Alias: %s - value n. %d: (val=%d timestamp=%d)\n" ,
151 aliasName.Data(), timeStamp, dcsVal->GetFloat(), dcsVal->GetTimeStamp());
dc7ca31d 152 }
153 aliasMap->Add(new TObjString(aliasName), valueSet);
5bdebf6a 154
dc7ca31d 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);
955ef7d2 172 metaData.SetResponsible("Tomek");
dc7ca31d 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}