]>
Commit | Line | Data |
---|---|---|
7bdc4686 | 1 | /* $Id$ */ |
2 | ||
3 | // Script to create calibration parameters and store them into CDB | |
4 | // Two sets of calibration parameters can be created: | |
5 | // 1) equal parameters | |
6 | // 2) randomly distributed parameters for decalibrated detector silumations | |
7 | ||
8 | #if !defined(__CINT__) | |
9 | #include "TControlBar.h" | |
10 | #include "TString.h" | |
11 | #include "TRandom.h" | |
12 | #include "TH1F.h" | |
13 | #include "TF1.h" | |
14 | #include "TCanvas.h" | |
15 | ||
16 | #include "AliRun.h" | |
17 | #include "AliSTARTCalibData.h" | |
18 | #include "AliSTARTAlignData.h" | |
19 | #include "AliCDBMetaData.h" | |
20 | #include "AliCDBId.h" | |
21 | #include "AliCDBEntry.h" | |
22 | #include "AliCDBManager.h" | |
23 | #include "AliCDBStorage.h" | |
24 | #endif | |
25 | ||
26 | ||
27 | void AliSTARTSetCDB() | |
28 | { | |
29 | TControlBar *menu = new TControlBar("vertical","START CDB"); | |
30 | menu->AddButton("Set Calib","SetCC()", | |
31 | "Set calibration coefficients"); | |
32 | menu->AddButton("Set Align","SetAC()", | |
33 | "Set alignment coefficients"); | |
34 | menu->AddButton("Read calibration CC","GetCC()", | |
35 | "Read calibration coefficients"); | |
36 | menu->AddButton("Read alignment CC","GetAC()", | |
37 | "Read face detector position "); | |
38 | menu->Show(); | |
39 | } | |
40 | ||
41 | ||
42 | //------------------------------------------------------------------------ | |
43 | void SetAC() | |
44 | { | |
45 | // Writing alignment coefficients into the Condition DB | |
46 | // Arguments: | |
47 | ||
48 | TString DBFolder; | |
49 | Int_t firstRun = 0; | |
50 | Int_t lastRun = 10; | |
51 | Int_t beamPeriod = 1; | |
52 | char* objFormat = ""; | |
53 | ||
54 | DBFolder ="local://Align"; | |
55 | firstRun = 0; | |
56 | lastRun = 10; | |
57 | objFormat = "START array Z positions"; | |
58 | ||
59 | ||
60 | AliSTARTAlignData *alignda=new AliSTARTAlignData("START"); | |
61 | alignda-> SetZposition (67.9,373); | |
62 | alignda->Print(); | |
63 | ||
64 | //Store calibration data into database | |
65 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); | |
66 | AliCDBManager::Instance()->SetSpecificStorage("START",DBFolder.Data()); | |
67 | ||
68 | AliCDBMetaData md; | |
69 | md.SetComment(objFormat); | |
70 | md.SetBeamPeriod(beamPeriod); | |
71 | md.SetResponsible("Alla"); | |
72 | TString fPath="START/Align/Positions"; | |
73 | ||
74 | ||
75 | // AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("START"); | |
76 | AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage(); | |
77 | if(storage) { | |
78 | AliCDBId id(fPath.Data(),firstRun,lastRun); | |
79 | ||
80 | storage->Put(alignda, id, &md); | |
81 | } | |
82 | } | |
83 | //------------------------------------------------------------------------ | |
84 | void SetCC() | |
85 | { | |
86 | // Writing calibration coefficients into the Calibration DB | |
87 | // Arguments: | |
88 | ||
89 | TString DBFolder; | |
90 | Int_t firstRun = 0; | |
91 | Int_t lastRun = 10; | |
92 | Int_t beamPeriod = 1; | |
93 | char* objFormat = ""; | |
94 | ||
95 | DBFolder ="local://Calib"; | |
96 | firstRun = 0; | |
97 | lastRun = 10; | |
98 | objFormat = "START initial gain factors, time delay, slewnig"; | |
99 | ||
100 | AliSTARTCalibData *calibda=new AliSTARTCalibData("START"); | |
101 | ||
102 | Float_t fGain = 1; | |
103 | Float_t fTimeDelay = 200; | |
104 | ||
105 | TRandom rn; | |
106 | ||
107 | for(Int_t ipmt=0; ipmt<24; ipmt++) { | |
108 | calibda->SetGain (fGain,ipmt); | |
109 | calibda->SetTimeDelayCFD(fTimeDelay,ipmt); | |
110 | calibda->SetTimeDelayLED(fTimeDelay,ipmt); | |
111 | calibda->SetWalk(ipmt,"data/re.root"); | |
112 | calibda->SetSlewingLED(ipmt,"data/CFD-LED.txt"); | |
113 | calibda->SetSlewingRec(ipmt,"data/CFD-LED.txt"); | |
114 | Double_t value=calibda->GetSlewingLED(ipmt,300); | |
115 | Double_t rec= calibda->GetSlewingRec(ipmt, value); | |
116 | cout<<" in "<<value<<" out "<<rec<<endl; | |
117 | } | |
118 | calibda->Print(); | |
119 | //Store calibration data into database | |
120 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); | |
121 | ||
122 | // AliCDBManager::Instance()->SetSpecificStorage("START",DBFolder.Data()); | |
123 | ||
124 | AliCDBMetaData md; | |
125 | md.SetComment(objFormat); | |
126 | md.SetBeamPeriod(beamPeriod); | |
127 | md.SetResponsible("Alla"); | |
128 | TString fPath="START/Calib/Gain_TimeDelay_Slewing_Walk"; | |
129 | ||
130 | ||
131 | // AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("START"); | |
132 | AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage(); | |
133 | if(storage) { | |
134 | AliCDBId id(fPath.Data(),firstRun,lastRun); | |
135 | storage->Put(calibda, id, &md); | |
136 | } | |
137 | } | |
138 | ||
139 | //------------------------------------------------------------------------ | |
140 | void GetCC() | |
141 | { | |
142 | // Read calibration coefficients into the Calibration DB | |
143 | // Arguments: | |
144 | ||
145 | TString DBFolder; | |
146 | ||
147 | DBFolder ="local://Calib"; | |
148 | Int_t nRun=gAlice->GetRunNumber(); | |
149 | ||
150 | AliCDBManager *man = AliCDBManager::Instance(); | |
151 | AliCDBStorage *stor2 = man->GetStorage("local://Calib"); | |
152 | AliCDBEntry *entry; | |
153 | entry = stor2->Get("START/Calib/Gain_TimeDelay_Slewing_Walk"); | |
154 | ||
155 | AliSTARTCalibData *clb = (AliSTARTCalibData*)entry->GetObject(); | |
156 | clb->Print(); | |
157 | } | |
158 | //------------------------------------------------------------------------ | |
159 | void GetAC() | |
160 | { | |
161 | // Read align coefficients into the Calibration DB | |
162 | // Arguments: | |
163 | ||
164 | TString DBFolder; | |
165 | ||
166 | DBFolder ="local://Align"; | |
167 | Int_t nRun=gAlice->GetRunNumber(); | |
168 | ||
169 | AliCDBManager *man = AliCDBManager::Instance(); | |
170 | AliCDBStorage *stor2 = man->GetStorage("local://Align"); | |
171 | AliCDBEntry *entry; | |
172 | entry = stor2->Get("START/Align/Positions", nRun); | |
173 | ||
174 | AliSTARTAlignData *aln = (AliSTARTAlignData*)entry->GetObject(); | |
175 | aln->Print(); | |
176 | } |