]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
ATO-97, ATO-78 - implemented convolution of calibration parameters. Used in order...
authormivanov <marian.ivanov@cern.ch>
Tue, 4 Nov 2014 06:39:28 +0000 (07:39 +0100)
committermivanov <marian.ivanov@cern.ch>
Sat, 22 Nov 2014 23:19:00 +0000 (00:19 +0100)
TPC/Base/AliTPCCalPad.cxx
TPC/Base/AliTPCCalPad.h
TPC/Base/AliTPCCalROC.cxx
TPC/Base/AliTPCCalROC.h

index 85e0be37b3d778c1b93929b63315fcf7392b0aea..18786bb3de00894936c05181a731d89c8fb6f7d9 100644 (file)
@@ -187,6 +187,21 @@ Bool_t  AliTPCCalPad::LTMFilter(Int_t deltaRow, Int_t deltaPad, Float_t fraction
   return isOK;
 }
 
+Bool_t  AliTPCCalPad::Convolute(Double_t sigmaPad, Double_t sigmaRow,  AliTPCCalPad*outlierPad, TF1 *fpad, TF1 *frow){
+  //
+  // replace constent with median in the neigborhood
+  //
+  Bool_t isOK=kTRUE;
+  for (Int_t isec = 0; isec < kNsec; isec++) {
+    AliTPCCalROC *outlierROC=(outlierPad==NULL)?NULL:outlierPad->GetCalROC(isec);
+    if (fROC[isec]){
+      isOK&=fROC[isec]->Convolute(sigmaPad,sigmaRow,outlierROC,fpad,frow);
+    }
+  }
+  return isOK;
+}
+
+
 //_____________________________________________________________________________
 void AliTPCCalPad::Add(Float_t c1)
 {
index 82eeb1f22cadbfd2d697f31c45892acb0dfcffe2..40f7fc876d5fb950eebd5e748c502b0759f674af 100644 (file)
@@ -29,6 +29,7 @@ class TH1F;
 class TCanvas;
 class TTree;
 class TH2;
+class TF1;
 
 class AliTPCCalPad : public TNamed {
  public:
@@ -50,6 +51,7 @@ class AliTPCCalPad : public TNamed {
   // convolution
   Bool_t MedianFilter(Int_t deltaRow, Int_t deltaPad, AliTPCCalPad*outlierPad=0, Bool_t doEdge=kTRUE);
   Bool_t LTMFilter(Int_t deltaRow, Int_t deltaPad, Float_t fraction, Int_t type, AliTPCCalPad*outlierPad=0, Bool_t doEdge=kTRUE);
+  Bool_t Convolute(Double_t sigmaPad, Double_t sigmaRow,  AliTPCCalPad*outlierPad=0, TF1 *fpad=0, TF1 *frow=0 );
   //
   // algebra
   void Add(Float_t c1);   // add constant c1 to all channels of all ROCs
index fb5f42583bc568ecf9b99faa4b455b42af66be8b..21a2a84e8c55847e11410b171eb333f622e4ec00 100644 (file)
@@ -257,6 +257,43 @@ Bool_t AliTPCCalROC::LTMFilter(Int_t deltaRow, Int_t deltaPad, Float_t fraction,
   return kTRUE;
 }
 
+Bool_t  AliTPCCalROC::Convolute(Double_t sigmaPad, Double_t sigmaRow,  AliTPCCalROC*outlierROC, TF1 */*fpad*/, TF1 */*frow*/){
+  //
+  // convolute the calibration with function fpad,frow
+  // in range +-4 sigma
+
+  Float_t *newBuffer=new Float_t[fNChannels] ;
+  //
+  for (Int_t iRow=0; iRow< Int_t(fNRows); iRow++){
+    Int_t nPads=GetNPads(iRow); // number of rows in current row
+    for (Int_t iPad=0; iPad<nPads; iPad++){
+      Int_t jRow0=TMath::Max(TMath::Nint(iRow-sigmaRow*4.),0);
+      Int_t jRow1=TMath::Min(TMath::Nint(iRow+sigmaRow*4.),Int_t(fNRows));
+      Int_t jPad0=TMath::Max(TMath::Nint(iPad-sigmaPad*4.),0);
+      Int_t jPad1=TMath::Min(TMath::Nint(iRow+sigmaPad*4.),Int_t(nPads));
+      //
+      Double_t sumW=0;
+      Double_t sumCal=0;
+      for (Int_t jRow=jRow0; jRow<=jRow1; jRow++){
+       for (Int_t jPad=jPad0; jPad<=jPad1; jPad++){
+         if (!IsInRange(jRow,jPad)) continue;
+         Bool_t isOutlier=(outlierROC==NULL)?kFALSE:outlierROC->GetValue(jRow,jPad)>0;
+         if (!isOutlier){
+           Double_t weight= TMath::Gaus(jPad,iPad,sigmaPad)*TMath::Gaus(jRow,iRow,sigmaRow);       
+           sumCal+=weight*GetValue(jRow,jPad);
+           sumW+=weight;
+         }
+       }
+      }
+      if (sumW>0){
+       sumCal/=sumW;
+       newBuffer[fkIndexes[iRow]+iPad]=sumCal;
+      }
+    }
+  }
+  memcpy(fData, newBuffer,GetNchannels()*sizeof(Float_t));
+  delete []newBuffer;
+}
 
 
 //
index a85a460b6d0c9b76b9ca04c4eee9ff10f9478a2f..477d07bad9499226ed24df96fe5df4cc6d564a9d 100644 (file)
@@ -18,6 +18,7 @@
 class TH1F;
 class TH2F;
 class TArrayI;
+class TF1;
 //_____________________________________________________________________________
 class AliTPCCalROC : public TNamed {
 
@@ -41,6 +42,7 @@ class AliTPCCalROC : public TNamed {
   //
   Bool_t MedianFilter(Int_t deltaRow, Int_t deltaPad, AliTPCCalROC*outlierROC=0, Bool_t doEdge=kTRUE);
   Bool_t LTMFilter(Int_t deltaRow, Int_t deltaPad, Float_t fraction, Int_t type,  AliTPCCalROC*outlierROC=0, Bool_t doEdge=kTRUE);
+  Bool_t Convolute(Double_t sigmaPad, Double_t sigmaRow,  AliTPCCalROC*outlierPad=0, TF1 *fpad=0, TF1 *frow=0 );
   //
   // algebra
   void Add(Float_t c1); // add c1 to each channel of the ROC