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