]>
Commit | Line | Data |
---|---|---|
70da6c5a | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | // | |
16 | // HFE correction framework container | |
17 | // Contains many single containers | |
18 | // Extra fuctionality like appending added | |
19 | // | |
20 | #ifndef ALIHFECONTAINER_H | |
21 | #define ALIHFECONTAINER_H | |
22 | ||
23 | #ifndef ROOT_TNamed | |
24 | #include <TNamed.h> | |
25 | #endif | |
26 | ||
27 | #ifndef ROOT_TObjArray | |
28 | #include <TObjArray.h> | |
29 | #endif | |
30 | ||
31 | #ifndef ROOT_TArrayD | |
32 | #include <TArrayD.h> | |
33 | #endif | |
34 | ||
35 | class TCollection; | |
36 | class TList; | |
37 | class THashList; | |
38 | class TString; | |
39 | class AliCFContainer; | |
40 | ||
41 | class AliHFEcontainer : public TNamed{ | |
42 | public: | |
43 | AliHFEcontainer(); | |
44 | AliHFEcontainer(const Char_t *name); | |
45 | AliHFEcontainer(const Char_t *name, UInt_t nVar); | |
46 | AliHFEcontainer(const AliHFEcontainer &ref); | |
47 | AliHFEcontainer& operator=(const AliHFEcontainer &ref); | |
48 | ~AliHFEcontainer(); | |
49 | ||
50 | virtual Long64_t Merge(TCollection *coll); | |
51 | ||
52 | void CreateContainer(const Char_t *name, const Char_t *title, UInt_t nStep); | |
53 | AliCFContainer *GetCFContainer(const Char_t *name); | |
54 | void FillCFContainer(const Char_t *name, UInt_t step, Double_t *content); | |
55 | AliCFContainer *MakeMergedCFContainer(const Char_t *name, const Char_t *title, const Char_t *contnames); | |
56 | ||
57 | Int_t GetNumberOfCFContainers() const; | |
58 | Int_t GetNumberOfEvents() const { return fNEvents; }; | |
59 | void NewEvent() { fNEvents++; }; | |
60 | void SetNumberOfVariables(UInt_t nVar); | |
61 | inline void SetBinning(UInt_t var, UInt_t nBins, Double_t *content); | |
62 | void SetVariableName(UInt_t var, const Char_t *varname); | |
63 | void MakeLinearBinning(UInt_t var, UInt_t nBins, Double_t begin, Double_t end); | |
64 | void MakeLogarithmicBinning(UInt_t var, UInt_t nBins, Double_t begin, Double_t end); | |
65 | ||
66 | virtual void Print(const Option_t * opt = 0x0) const; | |
67 | ||
68 | struct AliHFEvarInfo : public TObject{ | |
69 | AliHFEvarInfo(); | |
70 | AliHFEvarInfo(const Char_t *name); | |
71 | AliHFEvarInfo(const AliHFEvarInfo &ref); | |
72 | AliHFEvarInfo &operator=(const AliHFEvarInfo &ref); | |
73 | ~AliHFEvarInfo(); | |
74 | ||
75 | UInt_t GetNumberOfBins() const { return fBinning->GetSize() ? fBinning->GetSize() - 1 : 0; }; | |
76 | Double_t *GetBinning() const { return fBinning->GetArray(); }; | |
77 | TString *GetVarName() const { return fVarName; }; | |
78 | ||
79 | void SetVarName(const Char_t *name); | |
80 | void SetBinning(UInt_t nBins, Double_t *binning); | |
81 | private: | |
82 | TString *fVarName; // Variable Name | |
83 | TArrayD *fBinning; // Binning | |
84 | ||
85 | ClassDef(AliHFEcontainer::AliHFEvarInfo, 1) // Variable information | |
86 | }; | |
87 | ||
88 | private: | |
89 | THashList*fContainers; // TObjArray for Containers | |
90 | TObjArray *fVariables; // Variable Information | |
91 | UInt_t fNVars; // Number of Variables | |
92 | Int_t fNEvents; // Number of Events | |
93 | ||
94 | ClassDef(AliHFEcontainer, 1) // HFE Efficiency Container | |
95 | }; | |
96 | ||
97 | //__________________________________________________________________ | |
98 | void AliHFEcontainer::SetBinning(UInt_t var, UInt_t nBins, Double_t *content){ | |
99 | // | |
100 | // Set Binning for a given variable | |
101 | // | |
102 | if(var >= fNVars) return; | |
103 | AliHFEvarInfo *inf = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(var)); | |
104 | if(!inf) return; | |
105 | inf->SetBinning(nBins, content); | |
106 | } | |
107 | #endif |