CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Friends
ALIBestUnit Class Reference

#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
 
ALIdoubleGetValue ()
 
 ~ALIBestUnit ()
 

Private Attributes

ALIstring Category
 
size_t IndexOfCategory
 
ALIint nbOfVals
 
ALIdouble Value [3]
 

Friends

std::ostream & operator<< (std::ostream &, ALIBestUnit VU)
 

Detailed Description

Definition at line 129 of file ALIUnitsTable.h.

Constructor & Destructor Documentation

◆ ALIBestUnit() [1/2]

ALIBestUnit::ALIBestUnit ( ALIdouble  internalValue,
ALIstring  category 
)

Definition at line 282 of file ALIUnitsTable.cc.

282  {
283  // find the category
285  size_t nbCat = theUnitsTable.size();
286  size_t i = 0;
287  while ((i < nbCat) && (theUnitsTable[i]->GetName() != category))
288  i++;
289  if (i == nbCat) {
290  std::cout << " ALIBestUnit: the category " << category << " does not exist !!" << std::endl;
291  std::cerr << "Missing unit category !" << std::endl;
292  abort();
293  }
294  //
295  IndexOfCategory = i;
296  nbOfVals = 1;
297  Value[0] = value;
298  Value[1] = 0.;
299  Value[2] = 0.;
300 }

References taus_updatedMVAIds_cff::category, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, gather_cfg::cout, ALIUnitDefinition::GetUnitsTable(), mps_fire::i, IndexOfCategory, nbOfVals, relativeConstraints::value, and Value.

◆ ALIBestUnit() [2/2]

ALIBestUnit::ALIBestUnit ( const CLHEP::Hep3Vector &  internalValue,
ALIstring  category 
)

Definition at line 304 of file ALIUnitsTable.cc.

304  {
305  // find the category
307  size_t nbCat = theUnitsTable.size();
308  size_t i = 0;
309  while ((i < nbCat) && (theUnitsTable[i]->GetName() != category))
310  i++;
311  if (i == nbCat) {
312  std::cerr << " ALIBestUnit: the category " << category << " does not exist." << std::endl;
313  std::cerr << "Unit category not existing !" << std::endl;
314  abort();
315  }
316  //
317  IndexOfCategory = i;
318  nbOfVals = 3;
319  Value[0] = value.x();
320  Value[1] = value.y();
321  Value[2] = value.z();
322 }

References taus_updatedMVAIds_cff::category, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, ALIUnitDefinition::GetUnitsTable(), mps_fire::i, IndexOfCategory, nbOfVals, and Value.

◆ ~ALIBestUnit()

ALIBestUnit::~ALIBestUnit ( )

Definition at line 325 of file ALIUnitsTable.cc.

325 {}

Member Function Documentation

◆ GetCategory()

ALIstring ALIBestUnit::GetCategory ( ) const
inline

Definition at line 141 of file ALIUnitsTable.h.

141 { return Category; }

References Category.

◆ GetIndexOfCategory()

size_t ALIBestUnit::GetIndexOfCategory ( ) const
inline

Definition at line 142 of file ALIUnitsTable.h.

142 { return IndexOfCategory; }

References IndexOfCategory.

◆ GetValue()

ALIdouble* ALIBestUnit::GetValue ( )
inline

Definition at line 140 of file ALIUnitsTable.h.

140 { return Value; }

References Value.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  flux,
ALIBestUnit  VU 
)
friend

Definition at line 329 of file ALIUnitsTable.cc.

329  {
331  ALIUnitsContainer& List = theUnitsTable[a.IndexOfCategory]->GetUnitsList();
332  ALIint len = theUnitsTable[a.IndexOfCategory]->GetSymbMxLen();
333 
334  ALIint ksup(-1), kinf(-1);
335  ALIdouble umax(0.), umin(1.E12);
336  ALIdouble rsup(1.E12), rinf(0.);
337 
338  //for a ThreeVector, choose the best unit for the biggest value
339  ALIdouble value = std::max(std::max(std::abs(a.Value[0]), std::abs(a.Value[1])), std::abs(a.Value[2]));
340 
341  for (size_t k = 0; k < List.size(); k++) {
342  ALIdouble unit = List[k]->GetValue();
343  if (value == 1.E12) {
344  if (unit > umax) {
345  umax = unit;
346  ksup = k;
347  }
348  } else if (value <= -1.E12) {
349  if (unit < umin) {
350  umin = unit;
351  kinf = k;
352  }
353  }
354 
355  else {
357  if ((ratio >= 1.) && (ratio < rsup)) {
358  rsup = ratio;
359  ksup = k;
360  }
361  if ((ratio < 1.) && (ratio > rinf)) {
362  rinf = ratio;
363  kinf = k;
364  }
365  }
366  }
367 
368  ALIint index = ksup;
369  if (index == -1)
370  index = kinf;
371  if (index == -1)
372  index = 0;
373 
374  for (ALIint j = 0; j < a.nbOfVals; j++) {
375  flux << a.Value[j] / (List[index]->GetValue()) << " ";
376  }
377 
378 #ifdef ALIUSE_STD_NAMESPACE
379  std::ios::fmtflags oldform = std::cout.flags();
380 #else
381  // ALIint oldform = std::cout.flags();
382 #endif
383 
384  flux.setf(std::ios::left, std::ios::adjustfield);
385  flux << std::setw(len) << List[index]->GetSymbol();
386  //?? flux.flags(oldform);
387 
388  return flux;
389 }

Member Data Documentation

◆ Category

ALIstring ALIBestUnit::Category
private

Definition at line 151 of file ALIUnitsTable.h.

Referenced by GetCategory().

◆ IndexOfCategory

size_t ALIBestUnit::IndexOfCategory
private

Definition at line 152 of file ALIUnitsTable.h.

Referenced by ALIBestUnit(), and GetIndexOfCategory().

◆ nbOfVals

ALIint ALIBestUnit::nbOfVals
private

Definition at line 150 of file ALIUnitsTable.h.

Referenced by ALIBestUnit().

◆ Value

ALIdouble ALIBestUnit::Value[3]
private

Definition at line 149 of file ALIUnitsTable.h.

Referenced by ALIBestUnit(), and GetValue().

taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:31
mps_fire.i
i
Definition: mps_fire.py:428
ALIUnitsTable
std::vector< ALIUnitsCategory * > ALIUnitsTable
Definition: ALIUnitsTable.h:47
ALIBestUnit::Category
ALIstring Category
Definition: ALIUnitsTable.h:151
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ALIBestUnit::Value
ALIdouble Value[3]
Definition: ALIUnitsTable.h:149
ALIBestUnit::nbOfVals
ALIint nbOfVals
Definition: ALIUnitsTable.h:150
ALIBestUnit::IndexOfCategory
size_t IndexOfCategory
Definition: ALIUnitsTable.h:152
dqmdumpme.k
k
Definition: dqmdumpme.py:60
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
a
double a
Definition: hdecay.h:119
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
ALIUnitsContainer
std::vector< std::shared_ptr< ALIUnitDefinition > > ALIUnitsContainer
Definition: ALIUnitsTable.h:92
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
value
Definition: value.py:1
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
relativeConstraints.value
value
Definition: relativeConstraints.py:53
ALIUnitDefinition::GetUnitsTable
static ALIUnitsTable & GetUnitsTable()
Definition: ALIUnitsTable.h:75
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ALIint
int ALIint
Definition: CocoaGlobals.h:15
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8