technial fix to suppress the warning
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSDD.cxx
1 /**************************************************************************
2  * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 ///////////////////////////////////////////////////////////////////
17 //                                                               //
18 // Implementation of the base class for SDD detector algorithms  //
19 // Origin: F.Prino, Torino, prino@to.infn.it                     //
20 //                                                               //
21 ///////////////////////////////////////////////////////////////////
22
23 #include "AliITSOnlineSDD.h"
24 #include "TH2F.h"
25
26 ClassImp(AliITSOnlineSDD)
27 //______________________________________________________________________
28   AliITSOnlineSDD::AliITSOnlineSDD():TObject(),fDDL(0),fCarlos(0),fSide(0),fFirstGoodTB(0),fLastGoodTB(0)
29 {
30   // default constructor
31   SetFirstGoodTB();
32   SetLastGoodTB();
33 }
34 //______________________________________________________________________
35   AliITSOnlineSDD::AliITSOnlineSDD(Int_t nddl, Int_t ncarlos, Int_t sid):TObject(),fDDL(0),fCarlos(0),fSide(0),fFirstGoodTB(0),fLastGoodTB(0)
36 {
37   // standard constructor
38   SetDDL(nddl);
39   SetCarlos(ncarlos);
40   SetDetectorSide(sid);
41   SetFirstGoodTB();
42   SetLastGoodTB();
43 }
44 //______________________________________________________________________
45 TH2F* AliITSOnlineSDD::ApplyZeroSuppression(TH2F* hRaw, Float_t basl, Int_t tL, Int_t tH){
46   // apply zero suppression 
47
48   Int_t nx=hRaw->GetNbinsX();
49   Float_t xmin=hRaw->GetXaxis()->GetXmin();
50   Float_t xmax=hRaw->GetXaxis()->GetXmax();
51   Int_t ny=hRaw->GetNbinsY();
52   Float_t ymin=hRaw->GetYaxis()->GetXmin();
53   Float_t ymax=hRaw->GetYaxis()->GetXmax();
54   TH2F* hZeroSupp=new TH2F(Form("%s_ZeroSupp",hRaw->GetName()),"",nx,xmin,xmax,ny,ymin,ymax);
55   for(Int_t ix=1; ix<=nx;ix++){
56     for(Int_t iy=1; iy<=ny;iy++){
57       //                     N
58       // Get "quintuple":   WCE
59       //                     S
60       Float_t cC=hRaw->GetBinContent(ix,iy)-basl;
61       Int_t nLow=0, nHigh=0;      
62       if(cC<tL){
63         hZeroSupp->SetBinContent(ix,iy,0.);
64         continue;
65       }
66       nLow++; // cC is greater than tL
67       if(cC>tH) nHigh++;
68       Float_t wW=0.;
69       if(iy>0) wW=hRaw->GetBinContent(ix,iy-1)-basl;
70       if(wW>tL) nLow++;
71       if(wW>tH) nHigh++;
72       Float_t eE=0.;
73       if(iy<ny) eE=hRaw->GetBinContent(ix,iy+1)-basl;
74       if(eE>tL) nLow++;
75       if(eE>tH) nHigh++;
76       Float_t nN=0.;
77       if(ix<nx) nN=hRaw->GetBinContent(ix+1,iy)-basl;
78       if(nN>tL) nLow++;
79       if(nN>tH) nHigh++;
80       Float_t sS=0.;
81       if(ix>0) sS=hRaw->GetBinContent(ix-1,iy)-basl;
82       if(sS>tL) nLow++;
83       if(sS>tH) nHigh++;
84       if(nLow>=2 && nHigh>=1){
85         hZeroSupp->SetBinContent(ix,iy,cC);
86       }else{
87         hZeroSupp->SetBinContent(ix,iy,0.);
88       }
89     }
90   }
91   return hZeroSupp;
92 }