]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCcalibDButil.cxx
Compatibility with the Root trunk
[u/mrichter/AliRoot.git] / TPC / AliTPCcalibDButil.cxx
index 37f7c9f0002dce80ba4d434e58adaba52f85e7a8..f762174d3217677878cbb6eb1b49180a5132fe91 100644 (file)
@@ -384,7 +384,7 @@ void AliTPCcalibDButil::ProcessNoiseData(TVectorD &vNoiseMean, TVectorD &vNoiseM
         }
         //check for nan
         if ( !(noiseVal<10000000) ){
-//           printf ("Warning: nan detected in (sec,row,pad - val): %02d,%02d,%03d - %.1f\n",isec,irow,ipad,noiseVal);
+         AliInfo(Form("Warning: nan detected in (sec,row,pad - val): %02d,%02d,%03d - %.1f\n",isec,irow,ipad,noiseVal));
           ++nNaN;
           continue;
         }
@@ -460,7 +460,7 @@ void AliTPCcalibDButil::ProcessNoiseData(TVectorD &vNoiseMean, TVectorD &vNoiseM
     Double_t rmsSen=0;
     
     if (c[i]>verySmall){
-//       printf ("i: %d - m: %.3f, c: %.0f, r: %.3f\n",i,vNoiseMean[i],c[i],vNoiseRMS[i]);
+      AliInfo(Form("i: %d - m: %.3f, c: %.0f, r: %.3f\n",i,vNoiseMean[i],c[i],vNoiseRMS[i]));
       mean=vNoiseMean[i]/c[i];
       rms=vNoiseRMS[i];
       rms=TMath::Sqrt(TMath::Abs(rms/c[i]-mean*mean));
@@ -518,8 +518,7 @@ void AliTPCcalibDButil::ProcessQAData(TVectorD &vQaOcc, TVectorD &vQaQtot,
 
   for (UInt_t isec=0;isec<AliTPCCalPad::kNsec;++isec){
 
-    printf("Sector %d\n", isec);
-
+    AliInfo(Form("Sector %d\n", isec));
     AliTPCCalROC* occupancyROC = fDataQA->GetNoThreshold()->GetCalROC(isec); 
     AliTPCCalROC* nclusterROC = fDataQA->GetNLocalMaxima()->GetCalROC(isec); 
     AliTPCCalROC* qROC = fDataQA->GetMeanCharge()->GetCalROC(isec); 
@@ -531,7 +530,7 @@ void AliTPCcalibDButil::ProcessQAData(TVectorD &vQaOcc, TVectorD &vQaQtot,
     
     const UInt_t nchannels=occupancyROC->GetNchannels();
 
-    printf("Nchannels %d\n", nchannels);
+    AliInfo(Form("Nchannels %d\n", nchannels));
 
     for (UInt_t ichannel=0;ichannel<nchannels;++ichannel){
 
@@ -835,7 +834,7 @@ void AliTPCcalibDButil::ProcessPulserVariations(TVectorF &pulserQdeviations, Flo
         Float_t pt=ptROC->GetValue(irow,ipad);
 //         Float_t ptRef=ptRefROC->GetValue(irow,ipad);
         //comparisons q
-        Float_t deviation=TMath::Abs(pq/pqRef-1);
+       Float_t deviation=TMath::Abs(pqRef)>1e-20?TMath::Abs(pq/pqRef-1):-999; 
         for (Int_t i=0;i<npar;++i){
           if (deviation>vThres[i])
             ++pulserQdeviations.GetMatrixArray()[i];
@@ -1402,13 +1401,14 @@ AliTPCCalPad *AliTPCcalibDButil::CreateCEOutlyerMap( Int_t & noutliersCE, AliTPC
   Double_t rmsMedian         = fCETrms->GetMedian();
   for (UInt_t iroc=0;iroc<fCETmean->kNsec;++iroc){
     AliTPCCalROC *rocData=fCETmean->GetCalROC(iroc);
+    if (!rocData) continue;
     if (fALTROMasked) rocMasked= fALTROMasked->GetCalROC(iroc);
     AliTPCCalROC *rocOut       = out->GetCalROC(iroc);
     AliTPCCalROC *rocCEQ       = fCEQmean->GetCalROC(iroc);
     AliTPCCalROC *rocCETrms    = fCETrms->GetCalROC(iroc);
     Double_t trocMedian        = rocData->GetMedian();
     //
-    if (!rocData) {
+    if (!rocData || !rocCEQ || !rocCETrms || !rocData) {
       noutliersCE+=AliTPCROC::Instance()->GetNChannels(iroc);
       rocOut->Add(1.);
       continue;
@@ -1515,7 +1515,10 @@ AliTPCCalPad *AliTPCcalibDButil::CreatePulserOutlyerMap(Int_t &noutliersPulser,
       Float_t valTmean=rocData->GetValue(ichannel);
       Float_t valQmean=rocPulserQ->GetValue(ichannel);
       Float_t valTrms =rocPulserTrms->GetValue(ichannel);
+      Float_t valMasked =0;
+      if (rocMasked) valMasked = rocMasked->GetValue(ichannel);
       Int_t isOut=0;
+      if (valMasked>0.5) isOut=1;
       if (TMath::Abs(valTmean-rocMedianT)>cutTime) isOut=1;
       if (TMath::Abs(valQmean-rocMedianQ)>cutnRMSQ*rocRMSQ) isOut=1;
       if (TMath::Abs(valTrms-rocMedianTrms)>cutnRMSrms*rocRMSTrms) isOut=1;
@@ -1773,9 +1776,13 @@ Double_t  AliTPCcalibDButil::GetTriggerOffsetTPC(Int_t run, Int_t timeStamp, Dou
     tdelta[nused]=ccosmic-claser;
     nused++;
   }
-  if (nused<kMinPoints &&deltaT<kMaxPeriod) return  AliTPCcalibDButil::GetTriggerOffsetTPC(run, timeStamp, deltaT*2,deltaTLaser);
+  if (nused<kMinPoints &&deltaT<kMaxPeriod) {
+    delete [] tdelta;
+    return  AliTPCcalibDButil::GetTriggerOffsetTPC(run, timeStamp, deltaT*2,deltaTLaser);
+  }
   if (nused<kMinPoints) {
-    printf("AliFatal: No time offset calibration available\n");
+    delete [] tdelta;
+    //AliWarning("AliFatal: No time offset calibration available\n");
     return 0;
   }
   Double_t median = TMath::Median(nused,tdelta);
@@ -2141,7 +2148,7 @@ Int_t  AliTPCcalibDButil::MakeRunList(Int_t startRun, Int_t stopRun){
       if (!tmpRun) continue;
       fRunsStart[irun]=tmpRun->GetStartTime().GetSec();
       fRunsStop[irun]=tmpRun->GetEndTime().GetSec();
-      //      printf("irun\t%d\tRun\t%d\t%d\t%d\n",irun,fRuns[irun],tmpRun->GetStartTime().GetSec(),tmpRun->GetEndTime().GetSec());
+      //AliInfo(Form("irun\t%d\tRun\t%d\t%d\t%d\n",irun,fRuns[irun],tmpRun->GetStartTime().GetSec(),tmpRun->GetEndTime().GetSec()));
     }}
   return fRuns.fN;
 }
@@ -2157,7 +2164,7 @@ Int_t AliTPCcalibDButil::FindRunTPC(Int_t    itime, Bool_t debug){
   for (Int_t index=index0; index<=index1; index++){
     if (fRunsStart[index]<=itime && fRunsStop[index]>=itime) cindex=index;
     if (debug) {
-      printf("%d\t%d\t%d\n",fRuns[index], fRunsStart[index]-itime, fRunsStop[index]-itime);
+      AliInfo(Form("%d\t%d\t%d\n",fRuns[index], fRunsStart[index]-itime, fRunsStop[index]-itime));
     }
   }
   if (cindex<0) cindex =(index0+index1)/2;
@@ -2357,12 +2364,12 @@ Double_t AliTPCcalibDButil::EvalGraphConst(TGraph * const graph, Double_t xref){
   // Use constant interpolation outside of range 
   //
   if (!graph) {
-    printf("AliTPCcalibDButil::EvalGraphConst: 0 pointer\n");
+    AliInfoGeneral("AliTPCcalibDButil","AliTPCcalibDButil::EvalGraphConst: 0 pointer\n");
     return 0;
   }
 
   if (graph->GetN()<1){
-    printf("AliTPCcalibDButil::EvalGraphConst: Empty graph \n");
+    AliInfoGeneral("AliTPCcalibDButil","AliTPCcalibDButil::EvalGraphConst: Empty graph \n");
     return 0;
   }
  
@@ -2370,7 +2377,7 @@ Double_t AliTPCcalibDButil::EvalGraphConst(TGraph * const graph, Double_t xref){
   if (xref<graph->GetX()[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));
+  //  AliInfo(Form("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]);
@@ -2384,11 +2391,11 @@ 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");
+    AliInfoGeneral("AliTPCcalibDButil","AliTPCcalibDButil::EvalGraphConst: 0 pointer\n");
     return 0;
   }
   if (graph->GetKnots()<1){
-    printf("AliTPCcalibDButil::EvalGraphConst: Empty graph");
+    AliInfoGeneral("AliTPCcalibDButil","AliTPCcalibDButil::EvalGraphConst: Empty graph");
     return 0;
   }
   if (xref<graph->GetX()[0]) return graph->GetY0()[0];
@@ -2485,7 +2492,6 @@ Float_t  AliTPCcalibDButil::FilterTemperature(AliTPCSensorTempArray *tempArray,
   for (Int_t isensor=0; isensor<nsensors; isensor++){
     AliDCSSensor *sensor = tempArray->GetSensorNum(isensor);
     if (!sensor) continue;
-    //printf("%d\n",isensor);
     FilterSensor(sensor,ymin,ymax,kMaxDy, sigmaCut);
     if (sensor->GetFit()==0){
       //delete sensor;
@@ -2634,6 +2640,7 @@ void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutS
       continue;
     }
     TGraph* graphTS= FilterGraphMedian(graphTS0,cutSigma,medianY);    
+    if (!graphTS) continue;
     graphTS->Sort();
     AliTPCcalibDButil::SmoothGraph(graphTS,deltaT);      
     if (pcstream){
@@ -2648,7 +2655,6 @@ void AliTPCcalibDButil::FilterCE(Double_t deltaT, Double_t cutAbs, Double_t cutS
        "\n";
     }
     delete graphTS0;
-    if (!graphTS) continue;
     arrT->AddAt(graphTS,i);
     delete graph;
   }
@@ -2798,7 +2804,11 @@ Double_t AliTPCcalibDButil::GetLaserTime0(Int_t run, Int_t timeStamp, Int_t delt
   //if (index1-index0 <kMinPoints) { index1+=kMinPoints; index0-=kMinPoints;}
   if (index0<0) index0=0;
   if (index1>=npoints-1) index1=npoints-1;
-  if (index1-index0<kMinPoints) return 0;
+  if (index1-index0<kMinPoints) {
+    delete [] ylaser;
+    delete [] xlaser;
+    return 0;
+  }
   //
   //Double_t median = TMath::Median(index1-index0, &(ylaser[index0]));
     Double_t mean = TMath::Mean(index1-index0, &(ylaser[index0]));
@@ -2948,7 +2958,7 @@ void AliTPCcalibDButil::FilterGoofie(AliDCSSensorArray * goofieArray, Double_t d
            AliTPCcalibDButil::SmoothGraph(graphNew2,deltaT);
            AliTPCcalibDButil::SmoothGraph(graphNew2,deltaT);
            AliTPCcalibDButil::SmoothGraph(graphNew2,deltaT);
-           printf("%d\t%f\t%f\n",isensor, median,vrmsArray[isensor]);
+           //      AliInfo(Form("%d\t%f\t%f\n",isensor, median,vrmsArray[isensor]));
            vmedianArray[isensor]=median;
            //
          }
@@ -3006,7 +3016,7 @@ TMatrixD* AliTPCcalibDButil::MakeStatRelKalman(TObjArray * const array, Float_t
     if (!kalman) continue;
     if (TMath::Abs(kalman->GetTPCvdCorr()-1)>maxvd) continue;
     if (kalman->GetNUpdates()<minStat) continue;
-    if (kalman->GetNUpdates()/kalman->GetNTracks()<minFraction) continue;
+    if (Float_t(kalman->GetNUpdates())/Float_t(kalman->GetNTracks())<minFraction) continue;
     kalman->GetState(state);
     for (Int_t ipar=0; ipar<9; ipar++)
       (*valArray[ipar])[naccept]=state[ipar];