AliPhysics  e59a9ba (e59a9ba)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
25  /*
26  * See header file for details
27  */
28 }
29 
31  /*
32  * See header file for details
33  */
34  TArrayD binLimits;
35  if(!data->GetBinning("pt")){
36  CreateRAAPtBinning(binLimits);
37  data->SetBinning("pt", binLimits);
38  }
39  if(!data->GetBinning("eta")){
40  CreateDefaultEtaBinning(binLimits);
41  data->SetBinning("eta", binLimits);
42  }
43  if(!data->GetBinning("phi")){
44  CreateLinearBinning(binLimits, 100, 0, 2*TMath::Pi());
45  data->SetBinning("phi", binLimits);
46  }
47  if(!data->GetBinning("zvertex")){
48  CreateDefaultZVertexBinning(binLimits);
49  data->SetBinning("zvertex", binLimits);
50  }
51  if(!data->GetBinning("centrality")){
52  CreateLinearBinning(binLimits, 5, 0., 100.);
53  data->SetBinning("centrality", binLimits);
54  }
55 }
56 
58  /*
59  * See header file for details
60  */
61  std::vector<double> mybinning;
62  std::map<double,double> definitions;
63  definitions.insert(std::pair<double,double>(2.5, 0.1));
64  definitions.insert(std::pair<double,double>(7., 0.25));
65  definitions.insert(std::pair<double,double>(10., 0.5));
66  definitions.insert(std::pair<double,double>(15., 1.));
67  definitions.insert(std::pair<double,double>(20., 2.5));
68  definitions.insert(std::pair<double,double>(30., 5.));
69  definitions.insert(std::pair<double,double>(100., 10.));
70  definitions.insert(std::pair<double, double>(200., 20.));
71  double currentval = 0;
72  mybinning.push_back(currentval);
73  for(std::map<double,double>::iterator id = definitions.begin(); id != definitions.end(); ++id){
74  double limit = id->first, binwidth = id->second;
75  while(currentval < limit){
76  currentval += binwidth;
77  mybinning.push_back(currentval);
78  }
79  }
80  binning.Set(mybinning.size());
81  int ib = 0;
82  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
83  binning[ib++] = *it;
84 }
85 
87  /*
88  * See header file for details
89  */
90  std::vector<double> mybinning;
91  std::map<double,double> definitions;
92  definitions.insert(std::pair<double, double>(1, 0.05));
93  definitions.insert(std::pair<double, double>(2, 0.1));
94  definitions.insert(std::pair<double, double>(4, 0.2));
95  definitions.insert(std::pair<double, double>(7, 0.5));
96  definitions.insert(std::pair<double, double>(16, 1));
97  definitions.insert(std::pair<double, double>(36, 2));
98  definitions.insert(std::pair<double, double>(40, 4));
99  definitions.insert(std::pair<double, double>(50, 5));
100  definitions.insert(std::pair<double, double>(100, 10));
101  definitions.insert(std::pair<double, double>(200, 20));
102  double currentval = 0.;
103  mybinning.push_back(currentval);
104  for(std::map<double,double>::iterator id = definitions.begin(); id != definitions.end(); ++id){
105  double limit = id->first, binwidth = id->second;
106  while(currentval < limit){
107  currentval += binwidth;
108  mybinning.push_back(currentval);
109  }
110  }
111  binning.Set(mybinning.size());
112  int ib = 0;
113  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
114  binning[ib++] = *it;
115 }
116 
117 
118 void AliEMCalTriggerBinningFactory::CreateDefaultZVertexBinning(TArrayD &binning) const {
119  /*
120  * See header file for details
121  */
122  std::vector<double> mybinning;
123  double currentval = -10;
124  mybinning.push_back(currentval);
125  while(currentval < 10.){
126  currentval += 5.;
127  mybinning.push_back(currentval);
128  }
129  binning.Set(mybinning.size());
130  int ib = 0;
131  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
132  binning[ib++] = *it;
133 }
134 
135 void AliEMCalTriggerBinningFactory::CreateDefaultEtaBinning(TArrayD& binning) const {
136  /*
137  * See header file for details
138  */
139  std::vector<double> mybinning;
140  double currentval = -0.8;
141  mybinning.push_back(currentval);
142  while(currentval < 0.8){
143  currentval += 0.1;
144  mybinning.push_back(currentval);
145  }
146  binning.Set(mybinning.size());
147  int ib = 0;
148  for(std::vector<double>::iterator it = mybinning.begin(); it != mybinning.end(); ++it)
149  binning[ib++] = *it;
150 }
151 
152 void AliEMCalTriggerBinningFactory::CreateLinearBinning(TArrayD& binning, int nbins, double min, double max){
153  /*
154  * See header file for details
155  */
156  double binwidth = (max-min)/static_cast<double>(nbins);
157  binning.Set(nbins+1);
158  binning[0] = min;
159  double currentlimit = min + binwidth;
160  for(int ibin = 0; ibin < nbins; ibin++){
161  binning[ibin+1] = currentlimit;
162  currentlimit += binwidth;
163  }
164 }
165 
166 } /* namespace EMCalTriggerPtAnalysis */
static void CreateLinearBinning(TArrayD &binning, int nbins, double min, double max)
void Create(AliEMCalTriggerBinningComponent *const data)
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.
const Int_t nbins