///////////////////////////////////////////////////////////////////////// // G4Tutorial: // // AnalysisManager.hh // // Creating and maintaining analysis objects to store information // retrieved from the simulation (here: energy deposition) // ///////////////////////////////////////////////////////////////////////// #ifndef ANALYSISMANAGER_HH #define ANALYSISMANAGER_HH #include #include "globals.hh" class AnalysisManager { public: // The analysis class is designed to be a singleton (i.e. only one instance // can exist). A member function called Instance is defined, which allows // the user to get a pointer to the existing instance or to create it if // it does not yet exist: // (see the constructor for an explanation of the arguments) static AnalysisManager* Instance(G4String fileNameBase = "simoutput", G4int bins = 100, G4double lowerBound = 0.0 * mm, G4double upperBound = 10.0 * mm); // The analysis class instance can be deleted by calling the Destroy // method (NOTE: The class destructor is protected, and can thus not be // called directly): static void Destroy(); // Method for setting the bins of the histogram that is used to store the // energy deposit (NOTE: The binning can be changed only before the // ScoreEnergyDeposit method was called the first time): void SetBinning(G4int bins, // number of bins G4double lowerBound, // lower histogram boundary G4double upperBound); // upper histogram boundary // Member function used to score the energy deposit: void ScoreEnergyDeposit(G4double zPosition, G4double energyDeposit); protected: // Constructor (protected): AnalysisManager(G4String fileNameBase, // File where output is stored // Histogram for storing energy: G4int bins, // number of bins G4double lowerBound, // lower histogram boundary G4double upperBound); // upper histogram boundary // Destructor (protected): virtual ~AnalysisManager(); // Prevent copying AnalysisManager(const AnalysisManager& only); const AnalysisManager& operator=(const AnalysisManager& only); private: // The static instance of the AnalysisManager class: static AnalysisManager* instance; // AIDA analysis factory, tree and histogram factory: AIDA::IAnalysisFactory* analysisFactory; AIDA::ITree* tree; AIDA::IHistogramFactory* histogramFactory; // AIDA histogram used to store the energy deposit: AIDA::IHistogram1D* energyDeposit; G4int numbBins; G4double lowerBoundary; G4double upperBoundary; }; #endif // ANALYSISMANAGER_HH