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.2.4.1 2000/06/14 16:48:24 kowal2
19 Parameter setting improved. Removed compiler warnings
21 Revision 1.2 2000/04/17 09:37:33 kowal2
22 removed obsolete AliTPCDigitsDisplay.C
24 Revision 1.1.4.2 2000/04/10 11:36:13 kowal2
26 New Detector parameters handling class
30 ///////////////////////////////////////////////////////////////////////
31 // Manager and of geomety classes for set: TPC //
33 // !sectors are numbered from 0 //
34 // !pad rows are numbered from 0 //
36 // 27.7. - AliTPCPaaramSr object for TPC
37 // TPC with straight pad rows
38 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
40 ///////////////////////////////////////////////////////////////////////
46 #include <AliTPCParamCR.h>
47 #include "AliTPCPRF2D.h"
48 #include "AliTPCRF1D.h"
52 ClassImp(AliTPCParamCR)
53 const static Int_t kMaxRows=600;
54 const static Float_t kEdgeSectorSpace = 2.5;
56 AliTPCParamCR::AliTPCParamCR()
59 //constructor set the default parameters
63 fFacSigma = Float_t(2.);
68 AliTPCParamCR::~AliTPCParamCR()
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 AliTPCParamCR::SetDefault()
79 //set default TPC param
81 AliTPCParam::SetDefault();
84 Int_t AliTPCParamCR::CalcResponse(Float_t* xyz, Int_t * index, Int_t dummy)
87 //calculate bin response as function of the input position -x
88 //return number of valid response bin
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");
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;
105 sfpadrow =fFacSigma*fOuterPRF->GetSigmaY()/fOuterPadPitchLength;
106 sfpad =fFacSigma*fOuterPRF->GetSigmaX()/fOuterPadPitchWidth;
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
116 Float_t padres[20][20]; //I don't expect bigger number of bins
118 //calculate padresponse function
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);
127 padres[padrow-fpadrow][pad-fpad]=fOuterPRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuterPadPitchLength);
129 //calculate time response function
132 for (time = ftime;time<=ltime;time++) timeres[time-ftime]= fTimeRF->GetRF((xyz[2]-Float_t(time))*fZWidth);
134 //write over threshold values to stack
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;
153 void AliTPCParamCR::CRXYZtoXYZ(Float_t *xyz,
154 const Int_t §or, const Int_t & padrow, Int_t option) const
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);
163 void AliTPCParamCR::XYZtoCRXYZ(Float_t *xyz,
164 Int_t §or, Int_t & padrow, Int_t option) const
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
173 Bool_t rel = ( (option&2)!=0);
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
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);
189 Bool_t AliTPCParamCR::Update()
193 // update some calculated parameter which must be updated after changing "base"
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 ....
198 if (AliTPCParam::Update()==kFALSE) return kFALSE;
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.;
209 for (i = 0;i<fNRowLow;i++)
211 Float_t x = firstpad +fInnerPadPitchLength*(Float_t)i;
212 Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerFrameSpace-
213 fInnerPadPitchWidth/2.;
215 fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ;
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.;
226 for (i = 0;i<fNRowUp;i++)
228 Float_t x = firstpad + fOuterPadPitchLength*(Float_t)i;
229 Float_t y = (x-0.5*fOuterPadPitchLength)*tan(fOuterAngle/2.)-fOuterFrameSpace-
230 fInnerPadPitchWidth/2.;
232 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
234 fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp;
240 void AliTPCParamCR::Streamer(TBuffer &R__b)
242 // Stream an object of class AliTPC.
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;
251 R__b.WriteVersion(AliTPCParamCR::IsA());
252 //TObject::Streamer(R__b);
253 AliTPCParam::Streamer(R__b);