minor
[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
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 {
66 aliasName=Form("t00_ac_scaler_sec_%02d",nAlias);
67 }
68 else if(nAlias < 76)
69 {
70 aliasName=Form("t00_a_hv_imon_%02d",nAlias);
71 }
72 else if(nAlias < 88)
73 {
74 aliasName=Form("t00_a_hv_vmon_%02d",nAlias);
75 }
76 else if(nAlias < 90)
77 {
78 aliasName=Form("t00_a_lv_imon_%02d",nAlias);
79 }
80 else if(nAlias < 92)
81 {
82 aliasName=Form("t00_a_lv_vmon_%02d",nAlias);
83 }
84 else if(nAlias < 104)
85 {
86 aliasName=Form("t00_c_hv_imon_%02d",nAlias);
87 }
88 else if(nAlias < 116)
89 {
90 aliasName=Form("t00_c_hv_vmon_%02d",nAlias);
91 }
92 else if(nAlias < 118)
93 {
94 aliasName=Form("t00_c_lv_imon_%02d",nAlias);
95 }
96 else if(nAlias < 120)
97 {
98 aliasName=Form("t00_c_lv_vmon_%02d",nAlias);
99 }
100 else if(nAlias < 132)
101 {
102 aliasName=Form("t00_a_cfd_thre_%02d",nAlias);
103 }
104 else if(nAlias < 144)
105 {
106 aliasName=Form("t00_a_cfd_walk_%02d",nAlias);
107 }
108 else if(nAlias < 156)
109 {
110 aliasName=Form("t00_c_cfd_thre_%02d",nAlias);
111 }
112 else if(nAlias < 168)
113 {
114 aliasName=Form("t00_c_cfd_walk_%02d",nAlias);
115 }
116 else if(nAlias < 178)
117 {
118 aliasName=Form("t00_ac_trm_%02d",nAlias);
119 }
120 else if(nAlias < 183)
121 {
122 aliasName=Form("t00_ac_drm_%02d",nAlias);
123 }
124 else
125 {
126 aliasName=Form("t00_ac_atten",nAlias);
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}