CMS 3D CMS Logo

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.

References getInstance().

22 {};

Member Function Documentation

ALIuint OpticalObjectMgr::buildCmsSwID ( )

Definition at line 75 of file OpticalObjectMgr.cc.

References theLastCmsSwID.

Referenced by registerMe().

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

Definition at line 63 of file OpticalObjectMgr.cc.

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

Referenced by Fit::dumpEntryCorrelations(), and registerMe().

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
#define begin
Definition: vmac.h:32
std::string ALIstring
Definition: CocoaGlobals.h:9
OpticalObject * OpticalObjectMgr::findOptO ( const ALIstring longName,
bool  exists = false 
) const

Definition at line 19 of file OpticalObjectMgr.cc.

References beam_dqm_sourceclient-live_cfg::cerr, beamvalidation::exit(), and theOptODict.

Referenced by registerMe().

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 }
def exit(msg="")
std::vector< OpticalObject * > OpticalObjectMgr::findOptOs ( const ALIstring name,
bool  exists = false 
) const

Definition at line 37 of file OpticalObjectMgr.cc.

References beam_dqm_sourceclient-live_cfg::cerr, beamvalidation::exit(), heppy_report::oname, and theOptODict.

Referenced by registerMe().

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 }
std::string ALIstring
Definition: CocoaGlobals.h:9
def exit(msg="")
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(), OpticalObject::OpticalObject(), and ~OpticalObjectMgr().

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

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().