X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TPC%2FAliTPCcalibDButil.cxx;h=37f7c9f0002dce80ba4d434e58adaba52f85e7a8;hb=56b51ad9d25579100d1371343d813fd0d1cb8305;hp=80050f8536cae06c26a32d66ab1757a5b46883c9;hpb=d30aa17777f051a9466cd6d22bea68d2cf12e33a;p=u%2Fmrichter%2FAliRoot.git diff --git a/TPC/AliTPCcalibDButil.cxx b/TPC/AliTPCcalibDButil.cxx index 80050f8536c..37f7c9f0002 100644 --- a/TPC/AliTPCcalibDButil.cxx +++ b/TPC/AliTPCcalibDButil.cxx @@ -40,6 +40,7 @@ #include #include #include +#include #include "AliTPCcalibDB.h" #include "AliTPCCalPad.h" #include "AliTPCCalROC.h" @@ -55,6 +56,8 @@ #include "AliMathBase.h" #include "AliRelAlignerKalman.h" +const Float_t kAlmost0=1.e-30; + ClassImp(AliTPCcalibDButil) AliTPCcalibDButil::AliTPCcalibDButil() : TObject(), @@ -144,6 +147,7 @@ void AliTPCcalibDButil::UpdateFromCalibDB() // Update pointers from calibDB // if (!fCalibDB) fCalibDB=AliTPCcalibDB::Instance(); + fCalibDB->UpdateNonRec(); // load all infromation now fPadNoise=fCalibDB->GetPadNoise(); fPedestals=fCalibDB->GetPedestals(); fPulserTmean=fCalibDB->GetPulserTmean(); @@ -162,7 +166,7 @@ void AliTPCcalibDButil::UpdateFromCalibDB() } //_____________________________________________________________________________________ void AliTPCcalibDButil::ProcessCEdata(const char* fitFormula, TVectorD &fitResultsA, TVectorD &fitResultsC, - Int_t &noutliersCE, Double_t & chi2A, Double_t &chi2C, AliTPCCalPad *outCE) + Int_t &noutliersCE, Double_t & chi2A, Double_t &chi2C, AliTPCCalPad * const outCE) { // // Process the CE data for this run @@ -223,7 +227,7 @@ void AliTPCcalibDButil::ProcessCEdata(const char* fitFormula, TVectorD &fitResul if (ipad==0||ipad==npads-1) rocOut->SetValue(irow,ipad,1); Float_t valTmean=rocData->GetValue(irow,ipad); //exclude values that are exactly 0 - if (valTmean==0) { + if ( !(TMath::Abs(valTmean)>kAlmost0) ) { rocOut->SetValue(irow,ipad,1); ++noutliersCE; } @@ -374,7 +378,7 @@ void AliTPCcalibDButil::ProcessNoiseData(TVectorD &vNoiseMean, TVectorD &vNoiseM if (rocMasked && rocMasked->GetValue(irow,ipad)) continue; Float_t noiseVal=noiseROC->GetValue(irow,ipad); //check if noise==0 - if (noiseVal==0) { + if (noiseValGetEventCounter()<=0) { + + AliInfo("No QA data"); + return; // no data processed + } + // + fDataQA->Analyse(); + + TVectorD normOcc(infoSize); + TVectorD normQ(infoSize); + + for (UInt_t isec=0;isecGetNoThreshold()->GetCalROC(isec); + AliTPCCalROC* nclusterROC = fDataQA->GetNLocalMaxima()->GetCalROC(isec); + AliTPCCalROC* qROC = fDataQA->GetMeanCharge()->GetCalROC(isec); + AliTPCCalROC* qmaxROC = fDataQA->GetMaxCharge()->GetCalROC(isec); + if (!occupancyROC) continue; + if (!nclusterROC) continue; + if (!qROC) continue; + if (!qmaxROC) continue; + + const UInt_t nchannels=occupancyROC->GetNchannels(); + + printf("Nchannels %d\n", nchannels); + + for (UInt_t ichannel=0;ichannelGetValue(ichannel); + ++normOcc[isec]; + + Float_t nClusters = nclusterROC->GetValue(ichannel); + normQ[isec] += nClusters; + vQaQtot[isec]+=nClusters*qROC->GetValue(ichannel); + vQaQmax[isec]+=nClusters*qmaxROC->GetValue(ichannel); + } + } + + //calculate mean values + for (UInt_t isec=0;isec0) vQaOcc[isec] /= normOcc[isec]; + else vQaOcc[isec] = 0; + + if (normQ[isec]>0) { + vQaQtot[isec] /= normQ[isec]; + vQaQmax[isec] /= normQ[isec]; + }else { + + vQaQtot[isec] = 0; + vQaQmax[isec] = 0; + } + } +} + //_____________________________________________________________________________________ void AliTPCcalibDButil::ProcessPulser(TVectorD &vMeanTime) { @@ -771,7 +859,7 @@ void AliTPCcalibDButil::ProcessPulserVariations(TVectorF &pulserQdeviations, Flo void AliTPCcalibDButil::UpdatePulserOutlierMap() { // - // + // Update the outlier map of the pulser data // PulserOutlierMap(fPulserOutlier,fPulserTmean, fPulserQmean); } @@ -779,7 +867,7 @@ void AliTPCcalibDButil::UpdatePulserOutlierMap() void AliTPCcalibDButil::UpdateRefPulserOutlierMap() { // - // + // Update the outlier map of the pulser reference data // PulserOutlierMap(fRefPulserOutlier,fRefPulserTmean, fRefPulserQmean); } @@ -863,7 +951,7 @@ AliTPCCalPad* AliTPCcalibDButil::CreatePadTime0(Int_t model, Double_t &gyA, Doub AliTPCCalROC *rocOut=fPulserOutlier->GetCalROC(isec); Float_t mean=rocPulTmean->GetMean(rocOut); //treat case where a whole partition is masked - if (mean==0) mean=rocPulTmean->GetMean(); + if ( TMath::Abs(mean)GetMean(); if (model==1) { Int_t type=isec/18; mean=vMean[type]; @@ -877,7 +965,7 @@ AliTPCCalPad* AliTPCcalibDButil::CreatePadTime0(Int_t model, Double_t &gyA, Doub //This should be the most precise guess in that case. if (rocOut->GetValue(irow,ipad)) { time=GetMeanAltro(rocPulTmean,irow,ipad,rocOut); - if (time==0) time=mean; + if ( TMath::Abs(time)SetValue(irow,ipad,val); @@ -912,7 +1000,7 @@ AliTPCCalPad* AliTPCcalibDButil::CreatePadTime0(Int_t model, Double_t &gyA, Doub rocTime0->GlobalFit(rocOutCE,kFALSE,vFitROC,mFitROC,chi2); AliTPCCalROC *rocCEfit=AliTPCCalROC::CreateGlobalFitCalROC(vFitROC, isec); Float_t mean=rocPulTmean->GetMean(rocOutPul); - if (mean==0) mean=rocPulTmean->GetMean(); + if ( TMath::Abs(mean)GetMean(); UInt_t nrows=rocTime0->GetNrows(); for (UInt_t irow=0;irowGetNPads(irow); @@ -934,8 +1022,11 @@ AliTPCCalPad* AliTPCcalibDButil::CreatePadTime0(Int_t model, Double_t &gyA, Doub return padTime0; } //_____________________________________________________________________________________ -Float_t AliTPCcalibDButil::GetMeanAltro(const AliTPCCalROC *roc, const Int_t row, const Int_t pad, AliTPCCalROC *rocOut) +Float_t AliTPCcalibDButil::GetMeanAltro(const AliTPCCalROC *roc, const Int_t row, const Int_t pad, AliTPCCalROC *const rocOut) { + // + // GetMeanAlto information + // if (roc==0) return 0.; const Int_t sector=roc->GetSector(); AliTPCROC *tpcRoc=AliTPCROC::Instance(); @@ -1134,11 +1225,11 @@ void AliTPCcalibDButil::UpdateRefDataFromOCDB() entry=GetRefEntry(cdbPath.Data()); if (entry){ entry->SetOwner(kTRUE); - fDataQA=dynamic_cast(entry->GetObject()); - if (!fDataQA){ + fRefDataQA=dynamic_cast(entry->GetObject()); + if (!fRefDataQA){ AliError(Form("Could not get object from entry '%s'\nPlease check!!!",entry->GetId().GetPath().Data())); } else { - fRefDataQA=(AliTPCdataQA*)fDataQA->Clone(); + fRefDataQA=(AliTPCdataQA*)fRefDataQA->Clone(); } delete entry; } @@ -1256,27 +1347,27 @@ AliCDBEntry* AliTPCcalibDButil::GetRefEntry(const char* cdbPath) return entry; } //_____________________________________________________________________________________ -const Int_t AliTPCcalibDButil::GetCurrentReferenceRun(const char* type){ +Int_t AliTPCcalibDButil::GetCurrentReferenceRun(const char* type) const { // // Get reference run number for the specified OCDB path // if (!fCurrentRefMap) return -2; TObjString *str=dynamic_cast(fCurrentRefMap->GetValue(type)); if (!str) return -2; - return (const Int_t)str->GetString().Atoi(); + return (Int_t)str->GetString().Atoi(); } //_____________________________________________________________________________________ -const Int_t AliTPCcalibDButil::GetReferenceRun(const char* type) const{ +Int_t AliTPCcalibDButil::GetReferenceRun(const char* type) const{ // // Get reference run number for the specified OCDB path // if (!fRefMap) return -1; TObjString *str=dynamic_cast(fRefMap->GetValue(type)); if (!str) return -1; - return (const Int_t)str->GetString().Atoi(); + return (Int_t)str->GetString().Atoi(); } //_____________________________________________________________________________________ -AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPCCalPad *ceOut, Float_t minSignal, Float_t cutTrmsMin, Float_t cutTrmsMax, Float_t cutMaxDistT){ +AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPCCalPad * const ceOut, Float_t minSignal, Float_t cutTrmsMin, Float_t cutTrmsMax, Float_t cutMaxDistT){ // // Author: marian.ivanov@cern.ch // @@ -1346,7 +1437,7 @@ AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPC //2. exclude edge pads if (ipad==0||ipad==npads-1) rocOut->SetValue(irow,ipad,1); //exclude values that are exactly 0 - if (valTmean==0) { + if ( TMath::Abs(valTmean)SetValue(irow,ipad,1); ++noutliersCE; } @@ -1381,7 +1472,7 @@ AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPC } -AliTPCCalPad *AliTPCcalibDButil::CreatePulserOutlyerMap(Int_t &noutliersPulser, AliTPCCalPad *pulserOut,Float_t cutTime, Float_t cutnRMSQ, Float_t cutnRMSrms){ +AliTPCCalPad *AliTPCcalibDButil::CreatePulserOutlyerMap(Int_t &noutliersPulser, AliTPCCalPad * const pulserOut,Float_t cutTime, Float_t cutnRMSQ, Float_t cutnRMSrms){ // // Author: marian.ivanov@cern.ch // @@ -1601,17 +1692,27 @@ Int_t AliTPCcalibDButil::GetNearest(TGraph *graph, Double_t xref, Double_t &dx, // // find the closest point to xref in x direction // return dx and value + dx = 0; + y = 0; + + if(!graph) return 0; + if(graph->GetN() < 1) return 0; + Int_t index=0; index = TMath::BinarySearch(graph->GetN(), graph->GetX(),xref); if (index<0) index=0; - if (index>=graph->GetN()-1) index=graph->GetN()-2; - if (xref-graph->GetX()[index]>graph->GetX()[index]-xref) index++; - dx = xref-graph->GetX()[index]; + if(graph->GetN()==1) { + dx = xref-graph->GetX()[index]; + } + else { + if (index>=graph->GetN()-1) index=graph->GetN()-2; + if (xref-graph->GetX()[index]>graph->GetX()[index]-xref) index++; + dx = xref-graph->GetX()[index]; + } y = graph->GetY()[index]; return index; } - Double_t AliTPCcalibDButil::GetTriggerOffsetTPC(Int_t run, Int_t timeStamp, Double_t deltaT, Double_t deltaTLaser, Int_t valType){ // // Get the correction of the trigger offset @@ -1630,7 +1731,7 @@ Double_t AliTPCcalibDButil::GetTriggerOffsetTPC(Int_t run, Int_t timeStamp, Dou // // const Float_t kLaserCut=0.0005; - const Int_t kMaxPeriod=3600*24*30*3; // 3 month max + const Int_t kMaxPeriod=3600*24*30*12; // one year max const Int_t kMinPoints=20; // TObjArray *array =AliTPCcalibDB::Instance()->GetTimeVdriftSplineRun(run); @@ -1673,9 +1774,13 @@ Double_t AliTPCcalibDButil::GetTriggerOffsetTPC(Int_t run, Int_t timeStamp, Dou nused++; } if (nusedcosmicAll->GetX()[cosmicAll->GetN()-1]) vcosmic=cosmicAll->GetY()[cosmicAll->GetN()-1]; if (timeStampGetX()[0]) vcosmic=cosmicAll->GetY()[0]; return vcosmic-t0; @@ -1806,7 +1911,7 @@ Bool_t AliTPCcalibDButil::CreateGUIRefTree(const char* filename) Double_t AliTPCcalibDButil::GetVDriftTPCLaserTracks(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT, Int_t side){ // - // Get the correction of the drift velocity using the laser tracks calbration + // Get the correction of the drift velocity using the offline laser tracks calbration // // run - run number // timeStamp - tim stamp in seconds @@ -1814,6 +1919,56 @@ Double_t AliTPCcalibDButil::GetVDriftTPCLaserTracks(Double_t &dist, Int_t run, // side - 0 - A side, 1 - C side, 2 - mean from both sides // Note in case no data form both A and C side - the value from active side used TObjArray *array =AliTPCcalibDB::Instance()->GetTimeVdriftSplineRun(run); + + return GetVDriftTPCLaserTracksCommon(dist, timeStamp, deltaT, side, array); +} + +Double_t AliTPCcalibDButil::GetVDriftTPCLaserTracksOnline(Double_t &dist, Int_t /*run*/, Int_t timeStamp, Double_t deltaT, Int_t side){ + // + // Get the correction of the drift velocity using the online laser tracks calbration + // + // run - run number + // timeStamp - tim stamp in seconds + // deltaT - integration period to calculate time0 offset + // side - 0 - A side, 1 - C side, 2 - mean from both sides + // Note in case no data form both A and C side - the value from active side used + TObjArray *array =AliTPCcalibDB::Instance()->GetCEfitsDrift(); + + Double_t dv = GetVDriftTPCLaserTracksCommon(dist, timeStamp, deltaT, side, array); + AliTPCParam *param =AliTPCcalibDB::Instance()->GetParameters(); + if (!param) return 0; + + //the drift velocity is hard wired in the AliTPCCalibCE class, since online there is no access to OCDB + dv*=param->GetDriftV()/2.61301900000000000e+06; + if (dv>1e-20) dv=1/dv-1; + else return 0; + // T/P correction + TObjArray* cearray =AliTPCcalibDB::Instance()->GetCEData(); + + AliTPCSensorTempArray *temp = (AliTPCSensorTempArray*)cearray->FindObject("TempMap"); + AliDCSSensor *press = (AliDCSSensor*)cearray->FindObject("CavernAtmosPressure"); + + Double_t corrPTA=0; + Double_t corrPTC=0; + + if (temp&&press) { + AliTPCCalibVdrift corr(temp,press,0); + corrPTA=corr.GetPTRelative(timeStamp,0); + corrPTC=corr.GetPTRelative(timeStamp,1); + } + + if (side==0) dv -= corrPTA; + if (side==1) dv -= corrPTC; + if (side==2) dv -= (corrPTA+corrPTC)/2; + + return dv; +} + +Double_t AliTPCcalibDButil::GetVDriftTPCLaserTracksCommon(Double_t &dist, Int_t timeStamp, Double_t deltaT, + Int_t side, TObjArray * const array){ + // + // common drift velocity retrieval for online and offline method + // TGraphErrors *grlaserA=0; TGraphErrors *grlaserC=0; Double_t vlaserA=0, vlaserC=0; @@ -1821,12 +1976,12 @@ Double_t AliTPCcalibDButil::GetVDriftTPCLaserTracks(Double_t &dist, Int_t run, grlaserA=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_A"); grlaserC=(TGraphErrors*)array->FindObject("GRAPH_MEAN_DRIFT_LASER_ALL_C"); Double_t deltaY; - if (grlaserA) { + if (grlaserA && grlaserA->GetN()>0) { AliTPCcalibDButil::GetNearest(grlaserA,timeStamp,dist,deltaY); if (TMath::Abs(dist)>deltaT) vlaserA= deltaY; else vlaserA = AliTPCcalibDButil::EvalGraphConst(grlaserA,timeStamp); } - if (grlaserC) { + if (grlaserC && grlaserC->GetN()>0) { AliTPCcalibDButil::GetNearest(grlaserC,timeStamp,dist,deltaY); if (TMath::Abs(dist)>deltaT) vlaserC= deltaY; else vlaserC = AliTPCcalibDButil::EvalGraphConst(grlaserC,timeStamp); @@ -1862,6 +2017,7 @@ Double_t AliTPCcalibDButil::GetVDriftTPCCE(Double_t &dist,Int_t run, Int_t time Double_t gry=0; Double_t corrA=0, corrC=0; Double_t timeA=0, timeC=0; + const Double_t kEpsilon = 0.00001; TGraph *graphA = (TGraph*)arrT->At(72); TGraph *graphC = (TGraph*)arrT->At(73); if (!graphA && !graphC) return 0.; @@ -1870,6 +2026,7 @@ Double_t AliTPCcalibDButil::GetVDriftTPCCE(Double_t &dist,Int_t run, Int_t time timeA = AliTPCcalibDButil::EvalGraphConst(graphA,timeStamp); Int_t mtime =TMath::Nint((graphA->GetX()[0]+graphA->GetX()[graphA->GetN()-1])*0.5); ltime0A = GetLaserTime0(run,mtime,TMath::Nint(deltaT),0); + if(ltime0A < kEpsilon) return 0; if (driftCalib) corrPTA = driftCalib->GetPTRelative(timeStamp,0); corrA = (param->GetZLength(36)/(timeA*param->GetTSample()*(1.-ltime0A)-param->GetL1Delay()-0*param->GetZSigma()/param->GetDriftV()))/param->GetDriftV()-1; corrA-=corrPTA; @@ -1879,7 +2036,8 @@ Double_t AliTPCcalibDButil::GetVDriftTPCCE(Double_t &dist,Int_t run, Int_t time timeC=AliTPCcalibDButil::EvalGraphConst(graphC,timeStamp); Int_t mtime=TMath::Nint((graphC->GetX()[0]+graphC->GetX()[graphC->GetN()-1])*0.5); ltime0C = GetLaserTime0(run,mtime,TMath::Nint(deltaT),0); - if (driftCalib) corrPTC = driftCalib->GetPTRelative(timeStamp,0); + if(ltime0C < kEpsilon) return 0; +if (driftCalib) corrPTC = driftCalib->GetPTRelative(timeStamp,0); corrC = (param->GetZLength(54)/(timeC*param->GetTSample()*(1.-ltime0C)-param->GetL1Delay()-0*param->GetZSigma()/param->GetDriftV()))/param->GetDriftV()-1; corrC-=corrPTC; } @@ -1901,6 +2059,7 @@ Double_t AliTPCcalibDButil::GetVDriftTPCITS(Double_t &dist, Int_t run, Int_t ti TGraphErrors *graph=0; dist=0; if (!array) return 0; + //array->ls(); graph = (TGraphErrors*)array->FindObject("ALIGN_ITSB_TPC_DRIFTVD"); if (!graph) return 0; Double_t deltaY; @@ -2021,11 +2180,12 @@ TGraph* AliTPCcalibDButil::FilterGraphMedian(TGraph * graph, Float_t sigmaCut,Do Int_t npoints0 = graph->GetN(); Int_t npoints=0; Float_t rmsY=0; - Double_t *outx=new Double_t[npoints0]; - Double_t *outy=new Double_t[npoints0]; // // if (npoints01) graphOut= new TGraph(npoints,outx,outy); + delete [] outx; + delete [] outy; return graphOut; } @@ -2054,11 +2216,12 @@ TGraph* AliTPCcalibDButil::FilterGraphMedianAbs(TGraph * graph, Float_t cut,Doub Int_t npoints0 = graph->GetN(); Int_t npoints=0; Float_t rmsY=0; - Double_t *outx=new Double_t[npoints0]; - Double_t *outy=new Double_t[npoints0]; // // if (npoints01) graphOut= new TGraph(npoints,outx,outy); + delete [] outx; + delete [] outy; return graphOut; } -TGraphErrors* AliTPCcalibDButil::FilterGraphMedianErr(TGraphErrors * graph, Float_t sigmaCut,Double_t &medianY){ +TGraphErrors* AliTPCcalibDButil::FilterGraphMedianErr(TGraphErrors * const graph, Float_t sigmaCut,Double_t &medianY){ // // filter outlyer measurement // Only points with normalized errors median +- sigmaCut filtered @@ -2088,14 +2253,16 @@ TGraphErrors* AliTPCcalibDButil::FilterGraphMedianErr(TGraphErrors * graph, Floa Int_t npoints0 = graph->GetN(); Int_t npoints=0; Float_t medianErr=0, rmsErr=0; + // + // + if (npoints01) graphOut= new TGraphErrors(npoints,outx,outy,errx,erry); delete []outx; delete []outy; - delete []errx; delete []erry; + delete []nerry; + delete []errx; return graphOut; } @@ -2136,6 +2304,9 @@ void AliTPCcalibDButil::Sort(TGraph *graph){ for (Int_t i=0;iGetX()[i]=outx[i]; for (Int_t i=0;iGetY()[i]=outy[i]; + delete [] indexes; + delete [] outx; + delete [] outy; } void AliTPCcalibDButil::SmoothGraph(TGraph *graph, Double_t delta){ // @@ -2181,7 +2352,7 @@ void AliTPCcalibDButil::SmoothGraph(TGraph *graph, Double_t delta){ delete[] outy; } -Double_t AliTPCcalibDButil::EvalGraphConst(TGraph *graph, Double_t xref){ +Double_t AliTPCcalibDButil::EvalGraphConst(TGraph * const graph, Double_t xref){ // // Use constant interpolation outside of range // @@ -2189,12 +2360,39 @@ Double_t AliTPCcalibDButil::EvalGraphConst(TGraph *graph, Double_t xref){ printf("AliTPCcalibDButil::EvalGraphConst: 0 pointer\n"); return 0; } + if (graph->GetN()<1){ - printf("AliTPCcalibDButil::EvalGraphConst: Empty graph"); + printf("AliTPCcalibDButil::EvalGraphConst: Empty graph \n"); return 0; } + + if (xrefGetX()[0]) return graph->GetY()[0]; if (xref>graph->GetX()[graph->GetN()-1]) return graph->GetY()[graph->GetN()-1]; + + // printf("graph->Eval(graph->GetX()[0]) %f, graph->Eval(xref) %f \n",graph->Eval(graph->GetX()[0]), graph->Eval(xref)); + + if(graph->GetN()==1) + return graph->Eval(graph->GetX()[0]); + + + return graph->Eval(xref); +} + +Double_t AliTPCcalibDButil::EvalGraphConst(AliSplineFit *graph, Double_t xref){ + // + // Use constant interpolation outside of range also for spline fits + // + if (!graph) { + printf("AliTPCcalibDButil::EvalGraphConst: 0 pointer\n"); + return 0; + } + if (graph->GetKnots()<1){ + printf("AliTPCcalibDButil::EvalGraphConst: Empty graph"); + return 0; + } + if (xrefGetX()[0]) return graph->GetY0()[0]; + if (xref>graph->GetX()[graph->GetKnots()-1]) return graph->GetY0()[graph->GetKnots()-1]; return graph->Eval( xref); } @@ -2237,6 +2435,8 @@ Float_t AliTPCcalibDButil::FilterSensor(AliDCSSensor * sensor, Double_t ymin, Do if (naccept<1) { delete fit; sensor->SetFit(0); + delete [] yin0; + delete [] yin1; return 0.; } @@ -2298,7 +2498,7 @@ Float_t AliTPCcalibDButil::FilterTemperature(AliTPCSensorTempArray *tempArray, } -void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutSigma, TTreeSRedirector *pcstream){ +void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutSigma, TTreeSRedirector * const pcstream){ // // Filter CE data // Input parameters: @@ -2329,12 +2529,13 @@ void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutS // // AliTPCSensorTempArray *tempMapCE = (AliTPCSensorTempArray *)cearray->FindObject("TempMap"); - AliDCSSensor * cavernPressureCE = (AliDCSSensor *) cearray->FindObject("CavernPressure"); + AliDCSSensor * cavernPressureCE = (AliDCSSensor *) cearray->FindObject("CavernAtmosPressure"); if ( tempMapCE && cavernPressureCE){ // - Bool_t isOK = FilterTemperature(tempMapCE)>0.1; - FilterSensor(cavernPressureCE,960,1050,10, 5.); - if (cavernPressureCE->GetFit()==0) isOK=kFALSE; + // Bool_t isOK = FilterTemperature(tempMapCE)>0.1; + // FilterSensor(cavernPressureCE,960,1050,10, 5.); + // if (cavernPressureCE->GetFit()==0) isOK=kFALSE; + Bool_t isOK=kTRUE; if (isOK) { // recalculate P/T correction map for time of the CE AliTPCCalibVdrift * driftCalib = new AliTPCCalibVdrift(tempMapCE,cavernPressureCE ,0); @@ -2349,7 +2550,8 @@ void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutS for (Int_t i=0; i<72;i++){ TGraph *graph= (TGraph*)arrT->At(i); - if (!graph) continue; + if (!graph) continue; + graph->Sort(); if (graph->GetN()AddAt(0,i); delete graph; // delete empty graph @@ -2397,7 +2599,8 @@ void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutS Double_t median = (isec%36<18) ? medianA: medianC; Double_t rms = (isec%36<18) ? rmsA: rmsC; Int_t naccept=0; - for (Int_t ipoint=kMinPoints-1; ipointGetN();ipoint++){ + // for (Int_t ipoint=kMinPoints-1; ipointGetN();ipoint++){ //not neccessary to remove first points + for (Int_t ipoint=0; ipointGetN();ipoint++){ if (TMath::Abs(graph->GetY()[ipoint]-median)>cutAbs) continue; if (TMath::Abs(graph->GetY()[ipoint]-median)>cutSigma*rms) continue; vecX[naccept]= graph->GetX()[ipoint]; @@ -2500,7 +2703,7 @@ void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutS } -void AliTPCcalibDButil::FilterTracks(Int_t run, Double_t cutSigma, TTreeSRedirector *pcstream){ +void AliTPCcalibDButil::FilterTracks(Int_t run, Double_t cutSigma, TTreeSRedirector * const pcstream){ // // Filter Drift velocity measurement using the tracks // 0. remove outlyers - error based @@ -2512,16 +2715,25 @@ void AliTPCcalibDButil::FilterTracks(Int_t run, Double_t cutSigma, TTreeSRedirec Double_t medianY=0; if (!arrT) return; for (Int_t i=0; iGetEntries();i++){ - TGraphErrors *graph= (TGraphErrors*)arrT->At(i); + TGraphErrors *graph= dynamic_cast(arrT->At(i)); if (!graph) continue; if (graph->GetN()AddAt(0,i); continue; } - TGraphErrors *graph2= FilterGraphMedianErr(graph,cutSigma,medianY); - if (!graph2) { - delete graph; arrT->AddAt(0,i); continue; + TGraphErrors *graph2 = NULL; + if(graph->GetN()<10) { + graph2 = new TGraphErrors(graph->GetN(),graph->GetX(),graph->GetY(),graph->GetEX(),graph->GetEY()); + if (!graph2) { + delete graph; arrT->AddAt(0,i); continue; + } + } + else { + graph2= FilterGraphMedianErr(graph,cutSigma,medianY); + if (!graph2) { + delete graph; arrT->AddAt(0,i); continue; + } } if (graph2->GetN()<1) { delete graph; arrT->AddAt(0,i); continue; @@ -2598,7 +2810,7 @@ Double_t AliTPCcalibDButil::GetLaserTime0(Int_t run, Int_t timeStamp, Int_t delt -void AliTPCcalibDButil::FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT, Double_t cutSigma, Double_t minVd, Double_t maxVd, TTreeSRedirector *pcstream){ +void AliTPCcalibDButil::FilterGoofie(AliDCSSensorArray * goofieArray, Double_t deltaT, Double_t cutSigma, Double_t minVd, Double_t maxVd, TTreeSRedirector * const pcstream){ // // Filter Goofie data // goofieArray - points will be filtered @@ -2768,7 +2980,7 @@ void AliTPCcalibDButil::FilterGoofie(AliDCSSensorArray * goofieArray, Double_t d -TMatrixD* AliTPCcalibDButil::MakeStatRelKalman(TObjArray *array, Float_t minFraction, Int_t minStat, Float_t maxvd){ +TMatrixD* AliTPCcalibDButil::MakeStatRelKalman(TObjArray * const array, Float_t minFraction, Int_t minStat, Float_t maxvd){ // // Make a statistic matrix // Input parameters: @@ -2800,7 +3012,8 @@ TMatrixD* AliTPCcalibDButil::MakeStatRelKalman(TObjArray *array, Float_t minFrac (*valArray[ipar])[naccept]=state[ipar]; naccept++; } - if (naccept<2) return 0; + //if (naccept<2) return 0; + if (naccept<1) return 0; TMatrixD *pstat=new TMatrixD(9,3); TMatrixD &stat=*pstat; for (Int_t ipar=0; ipar<9; ipar++){ @@ -2812,7 +3025,7 @@ TMatrixD* AliTPCcalibDButil::MakeStatRelKalman(TObjArray *array, Float_t minFrac } -TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray *array,TMatrixD & stat, Bool_t direction, Float_t sigmaCut){ +TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray * const array, const TMatrixD & stat, Bool_t direction, Float_t sigmaCut){ // // Smooth the array of AliRelKalmanAlign - detector alignment and drift calibration) // Input: @@ -2827,7 +3040,7 @@ TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray *array,TMatrixD & stat, const Double_t kerrsTime[9]={ 0.00001, 0.00001, 0.00001, 0.001, 0.001, 0.001, - 0.0001, 0.001, 0.0001}; + 0.002, 0.01, 0.001}; // // Int_t entries = array->GetEntriesFast(); @@ -2871,7 +3084,7 @@ TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray *array,TMatrixD & stat, return sArray; } -TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray *arrayP, TObjArray *arrayM){ +TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray * const arrayP, TObjArray * const arrayM){ // // Merge 2 RelKalman arrays // Input: @@ -2881,16 +3094,32 @@ TObjArray *AliTPCcalibDButil::SmoothRelKalman(TObjArray *arrayP, TObjArray *arra if (arrayP->GetEntries()<=0) return 0; if (!arrayM) return 0; if (arrayM->GetEntries()<=0) return 0; + Int_t entries = arrayP->GetEntriesFast(); TObjArray *array = new TObjArray(arrayP->GetEntriesFast()); + for (Int_t i=0; iUncheckedAt(i); AliRelAlignerKalman * kalmanM = (AliRelAlignerKalman *) arrayM->UncheckedAt(i); if (!kalmanP) continue; if (!kalmanM) continue; - AliRelAlignerKalman *kalman = new AliRelAlignerKalman(*kalmanP); - kalman->Merge(kalmanM); + + AliRelAlignerKalman *kalman = NULL; + if(kalmanP->GetRunNumber() != 0 && kalmanM->GetRunNumber() != 0) { + kalman = new AliRelAlignerKalman(*kalmanP); + kalman->Merge(kalmanM); + } + else if (kalmanP->GetRunNumber() == 0) { + kalman = new AliRelAlignerKalman(*kalmanM); + } + else if (kalmanM->GetRunNumber() == 0) { + kalman = new AliRelAlignerKalman(*kalmanP); + } + else + continue; + array->AddAt(kalman,i); } + return array; }