]>
Commit | Line | Data |
---|---|---|
0116859c | 1 | |
2 | /************************************************************************** | |
3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * * | |
5 | * Author: The ALICE Off-line Project. * | |
6 | * Contributors are mentioned in the code where appropriate. * | |
7 | * * | |
8 | * Permission to use, copy, modify and distribute this software and its * | |
9 | * documentation strictly for non-commercial purposes is hereby granted * | |
10 | * without fee, provided that the above copyright notice appears in all * | |
11 | * copies and that both the copyright notice and this permission notice * | |
12 | * appear in the supporting documentation. The authors make no claims * | |
13 | * about the suitability of this software for any purpose. It is * | |
14 | * provided "as is" without express or implied warranty. * | |
15 | **************************************************************************/ | |
16 | ||
17 | //////////////////////////////////////////////////////////////////////////////// | |
18 | // // | |
19 | // AliTPCComposedCorrection class // | |
20 | // // | |
21 | // This class is creating a correction that is composed out of smaller // | |
22 | // corrections. // | |
23 | // There are two ways the sub-corrections can be combined into this one: // | |
24 | // 1. kParallel: All corrections are applied at the given position x and // | |
25 | // the dx terms are summed up (this commutes). // | |
26 | // 2. kQueue: The corrections are called in order. The first one at the // | |
27 | // given position x resulting in dx1, the second one is called at // | |
28 | // the corrected position (x+dx1) resulting in dx2, the third one // | |
29 | // is then called at position (x+dx1+dx2) and so forth. dx=dx1+dx2+... // | |
30 | // is returned. // | |
31 | // For the inverse of the correction this is taken into account by reversing // | |
32 | // the order the corrections are applied in the kQueue case (no issue for // | |
33 | // kParallel). // | |
34 | // // | |
35 | // date: 27/04/2010 // | |
36 | // Authors: Magnus Mager, Stefan Rossegger, Jim Thomas // | |
37 | // // | |
38 | // Example usage: // | |
39 | // // | |
40 | // AliMagF mag("mag","mag"); // | |
41 | // AliTPCExBBShape exb; // B field shape distortions // | |
42 | // exb.SetBField(&mag); // | |
43 | // // | |
44 | // AliTPCExBTwist twist; // ExB Twist distortions // | |
45 | // twist.SetXTwist(0.001); // | |
46 | // // | |
47 | // TObjArray cs; cs.Add(&exb); cs.Add(&twist); // | |
48 | // // | |
49 | // AliTPCComposedCorrection cc; // | |
50 | // cc.SetCorrections(&cs); // | |
51 | // cc.SetOmegaTauT1T2(wt,T1,T2); // | |
52 | // cc.Print("DA"); // | |
53 | // cc.CreateHistoDRPhiinZR(0,100,100)->Draw("surf2"); // | |
54 | //////////////////////////////////////////////////////////////////////////////// | |
55 | ||
56 | ||
57 | #include <TCollection.h> | |
58 | #include <TIterator.h> | |
e527a1b9 | 59 | #include <TTimeStamp.h> |
0116859c | 60 | |
61 | #include "AliTPCComposedCorrection.h" | |
62 | ||
63 | ||
64 | AliTPCComposedCorrection::AliTPCComposedCorrection() | |
65 | : AliTPCCorrection("composed_correction", | |
66 | "composition of corrections"), | |
67 | fCorrections(0), | |
68 | fMode(kParallel) | |
69 | { | |
70 | // | |
71 | // default constructor | |
72 | // | |
73 | } | |
74 | ||
75 | AliTPCComposedCorrection::AliTPCComposedCorrection(TCollection *corrections, | |
76 | AliTPCComposedCorrection::CompositionType mode) | |
77 | : AliTPCCorrection("composed_correction", | |
78 | "composition of corrections"), | |
79 | fCorrections(corrections), | |
80 | fMode(mode) | |
81 | { | |
82 | // | |
83 | // Constructor that defines the set of corrections, this one is composed of. | |
84 | // | |
85 | } | |
86 | ||
87 | AliTPCComposedCorrection::~AliTPCComposedCorrection() { | |
88 | // | |
89 | // virtual destructor | |
90 | // | |
91 | } | |
92 | ||
93 | ||
94 | void AliTPCComposedCorrection::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) { | |
95 | // | |
96 | // This applies all correction and the specified manner (see general | |
97 | // class description for details). | |
98 | // | |
99 | TIterator *i=fCorrections->MakeIterator(); | |
100 | AliTPCCorrection *c; | |
101 | switch (fMode) { | |
102 | case kParallel: | |
103 | Float_t dxi[3]; | |
104 | for (int j=0;j<3;++j) dx[j]=0.; | |
105 | while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) { | |
106 | c->GetCorrection(x,roc,dxi); | |
107 | for (Int_t j=0;j<3;++j) dx[j]+=dxi[j]; | |
108 | } | |
109 | break; | |
110 | case kQueue: | |
111 | Float_t xi[3]; | |
112 | for (Int_t j=0;j<3;++j) xi[j]=x[j]; | |
113 | while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) { | |
114 | c->GetCorrection(xi,roc,dx); | |
115 | for (Int_t j=0;j<3;++j) xi[j]+=dx[j]; | |
116 | } | |
117 | for (Int_t j=0;j<3;++j) dx[j]=xi[j]-x[j]; | |
118 | break; | |
119 | } | |
120 | delete i; | |
121 | } | |
122 | ||
123 | void AliTPCComposedCorrection::GetDistortion(const Float_t x[],const Short_t roc,Float_t dx[]) { | |
124 | // | |
125 | // This applies all distortions and the specified manner (see general | |
126 | // class descxiption for details). | |
127 | // | |
128 | ||
129 | TIterator *i=fCorrections->MakeReverseIterator(); | |
130 | AliTPCCorrection *c; | |
131 | switch (fMode) { | |
132 | case kParallel: | |
133 | Float_t dxi[3]; | |
134 | for (int j=0;j<3;++j) dx[j]=0.; | |
135 | while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) { | |
136 | c->GetDistortion(x,roc,dxi); | |
137 | for (Int_t j=0;j<3;++j) dx[j]+=dxi[j]; | |
138 | } | |
139 | break; | |
140 | case kQueue: | |
141 | Float_t xi[3]; | |
142 | for (Int_t j=0;j<3;++j) xi[j]=x[j]; | |
143 | while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) { | |
144 | c->GetDistortion(xi,roc,dx); | |
145 | for (Int_t j=0;j<3;++j) xi[j]+=dx[j]; | |
146 | } | |
147 | for (Int_t j=0;j<3;++j) dx[j]=xi[j]-x[j]; | |
148 | break; | |
149 | } | |
150 | delete i; | |
151 | } | |
152 | ||
153 | ||
154 | void AliTPCComposedCorrection::Print(Option_t* option) const { | |
155 | // | |
156 | // Print function to check which correction classes are used | |
157 | // option=="d" prints details regarding the setted magnitude | |
158 | // option=="a" prints the C0 and C1 coefficents for calibration purposes | |
159 | // | |
160 | ||
161 | printf("Composed TPC spacepoint correction \"%s\" -- composed of:\n",GetTitle()); | |
162 | TString opt = option; opt.ToLower(); | |
163 | Int_t in=1; | |
164 | TIterator *i=fCorrections->MakeIterator(); | |
165 | AliTPCCorrection *c; | |
166 | while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) { | |
167 | if (opt.Contains("d")) { | |
168 | printf("%d. ",in); | |
169 | c->Print(option); | |
170 | } else { | |
171 | printf("%d. %s\n",in,c->GetTitle()); | |
172 | } | |
173 | ++in; | |
174 | } | |
e527a1b9 | 175 | if (in==1) printf(" Info: The correction compound is empty: No corrections set\n"); |
0116859c | 176 | delete i; |
177 | } | |
178 | ||
179 | ||
e527a1b9 | 180 | void AliTPCComposedCorrection::Init() { |
181 | // | |
182 | // Initialization funtion (not used at the moment) | |
183 | // | |
184 | ||
185 | TIterator *i=fCorrections->MakeIterator(); | |
186 | AliTPCCorrection *c; | |
187 | while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) | |
188 | c->Init(); | |
189 | delete i; | |
190 | ||
191 | } | |
192 | ||
193 | void AliTPCComposedCorrection::Update(const TTimeStamp &timeStamp) { | |
194 | // | |
195 | // Update function | |
196 | // | |
197 | ||
198 | TIterator *i=fCorrections->MakeIterator(); | |
199 | AliTPCCorrection *c; | |
200 | while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) | |
201 | c->Update(timeStamp); | |
202 | delete i; | |
203 | ||
204 | } | |
205 | ||
206 | ||
207 | ||
0116859c | 208 | void AliTPCComposedCorrection::SetOmegaTauT1T2(Float_t omegaTau,Float_t t1,Float_t t2) { |
209 | // | |
210 | // Gives the possibility to set the OmegaTau plus Tensor corrections T1 and T2 (effective omega Tau) | |
211 | // to each subcorrection (since they might become event specific due to changing drift velocity) | |
212 | // | |
213 | // The omegaTau comes idealy from the Database, since it is a function of drift velocity, B and E field | |
214 | // e.g. omegaTau = -10.0 * Bz * vdrift / Ez ; // with Bz in kG and Ez in V/cm | |
215 | // omegaTau = -0.325 for Bz=5kG, Ez=400V/cm and vdrift = 2.6cm/muSec | |
216 | // The T1 and T2 tensors were measured in a dedicated calibration run | |
217 | // | |
218 | // Note: overwrites previously set values! | |
219 | // | |
220 | ||
221 | TIterator *i=fCorrections->MakeIterator(); | |
222 | AliTPCCorrection *c; | |
223 | while (0!=(c=dynamic_cast<AliTPCCorrection*>(i->Next()))) { | |
224 | c->SetOmegaTauT1T2(omegaTau,t1,t2); | |
225 | } | |
226 | delete i; | |
227 | } | |
228 | ||
229 | ClassImp(AliTPCComposedCorrection) |