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