Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:30

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 /// \file ExGflash1DetectorConstruction.cc
0028 /// \brief Implementation of the ExGflash1DetectorConstruction class
0029 //
0030 // Created by Joanna Weng 26.11.2004
0031 
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 
0035 // User Classes
0036 #include "ExGflash1DetectorConstruction.hh"
0037 
0038 #include "ExGflash1SensitiveDetector.hh"
0039 
0040 // G4 Classes
0041 #include "G4AutoDelete.hh"
0042 #include "G4Box.hh"
0043 #include "G4Colour.hh"
0044 #include "G4LogicalVolume.hh"
0045 #include "G4Material.hh"
0046 #include "G4NistManager.hh"
0047 #include "G4PVPlacement.hh"
0048 #include "G4SDManager.hh"
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4ThreeVector.hh"
0051 #include "G4VPhysicalVolume.hh"
0052 #include "G4VisAttributes.hh"
0053 #include "globals.hh"
0054 
0055 // fast simulation
0056 #include "GFlashHitMaker.hh"
0057 #include "GFlashHomoShowerParameterisation.hh"
0058 #include "GFlashParticleBounds.hh"
0059 #include "GFlashShowerModel.hh"
0060 
0061 #include "G4FastSimulationManager.hh"
0062 
0063 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0064 
0065 ExGflash1DetectorConstruction::ExGflash1DetectorConstruction()
0066 {
0067   G4cout << "ExGflash1DetectorConstruction::Detector constructor" << G4endl;
0068 }
0069 
0070 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0071 
0072 ExGflash1DetectorConstruction::~ExGflash1DetectorConstruction()
0073 {
0074   delete fFastShowerModel;
0075   delete fParameterisation;
0076   delete fParticleBounds;
0077   delete fHitMaker;
0078 }
0079 
0080 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0081 
0082 G4VPhysicalVolume* ExGflash1DetectorConstruction::Construct()
0083 {
0084   //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
0085   G4cout << "Defining the materials" << G4endl;
0086   // Get nist material manager
0087   G4NistManager* nistManager = G4NistManager::Instance();
0088   // Build materials
0089   G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0090   G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
0091 
0092   /*******************************
0093    * The Experimental Hall       *
0094    *******************************/
0095   G4double experimentalHall_x = 1000. * cm;
0096   G4double experimentalHall_y = 1000. * cm;
0097   G4double experimentalHall_z = 1000. * cm;
0098 
0099   G4VSolid* experimentalHall_box = new G4Box("expHall_box",  // World Volume
0100                                              experimentalHall_x,  // x size
0101                                              experimentalHall_y,  // y size
0102                                              experimentalHall_z);  // z size
0103 
0104   auto experimentalHallLog = new G4LogicalVolume(experimentalHall_box, air, "expHallLog",
0105                                                  nullptr,  // opt: fieldManager
0106                                                  nullptr,  // opt: SensitiveDetector
0107                                                  nullptr);  // opt: UserLimits
0108   G4VPhysicalVolume* experimentalHallPhys =
0109     new G4PVPlacement(nullptr,
0110                       G4ThreeVector(),  // at (0,0,0)
0111                       "expHall", experimentalHallLog, nullptr, false, 0);
0112 
0113   //------------------------------
0114   // Calorimeter segments
0115   //------------------------------
0116   // Simplified `CMS-like` PbWO4 crystal calorimeter
0117 
0118   G4int nbOfCrystals = 10;  // this are the crystals PER ROW in this example
0119                             // cube of 10 x 10 crystals
0120                             // don't change it @the moment, since
0121                             // the readout in event action assumes this
0122                             // dimensions and is not automatically adapted
0123                             // in this version of the example :-(
0124   // Simplified `CMS-like` PbWO4 crystal calorimeter
0125   G4double calo_xside = 31 * cm;
0126   G4double calo_yside = 31 * cm;
0127   G4double calo_zside = 24 * cm;
0128 
0129   G4double crystalWidth = 3 * cm;
0130   G4double crystalLength = 24 * cm;
0131 
0132   calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm;
0133   calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm;
0134   calo_zside = crystalLength;
0135 
0136   auto calo_box = new G4Box("CMS calorimeter",  // its name
0137                             calo_xside / 2.,  // size
0138                             calo_yside / 2., calo_zside / 2.);
0139   auto caloLog = new G4LogicalVolume(calo_box,  // its solid
0140                                      air,  // its material
0141                                      "calo log",  // its name
0142                                      nullptr,  // opt: fieldManager
0143                                      nullptr,  // opt: SensitiveDetector
0144                                      nullptr);  // opt: UserLimit
0145 
0146   G4double xpos = 0.0;
0147   G4double ypos = 0.0;
0148   G4double zpos = 100.0 * cm;
0149   new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), caloLog, "calorimeter",
0150                     experimentalHallLog, false, 1);
0151 
0152   // Crystals
0153   G4VSolid* crystal_box = new G4Box("Crystal",  // its name
0154                                     crystalWidth / 2, crystalWidth / 2, crystalLength / 2);
0155   // size
0156   fCrystalLog = new G4LogicalVolume(crystal_box,  // its solid
0157                                     pbWO4,  // its material
0158                                     "CrystalLog");  // its name
0159 
0160   for (G4int i = 0; i < nbOfCrystals; i++) {
0161     for (G4int j = 0; j < nbOfCrystals; j++) {
0162       G4int n = i * 10 + j;
0163       G4ThreeVector crystalPos((i * crystalWidth) - 135, (j * crystalWidth) - 135, 0);
0164       fCrystalPhys[n] = new G4PVPlacement(nullptr,  // no rotation
0165                                           crystalPos,  // translation
0166                                           fCrystalLog,
0167                                           "crystal",  // its name
0168                                           caloLog, false, i);
0169     }
0170   }
0171   G4cout << "There are " << nbOfCrystals << " crystals per row in the calorimeter, so in total "
0172          << nbOfCrystals * nbOfCrystals << " crystals" << G4endl;
0173   G4cout << "They have width of  " << crystalWidth / cm << "  cm and a length of  "
0174          << crystalLength / cm << " cm. The Material is " << pbWO4 << G4endl;
0175 
0176   experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
0177   auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0178   auto crystalVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0));
0179   caloLog->SetVisAttributes(caloVisAtt);
0180   fCrystalLog->SetVisAttributes(crystalVisAtt);
0181 
0182   // define the fParameterisation region
0183   fRegion = new G4Region("crystals");
0184   caloLog->SetRegion(fRegion);
0185   fRegion->AddRootLogicalVolume(caloLog);
0186 
0187   return experimentalHallPhys;
0188 }
0189 
0190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0191 
0192 void ExGflash1DetectorConstruction::ConstructSDandField()
0193 {
0194   // -- sensitive detectors:
0195   G4SDManager* SDman = G4SDManager::GetSDMpointer();
0196   auto CaloSD = new ExGflash1SensitiveDetector("Calorimeter", this);
0197   SDman->AddNewDetector(CaloSD);
0198   fCrystalLog->SetSensitiveDetector(CaloSD);
0199 
0200   // Get nist material manager
0201   G4NistManager* nistManager = G4NistManager::Instance();
0202   G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
0203   // -- fast simulation models:
0204   // **********************************************
0205   // * Initializing shower modell
0206   // ***********************************************
0207   G4cout << "Creating shower parameterization models" << G4endl;
0208   fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
0209   fParameterisation = new GFlashHomoShowerParameterisation(pbWO4);
0210   fFastShowerModel->SetParameterisation(*fParameterisation);
0211   // Energy Cuts to kill particles:
0212   fParticleBounds = new GFlashParticleBounds();
0213   fFastShowerModel->SetParticleBounds(*fParticleBounds);
0214   // Makes the EnergieSpots
0215   fHitMaker = new GFlashHitMaker();
0216   fFastShowerModel->SetHitMaker(*fHitMaker);
0217   G4cout << "end shower parameterization." << G4endl;
0218   // **********************************************
0219 }
0220 
0221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......