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4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/g3tog4/clGeometry/src/G3toG4DetectorConstruction.cc (Version 11.3.0) and /examples/extended/g3tog4/clGeometry/src/G3toG4DetectorConstruction.cc (Version 10.6.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 /// \file g3tog4/clGeometry/src/G3toG4Detector     26 /// \file g3tog4/clGeometry/src/G3toG4DetectorConstruction.cc
 27 /// \brief Implementation of the G3toG4Detecto     27 /// \brief Implementation of the G3toG4DetectorConstruction class
 28 //                                                 28 //
 29 //                                                 29 //
 30 //                                                 30 //
 31 //--------------------------------------------     31 //--------------------------------------------------------------------------
 32 // G3toG4DetectorConstruction. Most the work i     32 // G3toG4DetectorConstruction. Most the work is Done in
 33 // G4BuildGeom, which returns a G4LogicalVolum     33 // G4BuildGeom, which returns a G4LogicalVolume*, a pointer to the
 34 // top-level logiical volume in the detector d     34 // top-level logiical volume in the detector defined by the call List file
 35 // inFile                                          35 // inFile
 36 //--------------------------------------------     36 //--------------------------------------------------------------------------
 37                                                    37 
                                                   >>  38 #include "G4SystemOfUnits.hh"
                                                   >>  39 #include "G4ios.hh"
 38 #include "G3toG4DetectorConstruction.hh"           40 #include "G3toG4DetectorConstruction.hh"
 39                                                <<  41 #include "G4VisAttributes.hh"
 40 #include "G4Box.hh"                            << 
 41 #include "G4Colour.hh"                             42 #include "G4Colour.hh"
 42 #include "G4Material.hh"                           43 #include "G4Material.hh"
                                                   >>  44 #include "G4Box.hh"
 43 #include "G4SystemOfUnits.hh"                      45 #include "G4SystemOfUnits.hh"
 44 #include "G4VisAttributes.hh"                  << 
 45 #include "G4ios.hh"                            << 
 46                                                    46 
 47 //....oooOO0OOooo........oooOO0OOooo........oo     47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 48                                                    48 
 49 G3toG4DetectorConstruction::G3toG4DetectorCons     49 G3toG4DetectorConstruction::G3toG4DetectorConstruction(G4String inFile)
 50   : G4VUserDetectorConstruction(), fInFile(inF <<  50   : G4VUserDetectorConstruction(),
                                                   >>  51     fInFile(inFile)
 51 {                                                  52 {
 52   G4cout << "Instantiated G3toG4DetectorConstr <<  53   G4cout << "Instantiated G3toG4DetectorConstruction using call list file \"" 
 53          << G4endl;                            <<  54          << fInFile << "\"" << G4endl;
 54 }                                                  55 }
 55                                                    56 
 56 //....oooOO0OOooo........oooOO0OOooo........oo     57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 57                                                    58 
 58 G3toG4DetectorConstruction::~G3toG4DetectorCon     59 G3toG4DetectorConstruction::~G3toG4DetectorConstruction()
 59 {                                                  60 {
 60   // G4cout << "Deleted G3toG4DetectorConstruc     61   // G4cout << "Deleted G3toG4DetectorConstruction..." << G4endl;
 61 }                                                  62 }
 62                                                    63 
 63 //....oooOO0OOooo........oooOO0OOooo........oo     64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 64                                                    65 
 65 G4VPhysicalVolume* G3toG4DetectorConstruction:     66 G4VPhysicalVolume* G3toG4DetectorConstruction::Construct()
 66 {                                                  67 {
 67   G4LogicalVolume* lv = G4BuildGeom(fInFile);      68   G4LogicalVolume* lv = G4BuildGeom(fInFile);
 68   // G4LogicalVolume* lv = SimpleConstruct();  <<  69   //G4LogicalVolume* lv = SimpleConstruct();
 69   if (lv) {                                    <<  70   if ( lv ) {
 70     G4VPhysicalVolume* pv = new G4PVPlacement( <<  71     G4VPhysicalVolume* pv
                                                   >>  72       = new G4PVPlacement(0, G4ThreeVector(), lv, lv->GetName(), 0, false, 0);
 71     G4cout << "Top-level G3toG4 logical volume     73     G4cout << "Top-level G3toG4 logical volume " << lv->GetName() << " "
 72            << *(lv->GetVisAttributes()) << G4e <<  74            << *(lv -> GetVisAttributes()) << G4endl;
 73     return pv;                                 <<  75     return pv;       
 74   }                                            <<  76   } 
 75                                                    77 
 76   G4cerr << "creation of logical mother failed     78   G4cerr << "creation of logical mother failed !!!" << G4endl;
 77   return 0;                                        79   return 0;
 78 }                                                  80 }
 79                                                    81 
 80 //....oooOO0OOooo........oooOO0OOooo........oo     82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 81                                                    83 
 82 G4LogicalVolume* G3toG4DetectorConstruction::S     84 G4LogicalVolume* G3toG4DetectorConstruction::SimpleConstruct()
 83 {                                                  85 {
 84   G4String name, symbol;  // a=mass of a mole; <<  86   G4String name, symbol;             //a=mass of a mole;
 85   G4double a, z, density, fractionmass;  // z= <<  87   G4double a, z, density, fractionmass; //z=mean number of protons;
 86   G4int ncomponents;  // iz=number of protons  <<  88   G4int ncomponents;          //iz=number of protons  in an isotope;
 87   // n=number of nucleons in an isotope;           89   // n=number of nucleons in an isotope;
 88                                                    90 
 89   a = 14.01 * g / mole;                        <<  91   a = 14.01*g/mole;
 90   G4Element* eN = new G4Element(name = "Nitrog <<  92   G4Element* eN  = new G4Element(name="Nitrogen",symbol="N" , z= 7., a);
 91                                                    93 
 92   a = 16.00 * g / mole;                        <<  94   a = 16.00*g/mole;
 93   G4Element* eO = new G4Element(name = "Oxygen <<  95   G4Element* eO  = new G4Element(name="Oxygen"  ,symbol="O" , z= 8., a);
 94                                                    96 
 95   //                                               97   //
 96   // define a material from elements.   case 2     98   // define a material from elements.   case 2: mixture by fractional mass
 97   //                                               99   //
 98                                                   100 
 99   density = 1.290 * mg / cm3;                  << 101   density = 1.290*mg/cm3;
100   G4Material* air = new G4Material(name = "Air << 102   G4Material* air = new G4Material(name="Air"  , density, ncomponents=2);
101   air->AddElement(eN, fractionmass = 0.7);     << 103   air->AddElement(eN, fractionmass=0.7);
102   air->AddElement(eO, fractionmass = 0.3);     << 104   air->AddElement(eO, fractionmass=0.3);
103   G4VSolid* mother = new G4Box("TestMother",   << 105   G4VSolid* mother = new G4Box("TestMother",             //its name
104                                100 * cm, 100 * << 106                                 100*cm, 100*cm, 100*cm); //its size
105                                                << 107 
106   G4VSolid* daughter = new G4Box("TestDaughter << 108   G4VSolid* daughter = new G4Box("TestDaughter", 50*cm, 20*cm, 10*cm);
107                                                << 109 
108   G4LogicalVolume* logicMother = new G4Logical << 110   G4LogicalVolume* logicMother = new G4LogicalVolume(mother,     //its solid
109                                                << 111                                                      air,        //its material
110                                                << 112                                                      "LTestMother");//its name
111                                                   113 
112   G4LogicalVolume* logicDaughter = new G4Logic << 114   G4LogicalVolume* logicDaughter = new G4LogicalVolume(daughter, //its solid
113                                                << 115                                                        air,      //its material
114                                                   116                                                        "LTestDaughter");
115                                                   117 
116   new G4PVPlacement(0, G4ThreeVector(), logicD << 118   new G4PVPlacement(0,
                                                   >> 119                     G4ThreeVector(),
                                                   >> 120                     logicDaughter,
                                                   >> 121                     "PTestDaughter",
                                                   >> 122                     logicMother,
                                                   >> 123                     false,0);
117   //                                              124   //
118   // Visualization attributes                     125   // Visualization attributes
119   //                                              126   //
120                                                   127 
121   logicMother->SetVisAttributes(G4VisAttribute << 128   logicMother->SetVisAttributes (G4VisAttributes::GetInvisible());
122   G4VisAttributes* daughterVisAtt = new G4VisA << 129   G4VisAttributes* daughterVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
123   daughterVisAtt->SetVisibility(true);            130   daughterVisAtt->SetVisibility(true);
124   logicDaughter->SetVisAttributes(daughterVisA    131   logicDaughter->SetVisAttributes(daughterVisAtt);
125   return logicMother;                             132   return logicMother;
126 }                                                 133 }
127                                                   134 
128 //....oooOO0OOooo........oooOO0OOooo........oo    135 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
129                                                   136