Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Authors: S. Guatelli , M. G. Pia, INFN Genova and F. Ambroglini INFN Perugia, Italy
0027 //
0028 #include "G4MIRDUrinaryBladder.hh"
0029 
0030 #include "globals.hh"
0031 #include "G4SystemOfUnits.hh"
0032 #include "G4SDManager.hh"
0033 #include "G4VisAttributes.hh"
0034 #include "G4Ellipsoid.hh"
0035 #include "G4Material.hh"
0036 #include "G4LogicalVolume.hh"
0037 #include "G4HumanPhantomMaterial.hh"
0038 #include "G4VPhysicalVolume.hh"
0039 #include "G4PVPlacement.hh"
0040 #include "G4SubtractionSolid.hh"
0041 #include "G4HumanPhantomColour.hh"
0042 
0043 G4VPhysicalVolume* G4MIRDUrinaryBladder::Construct(const G4String& volumeName, G4VPhysicalVolume* mother,
0044                            const G4String& colourName, G4bool wireFrame, G4bool)
0045 {
0046  
0047   G4cout<<"Construct "<<volumeName<<" with mother volume "<<mother->GetName()<<G4endl;
0048  
0049   auto* material = new G4HumanPhantomMaterial();
0050   auto* soft = material -> GetMaterial("soft_tissue");
0051   delete material;
0052 
0053   G4double ax = 4.958*cm; 
0054   G4double by= 3.458 *cm;
0055   G4double cz= 3.458 *cm;
0056  
0057   auto* bladder = new G4Ellipsoid("bladder_out",ax, by, cz);
0058  
0059   ax = 4.706 * cm;
0060   by = 3.206 * cm;
0061   cz = 3.206 * cm;
0062   auto* inner = new G4Ellipsoid("innerBladder", ax, by, cz);
0063  
0064   auto* totalBladder = new G4SubtractionSolid("bladder", bladder, inner);
0065 
0066   auto* logicUrinaryBladder = new G4LogicalVolume(totalBladder, soft,
0067                                  "logical" + volumeName,
0068                                  nullptr, nullptr, nullptr);
0069   
0070   // Define rotation and position here!
0071   G4VPhysicalVolume* physUrinaryBladder = new G4PVPlacement(nullptr,G4ThreeVector(0 *cm, -4.5 *cm,-27. *cm),
0072                                 "physicalUrinaryBladder",
0073                                 logicUrinaryBladder,
0074                                 mother,
0075                                 false,
0076                                 0, true);
0077 
0078 
0079   // Visualization Attributes
0080   auto* colourPointer = new G4HumanPhantomColour();
0081   G4Colour colour = colourPointer -> GetColour(colourName);
0082   auto* UrinaryBladderVisAtt = new G4VisAttributes(colour);
0083   //G4VisAttributes* UrinaryBladderVisAtt = new G4VisAttributes(G4Colour(0.85,0.65,0.125));
0084 
0085   UrinaryBladderVisAtt->SetForceSolid(wireFrame);
0086   logicUrinaryBladder->SetVisAttributes(UrinaryBladderVisAtt);
0087 
0088   G4cout << "UrinaryBladder created !!!!!!" << G4endl;
0089 
0090   // Testing UrinaryBladder Volume
0091   G4double UrinaryBladderVol = logicUrinaryBladder->GetSolid()->GetCubicVolume();
0092   G4cout << "Volume of UrinaryBladder = " << UrinaryBladderVol/cm3 << " cm^3" << G4endl;
0093   
0094   // Testing UrinaryBladder Material
0095   G4String UrinaryBladderMat = logicUrinaryBladder->GetMaterial()->GetName();
0096   G4cout << "Material of UrinaryBladder = " << UrinaryBladderMat << G4endl;
0097   
0098   // Testing Density
0099   G4double UrinaryBladderDensity = logicUrinaryBladder->GetMaterial()->GetDensity();
0100   G4cout << "Density of Material = " << UrinaryBladderDensity*cm3/g << " g/cm^3" << G4endl;
0101 
0102   // Testing Mass
0103   G4double UrinaryBladderMass = (UrinaryBladderVol)*UrinaryBladderDensity;
0104   G4cout << "Mass of UrinaryBladder = " << UrinaryBladderMass/gram << " g" << G4endl;
0105 
0106   
0107   return physUrinaryBladder;
0108 }