From 9430b11abe82c45a1ed8b32c3b7dd193e288cd93 Mon Sep 17 00:00:00 2001 From: marian Date: Fri, 27 Feb 2009 19:57:14 +0000 Subject: [PATCH] AliTPCTransform.cxx AliTPCTransform.h Adding data members - RecoParam, Run number and time stamp Needed to calculate time dependent correction - inside run AliTPCRecoParam.cxx AliTPCRecoParam.h Possibility to switch OFF TOF correction AliTPCCalibVdrift.h AliTPCCalibVdrift.cxx Defining the default values, calculate default T/P correction for drift velocit y It is first order correction --- TPC/AliTPCCalibVdrift.cxx | 31 ++++++++++--- TPC/AliTPCCalibVdrift.h | 12 ++++-- TPC/AliTPCRecoParam.cxx | 5 ++- TPC/AliTPCRecoParam.h | 8 ++++ TPC/AliTPCTransform.cxx | 91 ++++++++++++++++++++++++++++++--------- TPC/AliTPCTransform.h | 11 +++++ 6 files changed, 128 insertions(+), 30 deletions(-) diff --git a/TPC/AliTPCCalibVdrift.cxx b/TPC/AliTPCCalibVdrift.cxx index bbfed36de97..4c0436fdacd 100644 --- a/TPC/AliTPCCalibVdrift.cxx +++ b/TPC/AliTPCCalibVdrift.cxx @@ -61,6 +61,14 @@ namespace paramDefinitions { Double_t krho = 0.934246; // density of TPC-Gas [kg/m^3] // method of calculation: weighted average Double_t kg = 9.81; + + // + // Nominal value obtained from 2008 data + // + const Double_t kKelvin =273.15; // degree to Kelvin + const Double_t kNominalTemp =19.03; // mean between A and C side in degree + const Double_t kNominalPress =973.9; // pressure sensor - in mbar- + // calibDB->GetPressure(tstamp,irun,1) } @@ -71,7 +79,9 @@ AliTPCCalibVdrift::AliTPCCalibVdrift(AliTPCSensorTempArray *SensTemp, AliDCSSens fSensTemp(0), fSensPres(0), fTempMap(0), - fSensGasComp(0) + fSensGasComp(0), + fNominalTemp(0), // nominal temperature in Kelvin + fNominalPress(0) // nominal pressure in mbar { // // Standard constructor @@ -85,6 +95,8 @@ AliTPCCalibVdrift::AliTPCCalibVdrift(AliTPCSensorTempArray *SensTemp, AliDCSSens fTempMap = 0; } fSensGasComp = SensGasComp; + fNominalTemp = kNominalTemp; + fNominalPress= kNominalPress; } //_____________________________________________________________________________ @@ -93,7 +105,10 @@ AliTPCCalibVdrift::AliTPCCalibVdrift(const AliTPCCalibVdrift& source) : fSensTemp(source.fSensTemp), fSensPres(source.fSensPres), fTempMap(source.fTempMap), - fSensGasComp(source.fSensGasComp) + fSensGasComp(source.fSensGasComp), + fNominalTemp(source.fNominalTemp), // nominal temperature in Kelvin + fNominalPress(source.fNominalPress) // nominal pressure in mbar + { // // Copy constructor @@ -138,11 +153,15 @@ Double_t AliTPCCalibVdrift::GetPTRelative(UInt_t absTimeSec, Int_t side){ fitter->GetParameters(vec); delete fitter; if (vec[0]<10) return 0; - Double_t temperature = vec[0]+273.15; - Double_t povertMeas = pressure/temperature; - Double_t povertNom = kstdP/(torrTokPascal*kstdT); + // + // + // + Double_t temperature = vec[0]; //vec[0] temeperature + Double_t tpnom = (fNominalTemp+kKelvin)/(fNominalPress); + Double_t tpmeasured = (temperature+kKelvin)/(pressure); + Double_t result = (tpmeasured-tpnom)/tpnom; - return povertMeas/povertNom; + return result; } diff --git a/TPC/AliTPCCalibVdrift.h b/TPC/AliTPCCalibVdrift.h index af3134512ff..b7f2b2a3202 100644 --- a/TPC/AliTPCCalibVdrift.h +++ b/TPC/AliTPCCalibVdrift.h @@ -11,7 +11,7 @@ class TObject; class AliTPCSensorTempArray; class TGraph; - +class AliTPCTempMap; class AliTPCCalibVdrift : public TNamed { public: @@ -35,14 +35,20 @@ public: Double_t GetMeanZVdriftChange(Double_t x, Double_t y, UInt_t absTimeSec); TGraph *MakeGraphMeanZVdriftChange(Double_t x, Double_t y, Int_t nPoints); + Float_t GetNominalTemperature(){return fNominalTemp;} + Float_t GetNominalPressure(){return fNominalPress;} protected: - + // AliTPCSensorTempArray *fSensTemp; // Temperature sensors AliDCSSensor *fSensPres; // pressure sensor (cavernpress in GRP) AliTPCTempMap *fTempMap; // Temperature Map TObject *fSensGasComp; // placeholder for GasConzentration infos - + // + // Nominal values + // + Float_t fNominalTemp; // nominal temperature in Kelvin + Float_t fNominalPress; // nominal pressure in mbar ClassDef(AliTPCCalibVdrift,1); }; diff --git a/TPC/AliTPCRecoParam.cxx b/TPC/AliTPCRecoParam.cxx index 0c043e78406..4c418291501 100644 --- a/TPC/AliTPCRecoParam.cxx +++ b/TPC/AliTPCRecoParam.cxx @@ -80,7 +80,8 @@ AliTPCRecoParam::AliTPCRecoParam(): fMaxC(0.3), fBSpecialSeeding(kFALSE), fBKinkFinder(kTRUE), - fLastSeedRowSec(120) + fLastSeedRowSec(120), + fUseTOFCorrection(kTRUE) { // // constructor @@ -160,6 +161,7 @@ AliTPCRecoParam *AliTPCRecoParam::GetLaserTestParam(Bool_t bPedestal){ param->fMaxSnpTracker = 0.98; param->fMaxC = 0.02; param->fBSpecialSeeding = kTRUE; + param->fUseTOFCorrection=kFALSE; // // param->SetName("Laser Flux"); @@ -181,6 +183,7 @@ AliTPCRecoParam *AliTPCRecoParam::GetCosmicTestParam(Bool_t bPedestal){ param->fBSpecialSeeding = kTRUE; param->fMaxC = 0.07; param->fBKinkFinder = kFALSE; + param->fUseTOFCorrection =kFALSE; param->SetName("Cosmic Flux"); param->SetTitle("Cosmic Flux"); diff --git a/TPC/AliTPCRecoParam.h b/TPC/AliTPCRecoParam.h index 6a512dbcb21..cefa4d919b3 100644 --- a/TPC/AliTPCRecoParam.h +++ b/TPC/AliTPCRecoParam.h @@ -54,6 +54,10 @@ class AliTPCRecoParam : public AliDetectorRecoParam Float_t GetMaxC() const { return fMaxC;} Bool_t GetSpecialSeeding() const { return fBSpecialSeeding;} // + // Correction setup + // + Bool_t GetUseTOFCorrection() {return fUseTOFCorrection;} + // void SetSystematicError(Double_t *systematic){ for (Int_t i=0; i<5;i++) fSystematicErrors[i]=systematic[i];} const Double_t * GetSystematicError() const { return fSystematicErrors;} @@ -91,6 +95,10 @@ class AliTPCRecoParam : public AliDetectorRecoParam Bool_t fBKinkFinder; // do kink finder reconstruction Int_t fLastSeedRowSec; // Most Inner Row to make seeding for secondaries // + // Correction switches + // + Bool_t fUseTOFCorrection; // switch - kTRUE use TOF correction kFALSE - do not use + // // misscalibration // Double_t fSystematicErrors[5]; //systematic errors in the track parameters - to be added to TPC covariance matrix diff --git a/TPC/AliTPCTransform.cxx b/TPC/AliTPCTransform.cxx index 885a4b42128..81cd03669bd 100755 --- a/TPC/AliTPCTransform.cxx +++ b/TPC/AliTPCTransform.cxx @@ -60,13 +60,36 @@ #include "AliLog.h" #include "AliTPCExB.h" #include "TGeoMatrix.h" +#include "AliTPCRecoParam.h" +#include "AliTPCCalibVdrift.h" #include "AliTPCTransform.h" ClassImp(AliTPCTransform) - AliTPCTransform::AliTPCTransform(): - AliTransform() +AliTPCTransform::AliTPCTransform(): + AliTransform(), + fCurrentRecoParam(0), //! current reconstruction parameters + fCurrentRun(0), //! current run + fCurrentTimeStamp(0) //! current time stamp +{ + // + // Speed it up a bit! + // + for (Int_t i=0;i<18;++i) { + Double_t alpha=TMath::DegToRad()*(10.+20.*(i%18)); + fSins[i]=TMath::Sin(alpha); + fCoss[i]=TMath::Cos(alpha); + } + fPrimVtx[0]=0; + fPrimVtx[1]=0; + fPrimVtx[2]=0; +} +AliTPCTransform::AliTPCTransform(const AliTPCTransform& transform): + AliTransform(transform), + fCurrentRecoParam(transform.fCurrentRecoParam), //! current reconstruction parameters + fCurrentRun(transform.fCurrentRun), //! current run + fCurrentTimeStamp(transform.fCurrentTimeStamp) //! current time stamp { // // Speed it up a bit! @@ -117,7 +140,7 @@ void AliTPCTransform::Transform(Double_t *x,Int_t *i,UInt_t /*time*/, Int_t row=TMath::Nint(x[0]); Int_t pad=TMath::Nint(x[1]); Int_t sector=i[0]; - AliTPCcalibDB* calib=AliTPCcalibDB::Instance(); + AliTPCcalibDB* calib=AliTPCcalibDB::Instance(); // AliTPCCalPad * time0TPC = calib->GetPadTime0(); AliTPCParam * param = calib->GetParameters(); @@ -151,23 +174,29 @@ void AliTPCTransform::Transform(Double_t *x,Int_t *i,UInt_t /*time*/, // // Time of flight correction // - const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector(); - Float_t sign=1; - if (sector < kNIS) { - sign = (sector < kNIS/2) ? 1 : -1; - } else { - sign = ((sector-kNIS) < kNOS/2) ? 1 : -1; + if (fCurrentRecoParam&&fCurrentRecoParam->GetUseTOFCorrection()){ + const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector(); + Float_t sign=1; + if (sector < kNIS) { + sign = (sector < kNIS/2) ? 1 : -1; + } else { + sign = ((sector-kNIS) < kNOS/2) ? 1 : -1; + } + Float_t deltaDr =0; + Float_t dist=0; + dist+=(fPrimVtx[0]-x[0])*(fPrimVtx[0]-x[0]); + dist+=(fPrimVtx[1]-x[1])*(fPrimVtx[1]-x[1]); + dist+=(fPrimVtx[2]-x[2])*(fPrimVtx[2]-x[2]); + dist = TMath::Sqrt(dist); + // drift length correction because of TOF + // the drift velocity is in cm/s therefore multiplication by 0.01 + deltaDr = (dist*(0.01*param->GetDriftV()))/TMath::C(); + xx[2]+=sign*deltaDr; } - Float_t deltaDr =0; - Float_t dist=0; - dist+=(fPrimVtx[0]-x[0])*(fPrimVtx[0]-x[0]); - dist+=(fPrimVtx[1]-x[1])*(fPrimVtx[1]-x[1]); - dist+=(fPrimVtx[2]-x[2])*(fPrimVtx[2]-x[2]); - dist = TMath::Sqrt(dist); - // drift length correction because of TOF - // the drift velocity is in cm/s therefore multiplication by 0.01 - deltaDr = (dist*(0.01*param->GetDriftV()))/TMath::C(); - xx[2]+=sign*deltaDr; + // + // + // + // Global2RotatedGlobal(sector,xx); // @@ -186,8 +215,30 @@ void AliTPCTransform::Local2RotatedGlobal(Int_t sector, Double_t *x) const { // // // + const Int_t kMax =60; // cache for 60 seconds + static Int_t lastStamp=-1; //cached values + static Double_t lastCorr = 1; + // AliTPCcalibDB* calib=AliTPCcalibDB::Instance(); AliTPCParam * param = calib->GetParameters(); + AliTPCCalibVdrift *driftCalib = AliTPCcalibDB::Instance()->GetVdrift(fCurrentRun); + Double_t driftCorr = 1.; + if (driftCalib){ + // + // caching drift correction - temp. fix + // Extremally slow procedure + if ( TMath::Abs((lastStamp)-Int_t(fCurrentTimeStamp))GetPTRelative(fCurrentTimeStamp,0)+ driftCalib->GetPTRelative(fCurrentTimeStamp,1))*0.5; + lastCorr=driftCorr; + lastStamp=fCurrentTimeStamp; + + } + } + + + if (!param){ AliFatal("Parameters missing"); } @@ -196,7 +247,7 @@ void AliTPCTransform::Local2RotatedGlobal(Int_t sector, Double_t *x) const { // const Int_t kNIS=param->GetNInnerSector(), kNOS=param->GetNOuterSector(); Double_t sign = 1.; - Double_t zwidth = param->GetZWidth(); + Double_t zwidth = param->GetZWidth()*driftCorr; Double_t padWidth = 0; Double_t padLength = 0; Double_t maxPad = 0; diff --git a/TPC/AliTPCTransform.h b/TPC/AliTPCTransform.h index 6559076fa9e..13a1762291f 100755 --- a/TPC/AliTPCTransform.h +++ b/TPC/AliTPCTransform.h @@ -13,11 +13,13 @@ // rotated global (tracking) cooridnate frame (sector, lx,ly,lz) // +class AliTPCRecoParam; #include "AliTransform.h" class AliTPCTransform:public AliTransform { public: AliTPCTransform(); + AliTPCTransform(const AliTPCTransform& transform); virtual ~AliTPCTransform(); virtual void Transform(Double_t *x,Int_t *i,UInt_t time, Int_t coordinateType); @@ -26,10 +28,19 @@ public: void RotatedGlobal2Global(Int_t sector,Double_t *x) const; void Global2RotatedGlobal(Int_t sector,Double_t *x) const; void GetCosAndSin(Int_t sector,Double_t &cos,Double_t &sin) const; + // + // set current values + // + void SetCurrentRecoParam(AliTPCRecoParam* param){fCurrentRecoParam=param;} + void SetCurrentRun(Int_t run){fCurrentRun=run;} + void SetCurrentTimeStamp(Int_t timeStamp){fCurrentTimeStamp=timeStamp;} private: Double_t fCoss[18]; // cache the transformation Double_t fSins[18]; // cache the transformation Double_t fPrimVtx[3];// position of the primary vertex - needed for TOF correction + AliTPCRecoParam * fCurrentRecoParam; //! current reconstruction parameters + Int_t fCurrentRun; //! current run + UInt_t fCurrentTimeStamp; //! current time stamp ClassDef(AliTPCTransform,1) }; -- 2.43.0