]>
Commit | Line | Data |
---|---|---|
cc80f89e | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
18 | Revision 1.1.4.2 2000/04/10 11:36:13 kowal2 | |
19 | ||
20 | New Detector parameters handling class | |
21 | ||
22 | */ | |
23 | ||
24 | /////////////////////////////////////////////////////////////////////// | |
25 | // Manager and of geomety classes for set: TPC // | |
26 | // // | |
27 | // !sectors are numbered from 0 // | |
28 | // !pad rows are numbered from 0 // | |
29 | // | |
30 | // 27.7. - AliTPCPaaramSr object for TPC | |
31 | // TPC with straight pad rows | |
32 | // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk // | |
33 | // // | |
34 | /////////////////////////////////////////////////////////////////////// | |
35 | ||
36 | ||
37 | #include <iostream.h> | |
38 | #include <TMath.h> | |
39 | #include <TObject.h> | |
40 | #include <AliTPCParamSR.h> | |
41 | ||
42 | ||
43 | ||
44 | ClassImp(AliTPCParamSR) | |
45 | const static Int_t kMaxRows=600; | |
46 | const static Float_t kEdgeSectorSpace = 2.5; | |
47 | const static Float_t kFacSigmaPadRow=2.; | |
48 | const static Float_t kFacSigmaPad=3.; | |
49 | const static Float_t kFacSigmaTime=3.; | |
50 | ||
51 | ||
52 | AliTPCParamSR::AliTPCParamSR() | |
53 | { | |
54 | // | |
55 | //constructor set the default parameters | |
56 | fInnerPRF=0; | |
57 | fOuterPRF=0; | |
58 | fTimeRF = 0; | |
59 | fFacSigmaPadRow = Float_t(kFacSigmaPadRow); | |
60 | fFacSigmaPad = Float_t(kFacSigmaPad); | |
61 | fFacSigmaTime = Float_t(kFacSigmaTime); | |
62 | ||
63 | ||
64 | SetDefault(); | |
65 | Update(); | |
66 | } | |
67 | ||
68 | AliTPCParamSR::~AliTPCParamSR() | |
69 | { | |
70 | // | |
71 | //destructor destroy some dynmicaly alocated variables | |
72 | if (fInnerPRF != 0) delete fInnerPRF; | |
73 | if (fOuterPRF != 0) delete fOuterPRF; | |
74 | if (fTimeRF != 0) delete fTimeRF; | |
75 | } | |
76 | ||
77 | void AliTPCParamSR::SetDefault() | |
78 | { | |
79 | //set default TPC param | |
80 | fbStatus = kFALSE; | |
81 | AliTPCParam::SetDefault(); | |
82 | } | |
83 | ||
84 | Int_t AliTPCParamSR::CalcResponse(Float_t* xyz, Int_t * index, Int_t row) | |
85 | { | |
86 | // | |
87 | //calculate bin response as function of the input position -x | |
88 | //return number of valid response bin | |
89 | // | |
90 | //we suppose that coordinate is expressed in float digits | |
91 | // it's mean coordinate system 8 | |
92 | //xyz[0] - float padrow xyz[1] is float pad (center pad is number 0) and xyz[2] is float time bin | |
93 | if ( (fInnerPRF==0)||(fOuterPRF==0)||(fTimeRF==0) ){ | |
94 | Error("AliTPCParamSR", "response function was not adjusted"); | |
95 | return -1; | |
96 | } | |
97 | ||
98 | Float_t sfpadrow; // sigma of response function | |
99 | Float_t sfpad; // sigma of | |
100 | Float_t sftime= fFacSigmaTime*fTimeRF->GetSigma()/fZWidth; //3 sigma of time response | |
101 | if (index[1]<fNInnerSector){ | |
102 | sfpadrow =fFacSigmaPadRow*fInnerPRF->GetSigmaY()/fInnerPadPitchLength; | |
103 | sfpad =fFacSigmaPad*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth; | |
104 | }else{ | |
105 | sfpadrow =fFacSigmaPadRow*fOuterPRF->GetSigmaY()/fOuterPadPitchLength; | |
106 | sfpad =fFacSigmaPad*fOuterPRF->GetSigmaX()/fOuterPadPitchWidth; | |
107 | } | |
108 | ||
109 | Int_t fpadrow = TMath::Max(TMath::Nint(index[2]+xyz[0]-sfpadrow),0); //"first" padrow | |
110 | Int_t fpad = TMath::Nint(xyz[1]-sfpad); //first pad | |
111 | Int_t ftime = TMath::Max(TMath::Nint(xyz[2]+GetZOffset()/GetZWidth()-sftime),0); // first time | |
112 | Int_t lpadrow = TMath::Min(TMath::Nint(index[2]+xyz[0]+sfpadrow),fpadrow+19); //"last" padrow | |
113 | lpadrow = TMath::Min(GetNRow(index[1])-1,lpadrow); | |
114 | Int_t lpad = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19); //last pad | |
115 | Int_t ltime = TMath::Min(TMath::Nint(xyz[2]+GetZOffset()/GetZWidth()+sftime),ftime+19); // last time | |
116 | ltime = TMath::Min(ltime,GetMaxTBin()-1); | |
117 | ||
118 | if (row>=0) { //if we are interesting about given pad row | |
119 | if (fpadrow<=row) fpadrow =row; | |
120 | else | |
121 | return 0; | |
122 | if (lpadrow>=row) lpadrow = row; | |
123 | else | |
124 | return 0; | |
125 | } | |
126 | ||
127 | ||
128 | Float_t padres[20][20]; //I don't expect bigger number of bins | |
129 | Float_t timeres[20]; | |
130 | Int_t cindex3=0; | |
131 | Int_t cindex=0; | |
132 | Float_t cweight = 0; | |
133 | if (fpadrow>=0) { | |
134 | //calculate padresponse function | |
135 | Int_t padrow, pad; | |
136 | for (padrow = fpadrow;padrow<=lpadrow;padrow++) | |
137 | for (pad = fpad;pad<=lpad;pad++){ | |
138 | Float_t dy = (-xyz[0]+Float_t(index[2]-padrow)); | |
139 | Float_t dx = (-xyz[1]+Float_t(pad)); | |
140 | if (index[1]<fNInnerSector) | |
141 | padres[padrow-fpadrow][pad-fpad]=fInnerPRF->GetPRF(dx*fInnerPadPitchWidth,dy*fInnerPadPitchLength); | |
142 | else | |
143 | padres[padrow-fpadrow][pad-fpad]=fOuterPRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuterPadPitchLength); } | |
144 | //calculate time response function | |
145 | Int_t time; | |
146 | for (time = ftime;time<=ltime;time++) | |
147 | timeres[time-ftime]= fTimeRF->GetRF((-xyz[2]+Float_t(time))*fZWidth); | |
148 | //write over threshold values to stack | |
149 | for (padrow = fpadrow;padrow<=lpadrow;padrow++) | |
150 | for (pad = fpad;pad<=lpad;pad++) | |
151 | for (time = ftime;time<=ltime;time++){ | |
152 | cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad]; | |
153 | if (cweight>fResponseThreshold) { | |
154 | fResponseBin[cindex3]=padrow; | |
155 | fResponseBin[cindex3+1]=pad; | |
156 | fResponseBin[cindex3+2]=time; | |
157 | cindex3+=3; | |
158 | fResponseWeight[cindex]=cweight; | |
159 | cindex++; | |
160 | } | |
161 | } | |
162 | } | |
163 | fCurrentMax=cindex; | |
164 | return fCurrentMax; | |
165 | } | |
166 | ||
167 | void AliTPCParamSR::TransformTo8(Float_t *xyz, Int_t *index) const | |
168 | { | |
169 | // | |
170 | // transformate point to digit coordinate | |
171 | // | |
172 | if (index[0]==0) Transform0to1(xyz,index); | |
173 | if (index[0]==1) Transform1to2(xyz,index); | |
174 | if (index[0]==2) Transform2to3(xyz,index); | |
175 | if (index[0]==3) Transform3to4(xyz,index); | |
176 | if (index[0]==4) Transform4to8(xyz,index); | |
177 | } | |
178 | ||
179 | void AliTPCParamSR::TransformTo2(Float_t *xyz, Int_t *index) const | |
180 | { | |
181 | // | |
182 | //transformate point to rotated coordinate | |
183 | // | |
184 | //we suppose that | |
185 | if (index[0]==0) Transform0to1(xyz,index); | |
186 | if (index[0]==1) Transform1to2(xyz,index); | |
187 | if (index[0]==4) Transform4to3(xyz,index); | |
188 | if (index[0]==8) { //if we are in digit coordinate system transform to global | |
189 | Transform8to4(xyz,index); | |
190 | Transform4to3(xyz,index); | |
191 | } | |
192 | } | |
193 | ||
194 | void AliTPCParamSR::CRXYZtoXYZ(Float_t *xyz, | |
195 | const Int_t §or, const Int_t & padrow, Int_t option) const | |
196 | { | |
197 | //transform relative coordinates to absolute | |
198 | Bool_t rel = ( (option&2)!=0); | |
199 | Int_t index[2]={sector,padrow}; | |
200 | if (rel==kTRUE) Transform4to3(xyz,index);//if the position is relative to pad row | |
201 | Transform2to1(xyz,index); | |
202 | } | |
203 | ||
204 | void AliTPCParamSR::XYZtoCRXYZ(Float_t *xyz, | |
205 | Int_t §or, Int_t & padrow, Int_t option) const | |
206 | { | |
207 | //transform global position to the position relative to the sector padrow | |
208 | //if option=0 X calculate absolute calculate sector | |
209 | //if option=1 X absolute use input sector | |
210 | //if option=2 X relative to pad row calculate sector | |
211 | //if option=3 X relative use input sector | |
212 | //!!!!!!!!! WE start to calculate rows from row = 0 | |
213 | Int_t index[2]; | |
214 | Bool_t rel = ( (option&2)!=0); | |
215 | ||
216 | //option 0 and 2 means that we don't have information about sector | |
217 | if ((option&1)==0) Transform0to1(xyz,index); //we calculate sector number | |
218 | else | |
219 | index[0]=sector; | |
220 | Transform1to2(xyz,index); | |
221 | Transform2to3(xyz,index); | |
222 | //if we store relative position calculate position relative to pad row | |
223 | if (rel==kTRUE) Transform3to4(xyz,index); | |
224 | sector = index[0]; | |
225 | padrow = index[1]; | |
226 | } | |
227 | ||
228 | Float_t AliTPCParamSR::GetPrimaryLoss(Float_t *x, Int_t *index, Float_t *angle) | |
229 | { | |
230 | // | |
231 | // | |
232 | Float_t padlength=GetPadPitchLength(index[1]); | |
233 | Float_t a1=TMath::Sin(angle[0]); | |
234 | a1*=a1; | |
235 | Float_t a2=TMath::Sin(angle[1]); | |
236 | a2*=a2; | |
237 | Float_t length =padlength*TMath::Sqrt(1+a1+a2); | |
238 | return length*fNPrimLoss; | |
239 | } | |
240 | ||
241 | Float_t AliTPCParamSR::GetTotalLoss(Float_t *x, Int_t *index, Float_t *angle) | |
242 | { | |
243 | // | |
244 | // | |
245 | Float_t padlength=GetPadPitchLength(index[1]); | |
246 | Float_t a1=TMath::Sin(angle[0]); | |
247 | a1*=a1; | |
248 | Float_t a2=TMath::Sin(angle[1]); | |
249 | a2*=a2; | |
250 | Float_t length =padlength*TMath::Sqrt(1+a1+a2); | |
251 | return length*fNTotalLoss; | |
252 | ||
253 | } | |
254 | ||
255 | ||
256 | void AliTPCParamSR::GetClusterSize(Float_t *x, Int_t *index, Float_t *angle, Int_t mode, Float_t *sigma) | |
257 | { | |
258 | // | |
259 | //return cluster sigma2 (x,y) for particle at position x | |
260 | // in this case x coordinata is in drift direction | |
261 | //and y in pad row direction | |
262 | //we suppose that input coordinate system is digit system | |
263 | ||
264 | Float_t xx; | |
265 | Float_t lx[3] = {x[0],x[1],x[2]}; | |
266 | Int_t li[3] = {index[0],index[1],index[2]}; | |
267 | TransformTo2(lx,li); | |
268 | // Float_t sigmadiff; | |
269 | sigma[0]=0; | |
270 | sigma[1]=0; | |
271 | ||
272 | xx = lx[2]; //calculate drift length in cm | |
273 | if (xx>0) { | |
274 | sigma[0]+= xx*GetDiffL()*GetDiffL(); | |
275 | sigma[1]+= xx*GetDiffT()*GetDiffT(); | |
276 | } | |
277 | ||
278 | ||
279 | //sigma[0]=sigma[1]=0; | |
280 | if (GetTimeRF()!=0) sigma[0]+=GetTimeRF()->GetSigma()*GetTimeRF()->GetSigma(); | |
281 | if ( (index[1]<fNInnerSector) &&(GetInnerPRF()!=0)) | |
282 | sigma[1]+=GetInnerPRF()->GetSigmaX()*GetInnerPRF()->GetSigmaX(); | |
283 | if ( (index[1]>=fNInnerSector) && (GetOuterPRF()!=0)) | |
284 | sigma[1]+=GetOuterPRF()->GetSigmaX()*GetOuterPRF()->GetSigmaX(); | |
285 | ||
286 | ||
287 | sigma[0]/= GetZWidth()*GetZWidth(); | |
288 | sigma[1]/=GetPadPitchWidth(index[0])*GetPadPitchWidth(index[0]); | |
289 | } | |
290 | ||
291 | ||
292 | ||
293 | ||
294 | void AliTPCParamSR::GetSpaceResolution(Float_t *x, Int_t *index, Float_t *angle, | |
295 | Float_t amplitude, Int_t mode, Float_t *sigma) | |
296 | { | |
297 | // | |
298 | // | |
299 | // | |
300 | ||
301 | } | |
302 | Float_t AliTPCParamSR::GetAmp(Float_t *x, Int_t *index, Float_t *angle) | |
303 | { | |
304 | // | |
305 | // | |
306 | // | |
307 | return 0; | |
308 | } | |
309 | ||
310 | Float_t * AliTPCParamSR::GetAnglesAccMomentum(Float_t *x, Int_t * index, Float_t* momentum, Float_t *angle) | |
311 | { | |
312 | // | |
313 | //calculate angle of track to padrow at given position | |
314 | // for given magnetic field and momentum of the particle | |
315 | // | |
316 | ||
317 | TransformTo2(x,index); | |
318 | AliDetectorParam::GetAnglesAccMomentum(x,index,momentum,angle); | |
319 | Float_t addangle = TMath::ASin(x[1]/GetPadRowRadii(index[1],index[2])); | |
320 | angle[1] +=addangle; | |
321 | return angle; | |
322 | } | |
323 | ||
324 | ||
325 | Bool_t AliTPCParamSR::Update() | |
326 | { | |
327 | ||
328 | // | |
329 | // update some calculated parameter which must be updated after changing "base" | |
330 | // parameters | |
331 | // for example we can change size of pads and according this recalculate number | |
332 | // of pad rows, number of of pads in given row .... | |
333 | Int_t i; | |
334 | if (AliTPCParam::Update()==kFALSE) return kFALSE; | |
335 | fbStatus = kFALSE; | |
336 | ||
337 | // adjust lower sectors pad row positions and pad numbers | |
338 | fNRowLow = (Int_t(1.001+((fRInnerLastWire-fRInnerFirstWire)/fInnerWWPitch)) | |
339 | -2*fInnerDummyWire)/fNInnerWiresPerPad; | |
340 | if ( kMaxRows<fNRowLow) fNRowUp = kMaxRows; | |
341 | if (1>fNRowLow) return kFALSE; | |
342 | ||
343 | //Float_t firstpad = fRInnerFirstWire+(fInnerDummyWire-0.5)*fInnerWWPitch | |
344 | // +fInnerPadPitchLength/2.; | |
345 | Float_t lastpad = fRInnerLastWire-(fInnerDummyWire-0.5)*fInnerWWPitch | |
346 | -fInnerPadPitchLength/2.; | |
347 | Float_t firstpad = lastpad-Float_t(fNRowLow-1)*fInnerPadPitchLength; | |
348 | ||
349 | for (i = 0;i<fNRowLow;i++) | |
350 | { | |
351 | Float_t x = firstpad +fInnerPadPitchLength*(Float_t)i; | |
352 | Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerWireMount- | |
353 | fInnerPadPitchWidth/2.; | |
354 | fPadRowLow[i] = x; | |
355 | fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ; | |
356 | } | |
357 | ||
358 | // adjust upper sectors pad row positions and pad numbers | |
359 | fNRowUp = (Int_t(1.001+((fROuterLastWire-fROuterFirstWire)/fOuterWWPitch)) | |
360 | -2*fOuterDummyWire)/fNOuterWiresPerPad; | |
361 | if ( kMaxRows<fNRowUp) fNRowUp = kMaxRows; | |
362 | if (1>fNRowUp) return kFALSE; | |
363 | firstpad = fROuterFirstWire+(fOuterDummyWire-0.5)*fOuterWWPitch | |
364 | +fOuterPadPitchLength/2.; | |
365 | ||
366 | for (i = 0;i<fNRowUp;i++) | |
367 | { | |
368 | Float_t x = firstpad + fOuterPadPitchLength*(Float_t)i; | |
369 | Float_t y = (x-0.5*fOuterPadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount- | |
370 | fInnerPadPitchWidth/2.; | |
371 | fPadRowUp[i] = x; | |
372 | fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ; | |
373 | } | |
374 | fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp; | |
375 | return kTRUE; | |
376 | } | |
377 | ||
378 | ||
379 | ||
380 | void AliTPCParamSR::Streamer(TBuffer &R__b) | |
381 | { | |
382 | // Stream an object of class AliTPC. | |
383 | ||
384 | if (R__b.IsReading()) { | |
385 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } | |
386 | // TObject::Streamer(R__b); | |
387 | AliTPCParam::Streamer(R__b); | |
388 | // if (R__v < 2) return; | |
389 | Update(); | |
390 | } else { | |
391 | R__b.WriteVersion(AliTPCParamSR::IsA()); | |
392 | //TObject::Streamer(R__b); | |
393 | AliTPCParam::Streamer(R__b); | |
394 | } | |
395 | } | |
396 | ||
397 | ||
398 | ||
399 |