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 <AliTPCParamCR.h>
44 ClassImp(AliTPCParamCR)
45 const static Int_t kMaxRows=600;
46 const static Float_t kEdgeSectorSpace = 2.5;
48 AliTPCParamCR::AliTPCParamCR()
51 //constructor set the default parameters
55 fFacSigma = Float_t(2.);
60 AliTPCParamCR::~AliTPCParamCR()
63 //destructor destroy some dynmicaly alocated variables
64 if (fInnerPRF != 0) delete fInnerPRF;
65 if (fOuterPRF != 0) delete fOuterPRF;
66 if (fTimeRF != 0) delete fTimeRF;
69 void AliTPCParamCR::SetDefault()
71 //set default TPC param
73 AliTPCParam::SetDefault();
76 Int_t AliTPCParamCR::CalcResponse(Float_t* xyz, Int_t * index)
79 //calculate bin response as function of the input position -x
80 //return number of valid response bin
82 //we suppose that coordinata is expressed in float digits
83 // it's mean coordinate system 8
84 //xyz[0] - float padrow xyz[1] is float pad (center pad is number 0) and xyz[2] is float time bin
85 if ( (fInnerPRF==0)||(fOuterPRF==0)||(fTimeRF==0) ){
86 Error("AliTPCParamCR", "response function were not adjusted");
90 Float_t sfpadrow; // sigma of response function
91 Float_t sfpad; // sigma of
92 Float_t sftime= fFacSigma*fTimeRF->GetSigma()/fZWidth; //3 sigma of time response
93 if (index[1]<fNInnerSector){
94 sfpadrow =fFacSigma*fInnerPRF->GetSigmaY()/fInnerPadPitchLength;
95 sfpad =fFacSigma*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth;
97 sfpadrow =fFacSigma*fOuterPRF->GetSigmaY()/fOuterPadPitchLength;
98 sfpad =fFacSigma*fOuterPRF->GetSigmaX()/fOuterPadPitchWidth;
101 Int_t fpadrow = TMath::Nint(xyz[0]-sfpadrow); //"first" padrow
102 Int_t fpad = TMath::Nint(xyz[1]-sfpad); //first pad
103 Int_t ftime = TMath::Nint(xyz[2]+fTimeRF->GetOffset()-sftime); // first time
104 Int_t lpadrow = TMath::Min(TMath::Nint(xyz[0]+sfpadrow),fpadrow+19); //"last" padrow
105 Int_t lpad = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19); //last pad
106 Int_t ltime = TMath::Min(TMath::Nint(xyz[2]+fTimeRF->GetOffset()+sftime),ftime+19); // last time
108 Float_t padres[20][20]; //I don't expect bigger number of bins
110 //calculate padresponse function
112 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
113 for (Int_t pad = fpad;pad<=lpad;pad++){
114 Float_t dy = (xyz[0]-Float_t(padrow));
115 Float_t dx = (xyz[1]-Float_t(pad));
116 if (index[1]<fNInnerSector)
117 padres[padrow-fpadrow][pad-fpad]=fInnerPRF->GetPRF(dx*fInnerPadPitchWidth,dy*fInnerPadPitchLength);
119 padres[padrow-fpadrow][pad-fpad]=fOuterPRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuterPadPitchLength);
121 //calculate time response function
124 for (time = ftime;time<=ltime;time++) timeres[time-ftime]= fTimeRF->GetRF((xyz[2]-Float_t(time))*fZWidth);
126 //write over threshold values to stack
130 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
131 for (Int_t pad = fpad;pad<=lpad;pad++)
132 for (time = ftime;time<=ltime;time++){
133 cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad];
134 if (cweight>fResponseThreshold) {
135 fResponseBin[++cindex3]=padrow;
136 fResponseBin[++cindex3]=pad;
137 fResponseBin[++cindex3]=time;
138 fResponseWeight[++cindex]=cweight;
145 void AliTPCParamCR::CRXYZtoXYZ(Float_t *xyz,
146 const Int_t §or, const Int_t & padrow, Int_t option) const
148 //transform relative coordinates to absolute
149 Bool_t rel = ( (option&2)!=0);
150 Int_t index[2]={sector,padrow};
151 if (rel==kTRUE) Transform4to3(xyz,index);//if the position is relative to pad row
152 Transform2to1(xyz,index);
155 void AliTPCParamCR::XYZtoCRXYZ(Float_t *xyz,
156 Int_t §or, Int_t & padrow, Int_t option) const
158 //transform global position to the position relative to the sector padrow
159 //if option=0 X calculate absolute calculate sector
160 //if option=1 X absolute use input sector
161 //if option=2 X relative to pad row calculate sector
162 //if option=3 X relative use input sector
163 //!!!!!!!!! WE start to calculate rows from row = 0
165 Bool_t rel = ( (option&2)!=0);
167 //option 0 and 2 means that we don't have information about sector
168 if ((option&1)==0) Transform0to1(xyz,index); //we calculate sector number
171 Transform1to2(xyz,index);
172 Transform2to3(xyz,index);
173 //if we store relative position calculate position relative to pad row
174 if (rel==kTRUE) Transform3to4(xyz,index);
181 Bool_t AliTPCParamCR::Update()
185 // update some calculated parameter which must be updated after changing "base"
187 // for example we can change size of pads and according this recalculate number
188 // of pad rows, number of of pads in given row ....
190 if (AliTPCParam::Update()==kFALSE) return kFALSE;
193 // adjust lower sectors pad row positions and pad numbers
194 fNRowLow = (Int_t(1.0001*(fRInnerLastWire-fRInnerFirstWire)/fInnerWWPitch)
195 -2*fInnerDummyWire)/fNInnerWiresPerPad;
196 if ( kMaxRows<fNRowLow) fNRowUp = kMaxRows;
197 if (1>fNRowLow) return kFALSE;
198 Float_t firstpad = fRInnerFirstWire+(fInnerDummyWire-0.5)*fInnerWWPitch
199 +fInnerPadPitchLength/2.;
201 for (i = 0;i<fNRowLow;i++)
203 Float_t x = firstpad +fInnerPadPitchLength*(Float_t)i;
204 Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerFrameSpace-
205 fInnerPadPitchWidth/2.;
207 fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ;
210 // adjust upper sectors pad row positions and pad numbers
211 fNRowUp = (Int_t((fROuterLastWire-fROuterFirstWire+0.001)/fOuterWWPitch)
212 -2*fOuterDummyWire)/fNOuterWiresPerPad;
213 if ( kMaxRows<fNRowUp) fNRowUp = kMaxRows;
214 if (1>fNRowUp) return kFALSE;
215 firstpad = fROuterFirstWire+(fOuterDummyWire-0.5)*fOuterWWPitch
216 +fOuterPadPitchLength/2.;
218 for (i = 0;i<fNRowUp;i++)
220 Float_t x = firstpad + fOuterPadPitchLength*(Float_t)i;
221 Float_t y = (x-0.5*fOuterPadPitchLength)*tan(fOuterAngle/2.)-fOuterFrameSpace-
222 fInnerPadPitchWidth/2.;
224 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
226 fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp;
232 void AliTPCParamCR::Streamer(TBuffer &R__b)
234 // Stream an object of class AliTPC.
236 if (R__b.IsReading()) {
237 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
238 // TObject::Streamer(R__b);
239 AliTPCParam::Streamer(R__b);
240 // if (R__v < 2) return;
243 R__b.WriteVersion(AliTPCParamCR::IsA());
244 //TObject::Streamer(R__b);
245 AliTPCParam::Streamer(R__b);