]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muondep/AliAnalysisMuMuFnorm.h
change way to check the origin of local maxima, add histogram depending on n overlaps...
[u/mrichter/AliRoot.git] / PWG / muondep / AliAnalysisMuMuFnorm.h
1 #ifndef ALIANALYSISMUMUFNORM_H
2 #define ALIANALYSISMUMUFNORM_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 #ifndef ROOT_TObject
8 #  include "TObject.h"
9 #endif
10
11 #ifndef ROOT_TString
12 #  include "TString.h"
13 #endif
14
15 #include <set>
16 #include <vector>
17
18 class TObjArray;
19 class TGraphErrors;
20 class TGraph;
21 class AliAnalysisMuMuResult;
22 class AliCounterCollection;
23 class AliMergeableCollection;
24
25 class AliAnalysisMuMuFnorm : public TObject
26 {
27
28 public:
29   
30   enum ETriggerType
31   {
32     kMB=1,
33     kMUL=2,
34     kMSL=3,
35     kMSH=4
36   };
37   
38   AliAnalysisMuMuFnorm(AliCounterCollection& cc,
39                        AliAnalysisMuMuFnorm::ETriggerType triggerType=AliAnalysisMuMuFnorm::kMUL,
40                        const char* ocdbpath="raw://",
41                        Bool_t compactGraphs=kFALSE);
42   
43   virtual ~AliAnalysisMuMuFnorm();
44   
45   void ComputeFnorm();
46   
47   void ComputeCorrectionFactors(Int_t eventSelectionCorrected);
48
49   void ComputeFnormOffline(Int_t nstep, Bool_t pileUpCorrected, Int_t eventSelectionCorrected);
50
51
52   void ComputeFnormScalers(Bool_t pileUpCorrected, Int_t eventSelectionCorrected);
53
54   void ComputeGraphRelDif(const char* a, const char* b) const;
55
56   void ComputeNofEvents(ETriggerType triggerType, Bool_t pileUpCorrected, Int_t eventSelectionCorrected);
57
58   void ComputePileUpGraph(ETriggerType tt, Int_t eventSelectionCorrected=0);
59   
60   void ComputeEventSelectionGraph(ETriggerType tt, Int_t eventSelectionCorrected);
61
62   void ComputeResultsFromGraphs();
63
64   void ComputeTriggerFractions(ETriggerType triggerType, Bool_t physicsSelectionCorrected);
65   
66   void ComputeTriggerL0B(ETriggerType tt);
67
68   void ComputeTSGraph(ETriggerType tt);
69
70   AliMergeableCollection* DetachMC();
71
72   void DrawWith2Scales(const char* graphName1, const char* graphName2);
73   
74   TString GetEventSelectionName(Int_t eventSelectionCorrected) const;
75
76   void GetFnorm(Int_t runNumber, const char* eventSelection, Double_t& value, Double_t& error) const;
77   
78   TGraphErrors* GetGraph(const char* name) const;
79   
80   void GetPurity(const char* triggerClassName, Int_t runNumber, Double_t& value, Double_t& error, Int_t eventSelectionCorrected) const;
81
82   void GetValueAndErrorFromGraph(TGraphErrors* graph,
83                                  Int_t runNumber,
84                                  Double_t& value,
85                                  Double_t& error) const;
86   
87   AliAnalysisMuMuResult* GetResult(const char* name) const;
88
89   AliAnalysisMuMuResult* GetRunIntegratedResult(const TGraphErrors& g, const char* basename="Fnorm");
90
91   AliMergeableCollection* MC() const;
92   
93   void MultiplyGraphs(const char* g1, const char* g2, const char* name="");
94   
95   TString OCDBPath() const { return fOCDBPath; }
96   
97   void Print(Option_t* opt="") const;
98
99   void ScalerFnorm(Double_t& value, Double_t& error,
100                    Double_t L0bCMUL7, Double_t purityCMUL7, Double_t purityCMUL7error,
101                    Double_t L0bCINT7, Double_t purityCINT7, Double_t purityCINT7error,
102                    Double_t pileUpFactor, Double_t pileUpFactorError);
103   
104   void ShowFnorm(const TObjArray& a) const;
105
106   Bool_t TriggerClassnameTest(const char* triggerClassName, Int_t runNumber) const;
107
108   void WeightedMeanGraphs(const char* pattern, const char* name="");
109   
110 private:
111   
112   AliAnalysisMuMuFnorm(const AliAnalysisMuMuFnorm& rhs); // not implemented on purpose
113   AliAnalysisMuMuFnorm& operator=(const AliAnalysisMuMuFnorm& rhs); // not implemented on purpose
114
115   TGraphErrors* CreateAndAddGraph(const TString& name,
116                                   const TString& title,
117                                   const std::vector<double>& vx,
118                                   const std::vector<double>& vxerr,
119                                   const std::vector<double>& vy,
120                                   const std::vector<double>& vyerr) const;
121
122   Double_t GetSum(const char* triggerClassName, Int_t runNumber, Int_t eventSelectionCorrected) const;
123
124   TString GetTriggerClassName(ETriggerType tt, Int_t runNumber) const;
125
126   TString GetTriggerTypeName(ETriggerType tt) const;
127
128   std::set<int> RunNumbers() const;
129
130   TString MBTriggerClassName(Int_t runNumber) const;
131   TString MSLTriggerClassName(Int_t runNumber) const;
132   TString MULTriggerClassName(Int_t runNumber) const;
133   TString MSHTriggerClassName(Int_t runNumber) const;
134
135 private:
136   
137   /*const*/ AliCounterCollection& fCounterCollection; // collection of trigger counters (not owner)
138   mutable AliMergeableCollection* fMergeableCollection; // collection of results, histograms, graphs (ownership is in fIsOwner)
139   Bool_t fIsOwner; // whether we are the owner of the mergeable collection
140   TString fOCDBPath; // OCDB to be used (raw:// by default)
141   mutable AliAnalysisMuMuResult* fResult; // combined result of the various computations
142   Bool_t fIsCompactGraphs; // whether the graph produced should be compact
143   ETriggerType fReferenceTriggerType; // reference trigger to get the weighting factors
144   
145   ClassDef(AliAnalysisMuMuFnorm,0) // class to compute MB to MUON trigger normalization factor
146 };
147
148 #endif