#include <Alignment/CocoaModel/interface/ALIUnitsTable.h>
Public Member Functions | |
ALIBestUnit (const Hep3Vector &internalValue, ALIstring category) | |
ALIBestUnit (ALIdouble 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 307 of file ALIUnitsTable.cc.
References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), ALIUnitDefinition::GetUnitsTable(), i, IndexOfCategory, nbOfVals, and Value.
00308 { 00309 // find the category 00310 ALIUnitsTable& theUnitsTable = ALIUnitDefinition::GetUnitsTable(); 00311 size_t nbCat = theUnitsTable.size(); 00312 size_t i = 0; 00313 while 00314 ((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) i++; 00315 if (i == nbCat) 00316 { std::cout << " ALIBestUnit: the category " << category 00317 << " does not exist !!" << std::endl; 00318 std::cerr << "Missing unit category !" << std::endl; 00319 abort(); 00320 } 00321 // 00322 IndexOfCategory = i; 00323 nbOfVals = 1; 00324 Value[0] = value; Value[1] = 0.; Value[2] = 0.; 00325 }
ALIBestUnit::ALIBestUnit | ( | const Hep3Vector & | internalValue, | |
ALIstring | category | |||
) |
ALIBestUnit::~ALIBestUnit | ( | ) |
ALIstring ALIBestUnit::GetCategory | ( | ) | const [inline] |
size_t ALIBestUnit::GetIndexOfCategory | ( | ) | const [inline] |
Definition at line 153 of file ALIUnitsTable.h.
References IndexOfCategory.
00153 {return IndexOfCategory;}
ALIdouble* ALIBestUnit::GetValue | ( | ) | [inline] |
std::ostream& operator<< | ( | std::ostream & | flux, | |
ALIBestUnit | VU | |||
) | [friend] |
Definition at line 357 of file ALIUnitsTable.cc.
00358 { 00359 ALIUnitsTable& theUnitsTable = ALIUnitDefinition::GetUnitsTable(); 00360 ALIUnitsContainer& List = theUnitsTable[a.IndexOfCategory] 00361 ->GetUnitsList(); 00362 ALIint len = theUnitsTable[a.IndexOfCategory]->GetSymbMxLen(); 00363 00364 ALIint ksup(-1), kinf(-1); 00365 ALIdouble umax(0.), umin(1.E12); 00366 ALIdouble rsup(1.E12), rinf(0.); 00367 00368 //for a ThreeVector, choose the best unit for the biggest value 00369 ALIdouble value = std::max(std::max(fabs(a.Value[0]),fabs(a.Value[1])), 00370 fabs(a.Value[2])); 00371 00372 for (size_t k=0; k<List.size(); k++) 00373 { 00374 ALIdouble unit = List[k]->GetValue(); 00375 if (value==1.E12) {if(unit>umax) {umax=unit; ksup=k;}} 00376 else if (value<=-1.E12) {if(unit<umin) {umin=unit; kinf=k;}} 00377 00378 else { ALIdouble ratio = value/unit; 00379 if ((ratio>=1.)&&(ratio<rsup)) {rsup=ratio; ksup=k;} 00380 if ((ratio< 1.)&&(ratio>rinf)) {rinf=ratio; kinf=k;} 00381 } 00382 } 00383 00384 ALIint index=ksup; if(index==-1) index=kinf; if(index==-1) index=0; 00385 00386 for (ALIint j=0; j<a.nbOfVals; j++) 00387 {flux << a.Value[j]/(List[index]->GetValue()) << " ";} 00388 00389 #ifdef ALIUSE_STD_NAMESPACE 00390 std::ios::fmtflags oldform = std::cout.flags(); 00391 #else 00392 // ALIint oldform = std::cout.flags(); 00393 #endif 00394 00395 flux.setf(std::ios::left,std::ios::adjustfield); 00396 flux << std::setw(len) << List[index]->GetSymbol(); 00397 //?? flux.flags(oldform); 00398 00399 return flux; 00400 }
ALIstring ALIBestUnit::Category [private] |
size_t ALIBestUnit::IndexOfCategory [private] |
Definition at line 166 of file ALIUnitsTable.h.
Referenced by ALIBestUnit(), GetIndexOfCategory(), and operator<<().
ALIint ALIBestUnit::nbOfVals [private] |
ALIdouble ALIBestUnit::Value[3] [private] |
Definition at line 163 of file ALIUnitsTable.h.
Referenced by ALIBestUnit(), GetValue(), and operator<<().