AliPhysics  d497547 (d497547)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEMCalTriggerBinningComponent.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2014, 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 #include <iostream>
16 
17 #include <TCustomBinning.h>
18 #include <TLinearBinning.h>
19 #include <TVariableBinning.h>
20 #include <TObjArray.h>
23 
26 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerBinningComponent::AliEMCalTriggerBinningData)
28 
29 namespace EMCalTriggerPtAnalysis {
30 
31 AliEMCalTriggerBinningComponent::AliEMCalTriggerBinningComponent() :
32  TObject(),
33  fDimensions(nullptr)
34 {
35  fDimensions = new TObjArray;
36  fDimensions->SetOwner();
37 }
38 
40  TObject(ref),
41  fDimensions(nullptr)
42 {
43  fDimensions = new TObjArray;
44  fDimensions->SetOwner();
45  for(auto dimIter : *(ref.fDimensions))
46  fDimensions->Add(new AliEMCalTriggerBinningData(*(static_cast<AliEMCalTriggerBinningData *>(dimIter))));
47 }
48 
50  TObject::operator=(ref);
51  if(&ref != this){
53 
54  fDimensions = new TObjArray;
55  fDimensions->SetOwner();
56  for(auto dimIter : *(ref.fDimensions))
57  fDimensions->Add(new AliEMCalTriggerBinningData(*(static_cast<AliEMCalTriggerBinningData *>(dimIter))));
58  }
59  return *this;
60 }
61 
63  delete fDimensions;
64 }
65 
67  AliEMCalTriggerBinningData *data = dynamic_cast<AliEMCalTriggerBinningData *>(fDimensions->FindObject(name));
68  if(data) return data->GetBinning();
69  return nullptr;
70 }
71 
72 void AliEMCalTriggerBinningComponent::SetBinning(const char* dimname, int nbins, const double* binning) {
73  SetBinning(dimname, new TVariableBinning(nbins, binning));
74 }
75 
76 void AliEMCalTriggerBinningComponent::SetBinning(const char* dimname, const TArrayD& binning) {
77  SetBinning(dimname, new TVariableBinning(binning));
78 }
79 
80 
81 void AliEMCalTriggerBinningComponent::SetLinearBinning(const char *dimname, int nbins, double min, double max){
82  SetBinning(dimname, new TLinearBinning(nbins, min, max));
83 }
84 
85 void AliEMCalTriggerBinningComponent::SetBinning(const char *dimname, TBinning *binning){
87  if(dim) dim->SetBinning(binning);
88  else fDimensions->Add(new AliEMCalTriggerBinningData(dimname, binning));
89 }
90 
92  return dynamic_cast<AliEMCalTriggerBinningData *>(fDimensions->FindObject(dimname));
93 }
94 
96  TNamed(),
97  fBinning(nullptr)
98 {
99 
100 }
101 
103  TNamed(name, ""),
104  fBinning(binning)
105 {
106 
107 }
108 
110  TNamed(data),
111  fBinning(nullptr)
112 {
113  TBinning *refbinning = data.GetBinning();
114  if(refbinning) fBinning = refbinning->MakeCopy();
115 }
116 
119  TNamed::operator=(data);
120  if(this != &data){
121  if(fBinning) delete fBinning;
122  fBinning = data.fBinning;
123  }
124  return *this;
125 }
126 
128  if(fBinning) delete fBinning;
129 }
130 
132  if(fBinning) delete fBinning;
133  fBinning = binning;
134 }
135 
136 }
AliEMCalTriggerBinningData * FindBinning(const char *dim) const
Class creating a variable binning, used in the histogram manager.
Class creating a linear binning, used in the histogram manager.
Interface for binnings used by the histogram handler.
Definition: TBinning.h:21
AliEMCalTriggerBinningData & operator=(const AliEMCalTriggerBinningData &data)
void SetBinning(const char *dimname, int nbins, const double *binning)
Global binning definition for the high- charged particle analysis.
AliEMCalTriggerBinningComponent & operator=(const AliEMCalTriggerBinningComponent &ref)
virtual TBinning * MakeCopy() const =0
const Int_t nbins
void SetLinearBinning(const char *dirname, int nbins, double min, double max)