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.4 2000/11/02 07:33:15 kowal2
19 Improvements of the code.
21 Revision 1.3 2000/06/30 12:07:50 kowal2
22 Updated from the TPC-PreRelease branch
24 Revision 1.2.4.1 2000/06/14 16:48:24 kowal2
25 Parameter setting improved. Removed compiler warnings
27 Revision 1.2 2000/04/17 09:37:33 kowal2
28 removed obsolete AliTPCDigitsDisplay.C
30 Revision 1.1.4.2 2000/04/10 11:36:13 kowal2
32 New Detector parameters handling class
36 ///////////////////////////////////////////////////////////////////////
37 // Manager and of geomety classes for set: TPC //
39 // !sectors are numbered from 0 //
40 // !pad rows are numbered from 0 //
42 // 27.7. - AliTPCPaaramSr object for TPC
43 // TPC with straight pad rows
44 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
46 ///////////////////////////////////////////////////////////////////////
52 #include <AliTPCParamCR.h>
53 #include "AliTPCPRF2D.h"
54 #include "AliTPCRF1D.h"
58 ClassImp(AliTPCParamCR)
59 const static Int_t kMaxRows=600;
60 const static Float_t kEdgeSectorSpace = 2.5;
62 AliTPCParamCR::AliTPCParamCR()
65 //constructor set the default parameters
69 fFacSigma = Float_t(2.);
74 AliTPCParamCR::~AliTPCParamCR()
77 //destructor destroy some dynmicaly alocated variables
78 if (fInnerPRF != 0) delete fInnerPRF;
79 if (fOuterPRF != 0) delete fOuterPRF;
80 if (fTimeRF != 0) delete fTimeRF;
83 void AliTPCParamCR::SetDefault()
85 //set default TPC param
87 AliTPCParam::SetDefault();
90 Int_t AliTPCParamCR::CalcResponse(Float_t* xyz, Int_t * index, Int_t dummy)
93 //calculate bin response as function of the input position -x
94 //return number of valid response bin
96 //we suppose that coordinata is expressed in float digits
97 // it's mean coordinate system 8
98 //xyz[0] - float padrow xyz[1] is float pad (center pad is number 0) and xyz[2] is float time bin
99 if ( (fInnerPRF==0)||(fOuterPRF==0)||(fTimeRF==0) ){
100 Error("AliTPCParamCR", "response function were not adjusted");
104 Float_t sfpadrow; // sigma of response function
105 Float_t sfpad; // sigma of
106 Float_t sftime= fFacSigma*fTimeRF->GetSigma()/fZWidth; //3 sigma of time response
107 if (index[1]<fNInnerSector){
108 sfpadrow =fFacSigma*fInnerPRF->GetSigmaY()/fInnerPadPitchLength;
109 sfpad =fFacSigma*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth;
111 sfpadrow =fFacSigma*fOuterPRF->GetSigmaY()/fOuterPadPitchLength;
112 sfpad =fFacSigma*fOuterPRF->GetSigmaX()/fOuterPadPitchWidth;
115 Int_t fpadrow = TMath::Nint(xyz[0]-sfpadrow); //"first" padrow
116 Int_t fpad = TMath::Nint(xyz[1]-sfpad); //first pad
117 Int_t ftime = TMath::Nint(xyz[2]+fTimeRF->GetOffset()-sftime); // first time
118 Int_t lpadrow = TMath::Min(TMath::Nint(xyz[0]+sfpadrow),fpadrow+19); //"last" padrow
119 Int_t lpad = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19); //last pad
120 Int_t ltime = TMath::Min(TMath::Nint(xyz[2]+fTimeRF->GetOffset()+sftime),ftime+19); // last time
122 Float_t padres[20][20]; //I don't expect bigger number of bins
124 //calculate padresponse function
126 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
127 for (Int_t pad = fpad;pad<=lpad;pad++){
128 Float_t dy = (xyz[0]-Float_t(padrow));
129 Float_t dx = (xyz[1]-Float_t(pad));
130 if (index[1]<fNInnerSector)
131 padres[padrow-fpadrow][pad-fpad]=fInnerPRF->GetPRF(dx*fInnerPadPitchWidth,dy*fInnerPadPitchLength);
133 padres[padrow-fpadrow][pad-fpad]=fOuterPRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuterPadPitchLength);
135 //calculate time response function
138 for (time = ftime;time<=ltime;time++) timeres[time-ftime]= fTimeRF->GetRF((xyz[2]-Float_t(time))*fZWidth);
140 //write over threshold values to stack
144 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
145 for (Int_t pad = fpad;pad<=lpad;pad++)
146 for (time = ftime;time<=ltime;time++){
147 cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad];
148 if (cweight>fResponseThreshold) {
149 fResponseBin[++cindex3]=padrow;
150 fResponseBin[++cindex3]=pad;
151 fResponseBin[++cindex3]=time;
152 fResponseWeight[++cindex]=cweight;
159 void AliTPCParamCR::CRXYZtoXYZ(Float_t *xyz,
160 const Int_t §or, const Int_t & padrow, Int_t option) const
162 //transform relative coordinates to absolute
163 Bool_t rel = ( (option&2)!=0);
164 Int_t index[2]={sector,padrow};
165 if (rel==kTRUE) Transform4to3(xyz,index);//if the position is relative to pad row
166 Transform2to1(xyz,index);
169 void AliTPCParamCR::XYZtoCRXYZ(Float_t *xyz,
170 Int_t §or, Int_t & padrow, Int_t option) const
172 //transform global position to the position relative to the sector padrow
173 //if option=0 X calculate absolute calculate sector
174 //if option=1 X absolute use input sector
175 //if option=2 X relative to pad row calculate sector
176 //if option=3 X relative use input sector
177 //!!!!!!!!! WE start to calculate rows from row = 0
179 Bool_t rel = ( (option&2)!=0);
181 //option 0 and 2 means that we don't have information about sector
182 if ((option&1)==0) Transform0to1(xyz,index); //we calculate sector number
185 Transform1to2(xyz,index);
186 Transform2to3(xyz,index);
187 //if we store relative position calculate position relative to pad row
188 if (rel==kTRUE) Transform3to4(xyz,index);
195 Bool_t AliTPCParamCR::Update()
199 // update some calculated parameter which must be updated after changing "base"
201 // for example we can change size of pads and according this recalculate number
202 // of pad rows, number of of pads in given row ....
204 if (AliTPCParam::Update()==kFALSE) return kFALSE;
207 // adjust lower sectors pad row positions and pad numbers
208 fNRowLow = (Int_t(1.0001*(fRInnerLastWire-fRInnerFirstWire)/fInnerWWPitch)
209 -2*fInnerDummyWire)/fNInnerWiresPerPad;
210 if ( kMaxRows<fNRowLow) fNRowUp = kMaxRows;
211 if (1>fNRowLow) return kFALSE;
212 Float_t firstpad = fRInnerFirstWire+(fInnerDummyWire-0.5)*fInnerWWPitch
213 +fInnerPadPitchLength/2.;
215 for (i = 0;i<fNRowLow;i++)
217 Float_t x = firstpad +fInnerPadPitchLength*(Float_t)i;
218 Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerFrameSpace-
219 fInnerPadPitchWidth/2.;
221 fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ;
224 // adjust upper sectors pad row positions and pad numbers
225 fNRowUp = (Int_t((fROuterLastWire-fROuterFirstWire+0.001)/fOuterWWPitch)
226 -2*fOuterDummyWire)/fNOuterWiresPerPad;
227 if ( kMaxRows<fNRowUp) fNRowUp = kMaxRows;
228 if (1>fNRowUp) return kFALSE;
229 firstpad = fROuterFirstWire+(fOuterDummyWire-0.5)*fOuterWWPitch
230 +fOuterPadPitchLength/2.;
232 for (i = 0;i<fNRowUp;i++)
234 Float_t x = firstpad + fOuterPadPitchLength*(Float_t)i;
235 Float_t y = (x-0.5*fOuterPadPitchLength)*tan(fOuterAngle/2.)-fOuterFrameSpace-
236 fInnerPadPitchWidth/2.;
238 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
240 fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp;
247 void AliTPCParamCR::Streamer(TBuffer &R__b)
249 // Stream an object of class AliTPC.
251 if (R__b.IsReading()) {
252 AliTPCParamCR::Class()->ReadBuffer(R__b, this);
255 AliTPCParamCR::Class()->WriteBuffer(R__b, this);