#ifndef ALITPCPARAM_H
#define ALITPCPARAM_H
#include "AliDetectorParam.h"
#include "TMath.h"
#include <TGeoMatrix.h>
#include <TVectorD.h>
class TString;
class TGraphErrors;
class AliTPCParam : public AliDetectorParam {
public:
AliTPCParam();
virtual ~AliTPCParam();
TGeoHMatrix * Tracking2LocalMatrix(const TGeoHMatrix * geoMatrix, Int_t sector) const;
virtual Bool_t Transform(Float_t *xyz, Int_t *index, Int_t* oindex);
Int_t Transform0to1(Float_t *xyz, Int_t *index) const;
void Transform1to2Ideal(Float_t *xyz, Int_t *index) const;
void Transform1to2(Float_t *xyz, Int_t *index) const;
void Transform2to1(Float_t *xyz, Int_t *index) const;
void Transform2to2(Float_t *xyz, Int_t *index, Int_t *oindex) const;
Float_t Transform2to2NearestWire(Float_t *xyz, Int_t *index) const;
Int_t Transform2to3(Float_t *xyz, Int_t *index) const;
void Transform3to4(Float_t *xyz, Int_t *index) const;
void Transform4to3(Float_t *xyz, Int_t *index) const;
void Transform2to5( Float_t *xyz, Int_t *index) const;
void Transform5to2(Float_t *xyz, Int_t *index) const;
void Transform4to8(Float_t *xyz, Int_t *index) const;
void Transform8to4(Float_t *xyz, Int_t *index) const;
void Transform6to8(Float_t *xyz, Int_t *index) const;
void Transform8to6(Float_t *xyz, Int_t *index) const;
virtual Int_t Transform2toPadRow(Float_t *, Int_t *) const{return 0;}
virtual Int_t GetPadRow(Float_t *xyz, Int_t *index) const ;
virtual void XYZtoCRXYZ(Float_t *,
Int_t &, Int_t &, Int_t ) const {;}
virtual void CRXYZtoXYZ(Float_t *,
const Int_t &, const Int_t & , Int_t ) const {;}
virtual void CRTimePadtoYZ(Float_t &, Float_t &,
const Float_t &, const Float_t &,
Int_t , Int_t ){;}
virtual void CRYZtoTimePad(const Float_t &, const Float_t &,
Float_t &, Float_t &,
Int_t , Int_t ){;}
virtual Int_t CalcResponse(Float_t* , Int_t * , Int_t ){return 0;}
virtual void SetDefault();
virtual Bool_t Update();
virtual Bool_t ReadGeoMatrices();
Bool_t GetStatus() const;
Int_t GetIndex(Int_t sector, Int_t row) const;
Int_t GetNSegmentsTotal() const {return fNtRows;}
Double_t GetLowMaxY(Int_t irow) const {return irow*0.;}
Double_t GetUpMaxY(Int_t irow) const {return irow*0;}
Bool_t AdjustSectorRow(Int_t index, Int_t & sector, Int_t &row) const;
void AdjustCosSin(Int_t isec, Float_t &cos, Float_t &sin) const;
Float_t GetAngle(Int_t isec) const;
void SetInnerRadiusLow(Float_t InnerRadiusLow ) { fInnerRadiusLow=InnerRadiusLow;}
void SetOuterRadiusLow(Float_t OuterRadiusLow ) { fOuterRadiusLow=OuterRadiusLow;}
void SetInnerRadiusUp(Float_t InnerRadiusUp) { fInnerRadiusUp= InnerRadiusUp;}
void SetOuterRadiusUp(Float_t OuterRadiusUp) { fOuterRadiusUp= OuterRadiusUp;}
void SetSectorAngles(Float_t innerangle, Float_t innershift, Float_t outerangle,
Float_t outershift);
void SetInnerFrameSpace(Float_t frspace) {fInnerFrameSpace = frspace;}
void SetOuterFrameSpace(Float_t frspace) {fOuterFrameSpace = frspace;}
void SetInnerWireMount(Float_t fmount) {fInnerWireMount = fmount;}
void SetOuterWireMount(Float_t fmount) {fOuterWireMount = fmount;}
void SetZLength(Float_t zlength) {fZLength = zlength;}
void SetGeometryType(Int_t type) {fGeometryType = type;}
void SetRowNLow( Int_t NRowLow){fNRowLow = NRowLow;}
void SetRowNUp1 (Int_t NRowUp1){fNRowUp1 = NRowUp1 ;}
void SetRowNUp2 (Int_t NRowUp2){fNRowUp2 = NRowUp2 ;}
void SetRowNUp (Int_t NRowUp){fNRowUp = NRowUp ;}
void SetInnerNWires(Int_t nWires){ fNInnerWiresPerPad=nWires;}
void SetInnerDummyWire(Int_t dummy) {fInnerDummyWire = dummy;}
void SetInnerOffWire(Float_t offset) {fInnerOffWire =offset;}
void SetOuter1NWires(Int_t nWires){ fNOuter1WiresPerPad=nWires;}
void SetOuter2NWire(Int_t nWires){ fNOuter2WiresPerPad=nWires;}
void SetOuterDummyWire(Int_t dummy) {fOuterDummyWire = dummy;}
void SetOuterOffWire(Float_t offset) {fOuterOffWire =offset;}
void SetInnerWWPitch( Float_t wwPitch) {fInnerWWPitch = wwPitch;}
void SetRInnerFirstWire(Float_t firstWire){fRInnerFirstWire = firstWire;}
void SetRInnerLastWire(Float_t lastWire){fRInnerLastWire = lastWire;}
void SetOuterWWPitch(Float_t wwPitch){fOuterWWPitch = wwPitch;}
void SetLastWireUp1(Float_t wireUp1){fLastWireUp1 = wireUp1;}
void SetROuterFirstWire(Float_t firstWire){fROuterFirstWire = firstWire;}
void SetROuterLastWire(Float_t lastWire){fROuterLastWire = lastWire;}
void SetInnerPadPitchLength(Float_t PadPitchLength){ fInnerPadPitchLength=PadPitchLength;}
void SetInnerPadPitchWidth(Float_t PadPitchWidth){ fInnerPadPitchWidth = PadPitchWidth;}
void SetInnerPadLength(Float_t PadLength){ fInnerPadLength=PadLength;}
void SetInnerPadWidth(Float_t PadWidth) { fInnerPadWidth=PadWidth;}
void SetOuter1PadPitchLength(Float_t PadPitchLength){ fOuter1PadPitchLength=PadPitchLength;}
void SetOuter2PadPitchLength(Float_t PadPitchLength){ fOuter2PadPitchLength=PadPitchLength;}
void SetOuterPadPitchWidth(Float_t PadPitchWidth){ fOuterPadPitchWidth = PadPitchWidth;}
void SetOuter1PadLength(Float_t PadLength){ fOuter1PadLength=PadLength;}
void SetOuter2PadLength(Float_t PadLength){ fOuter2PadLength=PadLength;}
void SetOuterPadWidth(Float_t PadWidth) { fOuterPadWidth=PadWidth;}
void SetMWPCReadout(Bool_t type) {fBMWPCReadout = type;}
void SetNCrossRows(Int_t rows){fNCrossRows = rows;}
void SetDiffT(Float_t DiffT){ fDiffT= DiffT;}
void SetDiffL(Float_t DiffL){ fDiffL=DiffL;}
void SetGasGain(Float_t GasGain){ fGasGain=GasGain;}
void SetDriftV(Float_t DriftV){ fDriftV= DriftV;}
void SetOmegaTau(Float_t OmegaTau){ fOmegaTau=OmegaTau;}
void SetAttCoef(Float_t AttCoef){ fAttCoef=AttCoef;}
void SetOxyCont(Float_t OxyCont){ fOxyCont=OxyCont;}
void SetGainSlopesHV(TGraphErrors * gainSlopesHV){ fGainSlopesHV=gainSlopesHV;}
void SetGainSlopesPT(TGraphErrors * gainSlopesPT){ fGainSlopesPT=gainSlopesPT;}
void SetNominalGainSlopes();
void SetComposition(Float_t c1, Float_t c2, Float_t c3, Float_t c4, Float_t c5, Float_t c6){fComposition[0]=c1;
fComposition[1]=c2;
fComposition[2]=c3;
fComposition[3]=c4;
fComposition[4]=c5;
fComposition[5]=c6;}
void SetFpot(Float_t fpot){fFpot=fpot;}
void SetNprim(Float_t prim){fNprim=prim;}
void SetNtot(Float_t ntot){fNtot=ntot;}
void SetWmean(Float_t wmean){fWmean=wmean;}
void SetExp(Float_t exp){fExp=exp;}
void SetEend(Float_t end){fEend=end;}
void SetBetheBloch(TVectorD *v){
if (fBetheBloch) delete fBetheBloch;
fBetheBloch=0;
if (v) fBetheBloch=new TVectorD(*v);
}
static TVectorD * GetBetheBlochParamNa49();
static TVectorD * GetBetheBlochParamAlice();
static void RegisterBBParam(TVectorD* param, Int_t position);
void SetPadCoupling(Float_t PadCoupling){ fPadCoupling=PadCoupling;}
void SetZeroSup(Int_t ZeroSup) { fZeroSup=ZeroSup;}
void SetNoise(Float_t Noise ) { fNoise= Noise;}
void SetChipGain(Float_t ChipGain){ fChipGain= ChipGain;}
void SetChipNorm(Float_t ChipNorm){ fChipNorm= ChipNorm;}
void SetTSample(Float_t TSample) { fTSample=TSample;}
void SetTFWHM(Float_t fwhm) { fTSigma=fwhm/2.35;}
void SetMaxTBin(Int_t maxtbin) { fMaxTBin = maxtbin;}
void SetADCSat(Int_t adcsat) { fADCSat = adcsat;}
void SetADCDynRange(Float_t adcdynrange) {fADCDynRange = adcdynrange;}
void SetNominalVoltage(Float_t v, UInt_t i) {if (i<72) fNominalVoltage[i]=v;}
void SetMaxVoltageDeviation(Float_t voltage) { fMaxVoltageDeviation=voltage; }
void SetMaxDipVoltage(Float_t voltage) { fMaxDipVoltage=voltage; }
void SetMaxFractionHVbad(Float_t frac ) { fMaxHVfractionBad=frac; }
void SetVoltageDipScanPeriod(Float_t period) { fVoltageDipScanPeriod=period; }
void SetNResponseMax(Int_t max) { fNResponseMax = max;}
void SetResponseThreshold(Int_t threshold) {fResponseThreshold = threshold;}
void SetGateDelay(Float_t delay) {fGateDelay = delay;}
void SetL1Delay(Float_t delay) {fL1Delay = delay;}
void SetNTBinsBeforeL1(UShort_t nbins) {fNTBinsBeforeL1 = nbins;}
Float_t GetInnerRadiusLow() const {return fInnerRadiusLow;}
Float_t GetInnerRadiusUp() const {return fInnerRadiusUp;}
Float_t GetOuterRadiusLow() const {return fOuterRadiusLow;}
Float_t GetOuterRadiusUp() const {return fOuterRadiusUp;}
Float_t GetInnerFrameSpace() const {return fInnerFrameSpace;}
Float_t GetOuterFrameSpace() const {return fOuterFrameSpace;}
Float_t GetInnerWireMount() const {return fInnerWireMount;}
Float_t GetOuterWireMount() const {return fOuterWireMount;}
Float_t GetInnerAngle() const ;
Float_t GetInnerAngleShift() const ;
Float_t GetOuterAngle() const ;
Float_t GetOuterAngleShift() const ;
Int_t GetNInnerSector() const {return fNInnerSector;}
Int_t GetNOuterSector() const {return fNOuterSector;}
Int_t GetNSector() const {return fNSector;}
Float_t GetZLength(Int_t sector=0) const;
Int_t GetGeometryType() const {return fGeometryType;}
Int_t GetInnerNWires() const {return fNInnerWiresPerPad;}
Float_t GetInnerWWPitch() const {return fInnerWWPitch;}
Int_t GetInnerDummyWire() const {return fInnerDummyWire;}
Float_t GetInnerOffWire() const {return fInnerOffWire;}
Float_t GetRInnerFirstWire() const {return fRInnerFirstWire;}
Float_t GetRInnerLastWire() const {return fRInnerLastWire;}
Int_t GetOuter1NWires() const {return fNOuter1WiresPerPad;}
Int_t GetOuter2NWires() const {return fNOuter2WiresPerPad;}
Float_t GetOuterWWPitch() const {return fOuterWWPitch;}
Int_t GetOuterDummyWire() const {return fOuterDummyWire;}
Float_t GetOuterOffWire() const {return fOuterOffWire;}
Float_t GetLastWireUp1() const {return fLastWireUp1;}
Float_t GetROuterFirstWire() const {return fROuterFirstWire;}
Float_t GetROuterLastWire() const {return fROuterLastWire;}
Float_t GetWWPitch(Int_t isector = 0) const {
return ( (isector < fNInnerSector) ? fInnerWWPitch :fOuterWWPitch);}
Float_t GetInnerPadPitchLength() const {return fInnerPadPitchLength;}
Float_t GetInnerPadPitchWidth() const {return fInnerPadPitchWidth;}
Float_t GetInnerPadLength() const {return fInnerPadLength;}
Float_t GetInnerPadWidth() const {return fInnerPadWidth;}
Float_t GetOuter1PadPitchLength() const {return fOuter1PadPitchLength;}
Float_t GetOuter2PadPitchLength() const {return fOuter2PadPitchLength;}
Float_t GetOuterPadPitchWidth() const {return fOuterPadPitchWidth;}
Float_t GetOuter1PadLength() const {return fOuter1PadLength;}
Float_t GetOuter2PadLength() const {return fOuter2PadLength;}
Float_t GetOuterPadWidth() const {return fOuterPadWidth;}
Bool_t GetMWPCReadout() const {return fBMWPCReadout;}
Int_t GetNCrossRows() const {return fNCrossRows;}
Float_t GetPadPitchWidth(Int_t isector = 0) const {
return ( (isector < fNInnerSector) ? fInnerPadPitchWidth :fOuterPadPitchWidth);}
Float_t GetPadPitchLength(Int_t isector = 0, Int_t padrow=0) const
{ if (isector < fNInnerSector) return fInnerPadPitchLength;
else return ((padrow<fNRowUp1) ? fOuter1PadPitchLength:fOuter2PadPitchLength);}
Int_t GetNRowLow() const;
Int_t GetNRowUp() const;
Int_t GetNRowUp1() const;
Int_t GetNRowUp2() const;
Int_t GetNRow(Int_t isec) const {return ((isec<fNInnerSector) ? fNRowLow:fNRowUp);}
Int_t GetNRowsTotal() const {return fNtRows;}
Float_t GetPadRowRadiiLow(Int_t irow) const;
Float_t GetPadRowRadiiUp(Int_t irow) const;
Float_t GetPadRowRadii(Int_t isec,Int_t irow) const {
return ( (isec < fNInnerSector) ?GetPadRowRadiiLow(irow):GetPadRowRadiiUp(irow));}
Int_t GetNPadsLow(Int_t irow) const;
Int_t GetNPadsUp(Int_t irow) const;
Int_t GetNPads(Int_t isector,Int_t irow) const{
return ( (isector < fNInnerSector) ?GetNPadsLow(irow) : GetNPadsUp(irow));}
Int_t GetWireSegment(Int_t sector, Int_t row) const ;
Int_t GetNPadsPerSegment(Int_t segmentID) const;
Float_t GetYInner(Int_t irow) const;
Float_t GetYOuter(Int_t irow) const;
Int_t GetSectorIndex(Float_t angle, Int_t row, Float_t z) const;
Float_t GetChamberCenter(Int_t isec, Float_t * center = 0) const;
TGeoHMatrix *GetTrackingMatrix(Int_t isec) const {
return fTrackingMatrix[isec];}
TGeoHMatrix *GetClusterMatrix(Int_t isec) const {
return fClusterMatrix[isec];}
TGeoHMatrix *GetGlobalMatrix(Int_t isec) const {
return fGlobalMatrix[isec];}
Bool_t IsGeoRead(){ return fGlobalMatrix!=0;}
Float_t GetDiffT() const {return fDiffT;}
Float_t GetDiffL() const {return fDiffL;}
Float_t GetGasGain() const {return fGasGain;}
Float_t GetDriftV() const {return fDriftV;}
Float_t GetOmegaTau() const {return fOmegaTau;}
Float_t GetAttCoef() const {return fAttCoef;}
Float_t GetOxyCont() const {return fOxyCont;}
TGraphErrors * GetGainSlopesHV() const { return fGainSlopesHV;}
TGraphErrors * GetGainSlopesPT() const { return fGainSlopesPT;}
Float_t* GetComposition() {return fComposition;}
Float_t GetFpot()const {return fFpot;}
Float_t GetNprim() const {return fNprim;}
Float_t GetNtot() const {return fNtot;}
Float_t GetWmean()const {return fWmean;}
Float_t GetExp()const {return fExp;}
Float_t GetEend()const {return fEend;}
TVectorD* GetBetheBlochParameters(){return fBetheBloch;}
static Double_t BetheBlochAleph(Double_t bb, Int_t type=0);
Float_t GetPadCoupling() const {return fPadCoupling;}
Int_t GetZeroSup() const {return fZeroSup;}
Float_t GetNoise() const {return fNoise;}
Float_t GetChipGain() const {return fChipGain;}
Float_t GetChipNorm() const {return fChipNorm;}
Float_t GetTSample() const {return fTSample;}
Float_t GetZWidth() const {return fZWidth;}
Float_t GetTFWHM() const {return fTSigma*2.35;}
Float_t GetZSigma() const {return fTSigma*fDriftV;}
virtual Float_t GetZOffset() const {return 3*fTSigma*fDriftV;}
Int_t GetMaxTBin() const {return fMaxTBin;}
Int_t GetADCSat() const {return fADCSat;}
Float_t GetADCDynRange() const {return fADCDynRange;}
Float_t GetTotalNormFac() const {return fTotalNormFac;}
Float_t GetNoiseNormFac() const {return fNoiseNormFac;}
Float_t GetNominalVoltage(UInt_t i) const {return (i<72)?fNominalVoltage[i]:0;}
Float_t GetMaxVoltageDeviation() const { return fMaxVoltageDeviation; }
Float_t GetMaxDipVoltage() const { return fMaxDipVoltage; }
Float_t GetMaxFractionHVbad() const { return fMaxHVfractionBad; }
Float_t GetVoltageDipScanPeriod() const { return fVoltageDipScanPeriod; }
Int_t * GetResBin(Int_t i);
Float_t & GetResWeight(Int_t i);
Float_t GetGateDelay() const {return fGateDelay;}
Float_t GetL1Delay() const {return fL1Delay;}
UShort_t GetNTBinsBeforeL1() const {return fNTBinsBeforeL1;}
Float_t GetNTBinsL1() const {return fNTBinsL1;}
protected :
Bool_t fbStatus;
Float_t fInnerRadiusLow;
Float_t fInnerRadiusUp;
Float_t fOuterRadiusUp;
Float_t fOuterRadiusLow;
Float_t fInnerAngle;
Float_t fInnerAngleShift;
Float_t fOuterAngle;
Float_t fOuterAngleShift;
Float_t fInnerFrameSpace;
Float_t fOuterFrameSpace;
Float_t fInnerWireMount;
Float_t fOuterWireMount;
Int_t fNInnerSector;
Int_t fNOuterSector;
Int_t fNSector;
Float_t fZLength;
Float_t *fRotAngle;
Int_t fGeometryType;
TGeoHMatrix **fTrackingMatrix;
TGeoHMatrix **fClusterMatrix;
TGeoHMatrix **fGlobalMatrix;
Int_t fNInnerWiresPerPad;
Float_t fInnerWWPitch;
Int_t fInnerDummyWire;
Float_t fInnerOffWire;
Float_t fRInnerFirstWire;
Float_t fRInnerLastWire;
Float_t fLastWireUp1;
Int_t fNOuter1WiresPerPad;
Int_t fNOuter2WiresPerPad;
Float_t fOuterWWPitch;
Int_t fOuterDummyWire;
Float_t fOuterOffWire;
Float_t fROuterFirstWire;
Float_t fROuterLastWire;
Float_t fInnerPadPitchLength;
Float_t fInnerPadPitchWidth;
Float_t fInnerPadLength;
Float_t fInnerPadWidth;
Float_t fOuter1PadPitchLength;
Float_t fOuter2PadPitchLength;
Float_t fOuterPadPitchWidth;
Float_t fOuter1PadLength;
Float_t fOuter2PadLength;
Float_t fOuterPadWidth;
Bool_t fBMWPCReadout;
Int_t fNCrossRows;
Int_t fNRowLow;
Int_t fNRowUp1;
Int_t fNRowUp2;
Int_t fNRowUp;
Int_t fNtRows;
Float_t fPadRowLow[600];
Float_t fPadRowUp[600];
Int_t fNPadsLow[600];
Int_t fNPadsUp[600];
Float_t fYInner[600];
Float_t fYOuter[600];
Float_t fDiffT;
Float_t fDiffL;
Float_t fGasGain;
Float_t fDriftV;
Float_t fOmegaTau;
Float_t fAttCoef;
Float_t fOxyCont;
Float_t fFpot;
Float_t fNprim;
Float_t fNtot;
Float_t fWmean;
Float_t fExp;
Float_t fEend;
TVectorD* fBetheBloch;
Float_t fComposition[6];
TGraphErrors * fGainSlopesHV;
TGraphErrors * fGainSlopesPT;
Float_t fPadCoupling;
Int_t fZeroSup;
Float_t fNoise;
Float_t fChipGain;
Float_t fChipNorm;
Float_t fTSample;
Float_t fZWidth;
Float_t fTSigma;
Int_t fMaxTBin;
Int_t fADCSat;
Float_t fADCDynRange;
Float_t fTotalNormFac;
Float_t fNoiseNormFac;
Float_t fNominalVoltage[72];
Float_t fMaxVoltageDeviation;
Float_t fMaxDipVoltage;
Float_t fMaxHVfractionBad;
Float_t fVoltageDipScanPeriod;
Int_t fNResponseMax;
Float_t fResponseThreshold;
Int_t fCurrentMax;
Int_t *fResponseBin;
Float_t *fResponseWeight;
Float_t fGateDelay;
Float_t fL1Delay;
UShort_t fNTBinsBeforeL1;
Float_t fNTBinsL1;
protected:
static TObjArray *fBBParam;
private:
AliTPCParam(const AliTPCParam &);
AliTPCParam & operator=(const AliTPCParam &);
void CleanGeoMatrices();
ClassDef(AliTPCParam,8)
};
inline Int_t * AliTPCParam::GetResBin(Int_t i)
{
if (i<fCurrentMax) return &fResponseBin[i*3];
else return 0;
}
inline Float_t &AliTPCParam::GetResWeight(Int_t i)
{
if (i<fCurrentMax) return fResponseWeight[i];
else return fResponseWeight[i];
}
inline void AliTPCParam::AdjustCosSin(Int_t isec, Float_t &cos, Float_t &sin) const
{
cos=fRotAngle[isec*4];
sin=fRotAngle[isec*4+1];
}
inline Float_t AliTPCParam::GetAngle(Int_t isec) const
{
return fRotAngle[isec*4+2];
}
inline void AliTPCParam::Transform1to2Ideal(Float_t *xyz, Int_t *index) const
{
Float_t cos,sin;
AdjustCosSin(index[1],cos,sin);
Float_t x1=xyz[0]*cos + xyz[1]*sin;
Float_t y1=-xyz[0]*sin + xyz[1]*cos;
xyz[0]=x1;
xyz[1]=y1;
xyz[2]=fZLength-TMath::Abs(xyz[2]);
index[0]=2;
}
inline void AliTPCParam::Transform1to2(Float_t *xyz, Int_t *index) const
{
Double_t xyzmaster[3] = {xyz[0],xyz[1],xyz[2]};
Double_t xyzlocal[3]={0,0,0};
if (index[1]>=0 && index[1]<fNSector)
fGlobalMatrix[index[1]]->MasterToLocal(xyzmaster,xyzlocal);
xyz[0] = xyzlocal[0];
xyz[1] = xyzlocal[1];
xyz[2] = xyzlocal[2];
index[0]=2;
}
inline void AliTPCParam::Transform2to1(Float_t *xyz, Int_t *index) const
{
Float_t cos,sin;
AdjustCosSin(index[1],cos,sin);
Float_t x1=xyz[0]*cos - xyz[1]*sin;
Float_t y1=xyz[0]*sin + xyz[1]*cos;
xyz[0]=x1;
xyz[1]=y1;
xyz[2]=fZLength-xyz[2];
if (index[1]<fNInnerSector)
{if ( index[1]>=(fNInnerSector>>1)) xyz[2]*=-1.;}
else
{if ( (index[1]-fNInnerSector) >= (fNOuterSector>>1) ) xyz[2]*=-1;}
index[0]=1;
}
inline void AliTPCParam::Transform2to2(Float_t *xyz, Int_t *index, Int_t *oindex) const
{
Transform2to1(xyz,index);
Transform1to2(xyz,oindex);
index[0]=2;
index[1]=oindex[1];
}
inline Float_t AliTPCParam::Transform2to2NearestWire(Float_t *xyz, Int_t *index) const
{
Float_t xnew,dx;
if (index[1]<fNInnerSector) {
xnew = fRInnerFirstWire+TMath::Nint((xyz[0]-fRInnerFirstWire)/fInnerWWPitch)*fInnerWWPitch;
}
else {
xnew = fROuterFirstWire+TMath::Nint((xyz[0]-fROuterFirstWire)/fOuterWWPitch)*fOuterWWPitch;
}
dx = xnew-xyz[0];
xyz[0]=xnew;
return dx;
}
inline Int_t AliTPCParam::Transform2to3(Float_t *xyz, Int_t *index) const
{
if (index[1]<fNInnerSector)
index[2] =TMath::Nint((xyz[0]-fPadRowLow[0])/fInnerPadPitchLength);
else
if (xyz[0] < fLastWireUp1 )
index[2] = TMath::Nint((xyz[0]-fPadRowUp[0])/fOuter1PadPitchLength);
else
index[2] = TMath::Nint(fNRowUp1+(xyz[0]-fPadRowUp[64])/fOuter2PadPitchLength);
index[0]=3;
return index[2];
}
inline void AliTPCParam::Transform3to4(Float_t *xyz, Int_t *index) const
{
if (index[1]<fNInnerSector)
xyz[0] -=index[2]*fInnerPadPitchLength+fPadRowLow[0];
else
if (index[2]<fNRowUp1)
xyz[0] -=index[2]*fOuter1PadPitchLength+fPadRowUp[0];
else
xyz[0] -=(index[2]-fNRowUp1)*fOuter2PadPitchLength+fPadRowUp[64];
index[0] =4;
}
inline void AliTPCParam::Transform4to3(Float_t *xyz, Int_t *index) const
{
if (index[1]<fNInnerSector)
xyz[0] +=index[2]*fInnerPadPitchLength+fPadRowLow[0];
else
if(index[2]<fNRowUp1)
xyz[0] +=index[2]*fOuter1PadPitchLength+fPadRowUp[0];
else
xyz[0] +=index[2]*fOuter2PadPitchLength+fPadRowUp[64];
index[0] =3;
}
inline void AliTPCParam::Transform2to5( Float_t *xyz, Int_t *index) const
{
Float_t angle;
Float_t r = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
if ((xyz[0]==0)&&(xyz[1]==0)) angle = 0;
else
{
angle =TMath::ASin(xyz[1]/r);
if (xyz[0]<0) angle=TMath::Pi()-angle;
if ( (xyz[0]>0) && (xyz[1]<0) ) angle=2*TMath::Pi()+angle;
}
xyz[0]=r;
xyz[1]=angle;
index[0]=5;
}
inline void AliTPCParam::Transform5to2( Float_t *xyz, Int_t *index) const
{
Float_t r = xyz[0];
Float_t angle= xyz[1];
xyz[0]=r*TMath::Cos(angle);
xyz[1]=r*TMath::Sin(angle);
index[0]=2;
}
inline void AliTPCParam::Transform4to8(Float_t *xyz, Int_t *index) const
{
if (index[1]<fNInnerSector) {
if ( index[1]>=(fNInnerSector>>1)) xyz[1]*=-1.;
}
else {
if ( (index[1]-fNInnerSector) >= (fNOuterSector>>1) ) xyz[1]*=-1;
}
xyz[2]/=fZWidth;
if (index[1]<fNInnerSector) {
xyz[0]/=fInnerPadPitchLength;
xyz[1]/=fInnerPadPitchWidth;
}
else{
xyz[1]/=fOuterPadPitchWidth;
if (index[2]<fNRowUp1 ) xyz[0]/=fOuter1PadPitchLength;
else xyz[0]/=fOuter2PadPitchLength;
}
xyz[1]-=0.5;
index[0]=8;
}
inline void AliTPCParam::Transform8to4(Float_t *xyz, Int_t *index) const
{
if (index[1]<fNInnerSector) {
if ( index[1]>=(fNInnerSector>>1)) xyz[1]*=-1.;
}
else {
if ( (index[1]-fNInnerSector) >= (fNOuterSector>>1) ) xyz[1]*=-1;
}
xyz[2]*=fZWidth;
if (index[1]<fNInnerSector) {
xyz[0]*=fInnerPadPitchLength;
xyz[1]*=fInnerPadPitchWidth;
}
else{
xyz[1]*=fOuterPadPitchWidth;
if (index[2] < fNRowUp1 ) xyz[0]*=fOuter1PadPitchLength;
else xyz[0]*=fOuter2PadPitchLength;
}
index[0]=4;
}
inline void AliTPCParam::Transform6to8(Float_t *xyz, Int_t *index) const
{
xyz[2]/=fZWidth;
if (index[1]<fNInnerSector) {
xyz[0]/=fInnerPadPitchLength;
xyz[1]*=xyz[0]/fInnerPadPitchWidth;
}
else{
xyz[1]*=xyz[0]/fOuterPadPitchWidth;
if (index[2] < fNRowUp1 ) xyz[0]/=fOuter1PadPitchLength;
else xyz[0]/=fOuter2PadPitchLength;
}
index[0]=8;
}
inline void AliTPCParam::Transform8to6(Float_t *xyz, Int_t *index) const
{
xyz[2]*=fZWidth;
if (index[1]<fNInnerSector) {
xyz[0]*=fInnerPadPitchLength;
xyz[1]/=xyz[0]/fInnerPadPitchWidth;
}
else{
xyz[1]/=xyz[0]/fOuterPadPitchWidth;
if (index[2] < fNRowUp1 ) xyz[0]*=fOuter1PadPitchLength;
else xyz[0]*=fOuter2PadPitchLength;
}
index[0]=6;
}
inline Float_t AliTPCParam::GetZLength(Int_t sector) const
{ if(sector <18 || (sector>35&§or<54)) return fZLength-0.275;
else return fZLength-0.302;
}
#endif