SimPmtMaker Class Reference

#include <SimPmtMaker.h>

Inheritance diagram for SimPmtMaker:
SimPmtMakerProxy< T >

List of all members.

Static Public Member Functions

static SimPmtCreate (std::string className, PlexPixelSpotId tube, VldContext context, TRandom *random)
static Bool_t HasRegisteredClass (std::string className)

Protected Types

typedef std::map< std::string,
SimPmtMaker * > 
MakerMap_t

Protected Member Functions

 SimPmtMaker (const char *className)
virtual SimPmtCreate (PlexPixelSpotId tube, VldContext context, TRandom *random) const =0
 SimPmtMaker ()
virtual ~SimPmtMaker ()
 ClassDef (SimPmtMaker, 0)

Static Protected Member Functions

static MakerMap_tGetMakerMap ()

Detailed Description

Definition at line 17 of file SimPmtMaker.h.


Member Typedef Documentation

typedef std::map<std::string,SimPmtMaker*> SimPmtMaker::MakerMap_t [protected]

Definition at line 33 of file SimPmtMaker.h.


Constructor & Destructor Documentation

SimPmtMaker::SimPmtMaker ( const char *  className  )  [protected]

Definition at line 42 of file SimPmtMaker.cxx.

References GetMakerMap().

00043 {
00044   std::string tmp(className);
00045   //std::cout << "Adding Maker: " << tmp << std::endl;
00046   GetMakerMap().insert(std::pair<std::string,SimPmtMaker*>(tmp,this));
00047 }

SimPmtMaker::SimPmtMaker (  )  [inline, protected]

Definition at line 35 of file SimPmtMaker.h.

00035 { }

virtual SimPmtMaker::~SimPmtMaker (  )  [inline, protected, virtual]

Definition at line 36 of file SimPmtMaker.h.

00036 { }


Member Function Documentation

SimPmtMaker::ClassDef ( SimPmtMaker  ,
 
) [protected]
virtual SimPmt* SimPmtMaker::Create ( PlexPixelSpotId  tube,
VldContext  context,
TRandom *  random 
) const [protected, pure virtual]

Implemented in SimPmtMakerProxy< T >.

SimPmt * SimPmtMaker::Create ( std::string  className,
PlexPixelSpotId  tube,
VldContext  context,
TRandom *  random 
) [static]

Definition at line 6 of file SimPmtMaker.cxx.

References it.

Referenced by SimDetector::Config(), and SimDetector::SortDigiPE().

00010 {
00011   // Find the concrete factory:
00012   MakerMap_t::iterator it = GetMakerMap().find(className);
00013  
00014 
00015   if(it == GetMakerMap().end()) {
00016     // If it doesn't exist, return null.
00017     return 0;
00018   } else {
00019     // Otherwise, get the concrete factory to make one.
00020     SimPmt* pmt = it->second->Create(tube,context,random);
00021     return pmt;
00022   }
00023 
00024   // Make compiler happy:
00025   return 0;
00026 }

SimPmtMaker::MakerMap_t & SimPmtMaker::GetMakerMap (  )  [static, protected]

Definition at line 50 of file SimPmtMaker.cxx.

Referenced by HasRegisteredClass(), and SimPmtMaker().

00051 {
00052   // The whole point to this little function is to hide the 
00053   // static map from the compiler, to avoid
00054   // the "static initialization order fiasco"
00055   // ref: http://www.parashift.com/c++-faq-lite/ctors.html section 10.12
00056   
00057   // This object gets created on the first call,
00058   // thus ensuring it exists whenever it's needed. (i.e. before main())
00059   static MakerMap_t theMap;
00060   return theMap;
00061 }

Bool_t SimPmtMaker::HasRegisteredClass ( std::string  className  )  [static]

Definition at line 28 of file SimPmtMaker.cxx.

References GetMakerMap(), and it.

Referenced by SimDetector::Config().

00029 {
00030   // Find the concrete factory:
00031   MakerMap_t::iterator it = GetMakerMap().find(className);
00032   
00033   if(it == GetMakerMap().end()) {
00034     // If it doesn't exist, return null.
00035     return false;
00036   };
00037   return true;
00038 }


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1