]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/hfe/AliHFEcontainer.h
Add fast merging option (Diego)
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEcontainer.h
CommitLineData
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//
c2690925 20#ifndef ALIHFECONTAINER_H
21#define ALIHFECONTAINER_H
22
70da6c5a 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
67fe7bd0 35class TArrayF;
36template <class X>
37class THnSparseT;
38typedef class THnSparseT<TArrayF> THnSparseF;
70da6c5a 39class TCollection;
40class TList;
41class THashList;
42class TString;
43class AliCFContainer;
44
45class AliHFEcontainer : public TNamed{
46 public:
47 AliHFEcontainer();
48 AliHFEcontainer(const Char_t *name);
49 AliHFEcontainer(const Char_t *name, UInt_t nVar);
50 AliHFEcontainer(const AliHFEcontainer &ref);
51 AliHFEcontainer& operator=(const AliHFEcontainer &ref);
52 ~AliHFEcontainer();
53
54 virtual Long64_t Merge(TCollection *coll);
55
56 void CreateContainer(const Char_t *name, const Char_t *title, UInt_t nStep);
67fe7bd0 57 void CreateCorrelationMatrix(const Char_t *name, const Char_t *title);
58 AliCFContainer *GetCFContainer(const Char_t *name) const;
59 THnSparseF *GetCorrelationMatrix(const Char_t *name) const;
60 THashList *GetListOfCorrelationMatrices() const { return fCorrelationMatrices; }
c2690925 61 void FillCFContainer(const Char_t *name, UInt_t step, const Double_t * const content, Double_t weight = 1.) const;
62 void FillCFContainerStepname(const Char_t *name, const Char_t *step, const Double_t *const content, Double_t weight = 1.) const;
6555e2ad 63 AliCFContainer *MakeMergedCFContainer(const Char_t *name, const Char_t *title, const Char_t *contnames) const;
70da6c5a 64
65 Int_t GetNumberOfCFContainers() const;
66 Int_t GetNumberOfEvents() const { return fNEvents; };
67 void NewEvent() { fNEvents++; };
68 void SetNumberOfVariables(UInt_t nVar);
69 inline void SetBinning(UInt_t var, UInt_t nBins, Double_t *content);
70 void SetVariableName(UInt_t var, const Char_t *varname);
3a72645a 71 void SetStepTitle(const Char_t *contname, const Char_t *steptitle, UInt_t step);
70da6c5a 72 void MakeLinearBinning(UInt_t var, UInt_t nBins, Double_t begin, Double_t end);
73 void MakeLogarithmicBinning(UInt_t var, UInt_t nBins, Double_t begin, Double_t end);
8c1c76e9 74 void MakeUserDefinedBinning(UInt_t var, UInt_t nBins, const Double_t *binning);
70da6c5a 75
3a72645a 76 virtual void Print(const Option_t * opt = NULL) const;
70da6c5a 77
78 struct AliHFEvarInfo : public TObject{
79 AliHFEvarInfo();
80 AliHFEvarInfo(const Char_t *name);
81 AliHFEvarInfo(const AliHFEvarInfo &ref);
82 AliHFEvarInfo &operator=(const AliHFEvarInfo &ref);
83 ~AliHFEvarInfo();
84
85 UInt_t GetNumberOfBins() const { return fBinning->GetSize() ? fBinning->GetSize() - 1 : 0; };
8c1c76e9 86 const Double_t *GetBinning() const { return fBinning->GetArray(); };
70da6c5a 87 TString *GetVarName() const { return fVarName; };
88
89 void SetVarName(const Char_t *name);
8c1c76e9 90 void SetBinning(UInt_t nBins, const Double_t *binning);
70da6c5a 91 private:
92 TString *fVarName; // Variable Name
93 TArrayD *fBinning; // Binning
94
95 ClassDef(AliHFEcontainer::AliHFEvarInfo, 1) // Variable information
96 };
97
98 private:
67fe7bd0 99 THashList *fContainers; // TObjArray for Containers
100 THashList *fCorrelationMatrices; // Container for Correlation Matrices
70da6c5a 101 TObjArray *fVariables; // Variable Information
102 UInt_t fNVars; // Number of Variables
103 Int_t fNEvents; // Number of Events
104
105 ClassDef(AliHFEcontainer, 1) // HFE Efficiency Container
106};
107
108//__________________________________________________________________
109void AliHFEcontainer::SetBinning(UInt_t var, UInt_t nBins, Double_t *content){
110 //
111 // Set Binning for a given variable
112 //
113 if(var >= fNVars) return;
114 AliHFEvarInfo *inf = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(var));
115 if(!inf) return;
116 inf->SetBinning(nBins, content);
117}
118#endif