#include <ALIUnitsTable.h>
Public Member Functions | |
ALIBestUnit (ALIdouble internalValue, ALIstring category) | |
ALIBestUnit (const CLHEP::Hep3Vector &internalValue, ALIstring category) | |
ALIstring | GetCategory () const |
size_t | GetIndexOfCategory () const |
ALIdouble * | GetValue () |
~ALIBestUnit () | |
Private Attributes | |
ALIstring | Category |
size_t | IndexOfCategory |
ALIint | nbOfVals |
ALIdouble | Value [3] |
Friends | |
std::ostream & | operator<< (std::ostream &, ALIBestUnit VU) |
Definition at line 137 of file ALIUnitsTable.h.
Definition at line 308 of file ALIUnitsTable.cc.
References dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, ALIUnitDefinition::GetUnitsTable(), i, IndexOfCategory, nbOfVals, Value, and relativeConstraints::value.
{ // find the category ALIUnitsTable& theUnitsTable = ALIUnitDefinition::GetUnitsTable(); size_t nbCat = theUnitsTable.size(); size_t i = 0; while ((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) i++; if (i == nbCat) { std::cout << " ALIBestUnit: the category " << category << " does not exist !!" << std::endl; std::cerr << "Missing unit category !" << std::endl; abort(); } // IndexOfCategory = i; nbOfVals = 1; Value[0] = value; Value[1] = 0.; Value[2] = 0.; }
ALIBestUnit::ALIBestUnit | ( | const CLHEP::Hep3Vector & | internalValue, |
ALIstring | category | ||
) |
Definition at line 330 of file ALIUnitsTable.cc.
References dtNoiseDBValidation_cfg::cerr, ALIUnitDefinition::GetUnitsTable(), i, IndexOfCategory, nbOfVals, and Value.
{ // find the category ALIUnitsTable& theUnitsTable = ALIUnitDefinition::GetUnitsTable(); size_t nbCat = theUnitsTable.size(); size_t i = 0; while ((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) i++; if (i == nbCat) { std::cerr << " ALIBestUnit: the category " << category << " does not exist." << std::endl; std::cerr << "Unit category not existing !" << std::endl; abort(); } // IndexOfCategory = i; nbOfVals = 3; Value[0] = value.x(); Value[1] = value.y(); Value[2] = value.z(); }
ALIBestUnit::~ALIBestUnit | ( | ) |
Definition at line 353 of file ALIUnitsTable.cc.
{}
ALIstring ALIBestUnit::GetCategory | ( | ) | const [inline] |
size_t ALIBestUnit::GetIndexOfCategory | ( | ) | const [inline] |
Definition at line 153 of file ALIUnitsTable.h.
References IndexOfCategory.
{return IndexOfCategory;}
ALIdouble* ALIBestUnit::GetValue | ( | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | flux, |
ALIBestUnit | VU | ||
) | [friend] |
Definition at line 358 of file ALIUnitsTable.cc.
{ ALIUnitsTable& theUnitsTable = ALIUnitDefinition::GetUnitsTable(); ALIUnitsContainer& List = theUnitsTable[a.IndexOfCategory] ->GetUnitsList(); ALIint len = theUnitsTable[a.IndexOfCategory]->GetSymbMxLen(); ALIint ksup(-1), kinf(-1); ALIdouble umax(0.), umin(1.E12); ALIdouble rsup(1.E12), rinf(0.); //for a ThreeVector, choose the best unit for the biggest value ALIdouble value = std::max(std::max(fabs(a.Value[0]),fabs(a.Value[1])), fabs(a.Value[2])); for (size_t k=0; k<List.size(); k++) { ALIdouble unit = List[k]->GetValue(); if (value==1.E12) {if(unit>umax) {umax=unit; ksup=k;}} else if (value<=-1.E12) {if(unit<umin) {umin=unit; kinf=k;}} else { ALIdouble ratio = value/unit; if ((ratio>=1.)&&(ratio<rsup)) {rsup=ratio; ksup=k;} if ((ratio< 1.)&&(ratio>rinf)) {rinf=ratio; kinf=k;} } } ALIint index=ksup; if(index==-1) index=kinf; if(index==-1) index=0; for (ALIint j=0; j<a.nbOfVals; j++) {flux << a.Value[j]/(List[index]->GetValue()) << " ";} #ifdef ALIUSE_STD_NAMESPACE std::ios::fmtflags oldform = std::cout.flags(); #else // ALIint oldform = std::cout.flags(); #endif flux.setf(std::ios::left,std::ios::adjustfield); flux << std::setw(len) << List[index]->GetSymbol(); //?? flux.flags(oldform); return flux; }
ALIstring ALIBestUnit::Category [private] |
Definition at line 165 of file ALIUnitsTable.h.
Referenced by GetCategory().
size_t ALIBestUnit::IndexOfCategory [private] |
Definition at line 166 of file ALIUnitsTable.h.
Referenced by ALIBestUnit(), GetIndexOfCategory(), and operator<<().
ALIint ALIBestUnit::nbOfVals [private] |
Definition at line 164 of file ALIUnitsTable.h.
Referenced by ALIBestUnit(), and operator<<().
ALIdouble ALIBestUnit::Value[3] [private] |
Definition at line 163 of file ALIUnitsTable.h.
Referenced by ALIBestUnit(), GetValue(), and operator<<().