CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes

OpticalObjectMgr Class Reference

#include <OpticalObjectMgr.h>

List of all members.

Public Member Functions

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

Static Public Member Functions

static OpticalObjectMgrgetInstance ()
 Get the only instance.

Private Attributes

ALIuint theLastCmsSwID
msopto theOptODict

Static Private Attributes

static OpticalObjectMgrtheInstance = 0

Detailed Description

Definition at line 20 of file OpticalObjectMgr.h.


Constructor & Destructor Documentation

OpticalObjectMgr::OpticalObjectMgr ( ) [inline]

Definition at line 24 of file OpticalObjectMgr.h.

Referenced by getInstance().

{ };
OpticalObjectMgr::~OpticalObjectMgr ( ) [inline]

Definition at line 25 of file OpticalObjectMgr.h.

{ };

Member Function Documentation

ALIuint OpticalObjectMgr::buildCmsSwID ( )

Definition at line 85 of file OpticalObjectMgr.cc.

References theLastCmsSwID.

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

Definition at line 71 of file OpticalObjectMgr.cc.

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

{
  std::cout << "OPTICALOBJECT list size " << theOptODict.size() << std::endl;
  std::vector< OpticalObject* >::const_iterator vocite;
  for( vocite = Model::OptOList().begin(); vocite != Model::OptOList().end(); vocite++ ) {
    ALIstring name = (*vocite)->name();
    ALIUtils::dump3v( (*vocite)->centreGlobal(), (name + " CENTRE GLOBAL: ").c_str() );
    if( (*vocite)->parent() != 0 ) ALIUtils::dump3v( (*vocite)->centreLocal(),  (name + "  CENTRE LOCAL: ").c_str() ); //not for the 'system'
  }

}
OpticalObject * OpticalObjectMgr::findOptO ( const ALIstring longName,
bool  exists = 0 
) const

Definition at line 21 of file OpticalObjectMgr.cc.

References benchmark_cfg::cerr, cmsRelvalreport::exit, and theOptODict.

{
  OpticalObject* opto = 0;
  msopto::const_iterator cite = theOptODict.find( longName );
  if( cite == theOptODict.end() ) {
    if( exists ) {
      std::cerr << "!!!! EXITING: OptO not found: " << longName << std::endl;
      exit(1);
    } else {
      std::cerr << "!! WARNING: OptO not found: " << longName << std::endl;
    }
  } else {
    opto = (*cite).second;
  }

  return opto;

}  
std::vector< OpticalObject * > OpticalObjectMgr::findOptOs ( const ALIstring name,
bool  exists = 0 
) const

Definition at line 42 of file OpticalObjectMgr.cc.

References benchmark_cfg::cerr, cmsRelvalreport::exit, and theOptODict.

{
  std::vector<OpticalObject*> vopto;
  msopto::const_iterator cite;
  //----- Look for OptO's that contains 'name' in its longName as the last word (after the last '/')
  for( cite = theOptODict.begin(); cite != theOptODict.end(); cite++ ) {
    ALIstring oname = (*cite).first;
    int nf = oname.rfind( name );
    int sf = oname.rfind( '/' );
    if( nf != -1 && sf <= nf ) {
      vopto.push_back( (*cite).second );
    }
  }

  if( vopto.size() == 0 ) {
    if( exists ) {
      std::cerr << "!!!! EXITING: OptO not found: " << name << std::endl;
      exit(1);
    } else {
      std::cerr << "!! WARNING: OptO not found: " << name << std::endl;
    }
  }

  return vopto;

}
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(), and OpticalObject::OpticalObject().

{
  if( !theInstance ) {
    theInstance = new OpticalObjectMgr;
    theInstance->theLastCmsSwID = 1;
    //    theInstance->verbose = ALIUtils::verbosity();
  }
  return theInstance;
}
void OpticalObjectMgr::registerMe ( OpticalObject opto) [inline]

Definition at line 31 of file OpticalObjectMgr.h.

References OpticalObject::longName(), and theOptODict.

Referenced by OpticalObject::OpticalObject().

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

Member Data Documentation

Definition at line 44 of file OpticalObjectMgr.h.

Referenced by getInstance().

Definition at line 46 of file OpticalObjectMgr.h.

Referenced by buildCmsSwID(), and getInstance().

Definition at line 45 of file OpticalObjectMgr.h.

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