CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
OpticalObjectMgr Class Reference

#include <OpticalObjectMgr.h>

Public Member Functions

ALIuint buildCmsSwID ()
 
void dumpOptOs (std::ostream &out=std::cout) const
 
OpticalObjectfindOptO (const ALIstring &longName, bool exists=false) const
 
std::vector< OpticalObject * > findOptOs (const ALIstring &name, bool exists=false) const
 
 OpticalObjectMgr ()
 
void registerMe (OpticalObject *opto)
 
 ~OpticalObjectMgr ()
 

Static Public Member Functions

static OpticalObjectMgrgetInstance ()
 Get the only instance. More...
 

Private Attributes

ALIuint theLastCmsSwID
 
msopto theOptODict
 

Static Private Attributes

static OpticalObjectMgrtheInstance = nullptr
 

Detailed Description

Definition at line 19 of file OpticalObjectMgr.h.

Constructor & Destructor Documentation

OpticalObjectMgr::OpticalObjectMgr ( )
inline

Definition at line 21 of file OpticalObjectMgr.h.

Referenced by getInstance().

21 {};
OpticalObjectMgr::~OpticalObjectMgr ( )
inline

Definition at line 22 of file OpticalObjectMgr.h.

22 {};

Member Function Documentation

ALIuint OpticalObjectMgr::buildCmsSwID ( )

Definition at line 75 of file OpticalObjectMgr.cc.

References theLastCmsSwID.

75 { return theLastCmsSwID++; }
void OpticalObjectMgr::dumpOptOs ( std::ostream &  out = std::cout) const

Definition at line 63 of file OpticalObjectMgr.cc.

References SplitLinear::begin, gather_cfg::cout, ALIUtils::dump3v(), mergeVDriftHistosByStation::name, Model::OptOList(), and theOptODict.

Referenced by Fit::dumpEntryCorrelations().

63  {
64  std::cout << "OPTICALOBJECT list size " << theOptODict.size() << std::endl;
65  std::vector<OpticalObject*>::const_iterator vocite;
66  for (vocite = Model::OptOList().begin(); vocite != Model::OptOList().end(); ++vocite) {
67  ALIstring name = (*vocite)->name();
68  ALIUtils::dump3v((*vocite)->centreGlobal(), name + " CENTRE GLOBAL: ");
69  if ((*vocite)->parent() != nullptr)
70  ALIUtils::dump3v((*vocite)->centreLocal(), name + " CENTRE LOCAL: "); //not for the 'system'
71  }
72 }
static std::vector< OpticalObject * > & OptOList()
Definition: Model.h:84
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
std::string ALIstring
Definition: CocoaGlobals.h:9
tuple cout
Definition: gather_cfg.py:144
OpticalObject * OpticalObjectMgr::findOptO ( const ALIstring longName,
bool  exists = false 
) const

Definition at line 19 of file OpticalObjectMgr.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), and theOptODict.

19  {
20  OpticalObject* opto = nullptr;
21  msopto::const_iterator cite = theOptODict.find(longName);
22  if (cite == theOptODict.end()) {
23  if (exists) {
24  std::cerr << "!!!! EXITING: OptO not found: " << longName << std::endl;
25  exit(1);
26  } else {
27  std::cerr << "!! WARNING: OptO not found: " << longName << std::endl;
28  }
29  } else {
30  opto = (*cite).second;
31  }
32 
33  return opto;
34 }
std::vector< OpticalObject * > OpticalObjectMgr::findOptOs ( const ALIstring name,
bool  exists = false 
) const

Definition at line 37 of file OpticalObjectMgr.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), heppy_report::oname, and theOptODict.

37  {
38  std::vector<OpticalObject*> vopto;
39  msopto::const_iterator cite;
40  //----- Look for OptO's that contains 'name' in its longName as the last word (after the last '/')
41  for (cite = theOptODict.begin(); cite != theOptODict.end(); ++cite) {
42  ALIstring oname = (*cite).first;
43  int nf = oname.rfind(name);
44  int sf = oname.rfind('/');
45  if (nf != -1 && sf <= nf) {
46  vopto.push_back((*cite).second);
47  }
48  }
49 
50  if (vopto.empty()) {
51  if (exists) {
52  std::cerr << "!!!! EXITING: OptO not found: " << name << std::endl;
53  exit(1);
54  } else {
55  std::cerr << "!! WARNING: OptO not found: " << name << std::endl;
56  }
57  }
58 
59  return vopto;
60 }
string oname
Definition: heppy_report.py:57
std::string ALIstring
Definition: CocoaGlobals.h:9
OpticalObjectMgr * OpticalObjectMgr::getInstance ( )
static

Get the only instance.

Definition at line 9 of file OpticalObjectMgr.cc.

References OpticalObjectMgr(), theInstance, and theLastCmsSwID.

Referenced by OpticalObject::createComponentOptOs(), Fit::dumpEntryCorrelations(), and OpticalObject::OpticalObject().

9  {
10  if (!theInstance) {
13  // theInstance->verbose = ALIUtils::verbosity();
14  }
15  return theInstance;
16 }
static OpticalObjectMgr * theInstance
void OpticalObjectMgr::registerMe ( OpticalObject opto)
inline

Definition at line 28 of file OpticalObjectMgr.h.

References OpticalObject::longName(), and theOptODict.

Referenced by OpticalObject::OpticalObject().

28 { theOptODict[opto->longName()] = opto; }
const ALIstring longName() const

Member Data Documentation

OpticalObjectMgr * OpticalObjectMgr::theInstance = nullptr
staticprivate

Definition at line 39 of file OpticalObjectMgr.h.

Referenced by getInstance().

ALIuint OpticalObjectMgr::theLastCmsSwID
private

Definition at line 41 of file OpticalObjectMgr.h.

Referenced by buildCmsSwID(), and getInstance().

msopto OpticalObjectMgr::theOptODict
private

Definition at line 40 of file OpticalObjectMgr.h.

Referenced by dumpOptOs(), findOptO(), findOptOs(), and registerMe().