Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:19

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 /// \file radiobiology/include/VRadiobiologicalQuantity.hh
0027 /// \brief Definition of the RadioBio::VRadiobiologicalQuantity class
0028 
0029 // This is a purely virtual class giving the framework for the
0030 // calculation of a radiobiological quantity.
0031 // Default quantities (inheriting from this class) are Dose,
0032 // LET and RBE.
0033 
0034 #ifndef RadiobiologyVRadiobiologicalQuantity_H
0035 #define RadiobiologyVRadiobiologicalQuantity_H 1
0036 
0037 #include "VoxelizedSensitiveDetector.hh"
0038 
0039 #include <valarray>
0040 
0041 class G4VAccumulable;
0042 class G4UImessenger;
0043 
0044 namespace RadioBio
0045 {
0046 
0047 class VRadiobiologicalQuantity
0048 {
0049   public:
0050     VRadiobiologicalQuantity()
0051     {
0052       if (VoxelizedSensitiveDetector::GetInstance() == 0)
0053         G4Exception("VRadiobiologicalQuantity::VRadiobiologicalQuantity", "NotVoxelized",
0054                     FatalException,
0055                     "Trying to create a radiobiological quantity before voxelizing the detector!");
0056     }
0057 
0058     virtual ~VRadiobiologicalQuantity() { ; }
0059 
0060     // If this is false (set with macro), nothing happens
0061     G4bool IsCalculationEnabled() const { return fCalculationEnabled; }
0062 
0063     // If this is true, calculation is over and values are updated
0064     G4bool HasBeenCalculated() const { return fCalculated; }
0065 
0066     // Parameter setting
0067     void SetCalculationEnabled(G4bool enabled) { fCalculationEnabled = enabled; }
0068 
0069     // Verbosity for output
0070     void SetVerboseLevel(G4int level) { fVerboseLevel = level; }
0071     G4int GetVerboseLevel() const { return fVerboseLevel; }
0072 
0073     // Set path for output file
0074     void SetPath(G4String fN) { fPath = fN; }
0075 
0076     // Alias for matrix type
0077     using array_type = std::valarray<G4double>;
0078 
0079     // Update data from the accumulable
0080     void virtual AddFromAccumulable(G4VAccumulable*) = 0;
0081 
0082     // Initialization
0083     void virtual Initialize() = 0;
0084 
0085     // Calculation
0086     void virtual Compute() = 0;
0087 
0088     // Clear accumulated data
0089     void virtual Reset() = 0;
0090 
0091     // Output to text files (called at the end of run)
0092     void virtual Store() = 0;
0093 
0094     // Some basic output to the screen
0095     void PrintVirtualParameters()
0096     {
0097       G4cout << "** Verbose level = " << fVerboseLevel << " **********************" << G4endl
0098              << "** Initialized = " << (fInitialized ? "true *" : "false ")
0099              << "********************" << G4endl << "** Saved = " << (fSaved ? "true *" : "false ")
0100              << "**************************" << G4endl
0101              << "** Calculation enabled = " << (fCalculationEnabled ? "true *" : "false ")
0102              << "************" << G4endl << "*******************************************" << G4endl;
0103     }
0104     void virtual PrintParameters() { PrintVirtualParameters(); }
0105 
0106   protected:
0107     // Proper messenger
0108     G4UImessenger* fMessenger = nullptr;
0109 
0110     // Verbose Level
0111     G4int fVerboseLevel = 1;
0112 
0113     // Bool to see if class has been initialized
0114     G4bool fInitialized = false;
0115 
0116     // Bool to see if output has already been saved
0117     G4bool fSaved = false;
0118 
0119     // Bool to see if quantity has been calculated
0120     G4bool fCalculated = false;
0121 
0122     // Output paths
0123     G4String fPath;
0124 
0125     // Boolean for calculation
0126     G4bool fCalculationEnabled = false;
0127 };
0128 
0129 }  // namespace RadioBio
0130 
0131 #endif