68{
69
71
72
73 auto ghostLogicalVolume = GetWorld()->GetLogicalVolume();
74
75
76
77 G4int nbOfCrystals = 10;
78
79
80
81
82
83
84 G4double calo_xside = 31 * cm;
85 G4double calo_yside = 31 * cm;
86 G4double calo_zside = 24 * cm;
87
88 G4double crystalWidth = 3 * cm;
89 G4double crystalLength = 24 * cm;
90
91 calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm;
92 calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm;
93 calo_zside = crystalLength;
94
95 auto calo_box =
new G4Box(
"CMS calorimeter",
96 calo_xside / 2.,
97 calo_yside / 2., calo_zside / 2.);
99 dummy,
100 "calo log",
101 nullptr,
102 nullptr,
103 nullptr);
104
105 G4double xpos = 0.0;
106 G4double ypos = 0.0;
107 G4double zpos = 100.0 * cm;
108 new G4PVPlacement(
nullptr, G4ThreeVector(xpos, ypos, zpos), caloLog,
"calorimeter",
109 ghostLogicalVolume, false, 1);
110
111
113 crystalWidth / 2, crystalWidth / 2, crystalLength / 2);
114
116 dummy,
117 "CrystalLog");
118
119 for (G4int i = 0; i < nbOfCrystals; i++) {
120 for (G4int j = 0; j < nbOfCrystals; j++) {
121 G4int n = i * 10 + j;
122 G4ThreeVector crystalPos((i * crystalWidth) - 135, (j * crystalWidth) - 135, 0);
124 crystalPos,
126 "crystal",
127 caloLog, false, i);
128 }
129 }
130 G4cout << "There are " << nbOfCrystals << " crystals per row in the calorimeter, so in total "
131 << nbOfCrystals * nbOfCrystals << " crystals" << G4endl;
132 G4cout << "They have width of " << crystalWidth / cm << " cm and a length of "
133 << crystalLength / cm << " cm. " << G4endl;
134
137 caloLog->SetVisAttributes(caloVisAtt);
139}
G4LogicalVolume * fCrystalLog
G4VPhysicalVolume * fCrystalPhys[100]