Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 ////////////////////////////////////////////// 27 // File: CCalDetectorConstruction.cc 28 // Description: CCalDetectorConstruction user 29 // detector geometry 30 ////////////////////////////////////////////// 31 #include "CCalDetectorConstruction.hh" 32 33 //#define debug 34 35 #ifdef debug 36 #include "G4Timer.hh" 37 #endif 38 39 #include "CCalMaterialFactory.hh" 40 #include "CCalRotationMatrixFactory.hh" 41 #include "CCalSensAssign.hh" 42 #include "CCalMagneticField.hh" 43 #include "CCalG4Hall.hh" 44 #include "CCalutils.hh" 45 46 #include "CCalSensitiveConfiguration.hh" 47 #include "CCalEcalOrganization.hh" 48 #include "CCalHcalOrganization.hh" 49 50 #include "G4SystemOfUnits.hh" 51 #include "G4SDManager.hh" 52 #include "G4FieldManager.hh" 53 #include "G4ChordFinder.hh" 54 #include "G4Mag_UsualEqRhs.hh" 55 #include "G4PropagatorInField.hh" 56 #include "G4TransportationManager.hh" 57 58 #include "G4ClassicalRK4.hh" 59 #include "G4SimpleRunge.hh" 60 #include "G4ExplicitEuler.hh" 61 #include "G4ImplicitEuler.hh" 62 #include "G4SimpleHeum.hh" 63 #include "G4HelixExplicitEuler.hh" 64 #include "G4HelixImplicitEuler.hh" 65 #include "G4HelixSimpleRunge.hh" 66 #include "G4CashKarpRKF45.hh" 67 #include "G4RKG3_Stepper.hh" 68 69 70 CCalDetectorConstruction::CCalDetectorConstruc 71 72 73 CCalDetectorConstruction::~CCalDetectorConstru 74 75 76 G4VPhysicalVolume* CCalDetectorConstruction::C 77 78 ///////// 79 //Instantiate for the first time the materia 80 #ifdef debug 81 G4cout << "Retrieving materials...." << G4en 82 #endif 83 CCalMaterialFactory::getInstance("material.c 84 85 #ifdef debug 86 G4cout << "Retrieving rotation matrices..... 87 #endif 88 CCalRotationMatrixFactory::getInstance("rota 89 90 #ifdef debug 91 G4cout << tab << "CCalDetectorConstruction: 92 << G4endl; 93 G4Timer timer; 94 timer.Start(); 95 #endif 96 97 //HCAL Test Beam 96 98 testBeamHCal96 = new CCalG4Hall("HcalTB96"); 99 testBeamHCal96->constructHierarchy(); 100 #ifdef debug 101 timer.Stop(); 102 G4cout << tab << "CCalDetectorConstruction: 103 << "construct the geometry: " << time 104 #endif //debug 105 G4VPhysicalVolume* volume = testBeamHCal96-> 106 107 return volume; 108 } 109 110 111 void CCalDetectorConstruction::ConstructSDandF 112 // Create global magnetic field messenger. 113 114 //------------------------------------------ 115 // Magnetic field 116 //------------------------------------------ 117 118 static G4bool fieldIsInitialized = false; 119 //And finally that it was not initialized pr 120 if (!fieldIsInitialized) { 121 CCalMagneticField* ccalField=new CCalMagne 122 G4double field = ccalField->GetConstantFie 123 if (field == 0) { 124 ccalField = NULL; 125 G4cout << "***************************" 126 << "* *" 127 << "* Magnetic Field is off *" 128 << "* *" 129 << "***************************" 130 } else { 131 G4cout << "***************************" 132 << "* *" 133 << "* Magnetic Field is on *" 134 << "* *" 135 << "***************************" 136 << " Field Value " << tab << fiel 137 } 138 G4FieldManager* fieldMgr 139 = G4TransportationManager::GetTransporta 140 fieldMgr->SetDetectorField(ccalField); 141 G4Mag_UsualEqRhs *fEquation = new G4Mag_Us 142 143 G4MagIntegratorStepper *pStepper = new G4C 144 //pStepper = new G4ExplicitEuler( fEquatio 145 //pStepper = new G4ImplicitEuler( fEquatio 146 //pStepper = new G4SimpleRunge( fEquation 147 //pStepper = new G4SimpleHeum( fEquation ) 148 //pStepper = new G4HelixExplicitEuler( fEq 149 //pStepper = new G4HelixImplicitEuler( fEq 150 //pStepper = new G4HelixSimpleRunge( fEqua 151 //pStepper = new G4CashKarpRKF45( fEquatio 152 //pStepper = new G4RKG3_Stepper( fEquation 153 154 G4ChordFinder *pChordFinder = new G4ChordF 155 156 pChordFinder->SetDeltaChord(1.0e-3*mm); 157 fieldMgr->SetChordFinder(pChordFinder); 158 fieldMgr->SetDeltaOneStep(1.0e-3*mm); 159 fieldMgr->SetDeltaIntersection(1.0e-4*mm); 160 G4PropagatorInField* fieldPropagator 161 = G4TransportationManager::GetTransporta 162 ->GetPropagatorInField(); 163 fieldPropagator->SetMinimumEpsilonStep(1.e 164 fieldPropagator->SetMaximumEpsilonStep(1.e 165 fieldIsInitialized = true; 166 } 167 168 //Add sensitive detector types 169 testBeamHCal96->sensitiveHandling(); 170 G4int sensitive = CCalSensitiveConfiguration 171 if ( sensitive > 0 ) { 172 CCalSensAssign::getInstance()->addCaloSD(" 173 } 174 sensitive = CCalSensitiveConfiguration::getI 175 if ( sensitive > 0 ) { 176 CCalSensAssign::getInstance()->addCaloSD(" 177 } 178 // Assign the sensitive detectors 179 CCalSensAssign::getInstance()->assign(); 180 } 181