[807] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // Created by Joanna Weng 26.11.2004 |
---|
| 27 | #include <iostream> |
---|
| 28 | // G4 Classes |
---|
| 29 | #include "globals.hh" |
---|
| 30 | #include "G4ThreeVector.hh" |
---|
| 31 | #include "G4PVPlacement.hh" |
---|
| 32 | #include "G4VPhysicalVolume.hh" |
---|
| 33 | #include "G4LogicalVolume.hh" |
---|
| 34 | #include "G4VisAttributes.hh" |
---|
| 35 | #include "G4Box.hh" |
---|
| 36 | #include "G4SDManager.hh" |
---|
| 37 | #include "G4Material.hh" |
---|
| 38 | #include "G4GeometryManager.hh" |
---|
| 39 | #include "G4PhysicalVolumeStore.hh" |
---|
| 40 | #include "G4LogicalVolumeStore.hh" |
---|
| 41 | #include "G4SolidStore.hh" |
---|
| 42 | #include "G4Colour.hh" |
---|
| 43 | |
---|
| 44 | // User Classes |
---|
| 45 | #include "ExGflashDetectorConstruction.hh" |
---|
| 46 | #include "ExGflashSensitiveDetector.hh" |
---|
| 47 | #include "ExGflashMaterialManager.hh" |
---|
| 48 | //fast simulation |
---|
| 49 | #include "GFlashHomoShowerParameterisation.hh" |
---|
| 50 | #include "G4FastSimulationManager.hh" |
---|
| 51 | #include "GFlashShowerModel.hh" |
---|
| 52 | #include "GFlashHitMaker.hh" |
---|
| 53 | #include "GFlashParticleBounds.hh" |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | ExGflashDetectorConstruction::ExGflashDetectorConstruction() |
---|
| 57 | :m_experimentalHall_log(0), |
---|
| 58 | m_calo_log(0), |
---|
| 59 | m_experimentalHall_phys(0), |
---|
| 60 | m_calo_phys(0) |
---|
| 61 | { |
---|
| 62 | cout<<"ExGflashDetectorConstruction::Detector constructor"<<endl; |
---|
| 63 | |
---|
| 64 | // Simplified `CMS-like` PbWO4 crystal calorimeter |
---|
| 65 | m_calo_xside=31*cm; |
---|
| 66 | m_calo_yside=31*cm; |
---|
| 67 | m_calo_zside=24*cm; |
---|
| 68 | |
---|
| 69 | // GlashStuff |
---|
| 70 | m_theParticleBounds = new GFlashParticleBounds(); // Energy Cuts to kill particles |
---|
| 71 | m_theHMaker = new GFlashHitMaker(); // Makes the EnergieSpots |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | |
---|
| 75 | ExGflashDetectorConstruction::~ExGflashDetectorConstruction() |
---|
| 76 | { |
---|
| 77 | //@@@ ExGflashDetectorConstruction::Soll ich alles dlete |
---|
| 78 | delete m_theParameterisation; |
---|
| 79 | delete m_theParticleBounds; |
---|
| 80 | delete m_theHMaker; |
---|
| 81 | delete m_theFastShowerModel; |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | G4VPhysicalVolume* ExGflashDetectorConstruction::Construct() |
---|
| 86 | { |
---|
| 87 | //--------- Definitions of Solids, Logical Volumes, Physical Volumes --------- |
---|
| 88 | G4String mat= "PbWO4"; |
---|
| 89 | cout<<"Defining the materials"<<endl; |
---|
| 90 | ExGflashMaterialManager *matManager=ExGflashMaterialManager::GetMaterialManager(); |
---|
| 91 | |
---|
| 92 | /******************************* |
---|
| 93 | * The Experimental Hall * |
---|
| 94 | *******************************/ |
---|
| 95 | m_experimentalHall_x=1000.*cm; |
---|
| 96 | m_experimentalHall_y=1000.*cm; |
---|
| 97 | m_experimentalHall_z=1000.*cm; |
---|
| 98 | |
---|
| 99 | m_experimentalHall_box = new G4Box("expHall_box", // World Volume |
---|
| 100 | m_experimentalHall_x, // x size |
---|
| 101 | m_experimentalHall_y, // y size |
---|
| 102 | m_experimentalHall_z); // z size |
---|
| 103 | |
---|
| 104 | m_experimentalHall_log = new G4LogicalVolume(m_experimentalHall_box, //its solid |
---|
| 105 | matManager->getMaterial("Air"), //its material |
---|
| 106 | "expHall_log", // its name |
---|
| 107 | 0, //opt: fieldManager |
---|
| 108 | 0, //opt: SensitiveDetector |
---|
| 109 | 0); //opt: UserLimits |
---|
| 110 | m_experimentalHall_phys = new G4PVPlacement(0, //no rotation |
---|
| 111 | G4ThreeVector(), //at (0,0,0) |
---|
| 112 | "expHall", //its name |
---|
| 113 | m_experimentalHall_log, //its logical volume |
---|
| 114 | 0, //its mother volume |
---|
| 115 | false, //no boolean operation |
---|
| 116 | 0); //copy number |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | //------------------------------ |
---|
| 120 | // Calorimeter segments |
---|
| 121 | //------------------------------ |
---|
| 122 | // Simplified `CMS-like` PbWO4 crystal calorimeter |
---|
| 123 | |
---|
| 124 | m_NbOfCrystals = 10; // this are the crystals PER ROW in this example |
---|
| 125 | // cube of 10 x 10 crystals |
---|
| 126 | // don't change it @the moment, since |
---|
| 127 | // the readout in event action assumes this |
---|
| 128 | // dimensions and is not automatically adapted |
---|
| 129 | // in this version of the example :-( |
---|
| 130 | m_CrystalWidht = 3*cm; |
---|
| 131 | m_CrystalLenght= 24*cm; |
---|
| 132 | m_calo_xside=(m_CrystalWidht*m_NbOfCrystals)+1*cm; |
---|
| 133 | m_calo_yside=(m_CrystalWidht*m_NbOfCrystals)+1*cm;; |
---|
| 134 | m_calo_zside=m_CrystalLenght; |
---|
| 135 | |
---|
| 136 | G4Box *calo_box= new G4Box("CMS calorimeter", //its name |
---|
| 137 | m_calo_xside/2., //size |
---|
| 138 | m_calo_yside/2., |
---|
| 139 | m_calo_zside/2.); |
---|
| 140 | m_calo_log = new G4LogicalVolume(calo_box, //its solid |
---|
| 141 | matManager->getMaterial("Air"), //its material |
---|
| 142 | "calo log", //its name |
---|
| 143 | 0, //opt: fieldManager |
---|
| 144 | 0, //opt: SensitiveDetector |
---|
| 145 | 0); //opt: UserLimit |
---|
| 146 | |
---|
| 147 | G4double Xpos = 0.0; |
---|
| 148 | G4double Ypos = 0.0; |
---|
| 149 | G4double Zpos = 100.0*cm; |
---|
| 150 | |
---|
| 151 | m_calo_phys = new G4PVPlacement(0, //no rotation |
---|
| 152 | G4ThreeVector(Xpos,Ypos,Zpos), //at (0,0,0) |
---|
| 153 | m_calo_log, //its logical volume |
---|
| 154 | "calorimeter", //its name |
---|
| 155 | m_experimentalHall_log, //its mother volume |
---|
| 156 | false, //no boolean operation |
---|
| 157 | 1); |
---|
| 158 | //Visibility |
---|
| 159 | for (int i=0; i<m_NbOfCrystals;i++) |
---|
| 160 | { |
---|
| 161 | |
---|
| 162 | for (int j=0; j<m_NbOfCrystals;j++) |
---|
| 163 | { |
---|
| 164 | int n = i*10+j; |
---|
| 165 | m_crystal[n]= new G4Box("Crystal", //its name |
---|
| 166 | m_CrystalWidht/2,m_CrystalWidht/2,m_CrystalLenght/2); //size |
---|
| 167 | m_crystal_log[n] = new G4LogicalVolume(m_crystal[n], //its solid |
---|
| 168 | matManager->getMaterial(mat), //its material |
---|
| 169 | "Crystal_log"); //its name |
---|
| 170 | |
---|
| 171 | m_crystal_phys[n] = new G4PVPlacement(0, //no rotation |
---|
| 172 | G4ThreeVector((i*m_CrystalWidht)-135,(j*m_CrystalWidht)-135,0 ), //at (0,0,0) |
---|
| 173 | m_crystal_log[n], //its logical volume |
---|
| 174 | "crystal", //its name |
---|
| 175 | m_calo_log, //its mother volume |
---|
| 176 | false, //no boolean operation |
---|
| 177 | 1); //Visibility |
---|
| 178 | } |
---|
| 179 | } |
---|
| 180 | cout << "There are " << m_NbOfCrystals << " crystals per row in the calorimeter, so in total "<< |
---|
| 181 | m_NbOfCrystals*m_NbOfCrystals << " crystals" << endl; |
---|
| 182 | cout << "The have widthof " << m_CrystalWidht /cm << " cm and a lenght of " << m_CrystalLenght /cm |
---|
| 183 | <<" cm. The Material is "<< matManager->getMaterial(mat) << endl; |
---|
| 184 | |
---|
| 185 | // Sensitive Detector part |
---|
| 186 | G4SDManager* SDman = G4SDManager::GetSDMpointer(); |
---|
| 187 | ExGflashSensitiveDetector* CaloSD= |
---|
| 188 | new ExGflashSensitiveDetector("Calorimeter",this); |
---|
| 189 | SDman->AddNewDetector(CaloSD); |
---|
| 190 | |
---|
| 191 | m_experimentalHall_log->SetVisAttributes(G4VisAttributes::Invisible); |
---|
| 192 | G4VisAttributes* CaloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0)); |
---|
| 193 | G4VisAttributes* CrystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0)); |
---|
| 194 | m_calo_log->SetVisAttributes(CaloVisAtt); |
---|
| 195 | for (int i=0; i<100;i++) |
---|
| 196 | { |
---|
| 197 | m_crystal_log[i]->SetVisAttributes(CrystalVisAtt); |
---|
| 198 | m_crystal_log[i]->SetSensitiveDetector(CaloSD); |
---|
| 199 | } |
---|
| 200 | // define the parameterisation region |
---|
| 201 | aRegion = new G4Region("crystals"); |
---|
| 202 | m_calo_log->SetRegion(aRegion); |
---|
| 203 | aRegion->AddRootLogicalVolume(m_calo_log); |
---|
| 204 | |
---|
| 205 | |
---|
| 206 | /********************************************** |
---|
| 207 | * Initializing shower modell |
---|
| 208 | ***********************************************/ |
---|
| 209 | cout<<"Shower parameterization"<<endl; |
---|
| 210 | m_theFastShowerModel = new GFlashShowerModel("fastShowerModel",aRegion); |
---|
| 211 | m_theParameterisation = new GFlashHomoShowerParameterisation(matManager->getMaterial(mat)); |
---|
| 212 | m_theFastShowerModel->SetParameterisation(*m_theParameterisation); |
---|
| 213 | m_theFastShowerModel->SetParticleBounds(*m_theParticleBounds) ; |
---|
| 214 | m_theFastShowerModel->SetHitMaker(*m_theHMaker); |
---|
| 215 | cout<<"end shower parameterization"<<endl; |
---|
| 216 | /**********************************************/ |
---|
| 217 | |
---|
| 218 | return m_experimentalHall_phys; |
---|
| 219 | } |
---|
| 220 | |
---|
| 221 | |
---|
| 222 | |
---|
| 223 | |
---|
| 224 | |
---|
| 225 | |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | |
---|
| 229 | |
---|
| 230 | |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | |
---|