]>
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 | ||
88cb7938 | 16 | /* $Id$ */ |
cc80f89e | 17 | |
18 | /////////////////////////////////////////////////////////////////////// | |
19 | // Manager and of geomety classes for set: TPC // | |
20 | // // | |
21 | // !sectors are numbered from 0 // | |
22 | // !pad rows are numbered from 0 // | |
23 | // | |
24 | // 27.7. - AliTPCPaaramSr object for TPC | |
25 | // TPC with straight pad rows | |
26 | // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk // | |
27 | // // | |
28 | /////////////////////////////////////////////////////////////////////// | |
29 | ||
30 | ||
19364939 | 31 | #include <Riostream.h> |
cc80f89e | 32 | #include <TMath.h> |
2ab0c725 | 33 | #include <TClass.h> |
cc80f89e | 34 | #include <AliTPCParamCR.h> |
73042f01 | 35 | #include "AliTPCPRF2D.h" |
36 | #include "AliTPCRF1D.h" | |
cc80f89e | 37 | |
38 | ||
39 | ||
40 | ClassImp(AliTPCParamCR) | |
176aff27 | 41 | static const Int_t kMaxRows=600; |
42 | static const Float_t kEdgeSectorSpace = 2.5; | |
cc80f89e | 43 | |
44 | AliTPCParamCR::AliTPCParamCR() | |
179c6296 | 45 | :AliTPCParam(), |
46 | fInnerPRF(0), | |
47 | fOuter1PRF(0), | |
48 | fOuter2PRF(0), | |
49 | fTimeRF(0), | |
50 | fFacSigma(0.) | |
cc80f89e | 51 | { |
52 | // | |
53 | //constructor set the default parameters | |
179c6296 | 54 | |
cc80f89e | 55 | fFacSigma = Float_t(2.); |
56 | SetDefault(); | |
57 | Update(); | |
58 | } | |
179c6296 | 59 | AliTPCParamCR::AliTPCParamCR(const AliTPCParamCR ¶m) |
60 | :AliTPCParam(), | |
61 | fInnerPRF(0), | |
62 | fOuter1PRF(0), | |
63 | fOuter2PRF(0), | |
64 | fTimeRF(0), | |
65 | fFacSigma(0.) | |
66 | { | |
67 | // | |
68 | // copy constructor - dummy | |
69 | // | |
70 | fFacSigma= param.fFacSigma; | |
71 | } | |
72 | AliTPCParamCR & AliTPCParamCR::operator =(const AliTPCParamCR & param) | |
73 | { | |
74 | // | |
75 | // assignment operator - dummy | |
76 | // | |
77 | fFacSigma= param.fFacSigma; | |
78 | return (*this); | |
79 | } | |
cc80f89e | 80 | AliTPCParamCR::~AliTPCParamCR() |
81 | { | |
82 | // | |
83 | //destructor destroy some dynmicaly alocated variables | |
84 | if (fInnerPRF != 0) delete fInnerPRF; | |
f03e3423 | 85 | if (fOuter1PRF != 0) delete fOuter1PRF; |
86 | if (fOuter2PRF != 0) delete fOuter2PRF; | |
cc80f89e | 87 | if (fTimeRF != 0) delete fTimeRF; |
88 | } | |
89 | ||
90 | void AliTPCParamCR::SetDefault() | |
91 | { | |
92 | //set default TPC param | |
93 | fbStatus = kFALSE; | |
94 | AliTPCParam::SetDefault(); | |
95 | } | |
96 | ||
176aff27 | 97 | Int_t AliTPCParamCR::CalcResponse(Float_t* xyz, Int_t * index, Int_t /*dummy*/) |
cc80f89e | 98 | { |
99 | // | |
100 | //calculate bin response as function of the input position -x | |
101 | //return number of valid response bin | |
102 | // | |
103 | //we suppose that coordinata is expressed in float digits | |
104 | // it's mean coordinate system 8 | |
105 | //xyz[0] - float padrow xyz[1] is float pad (center pad is number 0) and xyz[2] is float time bin | |
f03e3423 | 106 | if ( (fInnerPRF==0)||(fOuter1PRF==0) ||(fOuter2PRF==0)||(fTimeRF==0) ){ |
cc80f89e | 107 | Error("AliTPCParamCR", "response function were not adjusted"); |
108 | return -1; | |
109 | } | |
110 | ||
111 | Float_t sfpadrow; // sigma of response function | |
112 | Float_t sfpad; // sigma of | |
113 | Float_t sftime= fFacSigma*fTimeRF->GetSigma()/fZWidth; //3 sigma of time response | |
114 | if (index[1]<fNInnerSector){ | |
115 | sfpadrow =fFacSigma*fInnerPRF->GetSigmaY()/fInnerPadPitchLength; | |
116 | sfpad =fFacSigma*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth; | |
117 | }else{ | |
f03e3423 | 118 | if(index[2]<fNRowUp1){ |
119 | sfpadrow =fFacSigma*fOuter1PRF->GetSigmaY()/fOuter1PadPitchLength; | |
120 | sfpad =fFacSigma*fOuter1PRF->GetSigmaX()/fOuterPadPitchWidth;} | |
121 | else{ sfpadrow =fFacSigma*fOuter2PRF->GetSigmaY()/fOuter2PadPitchLength; | |
122 | sfpad =fFacSigma*fOuter2PRF->GetSigmaX()/fOuterPadPitchWidth;} | |
cc80f89e | 123 | } |
124 | ||
125 | Int_t fpadrow = TMath::Nint(xyz[0]-sfpadrow); //"first" padrow | |
126 | Int_t fpad = TMath::Nint(xyz[1]-sfpad); //first pad | |
127 | Int_t ftime = TMath::Nint(xyz[2]+fTimeRF->GetOffset()-sftime); // first time | |
128 | Int_t lpadrow = TMath::Min(TMath::Nint(xyz[0]+sfpadrow),fpadrow+19); //"last" padrow | |
129 | Int_t lpad = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19); //last pad | |
130 | Int_t ltime = TMath::Min(TMath::Nint(xyz[2]+fTimeRF->GetOffset()+sftime),ftime+19); // last time | |
131 | ||
132 | Float_t padres[20][20]; //I don't expect bigger number of bins | |
133 | Float_t timeres[20]; | |
134 | //calculate padresponse function | |
135 | Int_t padrow; | |
136 | for (padrow = fpadrow;padrow<=lpadrow;padrow++) | |
137 | for (Int_t pad = fpad;pad<=lpad;pad++){ | |
138 | Float_t dy = (xyz[0]-Float_t(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); | |
f03e3423 | 142 | else{ |
143 | if(index[2]<fNRowUp1){ | |
144 | padres[padrow-fpadrow][pad-fpad]=fOuter1PRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuter1PadPitchLength);} | |
145 | else{ padres[padrow-fpadrow][pad-fpad]=fOuter2PRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuter2PadPitchLength);}}} | |
146 | ||
cc80f89e | 147 | //calculate time response function |
148 | ||
149 | Int_t time; | |
150 | for (time = ftime;time<=ltime;time++) timeres[time-ftime]= fTimeRF->GetRF((xyz[2]-Float_t(time))*fZWidth); | |
151 | ||
152 | //write over threshold values to stack | |
153 | Int_t cindex3=-1; | |
154 | Int_t cindex=0; | |
155 | Float_t cweight = 0; | |
156 | for (padrow = fpadrow;padrow<=lpadrow;padrow++) | |
157 | for (Int_t pad = fpad;pad<=lpad;pad++) | |
158 | for (time = ftime;time<=ltime;time++){ | |
159 | cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad]; | |
160 | if (cweight>fResponseThreshold) { | |
161 | fResponseBin[++cindex3]=padrow; | |
162 | fResponseBin[++cindex3]=pad; | |
163 | fResponseBin[++cindex3]=time; | |
164 | fResponseWeight[++cindex]=cweight; | |
165 | } | |
166 | } | |
167 | fCurrentMax=cindex; | |
168 | return fCurrentMax; | |
169 | } | |
170 | ||
171 | void AliTPCParamCR::CRXYZtoXYZ(Float_t *xyz, | |
172 | const Int_t §or, const Int_t & padrow, Int_t option) const | |
173 | { | |
174 | //transform relative coordinates to absolute | |
175 | Bool_t rel = ( (option&2)!=0); | |
176 | Int_t index[2]={sector,padrow}; | |
177 | if (rel==kTRUE) Transform4to3(xyz,index);//if the position is relative to pad row | |
178 | Transform2to1(xyz,index); | |
179 | } | |
180 | ||
181 | void AliTPCParamCR::XYZtoCRXYZ(Float_t *xyz, | |
182 | Int_t §or, Int_t & padrow, Int_t option) const | |
183 | { | |
184 | //transform global position to the position relative to the sector padrow | |
185 | //if option=0 X calculate absolute calculate sector | |
186 | //if option=1 X absolute use input sector | |
187 | //if option=2 X relative to pad row calculate sector | |
188 | //if option=3 X relative use input sector | |
189 | //!!!!!!!!! WE start to calculate rows from row = 0 | |
190 | Int_t index[2]; | |
191 | Bool_t rel = ( (option&2)!=0); | |
192 | ||
193 | //option 0 and 2 means that we don't have information about sector | |
194 | if ((option&1)==0) Transform0to1(xyz,index); //we calculate sector number | |
195 | else | |
196 | index[0]=sector; | |
197 | Transform1to2(xyz,index); | |
198 | Transform2to3(xyz,index); | |
199 | //if we store relative position calculate position relative to pad row | |
200 | if (rel==kTRUE) Transform3to4(xyz,index); | |
201 | sector = index[0]; | |
202 | padrow = index[1]; | |
203 | } | |
204 | ||
205 | ||
206 | ||
207 | Bool_t AliTPCParamCR::Update() | |
208 | { | |
cc80f89e | 209 | Int_t i; |
210 | if (AliTPCParam::Update()==kFALSE) return kFALSE; | |
211 | fbStatus = kFALSE; | |
212 | ||
f03e3423 | 213 | Float_t firstrow = fInnerRadiusLow + 2.225 ; |
214 | for( i= 0;i<fNRowLow;i++) | |
215 | { | |
216 | Float_t x = firstrow + fInnerPadPitchLength*(Float_t)i; | |
217 | fPadRowLow[i]=x; | |
218 | // number of pads per row | |
219 | /*Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerWireMount- | |
220 | fInnerPadPitchWidth/2.;*/ | |
221 | Float_t y = x*tan(fInnerAngle/2.)-fInnerWireMount; | |
222 | fYInner[i]=y; | |
223 | fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ; | |
cc80f89e | 224 | |
f03e3423 | 225 | } |
226 | firstrow = fOuterRadiusLow + 1.6; | |
227 | for(i=0;i<fNRowUp;i++) | |
228 | { | |
229 | if(i<fNRowUp1){ | |
230 | Float_t x = firstrow + fOuter1PadPitchLength*(Float_t)i; | |
231 | fPadRowUp[i]=x; | |
232 | /*Float_t y =(x-0.5*fOuter1PadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount- | |
233 | fOuterPadPitchWidth/2.;*/ | |
234 | Float_t y = x*tan(fInnerAngle/2.)-fInnerWireMount; | |
cc80f89e | 235 | fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ; |
f03e3423 | 236 | fYOuter[i] = y; |
237 | if(i==fNRowUp1-1) { | |
238 | fLastWireUp1=fPadRowUp[i] +0.375; | |
239 | firstrow = fPadRowUp[i] + 0.5*(fOuter1PadPitchLength+fOuter2PadPitchLength); | |
240 | } | |
241 | } | |
242 | else | |
243 | { | |
244 | Float_t x = firstrow + fOuter2PadPitchLength*(Float_t)(i-64); | |
245 | /*Float_t y =(x-0.5*fOuter2PadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount- | |
246 | fOuterPadPitchWidth/2.;*/ | |
247 | Float_t y = x*tan(fInnerAngle/2.)-fInnerWireMount; | |
248 | fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ; | |
249 | fYOuter[i] = y; | |
250 | } | |
251 | } | |
252 | ||
cc80f89e | 253 | fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp; |
c11cb93f | 254 | fbStatus = kTRUE; |
cc80f89e | 255 | return kTRUE; |
256 | } | |
257 | ||
258 | ||
259 | ||
260 | void AliTPCParamCR::Streamer(TBuffer &R__b) | |
261 | { | |
262 | // Stream an object of class AliTPC. | |
263 | ||
264 | if (R__b.IsReading()) { | |
2ab0c725 | 265 | AliTPCParamCR::Class()->ReadBuffer(R__b, this); |
266 | Update(); | |
cc80f89e | 267 | } else { |
2ab0c725 | 268 | AliTPCParamCR::Class()->WriteBuffer(R__b, this); |
cc80f89e | 269 | } |
270 | } | |
271 | ||
272 | ||
273 | ||
274 | ||
c11cb93f | 275 | |
276 | ||
277 | ||
278 | ||
279 | ||
280 |