ATO-98 - Temporary Bug fix: Use proper radius range to select TOF space point. Nicer...
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibViewer.h
CommitLineData
39bcd65d 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
2811495d 14class TFile;
72d0ab7e 15class TLegend;
4f3934a1 16class TGraph;
661f340b 17class TH1;
18class TH1F;
2811495d 19#include <TTree.h>
20#include <TMatrixDfwd.h>
661f340b 21#include <TVectorDfwd.h>
22#include <TVectorFfwd.h>
2811495d 23
24class AliTPCCalPad;
25class AliTPCCalROC;
26class TFriendElement;
72d0ab7e 27
39bcd65d 28
29class AliTPCCalibViewer : public TObject {
30public:
31 AliTPCCalibViewer();
32 AliTPCCalibViewer(const AliTPCCalibViewer &c);
2811495d 33 AliTPCCalibViewer(TTree *const tree);
a6e0ebfe 34 AliTPCCalibViewer(const char* fileName, const char* treeName = "calPads");
39bcd65d 35 AliTPCCalibViewer &operator = (const AliTPCCalibViewer & param);
36 virtual ~AliTPCCalibViewer();
a6d2bd0c 37 virtual void Delete(Option_t* option = "");
39bcd65d 38
8192627b 39 TString& GetAbbreviation() { return fAbbreviation; }
40 TString& GetAppendString() { return fAppendString; }
2811495d 41 void SetAbbreviation(const Char_t *abr) { fAbbreviation = abr; }
42 void SetAppendString(const Char_t *str) { fAppendString = str; }
832bb12c 43
39bcd65d 44 virtual void Draw(Option_t* opt="") { fTree->Draw(opt); }
45 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); };
46 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); };
47
2811495d 48 const char* AddAbbreviations(const Char_t *c, Bool_t printDrawCommand = kFALSE);
39bcd65d 49 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'
50 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'
51 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'
52 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'
832bb12c 53 void FormatHistoLabels(TH1 *histo) const; // formats title and axis labels of histo, removes '.fElements'
72d0ab7e 54
55 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
56 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
57 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
4f3934a1 58 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
72d0ab7e 59 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
60 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
61 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
4f3934a1 62 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
39bcd65d 63
a6e0ebfe 64 AliTPCCalPad* GetCalPadOld(const char* desiredData, const char* cuts = "", const char* calPadName = "NoName") const; // returns an AliTPCCalPad object containing the specified data with cuts applied
65 AliTPCCalPad* GetCalPad(const char* desiredData, const char* cuts = "", const char* calPadName = "NoName") const; // returns an AliTPCCalPad object containing the specified data with cuts applied
ac7becc3 66
f78da5ae 67 AliTPCCalROC* GetCalROC(const char* desiredData, UInt_t sector, const char* cuts = "") const; // returns an AliTPCCalROC object containing the specified data for sector with cuts applied
39bcd65d 68
69 TObjArray* GetArrayOfCalPads();
70 TObjArray* GetListOfVariables(Bool_t printList = kFALSE);
72d0ab7e 71 TObjArray* GetListOfNormalizationVariables(Bool_t printList = kFALSE) const;
39bcd65d 72
2811495d 73 static void MakeTreeWithObjects(const char * fileName, const TObjArray *const array, const char * mapFileName = 0);
74 static void MakeTree(const char * fileName, TObjArray * array, const char * mapFileName = 0, AliTPCCalPad *const outlierPad = 0, Float_t ltmFraction = 0.9);
4f3934a1 75 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");
76 static void CreateObjectList(const Char_t *filename, TObjArray *calibObjects);
39bcd65d 77
78 TFriendElement* AddReferenceTree(const char* filename, const char* treename = "calPads", const char* refname = "R");
79 TFriendElement* AddFriend(const char* treename, const char* filename) {return fTree->AddFriend(treename, filename);};
80 TFriendElement* AddFriend(TTree* tree, const char* alias, Bool_t warn=kFALSE) {return fTree->AddFriend(tree, alias, warn);};
81 TFriendElement* AddFriend(const char* treename, TFile* file) {return fTree->AddFriend(treename, file);};
2811495d 82 TTree * GetTree() const { return fTree;}
6d49cfb3 83 static void MakeCalPadAliases(TTree * tree);
a6d2bd0c 84 TString* Fit(const char* drawCommand, const char* formula, const char* cuts, Double_t & chi2, TVectorD &fitParam, TMatrixD &covMatrix);
72d0ab7e 85
86 //
87 // Array tools
88 //
2811495d 89 static Double_t GetLTM(Int_t n, const Double_t *const array, Double_t *const sigma = 0, Double_t fraction = 0.9);
72d0ab7e 90 static Int_t GetBin(Float_t value, Int_t nbins, Double_t binLow, Double_t binUp);
2811495d 91 static TH1F* SigmaCut(Int_t n, const 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);
92 static TH1F* SigmaCut(TH1F *const histogram, Float_t mean, Float_t sigma, Float_t sigmaMax, Float_t sigmaStep = -1, Bool_t pm = kFALSE);
93 static TH1F* Integrate(TH1F *const histogram, Float_t mean = 0, Float_t sigma = 0, Float_t sigmaMax = 0, Float_t sigmaStep = -1);
94 static TH1F* Integrate(Int_t n, const Float_t *const 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);
72d0ab7e 95
2811495d 96 static TH1F* SigmaCut(Int_t n, const Double_t *array, Double_t mean, Double_t sigma, Int_t nbins, const Double_t *xbins, Double_t sigmaMax);
72d0ab7e 97
98
99
39bcd65d 100protected:
101 TTree* fTree; // tree containing visualization data (e.g. written by AliTPCCalPad::MakeTree(...)
102 TFile* fFile; // file that contains a calPads tree (e.g. written by AliTPCCalPad::MakeTree(...)
103 TObjArray* fListOfObjectsToBeDeleted; //Objects, that will be deleted when the destructor ist called
a6d2bd0c 104 Bool_t fTreeMustBeDeleted; // decides weather the tree must be deleted in destructor or not
832bb12c 105 TString fAbbreviation; // the abreviation for '.fElements'
106 TString fAppendString; // '.fElements', stored in a TStrig
39bcd65d 107
72d0ab7e 108 void DrawLines(TH1F *cutHistoMean, TVectorF nsigma, TLegend *legend, Int_t color, Bool_t pm) const;
4f3934a1 109 void DrawLines(TGraph *graph, TVectorF nsigma, TLegend *legend, Int_t color, Bool_t pm) const;
72d0ab7e 110
111
39bcd65d 112 ClassDef(AliTPCCalibViewer,1) // TPC calibration viewer class
113};
114
115#endif
4f3934a1 116
117
118