CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CentralityBins.cc
Go to the documentation of this file.
2 #include <iostream>
3 using namespace std;
4 
5 int CentralityBins::getBin(double value) const {
6 
7  int bin = table_.size() - 1;
8  for(unsigned int i = 0; i < table_.size(); ++i){
9  if(value >= table_[i].bin_edge){
10  bin = i;
11  return bin;
12  }
13  }
14 
15  return bin;
16 }
17 
18 CentralityBins::RunMap getCentralityFromFile(TDirectoryFile* file, const char* tag, int firstRun, int lastRun){
19  return getCentralityFromFile(file,".",tag,firstRun,lastRun);
20 }
21 
22 CentralityBins::RunMap getCentralityFromFile(TDirectoryFile* file, const char* dir, const char* tag, int firstRun, int lastRun){
24  for(int run = firstRun; run<= lastRun; ++run){
25  const CentralityBins* table = (const CentralityBins*)file->Get(Form("%s/run%d/%s",dir,run,tag));
26  if(table) map.insert(std::pair<int,const CentralityBins*>(run,table));
27  }
28  return map;
29 }
30 
31 ClassImp(CBin)
32 ClassImp(CentralityBins)
33 
34 
35 
36 
37 
int i
Definition: DBlmapReader.cc:9
string firstRun
Definition: dataset.py:402
std::map< int, const CentralityBins * > RunMap
#define table(NAME)
Definition: DbCore.h:49
Table table_
int getBin(double value) const
dbl *** dir
Definition: mlp_gen.cc:35
CentralityBins::RunMap getCentralityFromFile(TDirectoryFile *, const char *dir, const char *tag, int firstRun=0, int lastRun=10)