Add method to apply offline zero suppression to SDD raw data
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 Feb 2011 23:45:49 +0000 (23:45 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 Feb 2011 23:45:49 +0000 (23:45 +0000)
ITS/AliITSOnlineSDD.cxx
ITS/AliITSOnlineSDD.h

index a207555..38a3b0d 100644 (file)
@@ -21,6 +21,7 @@
 ///////////////////////////////////////////////////////////////////
 
 #include "AliITSOnlineSDD.h"
+#include "TH2F.h"
 
 ClassImp(AliITSOnlineSDD)
 //______________________________________________________________________
@@ -40,3 +41,52 @@ ClassImp(AliITSOnlineSDD)
   SetFirstGoodTB();
   SetLastGoodTB();
 }
+//______________________________________________________________________
+TH2F* AliITSOnlineSDD::ApplyZeroSuppression(TH2F* hRaw, Float_t basl, Int_t tL, Int_t tH){
+  // apply zero suppression 
+
+  Int_t nx=hRaw->GetNbinsX();
+  Float_t xmin=hRaw->GetXaxis()->GetXmin();
+  Float_t xmax=hRaw->GetXaxis()->GetXmax();
+  Int_t ny=hRaw->GetNbinsY();
+  Float_t ymin=hRaw->GetYaxis()->GetXmin();
+  Float_t ymax=hRaw->GetYaxis()->GetXmax();
+  TH2F* hZeroSupp=new TH2F(Form("%s_ZeroSupp",hRaw->GetName()),"",nx,xmin,xmax,ny,ymin,ymax);
+  for(Int_t ix=1; ix<=nx;ix++){
+    for(Int_t iy=1; iy<=ny;iy++){
+      //                     N
+      // Get "quintuple":   WCE
+      //                     S
+      Float_t cC=hRaw->GetBinContent(ix,iy)-basl;
+      Int_t nLow=0, nHigh=0;      
+      if(cC<tL){
+       hZeroSupp->SetBinContent(ix,iy,0.);
+       continue;
+      }
+      nLow++; // cC is greater than tL
+      if(cC>tH) nHigh++;
+      Float_t wW=0.;
+      if(iy>0) wW=hRaw->GetBinContent(ix,iy-1)-basl;
+      if(wW>tL) nLow++;
+      if(wW>tH) nHigh++;
+      Float_t eE=0.;
+      if(iy<ny) eE=hRaw->GetBinContent(ix,iy+1)-basl;
+      if(eE>tL) nLow++;
+      if(eE>tH) nHigh++;
+      Float_t nN=0.;
+      if(ix<nx) nN=hRaw->GetBinContent(ix+1,iy)-basl;
+      if(nN>tL) nLow++;
+      if(nN>tH) nHigh++;
+      Float_t sS=0.;
+      if(ix>0) sS=hRaw->GetBinContent(ix-1,iy)-basl;
+      if(sS>tL) nLow++;
+      if(sS>tH) nHigh++;
+      if(nLow>=2 && nHigh>=1){
+       hZeroSupp->SetBinContent(ix,iy,cC);
+      }else{
+       hZeroSupp->SetBinContent(ix,iy,0.);
+      }
+    }
+  }
+  return hZeroSupp;
+}
index 1fbefff..5859fb7 100644 (file)
@@ -11,6 +11,8 @@
 
 #include<TObject.h>
 
+class TH2F;
+
 class AliITSOnlineSDD : public TObject {
 
  public:
@@ -30,6 +32,8 @@ class AliITSOnlineSDD : public TObject {
   Int_t GetFirstGoodTB() const {return fFirstGoodTB;}
   Int_t GetLastGoodTB() const {return fLastGoodTB;}
 
+  static TH2F* ApplyZeroSuppression(TH2F* hRaw, Float_t basl, Int_t tL, Int_t tH);
+
  protected:
   static const Int_t fgkNAnodes = 256; // number of anodes in each half-module
   Int_t fDDL;         // SDD DDL number (from 0 to 24)