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.3 2000/06/30 12:07:50 kowal2
19 Updated from the TPC-PreRelease branch
21 Revision 1.2.4.1 2000/06/14 16:48:24 kowal2
22 Parameter setting improved. Removed compiler warnings
24 Revision 1.2 2000/04/17 09:37:33 kowal2
25 removed obsolete AliTPCDigitsDisplay.C
27 Revision 1.1.4.2 2000/04/10 11:36:13 kowal2
29 New Detector parameters handling class
33 ///////////////////////////////////////////////////////////////////////
34 // Manager and of geomety classes for set: TPC //
36 // !sectors are numbered from 0 //
37 // !pad rows are numbered from 0 //
39 // 27.7. - AliTPCPaaramSr object for TPC
40 // TPC with straight pad rows
41 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
43 ///////////////////////////////////////////////////////////////////////
49 #include <AliTPCParamCR.h>
50 #include "AliTPCPRF2D.h"
51 #include "AliTPCRF1D.h"
55 ClassImp(AliTPCParamCR)
56 const static Int_t kMaxRows=600;
57 const static Float_t kEdgeSectorSpace = 2.5;
59 AliTPCParamCR::AliTPCParamCR()
62 //constructor set the default parameters
66 fFacSigma = Float_t(2.);
71 AliTPCParamCR::~AliTPCParamCR()
74 //destructor destroy some dynmicaly alocated variables
75 if (fInnerPRF != 0) delete fInnerPRF;
76 if (fOuterPRF != 0) delete fOuterPRF;
77 if (fTimeRF != 0) delete fTimeRF;
80 void AliTPCParamCR::SetDefault()
82 //set default TPC param
84 AliTPCParam::SetDefault();
87 Int_t AliTPCParamCR::CalcResponse(Float_t* xyz, Int_t * index, Int_t dummy)
90 //calculate bin response as function of the input position -x
91 //return number of valid response bin
93 //we suppose that coordinata is expressed in float digits
94 // it's mean coordinate system 8
95 //xyz[0] - float padrow xyz[1] is float pad (center pad is number 0) and xyz[2] is float time bin
96 if ( (fInnerPRF==0)||(fOuterPRF==0)||(fTimeRF==0) ){
97 Error("AliTPCParamCR", "response function were not adjusted");
101 Float_t sfpadrow; // sigma of response function
102 Float_t sfpad; // sigma of
103 Float_t sftime= fFacSigma*fTimeRF->GetSigma()/fZWidth; //3 sigma of time response
104 if (index[1]<fNInnerSector){
105 sfpadrow =fFacSigma*fInnerPRF->GetSigmaY()/fInnerPadPitchLength;
106 sfpad =fFacSigma*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth;
108 sfpadrow =fFacSigma*fOuterPRF->GetSigmaY()/fOuterPadPitchLength;
109 sfpad =fFacSigma*fOuterPRF->GetSigmaX()/fOuterPadPitchWidth;
112 Int_t fpadrow = TMath::Nint(xyz[0]-sfpadrow); //"first" padrow
113 Int_t fpad = TMath::Nint(xyz[1]-sfpad); //first pad
114 Int_t ftime = TMath::Nint(xyz[2]+fTimeRF->GetOffset()-sftime); // first time
115 Int_t lpadrow = TMath::Min(TMath::Nint(xyz[0]+sfpadrow),fpadrow+19); //"last" padrow
116 Int_t lpad = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19); //last pad
117 Int_t ltime = TMath::Min(TMath::Nint(xyz[2]+fTimeRF->GetOffset()+sftime),ftime+19); // last time
119 Float_t padres[20][20]; //I don't expect bigger number of bins
121 //calculate padresponse function
123 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
124 for (Int_t pad = fpad;pad<=lpad;pad++){
125 Float_t dy = (xyz[0]-Float_t(padrow));
126 Float_t dx = (xyz[1]-Float_t(pad));
127 if (index[1]<fNInnerSector)
128 padres[padrow-fpadrow][pad-fpad]=fInnerPRF->GetPRF(dx*fInnerPadPitchWidth,dy*fInnerPadPitchLength);
130 padres[padrow-fpadrow][pad-fpad]=fOuterPRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuterPadPitchLength);
132 //calculate time response function
135 for (time = ftime;time<=ltime;time++) timeres[time-ftime]= fTimeRF->GetRF((xyz[2]-Float_t(time))*fZWidth);
137 //write over threshold values to stack
141 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
142 for (Int_t pad = fpad;pad<=lpad;pad++)
143 for (time = ftime;time<=ltime;time++){
144 cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad];
145 if (cweight>fResponseThreshold) {
146 fResponseBin[++cindex3]=padrow;
147 fResponseBin[++cindex3]=pad;
148 fResponseBin[++cindex3]=time;
149 fResponseWeight[++cindex]=cweight;
156 void AliTPCParamCR::CRXYZtoXYZ(Float_t *xyz,
157 const Int_t §or, const Int_t & padrow, Int_t option) const
159 //transform relative coordinates to absolute
160 Bool_t rel = ( (option&2)!=0);
161 Int_t index[2]={sector,padrow};
162 if (rel==kTRUE) Transform4to3(xyz,index);//if the position is relative to pad row
163 Transform2to1(xyz,index);
166 void AliTPCParamCR::XYZtoCRXYZ(Float_t *xyz,
167 Int_t §or, Int_t & padrow, Int_t option) const
169 //transform global position to the position relative to the sector padrow
170 //if option=0 X calculate absolute calculate sector
171 //if option=1 X absolute use input sector
172 //if option=2 X relative to pad row calculate sector
173 //if option=3 X relative use input sector
174 //!!!!!!!!! WE start to calculate rows from row = 0
176 Bool_t rel = ( (option&2)!=0);
178 //option 0 and 2 means that we don't have information about sector
179 if ((option&1)==0) Transform0to1(xyz,index); //we calculate sector number
182 Transform1to2(xyz,index);
183 Transform2to3(xyz,index);
184 //if we store relative position calculate position relative to pad row
185 if (rel==kTRUE) Transform3to4(xyz,index);
192 Bool_t AliTPCParamCR::Update()
196 // update some calculated parameter which must be updated after changing "base"
198 // for example we can change size of pads and according this recalculate number
199 // of pad rows, number of of pads in given row ....
201 if (AliTPCParam::Update()==kFALSE) return kFALSE;
204 // adjust lower sectors pad row positions and pad numbers
205 fNRowLow = (Int_t(1.0001*(fRInnerLastWire-fRInnerFirstWire)/fInnerWWPitch)
206 -2*fInnerDummyWire)/fNInnerWiresPerPad;
207 if ( kMaxRows<fNRowLow) fNRowUp = kMaxRows;
208 if (1>fNRowLow) return kFALSE;
209 Float_t firstpad = fRInnerFirstWire+(fInnerDummyWire-0.5)*fInnerWWPitch
210 +fInnerPadPitchLength/2.;
212 for (i = 0;i<fNRowLow;i++)
214 Float_t x = firstpad +fInnerPadPitchLength*(Float_t)i;
215 Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerFrameSpace-
216 fInnerPadPitchWidth/2.;
218 fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ;
221 // adjust upper sectors pad row positions and pad numbers
222 fNRowUp = (Int_t((fROuterLastWire-fROuterFirstWire+0.001)/fOuterWWPitch)
223 -2*fOuterDummyWire)/fNOuterWiresPerPad;
224 if ( kMaxRows<fNRowUp) fNRowUp = kMaxRows;
225 if (1>fNRowUp) return kFALSE;
226 firstpad = fROuterFirstWire+(fOuterDummyWire-0.5)*fOuterWWPitch
227 +fOuterPadPitchLength/2.;
229 for (i = 0;i<fNRowUp;i++)
231 Float_t x = firstpad + fOuterPadPitchLength*(Float_t)i;
232 Float_t y = (x-0.5*fOuterPadPitchLength)*tan(fOuterAngle/2.)-fOuterFrameSpace-
233 fInnerPadPitchWidth/2.;
235 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
237 fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp;
244 void AliTPCParamCR::Streamer(TBuffer &R__b)
246 // Stream an object of class AliTPC.
248 if (R__b.IsReading()) {
249 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
250 // TObject::Streamer(R__b);
251 AliTPCParam::Streamer(R__b);
252 // if (R__v < 2) return;
255 R__b.WriteVersion(AliTPCParamCR::IsA());
256 //TObject::Streamer(R__b);
257 AliTPCParam::Streamer(R__b);