]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCParamCR.cxx
Changes due to the class restructuring.
[u/mrichter/AliRoot.git] / TPC / AliTPCParamCR.cxx
CommitLineData
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$
73042f01 18Revision 1.2.4.1 2000/06/14 16:48:24 kowal2
19Parameter setting improved. Removed compiler warnings
20
21Revision 1.2 2000/04/17 09:37:33 kowal2
22removed obsolete AliTPCDigitsDisplay.C
23
cc80f89e 24Revision 1.1.4.2 2000/04/10 11:36:13 kowal2
25
26New Detector parameters handling class
27
28*/
29
30///////////////////////////////////////////////////////////////////////
31// Manager and of geomety classes for set: TPC //
32// //
33// !sectors are numbered from 0 //
34// !pad rows are numbered from 0 //
35//
36// 27.7. - AliTPCPaaramSr object for TPC
37// TPC with straight pad rows
38// Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
39// //
40///////////////////////////////////////////////////////////////////////
41
42
43#include <iostream.h>
44#include <TMath.h>
45#include <TObject.h>
46#include <AliTPCParamCR.h>
73042f01 47#include "AliTPCPRF2D.h"
48#include "AliTPCRF1D.h"
cc80f89e 49
50
51
52ClassImp(AliTPCParamCR)
53const static Int_t kMaxRows=600;
54const static Float_t kEdgeSectorSpace = 2.5;
55
56AliTPCParamCR::AliTPCParamCR()
57{
58 //
59 //constructor set the default parameters
60 fInnerPRF=0;
61 fOuterPRF=0;
62 fTimeRF = 0;
63 fFacSigma = Float_t(2.);
64 SetDefault();
65 Update();
66}
67
68AliTPCParamCR::~AliTPCParamCR()
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
77void AliTPCParamCR::SetDefault()
78{
79 //set default TPC param
80 fbStatus = kFALSE;
81 AliTPCParam::SetDefault();
82}
83
73042f01 84Int_t AliTPCParamCR::CalcResponse(Float_t* xyz, Int_t * index, Int_t dummy)
cc80f89e 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 coordinata 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("AliTPCParamCR", "response function were 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= fFacSigma*fTimeRF->GetSigma()/fZWidth; //3 sigma of time response
101 if (index[1]<fNInnerSector){
102 sfpadrow =fFacSigma*fInnerPRF->GetSigmaY()/fInnerPadPitchLength;
103 sfpad =fFacSigma*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth;
104 }else{
105 sfpadrow =fFacSigma*fOuterPRF->GetSigmaY()/fOuterPadPitchLength;
106 sfpad =fFacSigma*fOuterPRF->GetSigmaX()/fOuterPadPitchWidth;
107 }
108
109 Int_t fpadrow = TMath::Nint(xyz[0]-sfpadrow); //"first" padrow
110 Int_t fpad = TMath::Nint(xyz[1]-sfpad); //first pad
111 Int_t ftime = TMath::Nint(xyz[2]+fTimeRF->GetOffset()-sftime); // first time
112 Int_t lpadrow = TMath::Min(TMath::Nint(xyz[0]+sfpadrow),fpadrow+19); //"last" padrow
113 Int_t lpad = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19); //last pad
114 Int_t ltime = TMath::Min(TMath::Nint(xyz[2]+fTimeRF->GetOffset()+sftime),ftime+19); // last time
115
116 Float_t padres[20][20]; //I don't expect bigger number of bins
117 Float_t timeres[20];
118 //calculate padresponse function
119 Int_t padrow;
120 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
121 for (Int_t pad = fpad;pad<=lpad;pad++){
122 Float_t dy = (xyz[0]-Float_t(padrow));
123 Float_t dx = (xyz[1]-Float_t(pad));
124 if (index[1]<fNInnerSector)
125 padres[padrow-fpadrow][pad-fpad]=fInnerPRF->GetPRF(dx*fInnerPadPitchWidth,dy*fInnerPadPitchLength);
126 else
127 padres[padrow-fpadrow][pad-fpad]=fOuterPRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuterPadPitchLength);
128 }
129 //calculate time response function
130
131 Int_t time;
132 for (time = ftime;time<=ltime;time++) timeres[time-ftime]= fTimeRF->GetRF((xyz[2]-Float_t(time))*fZWidth);
133
134 //write over threshold values to stack
135 Int_t cindex3=-1;
136 Int_t cindex=0;
137 Float_t cweight = 0;
138 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
139 for (Int_t pad = fpad;pad<=lpad;pad++)
140 for (time = ftime;time<=ltime;time++){
141 cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad];
142 if (cweight>fResponseThreshold) {
143 fResponseBin[++cindex3]=padrow;
144 fResponseBin[++cindex3]=pad;
145 fResponseBin[++cindex3]=time;
146 fResponseWeight[++cindex]=cweight;
147 }
148 }
149 fCurrentMax=cindex;
150 return fCurrentMax;
151}
152
153void AliTPCParamCR::CRXYZtoXYZ(Float_t *xyz,
154 const Int_t &sector, const Int_t & padrow, Int_t option) const
155{
156 //transform relative coordinates to absolute
157 Bool_t rel = ( (option&2)!=0);
158 Int_t index[2]={sector,padrow};
159 if (rel==kTRUE) Transform4to3(xyz,index);//if the position is relative to pad row
160 Transform2to1(xyz,index);
161}
162
163void AliTPCParamCR::XYZtoCRXYZ(Float_t *xyz,
164 Int_t &sector, Int_t & padrow, Int_t option) const
165{
166 //transform global position to the position relative to the sector padrow
167 //if option=0 X calculate absolute calculate sector
168 //if option=1 X absolute use input sector
169 //if option=2 X relative to pad row calculate sector
170 //if option=3 X relative use input sector
171 //!!!!!!!!! WE start to calculate rows from row = 0
172 Int_t index[2];
173 Bool_t rel = ( (option&2)!=0);
174
175 //option 0 and 2 means that we don't have information about sector
176 if ((option&1)==0) Transform0to1(xyz,index); //we calculate sector number
177 else
178 index[0]=sector;
179 Transform1to2(xyz,index);
180 Transform2to3(xyz,index);
181 //if we store relative position calculate position relative to pad row
182 if (rel==kTRUE) Transform3to4(xyz,index);
183 sector = index[0];
184 padrow = index[1];
185}
186
187
188
189Bool_t AliTPCParamCR::Update()
190{
191
192 //
193 // update some calculated parameter which must be updated after changing "base"
194 // parameters
195 // for example we can change size of pads and according this recalculate number
196 // of pad rows, number of of pads in given row ....
197 Int_t i;
198 if (AliTPCParam::Update()==kFALSE) return kFALSE;
199 fbStatus = kFALSE;
200
201 // adjust lower sectors pad row positions and pad numbers
202 fNRowLow = (Int_t(1.0001*(fRInnerLastWire-fRInnerFirstWire)/fInnerWWPitch)
203 -2*fInnerDummyWire)/fNInnerWiresPerPad;
204 if ( kMaxRows<fNRowLow) fNRowUp = kMaxRows;
205 if (1>fNRowLow) return kFALSE;
206 Float_t firstpad = fRInnerFirstWire+(fInnerDummyWire-0.5)*fInnerWWPitch
207 +fInnerPadPitchLength/2.;
208
209 for (i = 0;i<fNRowLow;i++)
210 {
211 Float_t x = firstpad +fInnerPadPitchLength*(Float_t)i;
212 Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerFrameSpace-
213 fInnerPadPitchWidth/2.;
214 fPadRowLow[i] = x;
215 fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ;
216 }
217
218 // adjust upper sectors pad row positions and pad numbers
219 fNRowUp = (Int_t((fROuterLastWire-fROuterFirstWire+0.001)/fOuterWWPitch)
220 -2*fOuterDummyWire)/fNOuterWiresPerPad;
221 if ( kMaxRows<fNRowUp) fNRowUp = kMaxRows;
222 if (1>fNRowUp) return kFALSE;
223 firstpad = fROuterFirstWire+(fOuterDummyWire-0.5)*fOuterWWPitch
224 +fOuterPadPitchLength/2.;
225
226 for (i = 0;i<fNRowUp;i++)
227 {
228 Float_t x = firstpad + fOuterPadPitchLength*(Float_t)i;
229 Float_t y = (x-0.5*fOuterPadPitchLength)*tan(fOuterAngle/2.)-fOuterFrameSpace-
230 fInnerPadPitchWidth/2.;
231 fPadRowUp[i] = x;
232 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
233 }
234 fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp;
235 return kTRUE;
236}
237
238
239
240void AliTPCParamCR::Streamer(TBuffer &R__b)
241{
242 // Stream an object of class AliTPC.
243
244 if (R__b.IsReading()) {
245 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
246 // TObject::Streamer(R__b);
247 AliTPCParam::Streamer(R__b);
248 // if (R__v < 2) return;
249 Update();
250 } else {
251 R__b.WriteVersion(AliTPCParamCR::IsA());
252 //TObject::Streamer(R__b);
253 AliTPCParam::Streamer(R__b);
254 }
255}
256
257
258
259