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