AliPhysics  29d4213 (29d4213)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
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>
19 
22 ClassImp(EMCalTriggerPtAnalysis::AliEMCalTriggerBinningComponent)
24 
25 namespace EMCalTriggerPtAnalysis {
26 
30 AliEMCalTriggerBinningComponent::AliEMCalTriggerBinningComponent() :
31  TObject(),
32  fDimensions(NULL)
33 {
34  fDimensions = new TObjArray;
35  fDimensions->SetOwner();
36 }
37 
43  TObject(ref),
44  fDimensions(NULL)
45 {
46  fDimensions = new TObjArray;
47  fDimensions->SetOwner();
48  TIter dimIter(ref.fDimensions);
50  while((dim = dynamic_cast<AliEMCalTriggerBinningDimension *>(dimIter())))
52 }
53 
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 
88  return dynamic_cast<AliEMCalTriggerBinningDimension *>(fDimensions->FindObject(name));
89 }
90 
98 void AliEMCalTriggerBinningComponent::SetBinning(const char* dimname, int nbins, double* binning) {
100  if(dim) dim->Set(nbins, binning);
101  else {
102  dim = new AliEMCalTriggerBinningDimension(dimname, nbins, binning);
103  fDimensions->Add(dim);
104  }
105 }
106 
114 void AliEMCalTriggerBinningComponent::SetBinning(const char* dimname, const TArrayD& binning) {
116  if(dim) dim->Set(binning);
117  else {
118  dim = new AliEMCalTriggerBinningDimension(dimname, binning);
119  fDimensions->Add(dim);
120  }
121 }
122 
126 void AliEMCalTriggerBinningDimension::Print(Option_t * /*option*/) const {
127  std::cout << "Binning for variable " << GetName() << ":" << std::endl;
128  std::cout << "================================================" << std::endl;
129  for(int ilim = 0; ilim < fBinning.GetSize(); ilim++){
130  std::cout << fBinning[ilim];
131  if(ilim < fBinning.GetSize() -1) std::cout << ", ";
132  }
133  std::cout << std::endl;
134 }
135 
136 
137 } /* namespace EMCalTriggerPtAnalysis */
138 
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
void SetBinning(const char *dimname, int nbins, double *binning)
AliEMCalTriggerBinningDimension * GetBinning(const char *name) const
Global binning definition for the high- charged particle analysis.
AliEMCalTriggerBinningComponent & operator=(const AliEMCalTriggerBinningComponent &ref)
Declaration of the classes AliEMCalTriggerBinningComponent and AliEMCalTriggerBinningDimension.
const Int_t nbins