1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include "DataFormats/HeavyIonEvent/interface/CentralityBins.h"
#include <iostream>
using namespace std;
int CentralityBins::getBin(double value) const {
int bin = table_.size() - 1;
for (unsigned int i = 0; i < table_.size(); ++i) {
if (value >= table_[i].bin_edge) {
bin = i;
return bin;
}
}
return bin;
}
CentralityBins::RunMap getCentralityFromFile(TDirectoryFile* file, const char* tag, int firstRun, int lastRun) {
return getCentralityFromFile(file, ".", tag, firstRun, lastRun);
}
CentralityBins::RunMap getCentralityFromFile(
TDirectoryFile* file, const char* dir, const char* tag, int firstRun, int lastRun) {
CentralityBins::RunMap map;
for (int run = firstRun; run <= lastRun; ++run) {
const CentralityBins* table = (const CentralityBins*)file->Get(Form("%s/run%d/%s", dir, run, tag));
if (table)
map.insert(std::pair<int, const CentralityBins*>(run, table));
}
return map;
}
ClassImp(CBin);
ClassImp(CentralityBins);
|