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 ///////////////////////////////////////////////////////////////////////
19 // Manager and of geomety classes for set: TPC //
21 // !sectors are numbered from 0 //
22 // !pad rows are numbered from 0 //
24 // 27.7. - AliTPCPaaramSr object for TPC
25 // TPC with straight pad rows
26 // Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
28 ///////////////////////////////////////////////////////////////////////
31 #include <Riostream.h>
34 #include <AliTPCParamCR.h>
35 #include "AliTPCPRF2D.h"
36 #include "AliTPCRF1D.h"
40 ClassImp(AliTPCParamCR)
41 static const Int_t kMaxRows=600;
42 static const Float_t kEdgeSectorSpace = 2.5;
44 AliTPCParamCR::AliTPCParamCR()
53 //constructor set the default parameters
55 fFacSigma = Float_t(2.);
59 AliTPCParamCR::AliTPCParamCR(const AliTPCParamCR ¶m)
68 // copy constructor - dummy
70 fFacSigma= param.fFacSigma;
72 AliTPCParamCR & AliTPCParamCR::operator =(const AliTPCParamCR & param)
75 // assignment operator - dummy
77 fFacSigma= param.fFacSigma;
80 AliTPCParamCR::~AliTPCParamCR()
83 //destructor destroy some dynmicaly alocated variables
84 if (fInnerPRF != 0) delete fInnerPRF;
85 if (fOuter1PRF != 0) delete fOuter1PRF;
86 if (fOuter2PRF != 0) delete fOuter2PRF;
87 if (fTimeRF != 0) delete fTimeRF;
90 void AliTPCParamCR::SetDefault()
92 //set default TPC param
94 AliTPCParam::SetDefault();
97 Int_t AliTPCParamCR::CalcResponse(Float_t* xyz, Int_t * index, Int_t /*dummy*/)
100 //calculate bin response as function of the input position -x
101 //return number of valid response bin
103 //we suppose that coordinata is expressed in float digits
104 // it's mean coordinate system 8
105 //xyz[0] - float padrow xyz[1] is float pad (center pad is number 0) and xyz[2] is float time bin
106 if ( (fInnerPRF==0)||(fOuter1PRF==0) ||(fOuter2PRF==0)||(fTimeRF==0) ){
107 Error("AliTPCParamCR", "response function were not adjusted");
111 Float_t sfpadrow; // sigma of response function
112 Float_t sfpad; // sigma of
113 Float_t sftime= fFacSigma*fTimeRF->GetSigma()/fZWidth; //3 sigma of time response
114 if (index[1]<fNInnerSector){
115 sfpadrow =fFacSigma*fInnerPRF->GetSigmaY()/fInnerPadPitchLength;
116 sfpad =fFacSigma*fInnerPRF->GetSigmaX()/fInnerPadPitchWidth;
118 if(index[2]<fNRowUp1){
119 sfpadrow =fFacSigma*fOuter1PRF->GetSigmaY()/fOuter1PadPitchLength;
120 sfpad =fFacSigma*fOuter1PRF->GetSigmaX()/fOuterPadPitchWidth;}
121 else{ sfpadrow =fFacSigma*fOuter2PRF->GetSigmaY()/fOuter2PadPitchLength;
122 sfpad =fFacSigma*fOuter2PRF->GetSigmaX()/fOuterPadPitchWidth;}
125 Int_t fpadrow = TMath::Nint(xyz[0]-sfpadrow); //"first" padrow
126 Int_t fpad = TMath::Nint(xyz[1]-sfpad); //first pad
127 Int_t ftime = TMath::Nint(xyz[2]+fTimeRF->GetOffset()-sftime); // first time
128 Int_t lpadrow = TMath::Min(TMath::Nint(xyz[0]+sfpadrow),fpadrow+19); //"last" padrow
129 Int_t lpad = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19); //last pad
130 Int_t ltime = TMath::Min(TMath::Nint(xyz[2]+fTimeRF->GetOffset()+sftime),ftime+19); // last time
132 Float_t padres[20][20]; //I don't expect bigger number of bins
134 //calculate padresponse function
136 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
137 for (Int_t pad = fpad;pad<=lpad;pad++){
138 Float_t dy = (xyz[0]-Float_t(padrow));
139 Float_t dx = (xyz[1]-Float_t(pad));
140 if (index[1]<fNInnerSector)
141 padres[padrow-fpadrow][pad-fpad]=fInnerPRF->GetPRF(dx*fInnerPadPitchWidth,dy*fInnerPadPitchLength);
143 if(index[2]<fNRowUp1){
144 padres[padrow-fpadrow][pad-fpad]=fOuter1PRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuter1PadPitchLength);}
145 else{ padres[padrow-fpadrow][pad-fpad]=fOuter2PRF->GetPRF(dx*fOuterPadPitchWidth,dy*fOuter2PadPitchLength);}}}
147 //calculate time response function
150 for (time = ftime;time<=ltime;time++) timeres[time-ftime]= fTimeRF->GetRF((xyz[2]-Float_t(time))*fZWidth);
152 //write over threshold values to stack
156 for (padrow = fpadrow;padrow<=lpadrow;padrow++)
157 for (Int_t pad = fpad;pad<=lpad;pad++)
158 for (time = ftime;time<=ltime;time++){
159 cweight = timeres[time-ftime]*padres[padrow-fpadrow][pad-fpad];
160 if (cweight>fResponseThreshold) {
161 fResponseBin[++cindex3]=padrow;
162 fResponseBin[++cindex3]=pad;
163 fResponseBin[++cindex3]=time;
164 fResponseWeight[++cindex]=cweight;
171 void AliTPCParamCR::CRXYZtoXYZ(Float_t *xyz,
172 const Int_t §or, const Int_t & padrow, Int_t option) const
174 //transform relative coordinates to absolute
175 Bool_t rel = ( (option&2)!=0);
176 Int_t index[2]={sector,padrow};
177 if (rel==kTRUE) Transform4to3(xyz,index);//if the position is relative to pad row
178 Transform2to1(xyz,index);
181 void AliTPCParamCR::XYZtoCRXYZ(Float_t *xyz,
182 Int_t §or, Int_t & padrow, Int_t option) const
184 //transform global position to the position relative to the sector padrow
185 //if option=0 X calculate absolute calculate sector
186 //if option=1 X absolute use input sector
187 //if option=2 X relative to pad row calculate sector
188 //if option=3 X relative use input sector
189 //!!!!!!!!! WE start to calculate rows from row = 0
191 Bool_t rel = ( (option&2)!=0);
193 //option 0 and 2 means that we don't have information about sector
194 if ((option&1)==0) Transform0to1(xyz,index); //we calculate sector number
197 Transform1to2(xyz,index);
198 Transform2to3(xyz,index);
199 //if we store relative position calculate position relative to pad row
200 if (rel==kTRUE) Transform3to4(xyz,index);
207 Bool_t AliTPCParamCR::Update()
210 if (AliTPCParam::Update()==kFALSE) return kFALSE;
213 Float_t firstrow = fInnerRadiusLow + 2.225 ;
214 for( i= 0;i<fNRowLow;i++)
216 Float_t x = firstrow + fInnerPadPitchLength*(Float_t)i;
218 // number of pads per row
219 /*Float_t y = (x-0.5*fInnerPadPitchLength)*tan(fInnerAngle/2.)-fInnerWireMount-
220 fInnerPadPitchWidth/2.;*/
221 Float_t y = x*tan(fInnerAngle/2.)-fInnerWireMount;
223 fNPadsLow[i] = 1+2*(Int_t)(y/fInnerPadPitchWidth) ;
226 firstrow = fOuterRadiusLow + 1.6;
227 for(i=0;i<fNRowUp;i++)
230 Float_t x = firstrow + fOuter1PadPitchLength*(Float_t)i;
232 /*Float_t y =(x-0.5*fOuter1PadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount-
233 fOuterPadPitchWidth/2.;*/
234 Float_t y = x*tan(fInnerAngle/2.)-fInnerWireMount;
235 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
238 fLastWireUp1=fPadRowUp[i] +0.375;
239 firstrow = fPadRowUp[i] + 0.5*(fOuter1PadPitchLength+fOuter2PadPitchLength);
244 Float_t x = firstrow + fOuter2PadPitchLength*(Float_t)(i-64);
245 /*Float_t y =(x-0.5*fOuter2PadPitchLength)*tan(fOuterAngle/2.)-fOuterWireMount-
246 fOuterPadPitchWidth/2.;*/
247 Float_t y = x*tan(fInnerAngle/2.)-fInnerWireMount;
248 fNPadsUp[i] = 1+2*(Int_t)(y/fOuterPadPitchWidth) ;
253 fNtRows = fNInnerSector*fNRowLow+fNOuterSector*fNRowUp;
260 void AliTPCParamCR::Streamer(TBuffer &R__b)
262 // Stream an object of class AliTPC.
264 if (R__b.IsReading()) {
265 AliTPCParamCR::Class()->ReadBuffer(R__b, this);
268 AliTPCParamCR::Class()->WriteBuffer(R__b, this);