AliPhysics  9fe175b (9fe175b)
 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 <TObjArray.h>
20 
23 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerBinningComponent)
25 
26 namespace EMCalTriggerPtAnalysis {
27 
31 AliEMCalTriggerBinningComponent::AliEMCalTriggerBinningComponent() :
32  TObject(),
33  fDimensions(NULL)
34 {
35  fDimensions = new TObjArray;
36  fDimensions->SetOwner();
37 }
38 
44  TObject(ref),
45  fDimensions(NULL)
46 {
47  fDimensions = new TObjArray;
48  fDimensions->SetOwner();
49  TIter dimIter(ref.fDimensions);
51  while((dim = dynamic_cast<AliEMCalTriggerBinningDimension *>(dimIter())))
53 }
54 
60  TObject::operator=(ref);
61  if(&ref != this){
63 
64  fDimensions = new TObjArray;
65  fDimensions->SetOwner();
66  TIter dimIter(ref.fDimensions);
68  while((dim = dynamic_cast<AliEMCalTriggerBinningDimension *>(dimIter())))
70  }
71  return *this;
72 }
73 
78  delete fDimensions;
79 }
80 
87  return dynamic_cast<AliEMCalTriggerBinningDimension *>(fDimensions->FindObject(name));
88 }
89 
96 void AliEMCalTriggerBinningComponent::SetBinning(const char* dimname, int nbins, const double* binning) {
98  if(dim) dim->Set(nbins, binning);
99  else {
100  dim = new AliEMCalTriggerBinningDimension(dimname, nbins, binning);
101  fDimensions->Add(dim);
102  }
103 }
104 
110 void AliEMCalTriggerBinningComponent::SetBinning(const char* dimname, const TArrayD& binning) {
112  if(dim) dim->Set(binning);
113  else {
114  dim = new AliEMCalTriggerBinningDimension(dimname, binning);
115  fDimensions->Add(dim);
116  }
117 }
118 
126 void AliEMCalTriggerBinningComponent::SetLinearBinning(const char *dimname, int nbins, double min, double max){
127  TArrayD binning;
128  AliEMCalTriggerBinningFactory::CreateLinearBinning(binning, nbins, min, max);
129  SetBinning(dimname, binning);
130 }
131 
137 void AliEMCalTriggerBinningDimension::PrintStream(std::ostream &stream) const{
138  stream << "Binning for variable " << GetName() << ":\n";
139  stream << "================================================\n";
140  for(int ilim = 0; ilim < fBinning.GetSize(); ilim++){
141  stream << fBinning[ilim];
142  if(ilim < fBinning.GetSize() -1) stream << ", ";
143  }
144 }
145 
149 void AliEMCalTriggerBinningDimension::Print(Option_t * /*option*/) const {
150  std::cout << *this << std::endl;
151 }
152 
159 std::ostream &operator<<(std::ostream &stream, const AliEMCalTriggerBinningDimension &dim){
160  dim.PrintStream(stream);
161  return stream;
162 }
163 
164 
165 } /* namespace EMCalTriggerPtAnalysis */
166 
static void CreateLinearBinning(TArrayD &binning, int nbins, double min, double max)
std::ostream & operator<<(std::ostream &stream, const AliCutValueRange< t > &val)
void SetBinning(const char *dimname, int nbins, const double *binning)
AliEMCalTriggerBinningDimension * GetBinning(const char *name) const
Global binning definition for the high- charged particle analysis.
AliEMCalTriggerBinningComponent & operator=(const AliEMCalTriggerBinningComponent &ref)
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
const Int_t nbins
void SetLinearBinning(const char *dirname, int nbins, double min, double max)