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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.3)


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