ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExGflash3ParallelWorld.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ExGflash3ParallelWorld.cc
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 
27 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29 
30 // User Classes
33 
34 // G4 Classes
35 #include "G4NistManager.hh"
36 #include "G4Material.hh"
37 #include "G4ThreeVector.hh"
38 #include "G4PVPlacement.hh"
39 #include "G4VPhysicalVolume.hh"
40 #include "G4LogicalVolume.hh"
41 #include "G4Box.hh"
42 #include "G4SDManager.hh"
43 #include "G4VisAttributes.hh"
44 #include "G4Colour.hh"
45 #include "G4SystemOfUnits.hh"
46 #include "G4AutoDelete.hh"
47 #include "globals.hh"
48 
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53  :G4VUserParallelWorld(aWorldName), fCrystalLog(nullptr), fCrystalPhys{}
54 {
55  G4cout<<"ExGflash3ParallelWorld::Parralel world constructor"<<G4endl;
56 }
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65 {
66  // In parallel world material does not matter
67  G4Material* dummy = nullptr;
68 
69  // Build parallel/ghost geometry:
70  auto ghostLogicalVolume = GetWorld()->GetLogicalVolume();
71 
72  // Use part of the Ex1GflashDetectorConstruction (without individual crystals)
73 
74  G4int nbOfCrystals = 10; // this are the crystals PER ROW in this example
75  // cube of 10 x 10 crystals
76  // don't change it @the moment, since
77  // the readout in event action assumes this
78  // dimensions and is not automatically adapted
79  // in this version of the example :-(
80  // Simplified `CMS-like` PbWO4 crystal calorimeter
81  G4double calo_xside = 31*cm;
82  G4double calo_yside = 31*cm;
83  G4double calo_zside = 24*cm;
84 
85  G4double crystalWidth = 3*cm;
86  G4double crystalLength = 24*cm;
87 
88  calo_xside = (crystalWidth*nbOfCrystals)+1*cm;
89  calo_yside = (crystalWidth*nbOfCrystals)+1*cm;
90  calo_zside = crystalLength;
91 
92  G4Box* calo_box= new G4Box("CMS calorimeter", // its name
93  calo_xside/2., // size
94  calo_yside/2.,
95  calo_zside/2.);
96  G4LogicalVolume* caloLog
97  = new G4LogicalVolume(calo_box, // its solid
98  dummy, // its material
99  "calo log", // its name
100  0, // opt: fieldManager
101  0, // opt: SensitiveDetector
102  0); // opt: UserLimit
103 
104  G4double xpos = 0.0;
105  G4double ypos = 0.0;
106  G4double zpos = 100.0*cm;
107  new G4PVPlacement(0,
108  G4ThreeVector(xpos, ypos, zpos),
109  caloLog,
110  "calorimeter",
111  ghostLogicalVolume,
112  false,
113  1);
114 
115  // Crystals
116  G4VSolid* crystal_box
117  = new G4Box("Crystal", // its name
118  crystalWidth/2,
119  crystalWidth/2,
120  crystalLength/2);
121  // size
122  fCrystalLog
123  = new G4LogicalVolume(crystal_box, // its solid
124  dummy, // its material
125  "CrystalLog"); // its name
126 
127  for (G4int i=0; i<nbOfCrystals; i++)
128  {
129 
130  for (G4int j=0; j<nbOfCrystals; j++)
131  {
132  G4int n = i*10+j;
133  G4ThreeVector crystalPos((i*crystalWidth)-135,
134  (j*crystalWidth)-135,0 );
135  fCrystalPhys[n]
136  = new G4PVPlacement(0, // no rotation
137  crystalPos, // translation
138  fCrystalLog,
139  "crystal", // its name
140  caloLog,
141  false,
142  i);
143  }
144  }
145  G4cout << "There are " << nbOfCrystals <<
146  " crystals per row in the calorimeter, so in total "<<
147  nbOfCrystals*nbOfCrystals << " crystals" << G4endl;
148  G4cout << "They have width of " << crystalWidth /cm <<
149  " cm and a length of " << crystalLength /cm
150  <<" cm. " << G4endl;
151 
152 
153  G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
154  G4VisAttributes* crystalVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
155  caloLog->SetVisAttributes(caloVisAtt);
156  fCrystalLog->SetVisAttributes(crystalVisAtt);
157 
158 }
159 
160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
161 
163 {
164  // -- sensitive detectors:
167  = new ExGflash3SensitiveDetector("Calorimeter",this);
168  SDman->AddNewDetector(CaloSD);
170 }
171 
172 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......