AliPhysics  vAN-20150429 (ffa5c54)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliEMCalTriggerBinningFactory.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  **************************************************************************/
17 #include <map>
18 #include <vector>
19 #include <TMath.h>
20 #include <TArrayD.h>
21 
22 namespace EMCalTriggerPtAnalysis {
23 
28 }
29 
36  TArrayD binLimits;
37  if(!data->GetBinning("pt")){
38  CreateRAAPtBinning(binLimits);
39  data->SetBinning("pt", binLimits);
40  }
41  if(!data->GetBinning("eta")){
42  CreateDefaultEtaBinning(binLimits);
43  data->SetBinning("eta", binLimits);
44  }
45  if(!data->GetBinning("phi")){
46  CreateLinearBinning(binLimits, 100, 0, 2*TMath::Pi());
47  data->SetBinning("phi", binLimits);
48  }
49  if(!data->GetBinning("zvertex")){
50  CreateDefaultZVertexBinning(binLimits);
51  data->SetBinning("zvertex", binLimits);
52  }
53  if(!data->GetBinning("centrality")){
54  CreateLinearBinning(binLimits, 5, 0., 100.);
55  data->SetBinning("centrality", binLimits);
56  }
57 }
58 
75  std::vector<double> mybinning;
76  std::map<double,double> definitions;
77  definitions.insert(std::pair<double,double>(2.5, 0.1));
78  definitions.insert(std::pair<double,double>(7., 0.25));
79  definitions.insert(std::pair<double,double>(10., 0.5));
80  definitions.insert(std::pair<double,double>(15., 1.));
81  definitions.insert(std::pair<double,double>(20., 2.5));
82  definitions.insert(std::pair<double,double>(30., 5.));
83  definitions.insert(std::pair<double,double>(100., 10.));
84  definitions.insert(std::pair<double, double>(200., 20.));
85  double currentval = 0;
86  mybinning.push_back(currentval);
87  for(std::map<double,double>::iterator id = definitions.begin(); id != definitions.end(); ++id){
88  double limit = id->first, binwidth = id->second;
89  while(currentval < limit){
90  currentval += binwidth;
91  mybinning.push_back(currentval);
92  }
93  }
94  binning.Set(mybinning.size());
95  int ib = 0;
96  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
97  binning[ib++] = *it;
98 }
99 
117  std::vector<double> mybinning;
118  std::map<double,double> definitions;
119  definitions.insert(std::pair<double, double>(1, 0.05));
120  definitions.insert(std::pair<double, double>(2, 0.1));
121  definitions.insert(std::pair<double, double>(4, 0.2));
122  definitions.insert(std::pair<double, double>(7, 0.5));
123  definitions.insert(std::pair<double, double>(16, 1));
124  definitions.insert(std::pair<double, double>(36, 2));
125  definitions.insert(std::pair<double, double>(40, 4));
126  definitions.insert(std::pair<double, double>(50, 5));
127  definitions.insert(std::pair<double, double>(100, 10));
128  definitions.insert(std::pair<double, double>(200, 20));
129  double currentval = 0.;
130  mybinning.push_back(currentval);
131  for(std::map<double,double>::iterator id = definitions.begin(); id != definitions.end(); ++id){
132  double limit = id->first, binwidth = id->second;
133  while(currentval < limit){
134  currentval += binwidth;
135  mybinning.push_back(currentval);
136  }
137  }
138  binning.Set(mybinning.size());
139  int ib = 0;
140  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
141  binning[ib++] = *it;
142 }
143 
144 
151  std::vector<double> mybinning;
152  double currentval = -10;
153  mybinning.push_back(currentval);
154  while(currentval < 10.){
155  currentval += 5.;
156  mybinning.push_back(currentval);
157  }
158  binning.Set(mybinning.size());
159  int ib = 0;
160  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
161  binning[ib++] = *it;
162 }
163 
169 void AliEMCalTriggerBinningFactory::CreateDefaultEtaBinning(TArrayD& binning) const {
170  std::vector<double> mybinning;
171  double currentval = -0.8;
172  mybinning.push_back(currentval);
173  while(currentval < 0.8){
174  currentval += 0.1;
175  mybinning.push_back(currentval);
176  }
177  binning.Set(mybinning.size());
178  int ib = 0;
179  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
180  binning[ib++] = *it;
181 }
182 
191 void AliEMCalTriggerBinningFactory::CreateLinearBinning(TArrayD& binning, int nbins, double min, double max) const {
192  double binwidth = (max-min)/static_cast<double>(nbins);
193  binning.Set(nbins+1);
194  binning[0] = min;
195  double currentlimit = min + binwidth;
196  for(int ibin = 0; ibin < nbins; ibin++){
197  binning[ibin+1] = currentlimit;
198  currentlimit += binwidth;
199  }
200 }
201 
202 } /* namespace EMCalTriggerPtAnalysis */
void Create(AliEMCalTriggerBinningComponent *const data)
Declaration of class AliEMCalTriggerBinningFactory.
void SetBinning(const char *dimname, int nbins, double *binning)
void CreateDefaultEtaBinning(TArrayD &binning) const
AliEMCalTriggerBinningDimension * GetBinning(const char *name) const
Global binning definition for the high- charged particle analysis.
void CreateLinearBinning(TArrayD &binning, int nbins, double min, double max) const
Declaration of the classes AliEMCalTriggerBinningComponent and AliEMCalTriggerBinningDimension.