Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:10

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 // Previous authors: G. Guerrieri, S. Guatelli and M. G. Pia, INFN Genova, Italy
0028 // Authors (since 2007): S. Guatelli, University of Wollongong, Australia
0029 // 
0030 //
0031 #include "G4MIRDBrain.hh"
0032 #include "globals.hh"
0033 #include "G4SystemOfUnits.hh"
0034 #include "G4SDManager.hh"
0035 #include "G4VisAttributes.hh"
0036 #include "G4Ellipsoid.hh"
0037 #include "G4ThreeVector.hh"
0038 #include "G4VPhysicalVolume.hh"
0039 #include "G4RotationMatrix.hh"
0040 #include "G4Material.hh"
0041 #include "G4LogicalVolume.hh"
0042 #include "G4HumanPhantomMaterial.hh"
0043 #include "G4VPhysicalVolume.hh"
0044 #include "G4PVPlacement.hh"
0045 #include "G4HumanPhantomColour.hh"
0046 
0047 G4VPhysicalVolume* G4MIRDBrain::Construct(const G4String& volumeName,G4VPhysicalVolume* mother,  
0048                       const G4String& colourName, G4bool wireFrame,G4bool)
0049 {
0050   G4cout << "Construct " << volumeName <<" with mother "<<mother->GetName()<<G4endl;
0051   auto* material = new G4HumanPhantomMaterial();
0052   auto* soft = material -> GetMaterial("soft_tissue");
0053   delete material;
0054 
0055   G4double ax = 6. * cm;
0056   G4double by= 9. * cm;
0057   G4double cz = 6.5 * cm;
0058 
0059   auto* brain = new G4Ellipsoid("Brain", ax, by, cz);
0060  
0061 
0062   auto* logicBrain =  new G4LogicalVolume(brain, soft, 
0063                              "logical" + volumeName,
0064                              nullptr, nullptr, nullptr);
0065   
0066   // Define rotation and position here!
0067   G4VPhysicalVolume* physBrain = new G4PVPlacement(nullptr,
0068                            G4ThreeVector(0.*cm, 0.*cm, 8.75 * cm),
0069                            "physicalBrain",
0070                            logicBrain,
0071                            mother,
0072                            false,
0073                            0, true);
0074   
0075   // Visualization Attributes
0076   // G4VisAttributes* BrainVisAtt = new G4VisAttributes(G4Colour(0.41,0.41,0.41));
0077   auto* colourPointer = new G4HumanPhantomColour();
0078   G4Colour colour = colourPointer -> GetColour(colourName);
0079   
0080   auto* brainVisAtt = new G4VisAttributes(colour);
0081   brainVisAtt->SetForceSolid(wireFrame);
0082   brainVisAtt->SetLineWidth(0.7* mm);
0083   logicBrain->SetVisAttributes(brainVisAtt);
0084 
0085   // Testing Brain Volume
0086   G4double BrainVol = logicBrain->GetSolid()->GetCubicVolume();
0087   G4cout << "Volume of Brain = " << BrainVol/cm3 << " cm^3" << G4endl;
0088   
0089   // Testing Brain Material
0090   G4String BrainMat = logicBrain->GetMaterial()->GetName();
0091   G4cout << "Material of Brain = " << BrainMat << G4endl;
0092   
0093   // Testing Density
0094   G4double BrainDensity = logicBrain->GetMaterial()->GetDensity();
0095   G4cout << "Density of Material = " << BrainDensity*cm3/g << " g/cm^3" << G4endl;
0096 
0097   // Testing Mass
0098   G4double BrainMass = (BrainVol)*BrainDensity;
0099   G4cout << "Mass of Brain = " << BrainMass/gram << " g" << G4endl;
0100   
0101   return physBrain;
0102 }