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