ROOT logo
#ifndef HSHOWERDIGIPAR_H
#define HSHOWERDIGIPAR_H

#include "hparcond.h"
#include "TH1D.h"
#include "TH2D.h"
#include "TArrayF.h"
#include "TArrayD.h"
#include "TObjArray.h"

class HShowerDigiPar : public HParCond {
private:
  TArrayF gain;                // gain of the 18 chambers
  TArrayF threshold;           // charge threshold for efficiency determination for 18 chambers

  TArrayF effScaleMap;         // efficiency mapping sector, module, row, col [6*3*32*32]
  TArrayD globalEff;           // global function - Efficiency (Beta) scaled up & down
  TArrayD chargeVsBeta[6][3];  // charge arrays per Beta

  Float_t fThickDet;           // thickness of gas chamber
  Int_t   nMatrixRange;        // size of pfChargeMatrix = 2*nMatrixRange+1
  Float_t fBoxSize;            // size of element of charge density matrix
  Float_t fChargeSlope;        // charge distribution slope parameter
  Float_t fPlaneDist;          // plane cathod to sense wires plane distance
  Float_t fPadThreshold;       // charge threshold for a pad
  Float_t fUpdatePadThreshold; // charge threshold for track updating

  Int_t   chargeMatrixSize;    //! size of pfChargeMatrix = 2*nMatrixRange+1
  Float_t *pfChargeMatrix;     //! charge density matrix

  Int_t   nGlobalEffBins;      //! number of bins in efficiency histograms
  Int_t   nQvBxbins[6][3];     //! number of Q bins in Q(beta) propability histogram

  TH1D      *phEff;            //! efficiency(beta) histogram
  TH2D      *ph2QvB[6][3];     //! Q(beta) propability histogram
  TObjArray *pArrayQvB[6][3];  //! array of 1-dim Q histograms

public:
  HShowerDigiPar(const Char_t* name="ShowerDigiPar",
                 const Char_t* title="Digitisation parameters for Shower",
                 const Char_t* context="ShowerStandardDigiPar");
  ~HShowerDigiPar();

  void    clear(void);
  Bool_t  init(HParIo*, Int_t*);
  void    putParams(HParamList*);
  Bool_t  getParams(HParamList*);

  Float_t getGain(Int_t sec, Int_t mod)      { return gain.At(sec*3+mod);      }
  Float_t getThreshold(Int_t sec, Int_t mod) { return threshold.At(sec*3+mod); }

  Float_t getThickDet()           { return fThickDet;           }
  Int_t   getMatrixRange()        { return nMatrixRange;        }
  Float_t getBoxSize()            { return fBoxSize;            }
  Float_t getChargeSlope()        { return fChargeSlope;        }
  Float_t getPlaneDist()          { return fPlaneDist;          }
  Float_t getPadThreshold()       { return fPadThreshold;       }
  Float_t getUpdatePadThreshold() { return fUpdatePadThreshold; }

  void setGain(Int_t sec, Int_t mod, Float_t fGain)       { gain.AddAt(fGain,sec*3+mod);       }
  void setThreshold(Int_t sec, Int_t mod, Float_t fThres) { threshold.AddAt(fThres,sec*3+mod); }

  void setThickDet(Float_t fThick)           { fThickDet           = fThick; }
  void setMatrixRange(Int_t iRange)          { nMatrixRange        = iRange; }
  void setBoxSize(Float_t fSize)             { fBoxSize            = fSize;  }
  void setChargeSlope(Float_t fSlope)        { fChargeSlope        = fSlope; }
  void setPlaneDist(Float_t fDist)           { fPlaneDist          = fDist;  }
  void setPadThreshold(Float_t fThres)	     { fPadThreshold       = fThres; }
  void setUpdatePadThreshold(Float_t fThres) { fUpdatePadThreshold = fThres; }

  void   setEffScaleMap(TArrayF&);
  TArrayF& getEffScaleMap() { return effScaleMap;}
  void   setGlobalEff(TArrayD&);
  void   setChargeVsBeta(Int_t, Int_t, TArrayD&);
  Bool_t recreateHistograms();

  const Float_t* getChargeMatrix()                { return pfChargeMatrix;   }
  const TH1D*    getEfficiencyHist()              { return phEff;            } 
  const TH2D*    getQvBHist(Int_t sec, Int_t mod) { return ph2QvB[sec][mod]; }

  Float_t getEfficiency(Int_t sec,Int_t mod,Int_t row,Int_t col, Float_t fBeta);
  Bool_t  checkEfficiency(Int_t sec,Int_t mod,Int_t row,Int_t col, Float_t fBeta);
  Float_t getCharge(Int_t sec,Int_t mod, Float_t fBeta);

  //private:
  void    removeHistograms(void);
  void    removeChargeHistograms(void);
  void    removeEfficiencyHistograms(void);
  void    removeQvBHistograms(void);
  Float_t calcCharge(Float_t fCharge, Float_t fDist, Float_t fXd,
                     Float_t fYd, Float_t fXu, Float_t fYu);
  void    setChargeMatrix(Int_t nRange, const Float_t *pMatrix = NULL);
  Bool_t  initChargeMatrix(void);
  Bool_t  initEffHistogram(void);
  Bool_t  initSumVersBetaHistograms(void);
  Int_t   padIndex(Int_t sec,Int_t mod,Int_t row,Int_t col) {
            return sec*3072 + mod*1024 + row*32 + col;
          } // 3*32*32=3072, 32*32=1024

  ClassDef(HShowerDigiPar,1) //ROOT extension
};
#endif
 hshowerdigipar.h:1
 hshowerdigipar.h:2
 hshowerdigipar.h:3
 hshowerdigipar.h:4
 hshowerdigipar.h:5
 hshowerdigipar.h:6
 hshowerdigipar.h:7
 hshowerdigipar.h:8
 hshowerdigipar.h:9
 hshowerdigipar.h:10
 hshowerdigipar.h:11
 hshowerdigipar.h:12
 hshowerdigipar.h:13
 hshowerdigipar.h:14
 hshowerdigipar.h:15
 hshowerdigipar.h:16
 hshowerdigipar.h:17
 hshowerdigipar.h:18
 hshowerdigipar.h:19
 hshowerdigipar.h:20
 hshowerdigipar.h:21
 hshowerdigipar.h:22
 hshowerdigipar.h:23
 hshowerdigipar.h:24
 hshowerdigipar.h:25
 hshowerdigipar.h:26
 hshowerdigipar.h:27
 hshowerdigipar.h:28
 hshowerdigipar.h:29
 hshowerdigipar.h:30
 hshowerdigipar.h:31
 hshowerdigipar.h:32
 hshowerdigipar.h:33
 hshowerdigipar.h:34
 hshowerdigipar.h:35
 hshowerdigipar.h:36
 hshowerdigipar.h:37
 hshowerdigipar.h:38
 hshowerdigipar.h:39
 hshowerdigipar.h:40
 hshowerdigipar.h:41
 hshowerdigipar.h:42
 hshowerdigipar.h:43
 hshowerdigipar.h:44
 hshowerdigipar.h:45
 hshowerdigipar.h:46
 hshowerdigipar.h:47
 hshowerdigipar.h:48
 hshowerdigipar.h:49
 hshowerdigipar.h:50
 hshowerdigipar.h:51
 hshowerdigipar.h:52
 hshowerdigipar.h:53
 hshowerdigipar.h:54
 hshowerdigipar.h:55
 hshowerdigipar.h:56
 hshowerdigipar.h:57
 hshowerdigipar.h:58
 hshowerdigipar.h:59
 hshowerdigipar.h:60
 hshowerdigipar.h:61
 hshowerdigipar.h:62
 hshowerdigipar.h:63
 hshowerdigipar.h:64
 hshowerdigipar.h:65
 hshowerdigipar.h:66
 hshowerdigipar.h:67
 hshowerdigipar.h:68
 hshowerdigipar.h:69
 hshowerdigipar.h:70
 hshowerdigipar.h:71
 hshowerdigipar.h:72
 hshowerdigipar.h:73
 hshowerdigipar.h:74
 hshowerdigipar.h:75
 hshowerdigipar.h:76
 hshowerdigipar.h:77
 hshowerdigipar.h:78
 hshowerdigipar.h:79
 hshowerdigipar.h:80
 hshowerdigipar.h:81
 hshowerdigipar.h:82
 hshowerdigipar.h:83
 hshowerdigipar.h:84
 hshowerdigipar.h:85
 hshowerdigipar.h:86
 hshowerdigipar.h:87
 hshowerdigipar.h:88
 hshowerdigipar.h:89
 hshowerdigipar.h:90
 hshowerdigipar.h:91
 hshowerdigipar.h:92
 hshowerdigipar.h:93
 hshowerdigipar.h:94
 hshowerdigipar.h:95
 hshowerdigipar.h:96
 hshowerdigipar.h:97
 hshowerdigipar.h:98
 hshowerdigipar.h:99
 hshowerdigipar.h:100
 hshowerdigipar.h:101
 hshowerdigipar.h:102