Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4PhysicalVolumeMassScene.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 //
0027 //
0028 // 
0029 // John Allison  12th September 2004
0030 
0031 // Class Description:
0032 //
0033 // Calculates the mass of a geometry tree taking into account daughters
0034 // up to the depth specified in the G4PhysicalVolumeModel.  Culling is
0035 // ignored so that all volumes are seen.
0036 //
0037 // Do not use this for a "parallel world" for which materials are not
0038 // defined.  Use only for the material world.
0039 //
0040 // The calculation is quite tricky, since it involves subtracting the
0041 // mass of that part of the mother that is occupied by each daughter and
0042 // then adding the mass of the daughter, and so on down the heirarchy.
0043 //
0044 // Usage for a given G4PhysicalVolumeModel* pvModel:
0045 //   G4PhysicalVolumeMassScene massScene(pvModel);
0046 //   pvModel->DescribeYourselfTo (massScene);
0047 //   G4double volume = massScene.GetVolume();
0048 //   G4double mass = massScene.GetMass();
0049 //   massScene.Reset();
0050 // See, for example, G4ASCIITreeSceneHandler::EndModeling().
0051 
0052 #ifndef G4PHYSICALVOLUMEMASSSCENE_HH
0053 #define G4PHYSICALVOLUMEMASSSCENE_HH
0054 
0055 #include "G4PseudoScene.hh"
0056 
0057 #include <deque>
0058 
0059 class G4VPhysicalVolume;
0060 class G4LogicalVolume;
0061 class G4PhysicalVolumeModel;
0062 class G4Material;
0063 
0064 class G4PhysicalVolumeMassScene: public G4PseudoScene
0065 {
0066 
0067 public:
0068   G4PhysicalVolumeMassScene (G4PhysicalVolumeModel*);
0069   virtual ~G4PhysicalVolumeMassScene ();
0070 
0071 public: // With description
0072 
0073   G4double GetVolume () const {return fVolume;}
0074   // Overall volume.
0075 
0076   G4double GetMass () const {return fMass;}
0077   // Mass of whole tree, i.e., accounting for all daughters.
0078 
0079   void Reset ();
0080   // Reset for subsequent re-use.
0081 
0082 private:
0083   void ProcessVolume (const G4VSolid&);
0084   G4PhysicalVolumeModel* fpPVModel;
0085   G4double fVolume;
0086   G4double fMass;
0087   G4VPhysicalVolume* fpLastPV;
0088   G4int fPVPCount;
0089   G4int fLastDepth;
0090   G4double fLastDensity;
0091   std::deque<G4double> fDensityStack;
0092 };
0093 
0094 #endif