CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/DataFormats/HeavyIonEvent/src/CentralityBins.cc

Go to the documentation of this file.
00001 #include "DataFormats/HeavyIonEvent/interface/CentralityBins.h"
00002 #include <iostream>
00003 using namespace std;
00004 
00005 int CentralityBins::getBin(double value) const {
00006 
00007    int bin = table_.size() - 1;
00008    for(unsigned int i = 0; i < table_.size(); ++i){
00009       if(value >= table_[i].bin_edge){
00010          bin = i;
00011          return bin;
00012       }
00013    }
00014 
00015    return bin;
00016 }
00017 
00018 CentralityBins::RunMap getCentralityFromFile(TDirectoryFile* file, const char* tag, int firstRun, int lastRun){
00019   return getCentralityFromFile(file,".",tag,firstRun,lastRun);  
00020 }
00021 
00022 CentralityBins::RunMap getCentralityFromFile(TDirectoryFile* file, const char* dir, const char* tag, int firstRun, int lastRun){
00023   CentralityBins::RunMap map;
00024   for(int run = firstRun; run<= lastRun; ++run){
00025     const CentralityBins* table = (const CentralityBins*)file->Get(Form("%s/run%d/%s",dir,run,tag));
00026     if(table) map.insert(std::pair<int,const CentralityBins*>(run,table));
00027   }
00028   return map;
00029 }
00030 
00031 ClassImp(CBin)
00032 ClassImp(CentralityBins)
00033 
00034 
00035 
00036 
00037