16 if( !inputFile.is_open() )
18 <<
"failed to open the file " <<
filename_ << std::endl;
22 const float undef = -999;
23 while( getline(inputFile, line) ){
24 if(line[0]==
'#')
continue;
26 std::stringstream
ss(line);
27 ss >> etaMin >> etaMax >> effArea;
32 if( etaMin==undef || etaMax==undef || effArea==undef )
34 <<
"wrong file format, file name " <<
filename_ << std::endl;
59 for(uint iEta = 0; iEta<nEtaBins; iEta++){
72 printf(
"EffectiveAreas: source file %s\n",
filename_.c_str());
73 printf(
" eta_min eta_max effective area\n");
75 for(uint iEta = 0; iEta<nEtaBins; iEta++){
76 printf(
" %8.4f %8.4f %8.5f\n",
89 <<
"found no effective area constans in the file "
93 for(uint iEta = 0; iEta<nEtaBins; iEta++){
98 <<
"eta ranges improperly defined (min>max) in the file"
103 if( iEta != nEtaBins-1 )
106 <<
"eta ranges improperly defined (disjointed) in the file "
115 <<
"effective area values are too large or negative in the file"
const float getEffectiveArea(float eta) const
EffectiveAreas(const std::string &filename)
std::vector< float > absEtaMax_
std::vector< float > effectiveAreaValues_
Abs< T >::type abs(const T &t)
std::vector< float > absEtaMin_
void checkConsistency() const
void printEffectiveAreas() const
const std::string filename_