ROOT logo
#ifndef ALITRDCALDET_H
#define ALITRDCALDET_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

///////////////////////////////////////////////////////////////////////////////
//                                                                           //
//  TRD calibration class for parameters which are saved per detector        //
//                                                                           //
///////////////////////////////////////////////////////////////////////////////

#include "TNamed.h"

#include "../AliTRDgeometry.h"

class TH1F;
class TH2F;

class AliTRDCalDet : public TNamed {

 public:
 
  enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 };

  AliTRDCalDet();
  AliTRDCalDet(const Text_t* name, const Text_t* title);
  AliTRDCalDet(const AliTRDCalDet &c);   
  virtual      ~AliTRDCalDet();
  AliTRDCalDet &operator=(const AliTRDCalDet &c);

  virtual void  Copy(TObject &c) const;

  Float_t       GetValue(Int_t d) const          { return fData[d];  };
  Float_t       GetValue(Int_t p, Int_t c, Int_t s) const 
                                                 { return fData[AliTRDgeometry::GetDetector(p,c,s)];  };

  void          SetValue(Int_t d, Float_t value) { fData[d] = value; };
  void          SetValue(Int_t p, Int_t c, Int_t s, Float_t value) 
                                                 { fData[AliTRDgeometry::GetDetector(p,c,s)] = value; };

  // statistic
  Double_t GetMean(AliTRDCalDet * const outlierDet=0) const;
  Double_t GetRMS(AliTRDCalDet * const outlierDet=0) const;
  Double_t GetRMSRobust(Double_t robust=0.92) const;
  Double_t GetMedian(AliTRDCalDet * const outlierDet=0) const;
  Double_t GetLTM(Double_t * sigma=0, Double_t fraction=0.9, AliTRDCalDet * const outlierDet=0);     
  Double_t CalcMean(Bool_t wghtPads=kFALSE);
  Double_t CalcMean(Bool_t wghtPads, Int_t &calib);
  Double_t CalcRMS(Bool_t wghtPads=kFALSE);
  Double_t CalcRMS(Bool_t wghtPads, Int_t &calib);
  Double_t GetMeanSM(Bool_t wghtPads, Int_t sector) const;
  
  // Plot functions
  TH1F * MakeHisto1Distribution(Float_t min=4, Float_t max=-4, Int_t type=0);     
  TH1F * MakeHisto1DAsFunctionOfDet(Float_t min=4, Float_t max=-4, Int_t type=0);
  TH2F * MakeHisto2DCh(Int_t ch, Float_t min=4, Float_t max=-4, Int_t type=0);  
  TH2F * MakeHisto2DSmPl(Int_t sm, Int_t pl, Float_t min=4, Float_t max=-4, Int_t type=0); 

  // algebra functions
  void Add(Float_t c1);
  void Multiply(Float_t c1);
  void Add(const AliTRDCalDet * calDet, Double_t c1 = 1);
  void Multiply(const AliTRDCalDet * calDet);
  void Divide(const AliTRDCalDet * calDet);
    
 protected:

  Float_t  fData[kNdet];       //[kNdet] Data

  ClassDef(AliTRDCalDet,1)     //  TRD calibration class for parameters which are saved per detector

};

#endif
 AliTRDCalDet.h:1
 AliTRDCalDet.h:2
 AliTRDCalDet.h:3
 AliTRDCalDet.h:4
 AliTRDCalDet.h:5
 AliTRDCalDet.h:6
 AliTRDCalDet.h:7
 AliTRDCalDet.h:8
 AliTRDCalDet.h:9
 AliTRDCalDet.h:10
 AliTRDCalDet.h:11
 AliTRDCalDet.h:12
 AliTRDCalDet.h:13
 AliTRDCalDet.h:14
 AliTRDCalDet.h:15
 AliTRDCalDet.h:16
 AliTRDCalDet.h:17
 AliTRDCalDet.h:18
 AliTRDCalDet.h:19
 AliTRDCalDet.h:20
 AliTRDCalDet.h:21
 AliTRDCalDet.h:22
 AliTRDCalDet.h:23
 AliTRDCalDet.h:24
 AliTRDCalDet.h:25
 AliTRDCalDet.h:26
 AliTRDCalDet.h:27
 AliTRDCalDet.h:28
 AliTRDCalDet.h:29
 AliTRDCalDet.h:30
 AliTRDCalDet.h:31
 AliTRDCalDet.h:32
 AliTRDCalDet.h:33
 AliTRDCalDet.h:34
 AliTRDCalDet.h:35
 AliTRDCalDet.h:36
 AliTRDCalDet.h:37
 AliTRDCalDet.h:38
 AliTRDCalDet.h:39
 AliTRDCalDet.h:40
 AliTRDCalDet.h:41
 AliTRDCalDet.h:42
 AliTRDCalDet.h:43
 AliTRDCalDet.h:44
 AliTRDCalDet.h:45
 AliTRDCalDet.h:46
 AliTRDCalDet.h:47
 AliTRDCalDet.h:48
 AliTRDCalDet.h:49
 AliTRDCalDet.h:50
 AliTRDCalDet.h:51
 AliTRDCalDet.h:52
 AliTRDCalDet.h:53
 AliTRDCalDet.h:54
 AliTRDCalDet.h:55
 AliTRDCalDet.h:56
 AliTRDCalDet.h:57
 AliTRDCalDet.h:58
 AliTRDCalDet.h:59
 AliTRDCalDet.h:60
 AliTRDCalDet.h:61
 AliTRDCalDet.h:62
 AliTRDCalDet.h:63
 AliTRDCalDet.h:64
 AliTRDCalDet.h:65
 AliTRDCalDet.h:66
 AliTRDCalDet.h:67
 AliTRDCalDet.h:68
 AliTRDCalDet.h:69
 AliTRDCalDet.h:70
 AliTRDCalDet.h:71
 AliTRDCalDet.h:72
 AliTRDCalDet.h:73
 AliTRDCalDet.h:74
 AliTRDCalDet.h:75
 AliTRDCalDet.h:76