Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Previous authors: G. Guerrieri, S. Guatelli and M. G. Pia, INFN Genova, Italy
0027 // Authors (since 2007): S. Guatelli, University of Wollongong, Australia
0028 // 
0029 // Contribution: F. Ambroglini INFN Perugia, Italy
0030 //
0031 //
0032 #ifdef G4LIB_USE_GDML
0033 
0034 #include "G4ORNLFemaleBodyFactory.hh"
0035 #include "G4PhysicalVolumeStore.hh"
0036 #include "G4GDMLParser.hh"
0037 #include "globals.hh"
0038 #include "G4PVPlacement.hh"
0039 #include "G4SDManager.hh"
0040 #include "G4VisAttributes.hh"
0041 #include "G4HumanPhantomColour.hh"
0042 
0043 G4ORNLFemaleBodyFactory::G4ORNLFemaleBodyFactory()
0044 {
0045 }
0046 
0047 G4ORNLFemaleBodyFactory::~G4ORNLFemaleBodyFactory()
0048 { 
0049 }
0050 
0051 G4VPhysicalVolume* G4ORNLFemaleBodyFactory::CreateOrgan(const G4String& gdmlFile, G4VPhysicalVolume* motherVolume,
0052                             const G4String& colourName, G4bool visAttribute, 
0053                             G4bool)
0054 {
0055   G4cout<< "ORNLBodyFactory: "<< "gdmlData/Female/ORNL"<< gdmlFile <<".gdml" << G4endl;
0056 
0057   G4GDMLParser parser;
0058   G4String filename = "gdmlData/Female/ORNL"+ gdmlFile + ".gdml";
0059   parser.Read(filename);
0060  
0061   G4String logicalVolumeName = gdmlFile + "Volume"; 
0062   G4LogicalVolume* logicOrgan = parser.GetVolume(logicalVolumeName);
0063   G4ThreeVector position = parser.GetPosition("OrganPos");
0064   G4ThreeVector rot = parser.GetRotation("OrganRot");
0065   G4RotationMatrix* rm = new G4RotationMatrix();
0066   rm->rotateX(rot.x()); rm->rotateY(rot.y()); rm->rotateZ(rot.z()); 
0067 
0068   G4PhysicalVolumeStore::DeRegister(parser.GetWorldVolume());
0069  
0070   //   sxp.Finalize();
0071   // Define rotation and position here!
0072   G4VPhysicalVolume* physOrgan = new G4PVPlacement(rm,position,
0073                        "physicalOrgan",
0074                    logicOrgan,
0075                    motherVolume,
0076                    false,
0077                    0);
0078 
0079 
0080      if ( (gdmlFile == "Trunk" ) ||
0081        (gdmlFile == "Head" ) ||
0082        (gdmlFile == "LeftLeg" ) ||
0083        (gdmlFile == "RightLeg" ))
0084     {
0085     logicOrgan->SetVisAttributes(G4VisAttributes::GetInvisible());
0086     }
0087   else
0088   {
0089 // Visualization Attributes
0090   G4HumanPhantomColour* colourPointer = new G4HumanPhantomColour();
0091   G4Colour colour = colourPointer -> GetColour(colourName);
0092   G4VisAttributes* organVisAtt = new G4VisAttributes(colour);
0093   // Visualization Attributes
0094   organVisAtt->SetForceSolid(visAttribute);
0095   logicOrgan->SetVisAttributes(organVisAtt);
0096   }
0097   G4cout << "Organ created !!!!!!  from " << filename <<G4endl;
0098 
0099   return physOrgan;
0100 }
0101 
0102 #endif