13 #include "StEStructCentrality.h"
28 StEStructCentrality::~StEStructCentrality(){
31 delete [] mcentralities;
45 int StEStructCentrality::centrality(
const double impact) {
49 cout<<
" Error:: centrality requested without initialization (warning #"<<warningCount<<
")"<<endl;
57 for(retVal=0;retVal<mnumCentralities-1;retVal++) {
58 if(impact>=mcentralities[retVal] && impact<mcentralities[retVal+1]) {
69 int StEStructCentrality::ptIndex(
const double pt) {
73 cout<<
" Error:: Pt index requested without initialization (warning #"<<warningCount<<
")"<<endl;
80 for(retVal=0;retVal<mnumpts-1;retVal++) {
81 if(pt>=mpts[retVal] && pt<mpts[retVal+1]) {
92 int StEStructCentrality::ptCentrality(
const double cent) {
96 cout<<
" Error:: Pt centrality index requested without initialization (warning #"<<warningCount<<
")"<<endl;
103 for(retVal=0;retVal<mnumptcents-1;retVal++) {
104 if(cent>=mptcents[retVal] && cent<mptcents[retVal+1]) {
116 void StEStructCentrality::setCentralities(
const double* centralities,
const int num){
118 if (!centralities || num==0) {
122 delete [] mcentralities;
124 mcentralities =
new double[num];
125 for (
int i=0;i<num;i++) {
126 mcentralities[i]=centralities[i];
128 mnumCentralities=num;
131 int StEStructCentrality::numCentralities() {
135 cout<<
" Error:: numCentralities requested without initialization (warning #"<<warningCount<<
")"<<endl;
140 return mnumCentralities;
143 double StEStructCentrality::centralityLimit(
const int index ) {
144 if ((index < 0) || (mnumCentralities <index)) {
147 return mcentralities[index];
151 void StEStructCentrality::setPts(
const double* pts,
const int numPt,
152 const double* cents,
const int numCent ) {
153 if (!pts || numPt==0 || !cents || numCent==0) {
162 mpts =
new double[numPt];
163 for (
int i=0;i<numPt;i++) {
167 mptcents =
new double[numCent];
168 for (
int i=0;i<numCent;i++) {
169 mptcents[i] = cents[i];
173 void StEStructCentrality::setPtLimit(
const int index,
double pt ) {
174 if ((index < 0) || (mnumpts <index)) {
179 int StEStructCentrality::numPts() {
182 int StEStructCentrality::numPtCentralities() {
185 double StEStructCentrality::ptLimit(
const int index ) {
186 if ((index < 0) || (mnumpts <index)) {
191 double StEStructCentrality::ptCentralityLimit(
const int index ) {
192 if ((index < 0) || (mnumptcents <index)) {
195 return mptcents[index];
197 void StEStructCentrality::Print() {
199 cout <<
"Print::Centralities not initialized!" << endl;
202 cout <<
"Centrality bin definitions:" << endl;
203 cout <<
" bin\tmin\tmax" <<endl;
204 for(
int i=0; i<numCentralities()-1; i++) cout <<
" " << i <<
"\t" << minCentrality(i) <<
"\t" << maxCentrality(i) << endl;