G4DigiManager.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 
00030 #ifndef G4DigiManager_h
00031 #define G4DigiManager_h 1
00032 
00033 #include "globals.hh"
00034 class G4Event;
00035 #include "G4VDigitizerModule.hh"
00036 class G4VHitsCollection;
00037 class G4VDigiCollection;
00038 class G4DMmessenger;
00039 #include "G4DCtable.hh"
00040 class G4RunManager;
00041 class G4SDManager;
00042 //#include "g4rw/tpordvec.h"
00043 #include <vector>
00044 
00045 // class description:
00046 //
00047 //  This is a singleton class which manages the digitizer modules.
00048 // The user cannot access to the constructor. The pointer of the
00049 // only existing object can be got via G4DigiManager::GetDMpointer()
00050 // static method. The first invokation in the program makes the 
00051 // singleton object.
00052 //
00053 
00054 class G4DigiManager 
00055 {
00056   public: // with description
00057       static G4DigiManager* GetDMpointer();
00058       // Returns the pointer to the singleton object
00059   public:
00060       static G4DigiManager* GetDMpointerIfExist();
00061 
00062   protected:
00063       G4DigiManager();
00064 
00065   public:
00066       ~G4DigiManager();
00067 
00068   public: // with description
00069       void AddNewModule(G4VDigitizerModule* DM); 
00070       //  Registers the user's digitizer mudule. This method must be invoked when
00071       // the user construct his/her digitizer module(s).
00072       void Digitize(G4String mName);
00073       //  Invokes Digitize() method of specified digitizer module. This is a kind
00074       // of service method. The user can invoke Digitize() method of a particular
00075       // module without knowing the pointer of the module object. The argument
00076       // "mName" is the name of the module, which is defined at the constructor
00077       // of the concrete digitizer module.
00078       G4VDigitizerModule* FindDigitizerModule(G4String mName);
00079       //  Returns the pointer to the digitizer module object with the given name.
00080       // Null will be returned if the name is not defined.
00081       const G4VHitsCollection* GetHitsCollection(G4int HCID, G4int eventID = 0);
00082       const G4VDigiCollection* GetDigiCollection(G4int DCID, G4int eventID = 0);
00083       //  These two methods return the pointer to the hits and digi collection
00084       // object, respectively. "HCID" and "DCID" are the ID numbers of hits and 
00085       // digi collections, which can be obtained vir the next two methods.
00086       //  If "eventID" is greater than zero, corresponding hits or digi collection
00087       // of "eventID" prevuois event is returned so that event overlap can be 
00088       // handled. To do this, necessary number of events must be set to G4RunManager
00089       // by G4RunManager::SetNumberOfEventsToBeStored() method previously to the
00090       // event loop.
00091       G4int GetHitsCollectionID(G4String HCname);
00092       G4int GetDigiCollectionID(G4String DCname);
00093       //  Returns the ID number of hits and digi collections, respectively. "HCname"
00094       // and "DCname" can be the collection name if it is unique, or can be detector
00095       // or module name and the collection name connected by "/".
00096       void SetDigiCollection(G4int DCID, G4VDigiCollection* aDC);
00097       //  This method must exclusively used by the base class of G4VDigitizerModule.
00098       // To set digi collection, the user must use SetDigiCollection of G4VDigitizerModule.
00099 
00100   public:
00101       void SetVerboseLevel(G4int vl);
00102       void List() const;
00103 
00104   private: 
00105       static G4DigiManager * fDManager;
00106       G4int verboseLevel;
00107       std::vector<G4VDigitizerModule*> DMtable;
00108       G4DCtable* DCtable;
00109       G4DMmessenger* theMessenger;
00110       G4RunManager* runManager;
00111       G4SDManager* SDManager;
00112 
00113   public:
00114       inline G4int GetVerboseLevel() const
00115       { return verboseLevel; }
00116       inline G4int GetCollectionCapacity() const
00117       { return DCtable->entries(); }
00118       inline G4int GetModuleCapacity() const
00119       { return DMtable.size(); }
00120       inline G4DCtable* GetDCtable() const
00121       { return DCtable; }
00122       inline void RestoreDCtable(G4DCtable* dc)
00123       { 
00124         if(DCtable) delete DCtable;
00125         DCtable = dc;
00126       }
00127 
00128 };
00129 
00130 
00131 
00132 
00133 #endif
00134 

Generated on Mon May 27 17:48:01 2013 for Geant4 by  doxygen 1.4.7