]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalibViewer.h
Adding new option - cumulative statistic
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibViewer.h
1 #ifndef ALITPCCALIBVIEWER_H
2 #define ALITPCCALIBVIEWER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id: AliTPCCalibViewer.h,v */
7
8 ///////////////////////////////////////////////////
9 //                                               //
10 //  TPC calibration viewer/visualization class   //
11 //  use Tree for visualization                   //
12 ///////////////////////////////////////////////////
13
14 #include <TObject.h>
15 #include <TTree.h>
16 #include <TFile.h>
17 #include "AliTPCCalPad.h"
18 #include "AliTPCCalROC.h"
19 #include "TFriendElement.h"
20
21 #include "AliMathBase.h"
22 class TLegend;
23 class TGraph;
24
25
26 class AliTPCCalibViewer : public TObject {
27 public:
28    AliTPCCalibViewer();
29    AliTPCCalibViewer(const AliTPCCalibViewer &c);
30    AliTPCCalibViewer(TTree* tree);
31    AliTPCCalibViewer(char* fileName, char* treeName = "calPads");
32    AliTPCCalibViewer &operator = (const AliTPCCalibViewer & param);
33    virtual ~AliTPCCalibViewer();
34    virtual void Delete(Option_t* option = "");
35    
36    virtual void     Draw(Option_t* opt="") { fTree->Draw(opt); }
37    virtual Long64_t Draw(const char* varexp, const TCut& selection, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0) { return fTree->Draw(varexp, selection, option, nentries, firstentry); };
38    virtual Long64_t Draw(const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0) { return fTree->Draw(varexp, selection, option, nentries, firstentry); };
39
40    Int_t EasyDraw(const char* drawCommand, const char* sector, const char* cuts = 0, const char* drawOptions = 0, Bool_t writeDrawCommand = kFALSE) const;   // easy drawing of data, use '~' for abbreviation of '.fElements'
41    Int_t EasyDraw(const char* drawCommand, Int_t sector, const char* cuts = 0, const char* drawOptions = 0, Bool_t writeDrawCommand = kFALSE) const;   // easy drawing of data, use '~' for abbreviation of '.fElements'
42    Int_t EasyDraw1D(const char* drawCommand, const char* sector, const char* cuts = 0, const char* drawOptions = 0, Bool_t writeDrawCommand = kFALSE) const;   // easy drawing of data, use '~' for abbreviation of '.fElements'
43    Int_t EasyDraw1D(const char* drawCommand, Int_t sector, const char* cuts = 0, const char* drawOptions = 0, Bool_t writeDrawCommand = kFALSE) const;   // easy drawing of data, use '~' for abbreviation of '.fElements'
44    
45    Int_t  DrawHisto1D(const char* drawCommand,       Int_t sector, const char* cuts = 0, const char *sigmas = "2;4;6", Bool_t plotMean = kTRUE, Bool_t plotMedian = kTRUE, Bool_t plotLTM = kTRUE) const; // draws 1d histograms and superimposes mean, median, ltm and several sigma cuts
46    Int_t  DrawHisto1D(const char* drawCommand, const char* sector, const char* cuts = 0, const char *sigmas = "2;4;6", Bool_t plotMean = kTRUE, Bool_t plotMedian = kTRUE, Bool_t plotLTM = kTRUE) const; // draws 1d histograms and superimposes mean, median, ltm and several sigma cuts
47    Int_t     SigmaCut(const char* drawCommand,       Int_t sector, const char* cuts = 0, Float_t sigmaMax = 5, Bool_t plotMean = kTRUE, Bool_t plotMedian = kTRUE, Bool_t plotLTM = kTRUE, Bool_t pm = kFALSE, const char *sigmas = "", Float_t sigmaStep = -1) const;    // draws fraction of used pads over different sigma cuts
48    Int_t  SigmaCutNew(const char* drawCommand, const char* sector, const char* cuts = 0, Float_t sigmaMax = 5, Bool_t plotMean = kTRUE, Bool_t plotMedian = kTRUE, Bool_t plotLTM = kTRUE, Bool_t pm = kFALSE, const char *sigmas = "", Float_t sigmaStep = -1) const;    // draws fraction of used pads over different sigma cuts
49    Int_t     SigmaCut(const char* drawCommand, const char* sector, const char* cuts = 0, Float_t sigmaMax = 5, Bool_t plotMean = kTRUE, Bool_t plotMedian = kTRUE, Bool_t plotLTM = kTRUE, Bool_t pm = kFALSE, const char *sigmas = "", Float_t sigmaStep = -1) const;    // draws fraction of used pads over different sigma cuts
50    Int_t    Integrate(const char* drawCommand, const char* sector, const char* cuts = 0, Float_t sigmaMax = 5, Bool_t plotMean = kTRUE, Bool_t plotMedian = kTRUE, Bool_t plotLTM = kTRUE, const char *sigmas = "", Float_t sigmaStep = -1) const;    // draws an integrated histogram
51    Int_t    Integrate(const char* drawCommand,       Int_t sector, const char* cuts = 0, Float_t sigmaMax = 5, Bool_t plotMean = kTRUE, Bool_t plotMedian = kTRUE, Bool_t plotLTM = kTRUE, const char *sigmas = "", Float_t sigmaStep = -1) const;    // draws an integrated histogram
52    Int_t IntegrateOld(const char* drawCommand, const char* sector, const char* cuts = 0, Float_t sigmaMax = 5, Bool_t plotMean = kTRUE, Bool_t plotMedian = kTRUE, Bool_t plotLTM = kTRUE, const char *sigmas = "", Float_t sigmaStep = -1) const;    // draws an integrated histogram
53    
54    AliTPCCalPad* GetCalPad(const char* desiredData, char* cuts = "", char* calPadName = "NoName") const;     // returns an AliTPCCalPad object containing the specified data with cuts applied
55    AliTPCCalROC* GetCalROC(const char* desiredData, UInt_t sector, char* cuts = "") const;  // returns an AliTPCCalROC object containing the specified data for sector with cuts applied
56    
57    TObjArray* GetArrayOfCalPads();
58    TObjArray* GetListOfVariables(Bool_t printList = kFALSE);
59    TObjArray* GetListOfNormalizationVariables(Bool_t printList = kFALSE) const;
60    
61    static void MakeTreeWithObjects(const char * fileName, TObjArray * array, const char * mapFileName = 0);
62    static void MakeTree(const char * fileName, TObjArray * array, const char * mapFileName = 0, AliTPCCalPad* outlierPad = 0, Float_t ltmFraction = 0.9);
63    static void MakeTree(const char *outPutFileName, const Char_t *inputFileName, AliTPCCalPad *outlierPad = 0, Float_t ltmFraction = 0.9, const char *mapFileName = "$ALICE_ROOT/TPC/Calib/MapCalibrationObjects.root");
64    static void CreateObjectList(const Char_t *filename, TObjArray *calibObjects);
65    
66    TFriendElement* AddReferenceTree(const char* filename, const char* treename = "calPads", const char* refname = "R");
67    TFriendElement* AddFriend(const char* treename, const char* filename) {return fTree->AddFriend(treename, filename);};
68    TFriendElement* AddFriend(TTree* tree, const char* alias, Bool_t warn=kFALSE) {return fTree->AddFriend(tree, alias, warn);};
69    TFriendElement* AddFriend(const char* treename, TFile* file) {return fTree->AddFriend(treename, file);};
70    TTree * GetTree() { return fTree;}
71
72    TString* Fit(const char* drawCommand, const char* formula, const char* cuts, Double_t & chi2, TVectorD &fitParam, TMatrixD &covMatrix);
73
74   // 
75   // Array tools
76   // 
77   static Double_t GetLTM(Int_t n, Double_t *array, Double_t *sigma = 0, Double_t fraction = 0.9);
78   static Int_t GetBin(Float_t value, Int_t nbins, Double_t binLow, Double_t binUp);
79   static TH1F* SigmaCut(Int_t n, Float_t *array, Float_t mean, Float_t sigma, Int_t nbins, Float_t binLow, Float_t binUp, Float_t sigmaMax, Float_t sigmaStep = -1, Bool_t pm = kFALSE);
80   static TH1F* SigmaCut(TH1F *histogram, Float_t mean, Float_t sigma, Float_t sigmaMax, Float_t sigmaStep = -1, Bool_t pm = kFALSE);
81   static TH1F* Integrate(TH1F *histogram, Float_t mean = 0, Float_t sigma = 0, Float_t sigmaMax = 0, Float_t sigmaStep = -1);
82   static TH1F* Integrate(Int_t n, Float_t *array, Int_t nbins, Float_t binLow, Float_t binUp, Float_t mean = 0, Float_t sigma = 0, Float_t sigmaMax = 0, Float_t sigmaStep = -1);
83   
84   static TH1F* SigmaCut(Int_t n, Double_t *array, Double_t mean, Double_t sigma, Int_t nbins, Double_t *xbins, Double_t sigmaMax);
85    
86    
87          
88 protected:
89    TTree* fTree;     // tree containing visualization data (e.g. written by AliTPCCalPad::MakeTree(...)
90    TFile* fFile;     // file that contains a calPads tree (e.g. written by AliTPCCalPad::MakeTree(...)
91    TObjArray* fListOfObjectsToBeDeleted;  //Objects, that will be deleted when the destructor ist called
92    Bool_t fTreeMustBeDeleted;  // decides weather the tree must be deleted in destructor or not 
93    
94    void DrawLines(TH1F *cutHistoMean, TVectorF nsigma, TLegend *legend, Int_t color, Bool_t pm) const;
95    void DrawLines(TGraph *graph, TVectorF nsigma, TLegend *legend, Int_t color, Bool_t pm) const;
96   
97    
98    ClassDef(AliTPCCalibViewer,1)    //  TPC calibration viewer class
99 };
100
101 #endif
102
103
104