X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSCorrMapSDD.cxx;h=58259956853b54d6a9cdc2c3663a7a737ed263d8;hb=67b72af70f3864bb78741912e56a1fd43e254d86;hp=75f62a1231aba06e3f4489f0778dc13b201713b9;hpb=6c790b32ae67b4f2732f1737f739fd243920d4c9;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSCorrMapSDD.cxx b/ITS/AliITSCorrMapSDD.cxx index 75f62a1231a..58259956853 100644 --- a/ITS/AliITSCorrMapSDD.cxx +++ b/ITS/AliITSCorrMapSDD.cxx @@ -25,30 +25,41 @@ #include "TH1F.h" #include "TH2F.h" #include "AliITSCorrMapSDD.h" +#include "AliITSsegmentationSDD.h" const Int_t AliITSCorrMapSDD::fgkNAnodePtsDefault = 1; const Int_t AliITSCorrMapSDD::fgkNDriftPtsDefault = 72; ClassImp(AliITSCorrMapSDD) //______________________________________________________________________ -AliITSCorrMapSDD::AliITSCorrMapSDD(): -TNamed("defaultmap",""), -fNAnodePts(fgkNAnodePtsDefault), -fNDriftPts(fgkNDriftPtsDefault) +AliITSCorrMapSDD::AliITSCorrMapSDD():TNamed("defaultmap",""), + fNAnodePts(fgkNAnodePtsDefault), + fNDriftPts(fgkNDriftPtsDefault), + fXt1(0.), + fXt2(0.), + fXm1(0.), + fXm2(0.), + fDrLen(0.) { // default constructor } //______________________________________________________________________ AliITSCorrMapSDD::AliITSCorrMapSDD(Char_t *mapname): -TNamed(mapname,""), -fNAnodePts(fgkNAnodePtsDefault), -fNDriftPts(fgkNDriftPtsDefault) + TNamed(mapname,""), + fNAnodePts(fgkNAnodePtsDefault), + fNDriftPts(fgkNDriftPtsDefault), + fXt1(0.), + fXt2(0.), + fXm1(0.), + fXm2(0.), + fDrLen(0.) { // standard constructor } //______________________________________________________________________ -Float_t AliITSCorrMapSDD::GetCorrection(Float_t z, Float_t x, AliITSsegmentationSDD *seg){ - // returns correction in cm starting from local coordinates on the module +void AliITSCorrMapSDD::ComputeGridPoints(Float_t z, Float_t x, AliITSsegmentationSDD *seg, Bool_t isReco){ + // extracts points from the discrete grid with the correction map + const Double_t kMicronTocm = 1.0e-4; Int_t nAnodes=seg->Npz(); Int_t nAnodesHybrid=seg->NpzHalf(); @@ -56,18 +67,78 @@ Float_t AliITSCorrMapSDD::GetCorrection(Float_t z, Float_t x, AliITSsegmentation if(bina>nAnodes) AliError("Wrong anode anumber!"); if(bina>=nAnodesHybrid) bina-=nAnodesHybrid; Float_t stept = seg->Dx()*kMicronTocm/(Float_t)fNDriftPts; - Float_t drLen= seg->Dx()*kMicronTocm-TMath::Abs(x); - Int_t bint = TMath::Abs((Int_t)(drLen/stept)); + fDrLen= seg->Dx()*kMicronTocm-TMath::Abs(x); + if(fDrLen<0) fDrLen=0; + Int_t bint = TMath::Abs((Int_t)(fDrLen/stept)); if(bint==fNDriftPts) bint-=1; - if(bint>=fNDriftPts) AliError("Wrong bin number along drift direction!"); - return kMicronTocm*GetCellContent(bina,bint); + if(bint>=fNDriftPts){ + AliError("Wrong bin number along drift direction!"); + bint=fNDriftPts-1; + } + fXt1=stept*bint; + fXm1=fXt1-GetCellContent(bina,bint)*kMicronTocm; + if((bint+1)fDrLen) return; + if(bint==0 || bint==(fNDriftPts-1)) return; + if(fXm1>fDrLen){ + for(Int_t itry=1; itry<=10; itry++){ + Float_t xmtest=(bint-itry)*stept-GetCellContent(bina,bint-itry)*kMicronTocm; + if(xmtestfDrLen){ + fXt1=stept*(bint+itry); + fXt2=fXt1+stept; + fXm1=fXt1-GetCellContent(bina,bint+itry)*kMicronTocm; + fXm2=fXt2-GetCellContent(bina,bint+1+itry)*kMicronTocm; + return; + } + } + } + } +} +//______________________________________________________________________ +Float_t AliITSCorrMapSDD::GetCorrection(Float_t z, Float_t x, AliITSsegmentationSDD *seg){ + // returns correction in cm starting from local coordinates on the module + ComputeGridPoints(z,x,seg,kTRUE); + Float_t m=(fXt2-fXt1)/(fXm2-fXm1); + Float_t q=fXt1-m*fXm1; + Float_t xcorr=m*fDrLen+q; + // fDrLen is the measured drift distance, xcorr is the corresponding true + return GetInversionBit() ? fDrLen-xcorr : xcorr-fDrLen; +} +//______________________________________________________________________ +Float_t AliITSCorrMapSDD::GetShiftForSimulation(Float_t z, Float_t x, AliITSsegmentationSDD *seg){ + // returns shift to be appiled in digitizarion (in cm) starting from local coordinates on the module + ComputeGridPoints(z,x,seg,kFALSE); + Float_t m=(fXm2-fXm1)/(fXt2-fXt1); + Float_t q=fXm1-m*fXt1; + Float_t xshifted=m*fDrLen+q; + // fDrLen is the true drift distance, xshifted is the one with map shift + return GetInversionBit() ? xshifted-fDrLen : fDrLen-xshifted; } //______________________________________________________________________ TH2F* AliITSCorrMapSDD::GetMapHisto() const{ // Returns a TH2F histogram with map of residuals - Char_t hname[50]; - sprintf(hname,"h%s",GetName()); - TH2F* hmap=new TH2F(hname,"",fNAnodePts,-0.5,255.5,fNDriftPts,0.,35.); + TString hname; + hname.Form("h%s",GetName()); + TH2F* hmap=new TH2F(hname.Data(),"",fNAnodePts,-0.5,255.5,fNDriftPts,0.,35.); for(Int_t iAn=0;iAnSetBinContent(iAn+1,iDr+1,GetCellContent(iAn,iDr)); @@ -78,9 +149,9 @@ TH2F* AliITSCorrMapSDD::GetMapHisto() const{ //______________________________________________________________________ TH1F* AliITSCorrMapSDD::GetMapProfile() const{ // Returns a TH1F with the projection of the map along drift coordinate - Char_t hname[50]; - sprintf(hname,"p%s",GetName()); - TH1F* hprof=new TH1F(hname,"",fNDriftPts,0.,35.); + TString hname; + hname.Form("p%s",GetName()); + TH1F* hprof=new TH1F(hname.Data(),"",fNDriftPts,0.,35.); for(Int_t iDr=0;iDrFill(GetCellContent(iAn,iDr)); @@ -104,3 +175,4 @@ TH1F* AliITSCorrMapSDD::GetResidualDistr(Float_t dmin, Float_t dmax) const{ } return hd; } +