ROOT logo
// File: $RCSfile: hmdcslope.h,v $
//
// Version: $Revision: 1.8 $
// Modified by $Author: halo $ on $Date: 2009-07-15 11:42:10 $
////////////////////////////////////////////////////////////

#ifndef HMDSLOPE_H
#define HMDSLOPE_H

#include "hreconstructor.h"
#include "TH1.h"
#include "TH2.h"
#include "TNtuple.h"

typedef Int_t   MyInt;
typedef Float_t MyFloat;

class TFile;
class HCategory;
class HIterator;
class HMdcCalPar;
class HMdcCalParRaw;

typedef MyFloat MyFloatField [6][4][16][96];
typedef MyInt   MyIntField   [6][4][16][96];

typedef MyInt   MboSlopeTrendIntField[16][96][5000]; // slope binning 1e-4
typedef MyInt   MboErrorTrendIntField[16][96][600];  // error binning 5e-7

class HMdcSlope : public HReconstructor {

protected:
    HCategory     *rawCat;     //! pointer to the raw data
    HCategory     *slopeCat;   //! pointer to the calibration's slope
    HIterator     *iter;       //! iterator on raw data
    HMdcCalParRaw *calparraw;  //! calibration parameters on raw level
    
    Char_t *fNameRoot;         //! file name of root output file
    Char_t *fNameNtuple;       //! file name of ntuple output file

    MyFloatField *avgSlope;
    MyFloatField *avgSlopeErr;
    MyIntField   *nEvt;

    //    MboSlopeTrendIntField (*slopeTrend)[6][4];
    //MboErrorTrendIntField *errorTrend[6][4];

    Int_t slopeTrend[6][4][16][96][5000];

    Bool_t trendCalculationActive;
    Int_t  calibrationAlgorithm;
    Int_t  nTimeValues;
    Int_t  debugActive;   //! 0x00: off, 0x01: general, 0x02: init, 0x04: finalize, 0x08: execute, 0x10: calc, 0x20: fitHistogramm
    Int_t  fitHistMethod;
 
    Bool_t linRegActive;
    Bool_t histFitActive;
    Bool_t graphFitActive;
    Int_t  binError;

    Bool_t selectorActive;
    Int_t  mbSelector;
    Int_t  tdcSelector;

    Bool_t createNtupleActive;
    TFile *ntupleOutputFile;
    TNtuple *ntuple;

    TFile *file;

    TH1F *hSlope;
    TH1F *hTime;
    
    enum calibrationMethod {HMDC_SLOPE_LIN_REG_6   = 1, 
			    HMDC_SLOPE_HIST_FIT_5  = 2,
			    HMDC_SLOPE_GRAPH_FIT_5 = 3,
			    HMDC_SLOPE_LIN_REG_5   = 4 };

public:
    HMdcSlope();
    HMdcSlope(const Text_t* name,const Text_t* title);
    ~HMdcSlope();

    Bool_t init();
    Bool_t finalize();
    Int_t  execute();
    
    Int_t calcBinNr(Double_t, Double_t, Double_t, Int_t);
    
    void setOutputRoot (Char_t*);
    void setOutputNtuple(Char_t*);

    void selectCalibrationAlgorithm(Int_t);
    void selectHistFitMethod(Int_t);
    void setBinError(Int_t);
    void setCreateNtupleActive(Bool_t);
    void setDebugActive(Int_t);
    void setGraphFitActive(Bool_t);
    void setHistFitActive(Bool_t);
    void setLinRegActive(Bool_t);
    void setMbSelector(Int_t);
    void setnTimeValues(Int_t);
    void setTrendCalculationActive(Bool_t);
    void setSelectorActive(Bool_t);
    void setTdcSelector(Int_t);
    
protected:
    void calc     (Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Float_t, Float_t*, Float_t*);
    void calc5    (Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Float_t, Float_t*, Float_t*);
    void calcCHI  (Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Float_t, Float_t*, Float_t*);
    void calcGraph(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Float_t, Float_t*, Float_t*);
    void calcSlope(Int_t, Int_t, Int_t, Int_t, Int_t, Int_t, Float_t, Float_t*, Float_t*, Float_t*, Int_t, Int_t);
    void fitHistogramm(Float_t*, Float_t*, Int_t, Int_t, Int_t, Int_t, Int_t);
    void fitHistogrammMeanCondition(Float_t*, Float_t*, Int_t, Int_t, Int_t, Int_t);
    void fitHistogrammMaxCondition(Float_t*, Float_t*, Int_t, Int_t, Int_t, Int_t);

public: // This has to be placed at the end (--> root docs)
    ClassDef(HMdcSlope, 0) //! Class calculates slopes and errors for TDC channels from internal calibration.
};

#endif /* !HMDCSLOPE_H */









 hmdcslope.h:1
 hmdcslope.h:2
 hmdcslope.h:3
 hmdcslope.h:4
 hmdcslope.h:5
 hmdcslope.h:6
 hmdcslope.h:7
 hmdcslope.h:8
 hmdcslope.h:9
 hmdcslope.h:10
 hmdcslope.h:11
 hmdcslope.h:12
 hmdcslope.h:13
 hmdcslope.h:14
 hmdcslope.h:15
 hmdcslope.h:16
 hmdcslope.h:17
 hmdcslope.h:18
 hmdcslope.h:19
 hmdcslope.h:20
 hmdcslope.h:21
 hmdcslope.h:22
 hmdcslope.h:23
 hmdcslope.h:24
 hmdcslope.h:25
 hmdcslope.h:26
 hmdcslope.h:27
 hmdcslope.h:28
 hmdcslope.h:29
 hmdcslope.h:30
 hmdcslope.h:31
 hmdcslope.h:32
 hmdcslope.h:33
 hmdcslope.h:34
 hmdcslope.h:35
 hmdcslope.h:36
 hmdcslope.h:37
 hmdcslope.h:38
 hmdcslope.h:39
 hmdcslope.h:40
 hmdcslope.h:41
 hmdcslope.h:42
 hmdcslope.h:43
 hmdcslope.h:44
 hmdcslope.h:45
 hmdcslope.h:46
 hmdcslope.h:47
 hmdcslope.h:48
 hmdcslope.h:49
 hmdcslope.h:50
 hmdcslope.h:51
 hmdcslope.h:52
 hmdcslope.h:53
 hmdcslope.h:54
 hmdcslope.h:55
 hmdcslope.h:56
 hmdcslope.h:57
 hmdcslope.h:58
 hmdcslope.h:59
 hmdcslope.h:60
 hmdcslope.h:61
 hmdcslope.h:62
 hmdcslope.h:63
 hmdcslope.h:64
 hmdcslope.h:65
 hmdcslope.h:66
 hmdcslope.h:67
 hmdcslope.h:68
 hmdcslope.h:69
 hmdcslope.h:70
 hmdcslope.h:71
 hmdcslope.h:72
 hmdcslope.h:73
 hmdcslope.h:74
 hmdcslope.h:75
 hmdcslope.h:76
 hmdcslope.h:77
 hmdcslope.h:78
 hmdcslope.h:79
 hmdcslope.h:80
 hmdcslope.h:81
 hmdcslope.h:82
 hmdcslope.h:83
 hmdcslope.h:84
 hmdcslope.h:85
 hmdcslope.h:86
 hmdcslope.h:87
 hmdcslope.h:88
 hmdcslope.h:89
 hmdcslope.h:90
 hmdcslope.h:91
 hmdcslope.h:92
 hmdcslope.h:93
 hmdcslope.h:94
 hmdcslope.h:95
 hmdcslope.h:96
 hmdcslope.h:97
 hmdcslope.h:98
 hmdcslope.h:99
 hmdcslope.h:100
 hmdcslope.h:101
 hmdcslope.h:102
 hmdcslope.h:103
 hmdcslope.h:104
 hmdcslope.h:105
 hmdcslope.h:106
 hmdcslope.h:107
 hmdcslope.h:108
 hmdcslope.h:109
 hmdcslope.h:110
 hmdcslope.h:111
 hmdcslope.h:112
 hmdcslope.h:113
 hmdcslope.h:114
 hmdcslope.h:115
 hmdcslope.h:116
 hmdcslope.h:117
 hmdcslope.h:118
 hmdcslope.h:119
 hmdcslope.h:120
 hmdcslope.h:121
 hmdcslope.h:122
 hmdcslope.h:123
 hmdcslope.h:124
 hmdcslope.h:125
 hmdcslope.h:126
 hmdcslope.h:127
 hmdcslope.h:128
 hmdcslope.h:129
 hmdcslope.h:130