]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muondep/AliAnalysisMuMuResult.h
added runs for jason
[u/mrichter/AliRoot.git] / PWG / muondep / AliAnalysisMuMuResult.h
1 #ifndef ALIANALYSISMUMURESULT_H
2 #define ALIANALYSISMUMURESULT_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 // $Id$
8
9 ///
10 /// AliAnalysisMuMuResult : helper class to store results from
11 /// AliAnalysisTaskMuMu
12 ///
13 /// author : Laurent Aphecetche (Subatech)
14
15 #include "TNamed.h"
16 #include <TString.h>
17
18 class TH1;
19 class THashList;
20 class TMap;
21
22 class AliAnalysisMuMuResult : public TNamed
23 {
24   
25 public:
26   
27   enum EResultMergingMethod { kMean, kSum };
28   
29   AliAnalysisMuMuResult(const char* name="", const char* title="", AliAnalysisMuMuResult::EResultMergingMethod mergindMethod=AliAnalysisMuMuResult::kMean);
30   AliAnalysisMuMuResult(const AliAnalysisMuMuResult& rhs);
31   AliAnalysisMuMuResult& operator=(const AliAnalysisMuMuResult& rhs);
32   
33   virtual ~AliAnalysisMuMuResult();
34
35   Bool_t AdoptSubResult(AliAnalysisMuMuResult* r);
36
37   virtual TObject* Clone(const char* newname = "") const;
38   
39   void Set(const char* name, Double_t value, Double_t errorStat, Double_t rms=0.0);
40   
41   Int_t HasValue(const char* name, const char* subResultName="") const;
42   
43   Double_t GetValue(const char* name, const char* subResultName="") const;
44   
45   Double_t GetErrorStat(const char* name, const char* subResultName="") const;
46
47   Double_t GetRMS(const char* name, const char* subResultName="") const;
48   
49   void Print(Option_t* opt="") const;
50   
51   AliAnalysisMuMuResult* SubResult(const char* subResultName) const;
52   
53   TObjArray* SubResults() const { return fSubResults; }
54   
55   Long64_t Merge(TCollection* list);
56
57   AliAnalysisMuMuResult* Mother() const { return fMother; }
58   
59   THashList* Keys() const;
60   
61   Double_t Weight() const { return fWeight; }
62   
63   void SetWeight(Double_t w) { fWeight=w; }
64
65   static Double_t ErrorAB(Double_t a, Double_t aerr, Double_t b, Double_t berr);
66   
67   static Double_t ErrorABC(Double_t a, Double_t aerr, Double_t b, Double_t berr, Double_t c, Double_t cerror);
68
69   static Double_t ErrorABCD(Double_t a, Double_t aerr, Double_t b, Double_t berr, Double_t c, Double_t cerror,
70                             Double_t d, Double_t derror);
71
72   static Double_t ErrorABCDE(Double_t a, Double_t aerr, Double_t b, Double_t berr, Double_t c, Double_t cerror,
73                              Double_t d, Double_t derror, Double_t e, Double_t eerror);
74
75   void PrintValue(const char* key, const char* opt, Double_t value, Double_t errorStat, Double_t rms=0.0) const; 
76
77   void SetAlias(const char* alias) { fAlias = alias; }
78   
79   TString Alias() const { if ( fAlias.Length()>0) return fAlias; else return GetName(); }
80   
81   void Include(const char* subResultsList);
82
83   void Exclude(const char* subResultsList);
84
85   Bool_t IsIncluded(const TString& alias) const;
86   
87   void Scale(Double_t value);
88   
89   void SetMergingMethod(AliAnalysisMuMuResult::EResultMergingMethod mergindMethod) { fResultMergingMethod=mergindMethod; }
90   
91   Bool_t IsValid() const { return fIsValid; }
92   
93   void Invalidate() { fIsValid = kFALSE; }
94   
95   void Show(const char* keyPattern);
96   
97   void Hide(const char* keyPattern);
98
99   Bool_t IsValidValue(Double_t val) const;
100   
101 private:
102   
103   enum EIndex
104   {
105     kValue=0,
106     kErrorStat=1,
107     kRMS=2
108   };
109   
110   void PrintParticle(const char* particle, const char* opt) const;
111
112   TList* SubResultsToBeIncluded() const;
113   
114   TString GetSubResultNameList() const;
115
116   Int_t NofIncludedSubResults(const char* name) const;
117   
118 private:
119   TObjArray* fSubResults; // TObjArray of AliAnalysisMuMuResult*
120   TMap* fMap; // internal parameter map
121   AliAnalysisMuMuResult* fMother; // mother result
122   mutable THashList* fKeys; //! keys we have in our internal map (or the one of our subresults)
123   Double_t fWeight; // weight of this result (default 1.0)
124   TString fAlias; // alias name
125   mutable TList* fSubResultsToBeIncluded; // inclusion list
126   EResultMergingMethod fResultMergingMethod; // how to merge result (e.g. mean or sum)
127   Bool_t fIsValid; // is this result valid ?
128   mutable THashList* fVisibleKeys; // list of keys to show with the Print method
129   
130   ClassDef(AliAnalysisMuMuResult,14) // a class to some results (counts, yields, AccxEff, R_AB, etc...)
131 };
132
133 #endif