1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 // HFE correction framework container
17 // Contains many single containers
18 // Extra fuctionality like appending added
20 #ifndef ALIHFECONTAINER_H
21 #define ALIHFECONTAINER_H
27 #ifndef ROOT_TObjArray
28 #include <TObjArray.h>
38 typedef class THnSparseT<TArrayF> THnSparseF;
45 class AliHFEcontainer : public TNamed{
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);
54 virtual Long64_t Merge(TCollection *coll);
56 void CreateContainer(const Char_t *name, const Char_t *title, UInt_t nStep);
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; }
61 void FillCFContainer(const Char_t *name, UInt_t step, Double_t *content);
62 AliCFContainer *MakeMergedCFContainer(const Char_t *name, const Char_t *title, const Char_t *contnames);
64 Int_t GetNumberOfCFContainers() const;
65 Int_t GetNumberOfEvents() const { return fNEvents; };
66 void NewEvent() { fNEvents++; };
67 void SetNumberOfVariables(UInt_t nVar);
68 inline void SetBinning(UInt_t var, UInt_t nBins, Double_t *content);
69 void SetVariableName(UInt_t var, const Char_t *varname);
70 void MakeLinearBinning(UInt_t var, UInt_t nBins, Double_t begin, Double_t end);
71 void MakeLogarithmicBinning(UInt_t var, UInt_t nBins, Double_t begin, Double_t end);
73 virtual void Print(const Option_t * opt = 0x0) const;
75 struct AliHFEvarInfo : public TObject{
77 AliHFEvarInfo(const Char_t *name);
78 AliHFEvarInfo(const AliHFEvarInfo &ref);
79 AliHFEvarInfo &operator=(const AliHFEvarInfo &ref);
82 UInt_t GetNumberOfBins() const { return fBinning->GetSize() ? fBinning->GetSize() - 1 : 0; };
83 Double_t *GetBinning() const { return fBinning->GetArray(); };
84 TString *GetVarName() const { return fVarName; };
86 void SetVarName(const Char_t *name);
87 void SetBinning(UInt_t nBins, Double_t *binning);
89 TString *fVarName; // Variable Name
90 TArrayD *fBinning; // Binning
92 ClassDef(AliHFEcontainer::AliHFEvarInfo, 1) // Variable information
96 THashList *fContainers; // TObjArray for Containers
97 THashList *fCorrelationMatrices; // Container for Correlation Matrices
98 TObjArray *fVariables; // Variable Information
99 UInt_t fNVars; // Number of Variables
100 Int_t fNEvents; // Number of Events
102 ClassDef(AliHFEcontainer, 1) // HFE Efficiency Container
105 //__________________________________________________________________
106 void AliHFEcontainer::SetBinning(UInt_t var, UInt_t nBins, Double_t *content){
108 // Set Binning for a given variable
110 if(var >= fNVars) return;
111 AliHFEvarInfo *inf = dynamic_cast<AliHFEvarInfo *>(fVariables->UncheckedAt(var));
113 inf->SetBinning(nBins, content);