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.5 2001/01/26 19:57:22 hristov
19 Major upgrade of AliRoot code
21 Revision 1.4 2000/11/02 07:33:15 kowal2
22 Improvements of the code.
24 Revision 1.3 2000/06/30 12:07:50 kowal2
25 Updated from the TPC-PreRelease branch
27 Revision 1.2.4.1 2000/06/14 16:48:24 kowal2
28 Parameter setting improved. Removed compiler warnings
30 Revision 1.2 2000/04/17 09:37:33 kowal2
31 removed obsolete AliTPCDigitsDisplay.C
33 Revision 1.1.4.2 2000/04/10 11:36:13 kowal2
35 New Detector parameters handling class
39 ///////////////////////////////////////////////////////////////////////
40 // Manager and of geomety classes for set: TPC //
42 // !sectors are numbered from 0 //
43 // !pad rows are numbered from 0 //
45 // 27.7. - AliTPCPaaramSr object for TPC
46 // TPC with straight pad rows
47 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
49 ///////////////////////////////////////////////////////////////////////
55 #include <AliTPCParamCR.h>
56 #include "AliTPCPRF2D.h"
57 #include "AliTPCRF1D.h"
61 ClassImp(AliTPCParamCR)
62 const static Int_t kMaxRows=600;
63 const static Float_t kEdgeSectorSpace = 2.5;
65 AliTPCParamCR::AliTPCParamCR()
68 //constructor set the default parameters
73 fFacSigma = Float_t(2.);
78 AliTPCParamCR::~AliTPCParamCR()
81 //destructor destroy some dynmicaly alocated variables
82 if (fInnerPRF != 0) delete fInnerPRF;
83 if (fOuter1PRF != 0) delete fOuter1PRF;
84 if (fOuter2PRF != 0) delete fOuter2PRF;
85 if (fTimeRF != 0) delete fTimeRF;
88 void AliTPCParamCR::SetDefault()
90 //set default TPC param
92 AliTPCParam::SetDefault();
95 Int_t AliTPCParamCR::CalcResponse(Float_t* xyz, Int_t * index, Int_t dummy)
98 //calculate bin response as function of the input position -x
99 //return number of valid response bin
101 //we suppose that coordinata is expressed in float digits
102 // it's mean coordinate system 8
103 //xyz[0] - float padrow xyz[1] is float pad (center pad is number 0) and xyz[2] is float time bin
104 if ( (fInnerPRF==0)||(fOuter1PRF==0) ||(fOuter2PRF==0)||(fTimeRF==0) ){
105 Error("AliTPCParamCR", "response function were not adjusted");
109 Float_t sfpadrow; // sigma of response function
110 Float_t sfpad; // sigma of
111 Float_t sftime= fFacSigma*fTimeRF->GetSigma()/fZWidth; //3 sigma of time response
112 if (index[1]<fNInnerSector){
113 sfpadrow =fFacSigma*fInnerPRF->GetSigmaY()/fInnerPadPitchLength;
114 sfpad =fFacSigma*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth;
116 if(index[2]<fNRowUp1){
117 sfpadrow =fFacSigma*fOuter1PRF->GetSigmaY()/fOuter1PadPitchLength;
118 sfpad =fFacSigma*fOuter1PRF->GetSigmaX()/fOuterPadPitchWidth;}
119 else{ sfpadrow =fFacSigma*fOuter2PRF->GetSigmaY()/fOuter2PadPitchLength;
120 sfpad =fFacSigma*fOuter2PRF->GetSigmaX()/fOuterPadPitchWidth;}
123 Int_t fpadrow = TMath::Nint(xyz[0]-sfpadrow); //"first" padrow
124 Int_t fpad = TMath::Nint(xyz[1]-sfpad); //first pad
125 Int_t ftime = TMath::Nint(xyz[2]+fTimeRF->GetOffset()-sftime); // first time
126 Int_t lpadrow = TMath::Min(TMath::Nint(xyz[0]+sfpadrow),fpadrow+19); //"last" padrow
127 Int_t lpad = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19); //last pad
128 Int_t ltime = TMath::Min(TMath::Nint(xyz[2]+fTimeRF->GetOffset()+sftime),ftime+19); // last time
130 Float_t padres[20][20]; //I don't expect bigger number of bins
132 //calculate padresponse function
134 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
135 for (Int_t pad = fpad;pad<=lpad;pad++){
136 Float_t dy = (xyz[0]-Float_t(padrow));
137 Float_t dx = (xyz[1]-Float_t(pad));
138 if (index[1]<fNInnerSector)
139 padres[padrow-fpadrow][pad-fpad]=fInnerPRF->GetPRF(dx*fInnerPadPitchWidth,dy*fInnerPadPitchLength);
141 if(index[2]<fNRowUp1){
142 padres[padrow-fpadrow][pad-fpad]=fOuter1PRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuter1PadPitchLength);}
143 else{ padres[padrow-fpadrow][pad-fpad]=fOuter2PRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuter2PadPitchLength);}}}
145 //calculate time response function
148 for (time = ftime;time<=ltime;time++) timeres[time-ftime]= fTimeRF->GetRF((xyz[2]-Float_t(time))*fZWidth);
150 //write over threshold values to stack
154 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
155 for (Int_t pad = fpad;pad<=lpad;pad++)
156 for (time = ftime;time<=ltime;time++){
157 cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad];
158 if (cweight>fResponseThreshold) {
159 fResponseBin[++cindex3]=padrow;
160 fResponseBin[++cindex3]=pad;
161 fResponseBin[++cindex3]=time;
162 fResponseWeight[++cindex]=cweight;
169 void AliTPCParamCR::CRXYZtoXYZ(Float_t *xyz,
170 const Int_t §or, const Int_t & padrow, Int_t option) const
172 //transform relative coordinates to absolute
173 Bool_t rel = ( (option&2)!=0);
174 Int_t index[2]={sector,padrow};
175 if (rel==kTRUE) Transform4to3(xyz,index);//if the position is relative to pad row
176 Transform2to1(xyz,index);
179 void AliTPCParamCR::XYZtoCRXYZ(Float_t *xyz,
180 Int_t §or, Int_t & padrow, Int_t option) const
182 //transform global position to the position relative to the sector padrow
183 //if option=0 X calculate absolute calculate sector
184 //if option=1 X absolute use input sector
185 //if option=2 X relative to pad row calculate sector
186 //if option=3 X relative use input sector
187 //!!!!!!!!! WE start to calculate rows from row = 0
189 Bool_t rel = ( (option&2)!=0);
191 //option 0 and 2 means that we don't have information about sector
192 if ((option&1)==0) Transform0to1(xyz,index); //we calculate sector number
195 Transform1to2(xyz,index);
196 Transform2to3(xyz,index);
197 //if we store relative position calculate position relative to pad row
198 if (rel==kTRUE) Transform3to4(xyz,index);
205 Bool_t AliTPCParamCR::Update()
208 if (AliTPCParam::Update()==kFALSE) return kFALSE;
211 Float_t firstrow = fInnerRadiusLow + 2.225 ;
212 for( i= 0;i<fNRowLow;i++)
214 Float_t x = firstrow + fInnerPadPitchLength*(Float_t)i;
216 // number of pads per row
217 /*Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerWireMount-
218 fInnerPadPitchWidth/2.;*/
219 Float_t y = x*tan(fInnerAngle/2.)-fInnerWireMount;
221 fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ;
224 firstrow = fOuterRadiusLow + 1.6;
225 for(i=0;i<fNRowUp;i++)
228 Float_t x = firstrow + fOuter1PadPitchLength*(Float_t)i;
230 /*Float_t y =(x-0.5*fOuter1PadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount-
231 fOuterPadPitchWidth/2.;*/
232 Float_t y = x*tan(fInnerAngle/2.)-fInnerWireMount;
233 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
236 fLastWireUp1=fPadRowUp[i] +0.375;
237 firstrow = fPadRowUp[i] + 0.5*(fOuter1PadPitchLength+fOuter2PadPitchLength);
242 Float_t x = firstrow + fOuter2PadPitchLength*(Float_t)(i-64);
243 /*Float_t y =(x-0.5*fOuter2PadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount-
244 fOuterPadPitchWidth/2.;*/
245 Float_t y = x*tan(fInnerAngle/2.)-fInnerWireMount;
246 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
251 fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp;
258 void AliTPCParamCR::Streamer(TBuffer &R__b)
260 // Stream an object of class AliTPC.
262 if (R__b.IsReading()) {
263 AliTPCParamCR::Class()->ReadBuffer(R__b, this);
266 AliTPCParamCR::Class()->WriteBuffer(R__b, this);