Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:06

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4DigiManager
0027 //
0028 // class description:
0029 //
0030 // This is a singleton class which manages the digitizer modules.
0031 // The user cannot access to the constructor. The pointer of the
0032 // only existing object can be got via G4DigiManager::GetDMpointer()
0033 // static method. The first invokation in the program makes the 
0034 // singleton object.
0035 
0036 // Author: M.Asai
0037 // --------------------------------------------------------------------
0038 #ifndef G4DigiManager_hh
0039 #define G4DigiManager_hh 1
0040 
0041 #include "globals.hh"
0042 class G4Event;
0043 #include "G4VDigitizerModule.hh"
0044 class G4VHitsCollection;
0045 class G4VDigiCollection;
0046 class G4DMmessenger;
0047 #include "G4DCtable.hh"
0048 class G4RunManager;
0049 class G4SDManager;
0050 #include <vector>
0051 
0052 class G4DigiManager 
0053 {
0054   public: // with description
0055 
0056       static G4DigiManager* GetDMpointer();
0057       // Returns the pointer to the singleton object
0058 
0059       static G4DigiManager* GetDMpointerIfExist();
0060 
0061       ~G4DigiManager();
0062 
0063       G4DigiManager(const G4DigiManager&) = delete;
0064       G4DigiManager& operator=(const G4DigiManager&) = delete;
0065 
0066   public: // with description
0067 
0068       void AddNewModule(G4VDigitizerModule* DM); 
0069       //  Registers the user's digitizer mudule. This method must be invoked when
0070       // the user construct his/her digitizer module(s).
0071       void Digitize(G4String mName);
0072       //  Invokes Digitize() method of specified digitizer module. This is a kind
0073       // of service method. The user can invoke Digitize() method of a particular
0074       // module without knowing the pointer of the module object. The argument
0075       // "mName" is the name of the module, which is defined at the constructor
0076       // of the concrete digitizer module.
0077       G4VDigitizerModule* FindDigitizerModule(G4String mName);
0078       //  Returns the pointer to the digitizer module object with the given name.
0079       // Null will be returned if the name is not defined.
0080       const G4VHitsCollection* GetHitsCollection(G4int HCID, G4int eventID = 0);
0081       const G4VDigiCollection* GetDigiCollection(G4int DCID, G4int eventID = 0);
0082       //  These two methods return the pointer to the hits and digi collection
0083       // object, respectively. "HCID" and "DCID" are the ID numbers of hits and 
0084       // digi collections, which can be obtained vir the next two methods.
0085       //  If "eventID" is greater than zero, corresponding hits or digi collection
0086       // of "eventID" prevuois event is returned so that event overlap can be 
0087       // handled. To do this, necessary number of events must be set to G4RunManager
0088       // by G4RunManager::SetNumberOfEventsToBeStored() method previously to the
0089       // event loop.
0090       G4int GetHitsCollectionID(G4String HCname);
0091       G4int GetDigiCollectionID(G4String DCname);
0092       //  Returns the ID number of hits and digi collections, respectively. "HCname"
0093       // and "DCname" can be the collection name if it is unique, or can be detector
0094       // or module name and the collection name connected by "/".
0095       void SetDigiCollection(G4int DCID, G4VDigiCollection* aDC);
0096       //  This method must exclusively used by the base class of G4VDigitizerModule.
0097       // To set digi collection, the user must use SetDigiCollection of G4VDigitizerModule.
0098 
0099   public:
0100 
0101       void SetVerboseLevel(G4int vl);
0102       void List() const;
0103 
0104       inline G4int GetVerboseLevel() const
0105       { return verboseLevel; }
0106       inline G4int GetCollectionCapacity() const
0107       { return DCtable->entries(); }
0108       inline G4int GetModuleCapacity() const
0109       { return G4int(DMtable.size()); }
0110       inline G4DCtable* GetDCtable() const
0111       { return DCtable; }
0112       inline void RestoreDCtable(G4DCtable* dc)
0113       { 
0114         if(DCtable) delete DCtable;
0115         DCtable = dc;
0116       }
0117 
0118   protected:
0119 
0120       G4DigiManager();
0121 
0122   private:
0123 
0124       static G4ThreadLocal G4DigiManager * fDManager;
0125       G4int verboseLevel;
0126       std::vector<G4VDigitizerModule*> DMtable;
0127       G4DCtable* DCtable;
0128       G4DMmessenger* theMessenger;
0129       G4RunManager* runManager;
0130       G4SDManager* SDManager;
0131 };
0132 
0133 #endif