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 ] [ 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/parameterisations/Par02/src/Par02DetectorConstruction.cc (Version 11.3.0) and /examples/extended/parameterisations/Par02/src/Par02DetectorConstruction.cc (Version 10.2.p1)


  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 // $Id: $
 26 //                                                 27 //
 27 /// \file Par02DetectorConstruction.cc             28 /// \file Par02DetectorConstruction.cc
 28 /// \brief Implementation of the Par02Detector     29 /// \brief Implementation of the Par02DetectorConstruction class
 29                                                    30 
 30 #include "Par02DetectorConstruction.hh"            31 #include "Par02DetectorConstruction.hh"
 31                                                << 
 32 #include "G4AutoDelete.hh"                     << 
 33 #include "G4GDMLParser.hh"                     << 
 34 #include "G4GlobalMagFieldMessenger.hh"        << 
 35 #include "G4ProductionCuts.hh"                     32 #include "G4ProductionCuts.hh"
 36 #include "G4RegionStore.hh"                    << 
 37 #include "G4SystemOfUnits.hh"                      33 #include "G4SystemOfUnits.hh"
                                                   >>  34 #include "G4RegionStore.hh"
                                                   >>  35 #include "G4GDMLParser.hh"
                                                   >>  36 #include "G4AutoDelete.hh"
 38                                                    37 
 39 //....oooOO0OOooo........oooOO0OOooo........oo     38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 40                                                    39 
 41 Par02DetectorConstruction::Par02DetectorConstr <<  40 Par02DetectorConstruction::Par02DetectorConstruction() {}
 42                                                    41 
 43 //....oooOO0OOooo........oooOO0OOooo........oo     42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 44                                                    43 
 45 Par02DetectorConstruction::~Par02DetectorConst <<  44 Par02DetectorConstruction::~Par02DetectorConstruction() {}
 46                                                    45 
 47 //....oooOO0OOooo........oooOO0OOooo........oo     46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 48                                                    47 
 49 G4VPhysicalVolume* Par02DetectorConstruction:: <<  48 G4VPhysicalVolume* Par02DetectorConstruction::Construct() {
 50 {                                              << 
 51   G4GDMLParser parser;                             49   G4GDMLParser parser;
 52   parser.Read("Par02FullDetector.gdml");       <<  50   parser.Read( "Par02FullDetector.gdml" );
 53   G4cout << "Geometry loaded from  file ......     51   G4cout << "Geometry loaded from  file .......Par02FullDetector.gdml " << G4endl;
 54                                                    52 
 55   // This GDML detector description uses the a     53   // This GDML detector description uses the auxiliary information part to store
 56   // information regarding which Geant4 volume     54   // information regarding which Geant4 volumes have a fast simulation model.
 57                                                    55 
 58   const G4GDMLAuxMapType* aAuxMap = parser.Get     56   const G4GDMLAuxMapType* aAuxMap = parser.GetAuxMap();
 59   for (G4GDMLAuxMapType::const_iterator iter = <<  57   for ( G4GDMLAuxMapType::const_iterator iter = aAuxMap->begin();
 60     for (G4GDMLAuxListType::const_iterator vit <<  58         iter != aAuxMap->end(); ++iter ) {
 61          vit != (*iter).second.end(); ++vit)   <<  59     for ( G4GDMLAuxListType::const_iterator vit = (*iter).second.begin();
 62     {                                          <<  60           vit != (*iter).second.end(); ++vit ) {
 63       if ((*vit).type == "FastSimModel") {     <<  61       if ( (*vit).type == "FastSimModel" ) {
 64         G4LogicalVolume* myvol = (*iter).first     62         G4LogicalVolume* myvol = (*iter).first;
 65         if ((myvol->GetName()).find("Tracker") <<  63         if ( ( myvol->GetName() ).find( "Tracker" ) != std::string::npos ) {
 66           fTrackerList.push_back(new G4Region( <<  64           fTrackerList.push_back( new G4Region( myvol->GetName() ) );
 67           fTrackerList.back()->AddRootLogicalV <<  65           fTrackerList.back()->AddRootLogicalVolume( myvol );
 68           G4cout << G4endl << "tracker !!!" << <<  66         } else if ( ( myvol->GetName() ).find( "HCal" ) != std::string::npos ) {
 69         }                                      <<  67           fHCalList.push_back( new G4Region( myvol->GetName() ) );
 70         else if ((myvol->GetName()).find("HCal <<  68           fHCalList.back()->AddRootLogicalVolume( myvol );
 71           fHCalList.push_back(new G4Region(myv <<  69         } else if ( ( myvol->GetName() ).find( "ECal" ) != std::string::npos ) {
 72           fHCalList.back()->AddRootLogicalVolu <<  70           fECalList.push_back( new G4Region( myvol->GetName() ) );
 73           G4cout << G4endl << "hcal !!!" << G4 <<  71           fECalList.back()->AddRootLogicalVolume( myvol );
 74         }                                      <<  72         } else if ( ( myvol->GetName() ).find( "Muon" ) != std::string::npos ) {
 75         else if ((myvol->GetName()).find("ECal <<  73           fMuonList.push_back( new G4Region( myvol->GetName() ) );
 76           fECalList.push_back(new G4Region(myv <<  74           fMuonList.back()->AddRootLogicalVolume( myvol );
 77           fECalList.back()->AddRootLogicalVolu <<  75         } else {
 78           G4cout << G4endl << "ecal !!!" << G4 << 
 79         }                                      << 
 80         else if ((myvol->GetName()).find("Muon << 
 81           fMuonList.push_back(new G4Region(myv << 
 82           fMuonList.back()->AddRootLogicalVolu << 
 83         }                                      << 
 84         else {                                 << 
 85           G4cout << G4endl << "NOT A KNOWN DET     76           G4cout << G4endl << "NOT A KNOWN DETECTOR !!!" << G4endl;
 86         }                                          77         }
 87       }                                            78       }
 88     }                                              79     }
 89   }                                                80   }
 90   for (G4int iterTracker = 0; iterTracker < G4 <<  81   for ( G4int iterTracker = 0; iterTracker < G4int( fTrackerList.size() ); 
 91     fTrackerList[iterTracker]->SetProductionCu <<  82         iterTracker++ ) {
 92     fTrackerList[iterTracker]->GetProductionCu <<  83     fTrackerList[ iterTracker ]->SetProductionCuts( new G4ProductionCuts() );
 93       1.0                                      <<  84     fTrackerList[ iterTracker ]->GetProductionCuts()->SetProductionCut
 94       * ((*fTrackerList[iterTracker]->GetRootL <<  85       ( 1.0* ( ( *fTrackerList[ iterTracker ]->GetRootLogicalVolumeIterator() )->
 95     fTrackerList[iterTracker]->GetProductionCu <<  86           GetMaterial()->GetRadlen() ) );
 96   }                                            <<  87     fTrackerList[ iterTracker ]->GetProductionCuts()->
 97   for (G4int iterECal = 0; iterECal < G4int(fE <<  88       SetProductionCut( 1.0*m, idxG4GammaCut );
 98     fECalList[iterECal]->SetProductionCuts(new <<  89   }
 99     fECalList[iterECal]->GetProductionCuts()-> <<  90   for ( G4int iterECal = 0; iterECal < G4int( fECalList.size() ); iterECal++ ) {
100       0.5 * ((*fECalList[iterECal]->GetRootLog <<  91     fECalList[ iterECal ]->SetProductionCuts( new G4ProductionCuts() );
101     fECalList[iterECal]->GetProductionCuts()-> <<  92     fECalList[ iterECal ]->GetProductionCuts()->SetProductionCut
102   }                                            <<  93       ( 0.5* ( ( *fECalList[ iterECal ]->GetRootLogicalVolumeIterator() )->
103   for (G4int iterHCal = 0; iterHCal < G4int(fH <<  94           GetMaterial()->GetRadlen() ) );
104     fHCalList[iterHCal]->SetProductionCuts(new <<  95     fECalList[ iterECal ]->GetProductionCuts()->
105     fHCalList[iterHCal]->GetProductionCuts()-> <<  96       SetProductionCut( 0.1*m, idxG4GammaCut );
106       0.5 * ((*fHCalList[iterHCal]->GetRootLog <<  97   }
107     fHCalList[iterHCal]->GetProductionCuts()-> <<  98   for ( G4int iterHCal = 0; iterHCal < G4int( fHCalList.size() ); iterHCal++ ) {
                                                   >>  99     fHCalList[ iterHCal ]->SetProductionCuts( new G4ProductionCuts() );
                                                   >> 100     fHCalList[ iterHCal ]->GetProductionCuts()->SetProductionCut(
                                                   >> 101       0.5* ( ( *fHCalList[iterHCal]->GetRootLogicalVolumeIterator() )->
                                                   >> 102         GetMaterial()->GetRadlen() ) );
                                                   >> 103     fHCalList[ iterHCal ]->GetProductionCuts()->
                                                   >> 104       SetProductionCut( 1.0*m, idxG4GammaCut );
108   }                                               105   }
109                                                   106 
110   // Returns the pointer to the physical world    107   // Returns the pointer to the physical world.
111   return parser.GetWorldVolume();                 108   return parser.GetWorldVolume();
112 }                                                 109 }
113                                                   110 
114 //....oooOO0OOooo........oooOO0OOooo........oo    111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115                                                   112 
116 void Par02DetectorConstruction::ConstructSDand << 113 void Par02DetectorConstruction::ConstructSDandField() {
117 {                                              << 114   for ( G4int iterTracker = 0; iterTracker < G4int( fTrackerList.size() ); 
118   for (G4int iterTracker = 0; iterTracker < G4 << 115         iterTracker++ ) {
119     // Bound the fast simulation model for the    116     // Bound the fast simulation model for the tracker subdetector
120     // to all the corresponding Geant4 regions    117     // to all the corresponding Geant4 regions
121     Par02FastSimModelTracker* fastSimModelTrac << 118     Par02FastSimModelTracker* fastSimModelTracker
122       "fastSimModelTracker", fTrackerList[iter << 119       = new Par02FastSimModelTracker( "fastSimModelTracker", fTrackerList[ iterTracker ],
123                                                << 120                                      Par02DetectorParametrisation::eCMS );
                                                   >> 121                                      
124     // Register the fast simulation model for     122     // Register the fast simulation model for deleting
125     G4AutoDelete::Register(fastSimModelTracker    123     G4AutoDelete::Register(fastSimModelTracker);
126   }                                               124   }
127   for (G4int iterECal = 0; iterECal < G4int(fE << 125   for ( G4int iterECal = 0; iterECal < G4int( fECalList.size() ); iterECal++ ) {
128     // Bound the fast simulation model for the    126     // Bound the fast simulation model for the electromagnetic calorimeter
129     // to all the corresponding Geant4 regions    127     // to all the corresponding Geant4 regions
130     Par02FastSimModelEMCal* fastSimModelEMCal  << 128     Par02FastSimModelEMCal* fastSimModelEMCal
131       "fastSimModelEMCal", fECalList[iterECal] << 129       = new Par02FastSimModelEMCal( "fastSimModelEMCal", fECalList[ iterECal ],
132                                                << 130                                   Par02DetectorParametrisation::eCMS );
                                                   >> 131                                      
133     // Register the fast simulation model for     132     // Register the fast simulation model for deleting
134     G4AutoDelete::Register(fastSimModelEMCal);    133     G4AutoDelete::Register(fastSimModelEMCal);
135   }                                               134   }
136   for (G4int iterHCal = 0; iterHCal < G4int(fH << 135   for ( G4int iterHCal = 0; iterHCal < G4int( fHCalList.size() ); iterHCal++ ) {
137     // Bound the fast simulation model for the    136     // Bound the fast simulation model for the hadronic calorimeter
138     // to all the corresponding Geant4 regions    137     // to all the corresponding Geant4 regions
139     Par02FastSimModelHCal* fastSimModelHCal =  << 138     Par02FastSimModelHCal* fastSimModelHCal
140       "fastSimModelHCal", fHCalList[iterHCal], << 139       = new Par02FastSimModelHCal( "fastSimModelHCal", fHCalList[ iterHCal ],
141                                                << 140                                  Par02DetectorParametrisation::eCMS );
                                                   >> 141                                      
142     // Register the fast simulation model for     142     // Register the fast simulation model for deleting
143     G4AutoDelete::Register(fastSimModelHCal);     143     G4AutoDelete::Register(fastSimModelHCal);
144   }                                               144   }
145   // Currently we don't have a fast muon simul    145   // Currently we don't have a fast muon simulation model to be bound
146   // to all the corresponding Geant4 regions.     146   // to all the corresponding Geant4 regions.
147   // But it could be added in future, in a sim    147   // But it could be added in future, in a similar way as done above for
148   // the tracker subdetector and the electroma    148   // the tracker subdetector and the electromagnetic and hadronic calorimeters.
149                                                << 
150   // Add global magnetic field                 << 
151   G4ThreeVector fieldValue = G4ThreeVector();  << 
152   fMagFieldMessenger = new G4GlobalMagFieldMes << 
153   fMagFieldMessenger->SetVerboseLevel(1);      << 
154 }                                                 149 }
155                                                << 150  
156 //....oooOO0OOooo........oooOO0OOooo........oo    151 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 152 
157                                                   153