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