1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.1.4.2 2000/04/10 11:36:13 kowal2
20 New Detector parameters handling class
24 ///////////////////////////////////////////////////////////////////////
25 // Manager and of geomety classes for set: TPC //
27 // !sectors are numbered from 0 //
28 // !pad rows are numbered from 0 //
30 // 27.7. - AliTPCPaaramSr object for TPC
31 // TPC with straight pad rows
32 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
34 ///////////////////////////////////////////////////////////////////////
40 #include <AliTPCParamSR.h>
44 ClassImp(AliTPCParamSR)
45 const static Int_t kMaxRows=600;
46 const static Float_t kEdgeSectorSpace = 2.5;
47 const static Float_t kFacSigmaPadRow=2.;
48 const static Float_t kFacSigmaPad=3.;
49 const static Float_t kFacSigmaTime=3.;
52 AliTPCParamSR::AliTPCParamSR()
55 //constructor set the default parameters
59 fFacSigmaPadRow = Float_t(kFacSigmaPadRow);
60 fFacSigmaPad = Float_t(kFacSigmaPad);
61 fFacSigmaTime = Float_t(kFacSigmaTime);
68 AliTPCParamSR::~AliTPCParamSR()
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;
77 void AliTPCParamSR::SetDefault()
79 //set default TPC param
81 AliTPCParam::SetDefault();
84 Int_t AliTPCParamSR::CalcResponse(Float_t* xyz, Int_t * index, Int_t row)
87 //calculate bin response as function of the input position -x
88 //return number of valid response bin
90 //we suppose that coordinate 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("AliTPCParamSR", "response function was not adjusted");
98 Float_t sfpadrow; // sigma of response function
99 Float_t sfpad; // sigma of
100 Float_t sftime= fFacSigmaTime*fTimeRF->GetSigma()/fZWidth; //3 sigma of time response
101 if (index[1]<fNInnerSector){
102 sfpadrow =fFacSigmaPadRow*fInnerPRF->GetSigmaY()/fInnerPadPitchLength;
103 sfpad =fFacSigmaPad*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth;
105 sfpadrow =fFacSigmaPadRow*fOuterPRF->GetSigmaY()/fOuterPadPitchLength;
106 sfpad =fFacSigmaPad*fOuterPRF->GetSigmaX()/fOuterPadPitchWidth;
109 Int_t fpadrow = TMath::Max(TMath::Nint(index[2]+xyz[0]-sfpadrow),0); //"first" padrow
110 Int_t fpad = TMath::Nint(xyz[1]-sfpad); //first pad
111 Int_t ftime = TMath::Max(TMath::Nint(xyz[2]+GetZOffset()/GetZWidth()-sftime),0); // first time
112 Int_t lpadrow = TMath::Min(TMath::Nint(index[2]+xyz[0]+sfpadrow),fpadrow+19); //"last" padrow
113 lpadrow = TMath::Min(GetNRow(index[1])-1,lpadrow);
114 Int_t lpad = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19); //last pad
115 Int_t ltime = TMath::Min(TMath::Nint(xyz[2]+GetZOffset()/GetZWidth()+sftime),ftime+19); // last time
116 ltime = TMath::Min(ltime,GetMaxTBin()-1);
118 if (row>=0) { //if we are interesting about given pad row
119 if (fpadrow<=row) fpadrow =row;
122 if (lpadrow>=row) lpadrow = row;
128 Float_t padres[20][20]; //I don't expect bigger number of bins
134 //calculate padresponse function
136 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
137 for (pad = fpad;pad<=lpad;pad++){
138 Float_t dy = (-xyz[0]+Float_t(index[2]-padrow));
139 Float_t dx = (-xyz[1]+Float_t(pad));
140 if (index[1]<fNInnerSector)
141 padres[padrow-fpadrow][pad-fpad]=fInnerPRF->GetPRF(dx*fInnerPadPitchWidth,dy*fInnerPadPitchLength);
143 padres[padrow-fpadrow][pad-fpad]=fOuterPRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuterPadPitchLength); }
144 //calculate time response function
146 for (time = ftime;time<=ltime;time++)
147 timeres[time-ftime]= fTimeRF->GetRF((-xyz[2]+Float_t(time))*fZWidth);
148 //write over threshold values to stack
149 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
150 for (pad = fpad;pad<=lpad;pad++)
151 for (time = ftime;time<=ltime;time++){
152 cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad];
153 if (cweight>fResponseThreshold) {
154 fResponseBin[cindex3]=padrow;
155 fResponseBin[cindex3+1]=pad;
156 fResponseBin[cindex3+2]=time;
158 fResponseWeight[cindex]=cweight;
167 void AliTPCParamSR::TransformTo8(Float_t *xyz, Int_t *index) const
170 // transformate point to digit coordinate
172 if (index[0]==0) Transform0to1(xyz,index);
173 if (index[0]==1) Transform1to2(xyz,index);
174 if (index[0]==2) Transform2to3(xyz,index);
175 if (index[0]==3) Transform3to4(xyz,index);
176 if (index[0]==4) Transform4to8(xyz,index);
179 void AliTPCParamSR::TransformTo2(Float_t *xyz, Int_t *index) const
182 //transformate point to rotated coordinate
185 if (index[0]==0) Transform0to1(xyz,index);
186 if (index[0]==1) Transform1to2(xyz,index);
187 if (index[0]==4) Transform4to3(xyz,index);
188 if (index[0]==8) { //if we are in digit coordinate system transform to global
189 Transform8to4(xyz,index);
190 Transform4to3(xyz,index);
194 void AliTPCParamSR::CRXYZtoXYZ(Float_t *xyz,
195 const Int_t §or, const Int_t & padrow, Int_t option) const
197 //transform relative coordinates to absolute
198 Bool_t rel = ( (option&2)!=0);
199 Int_t index[2]={sector,padrow};
200 if (rel==kTRUE) Transform4to3(xyz,index);//if the position is relative to pad row
201 Transform2to1(xyz,index);
204 void AliTPCParamSR::XYZtoCRXYZ(Float_t *xyz,
205 Int_t §or, Int_t & padrow, Int_t option) const
207 //transform global position to the position relative to the sector padrow
208 //if option=0 X calculate absolute calculate sector
209 //if option=1 X absolute use input sector
210 //if option=2 X relative to pad row calculate sector
211 //if option=3 X relative use input sector
212 //!!!!!!!!! WE start to calculate rows from row = 0
214 Bool_t rel = ( (option&2)!=0);
216 //option 0 and 2 means that we don't have information about sector
217 if ((option&1)==0) Transform0to1(xyz,index); //we calculate sector number
220 Transform1to2(xyz,index);
221 Transform2to3(xyz,index);
222 //if we store relative position calculate position relative to pad row
223 if (rel==kTRUE) Transform3to4(xyz,index);
228 Float_t AliTPCParamSR::GetPrimaryLoss(Float_t *x, Int_t *index, Float_t *angle)
232 Float_t padlength=GetPadPitchLength(index[1]);
233 Float_t a1=TMath::Sin(angle[0]);
235 Float_t a2=TMath::Sin(angle[1]);
237 Float_t length =padlength*TMath::Sqrt(1+a1+a2);
238 return length*fNPrimLoss;
241 Float_t AliTPCParamSR::GetTotalLoss(Float_t *x, Int_t *index, Float_t *angle)
245 Float_t padlength=GetPadPitchLength(index[1]);
246 Float_t a1=TMath::Sin(angle[0]);
248 Float_t a2=TMath::Sin(angle[1]);
250 Float_t length =padlength*TMath::Sqrt(1+a1+a2);
251 return length*fNTotalLoss;
256 void AliTPCParamSR::GetClusterSize(Float_t *x, Int_t *index, Float_t *angle, Int_t mode, Float_t *sigma)
259 //return cluster sigma2 (x,y) for particle at position x
260 // in this case x coordinata is in drift direction
261 //and y in pad row direction
262 //we suppose that input coordinate system is digit system
265 Float_t lx[3] = {x[0],x[1],x[2]};
266 Int_t li[3] = {index[0],index[1],index[2]};
268 // Float_t sigmadiff;
272 xx = lx[2]; //calculate drift length in cm
274 sigma[0]+= xx*GetDiffL()*GetDiffL();
275 sigma[1]+= xx*GetDiffT()*GetDiffT();
279 //sigma[0]=sigma[1]=0;
280 if (GetTimeRF()!=0) sigma[0]+=GetTimeRF()->GetSigma()*GetTimeRF()->GetSigma();
281 if ( (index[1]<fNInnerSector) &&(GetInnerPRF()!=0))
282 sigma[1]+=GetInnerPRF()->GetSigmaX()*GetInnerPRF()->GetSigmaX();
283 if ( (index[1]>=fNInnerSector) && (GetOuterPRF()!=0))
284 sigma[1]+=GetOuterPRF()->GetSigmaX()*GetOuterPRF()->GetSigmaX();
287 sigma[0]/= GetZWidth()*GetZWidth();
288 sigma[1]/=GetPadPitchWidth(index[0])*GetPadPitchWidth(index[0]);
294 void AliTPCParamSR::GetSpaceResolution(Float_t *x, Int_t *index, Float_t *angle,
295 Float_t amplitude, Int_t mode, Float_t *sigma)
302 Float_t AliTPCParamSR::GetAmp(Float_t *x, Int_t *index, Float_t *angle)
310 Float_t * AliTPCParamSR::GetAnglesAccMomentum(Float_t *x, Int_t * index, Float_t* momentum, Float_t *angle)
313 //calculate angle of track to padrow at given position
314 // for given magnetic field and momentum of the particle
317 TransformTo2(x,index);
318 AliDetectorParam::GetAnglesAccMomentum(x,index,momentum,angle);
319 Float_t addangle = TMath::ASin(x[1]/GetPadRowRadii(index[1],index[2]));
325 Bool_t AliTPCParamSR::Update()
329 // update some calculated parameter which must be updated after changing "base"
331 // for example we can change size of pads and according this recalculate number
332 // of pad rows, number of of pads in given row ....
334 if (AliTPCParam::Update()==kFALSE) return kFALSE;
337 // adjust lower sectors pad row positions and pad numbers
338 fNRowLow = (Int_t(1.001+((fRInnerLastWire-fRInnerFirstWire)/fInnerWWPitch))
339 -2*fInnerDummyWire)/fNInnerWiresPerPad;
340 if ( kMaxRows<fNRowLow) fNRowUp = kMaxRows;
341 if (1>fNRowLow) return kFALSE;
343 //Float_t firstpad = fRInnerFirstWire+(fInnerDummyWire-0.5)*fInnerWWPitch
344 // +fInnerPadPitchLength/2.;
345 Float_t lastpad = fRInnerLastWire-(fInnerDummyWire-0.5)*fInnerWWPitch
346 -fInnerPadPitchLength/2.;
347 Float_t firstpad = lastpad-Float_t(fNRowLow-1)*fInnerPadPitchLength;
349 for (i = 0;i<fNRowLow;i++)
351 Float_t x = firstpad +fInnerPadPitchLength*(Float_t)i;
352 Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerWireMount-
353 fInnerPadPitchWidth/2.;
355 fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ;
358 // adjust upper sectors pad row positions and pad numbers
359 fNRowUp = (Int_t(1.001+((fROuterLastWire-fROuterFirstWire)/fOuterWWPitch))
360 -2*fOuterDummyWire)/fNOuterWiresPerPad;
361 if ( kMaxRows<fNRowUp) fNRowUp = kMaxRows;
362 if (1>fNRowUp) return kFALSE;
363 firstpad = fROuterFirstWire+(fOuterDummyWire-0.5)*fOuterWWPitch
364 +fOuterPadPitchLength/2.;
366 for (i = 0;i<fNRowUp;i++)
368 Float_t x = firstpad + fOuterPadPitchLength*(Float_t)i;
369 Float_t y = (x-0.5*fOuterPadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount-
370 fInnerPadPitchWidth/2.;
372 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
374 fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp;
380 void AliTPCParamSR::Streamer(TBuffer &R__b)
382 // Stream an object of class AliTPC.
384 if (R__b.IsReading()) {
385 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
386 // TObject::Streamer(R__b);
387 AliTPCParam::Streamer(R__b);
388 // if (R__v < 2) return;
391 R__b.WriteVersion(AliTPCParamSR::IsA());
392 //TObject::Streamer(R__b);
393 AliTPCParam::Streamer(R__b);