11 #include "G4Transform3D.hh"
12 #include "G4PVPlacement.hh"
13 #include "G4SDManager.hh"
14 #include "G4UserLimits.hh"
15 #include <G4VisAttributes.hh>
18 #include <ecl/geometry/GeoECLCreator.h>
19 #include <ecl/geometry/shapes.h>
20 #include <ecl/simulation/SensitiveDetector.h>
21 #include <geometry/CreatorFactory.h>
22 #include <geometry/Materials.h>
23 #include <framework/gearbox/GearDir.h>
24 #include "ecl/dbobjects/ECLCrystalsShapeAndPosition.h"
25 #include <framework/database/IntervalOfValidity.h>
26 #include <framework/database/Database.h>
27 #include <framework/database/DBObjPtr.h>
28 #include <framework/logging/Logger.h>
49 G4SDManager::GetSDMpointer()->AddNewDetector(
m_sensitive);
56 for (
auto a :
m_atts)
delete a.second;
62 G4SDManager::GetSDMpointer()->AddNewDetector(
m_sensediode);
65 if (!crystals.
isValid()) B2FATAL(
"No crystal's data in the database.");
82 G4SDManager::GetSDMpointer()->AddNewDetector(
m_sensediode);
94 std::string prefix(
"sv_"); prefix += endcap; prefix +=
"_wrap";
97 std::string name(
"lv_"); name += endcap +
"_wrap_" + std::to_string(s->nshape);
98 G4Material* wrap = NULL;
99 if (wrapthickness < 0.170)
101 else if (wrapthickness < 0.200)
105 G4LogicalVolume* wrapped_logical =
new G4LogicalVolume(
wrapped_crystal, wrap, name.c_str(), 0, 0, 0);
106 wrapped_logical->SetVisAttributes(
att(
"wrap"));
108 prefix =
"sv_"; prefix += endcap; prefix +=
"_crystal";
110 G4VSolid* crystal_solid = s->get_solid(prefix, 0, tc);
111 name =
"lv_" + endcap +
"_crystal_" + std::to_string(s->nshape);
112 G4LogicalVolume* crystal_logical =
new G4LogicalVolume(crystal_solid,
Materials::get(
"G4_CESIUM_IODIDE"), name.c_str(),
114 crystal_logical->SetVisAttributes(
att(
"cryst"));
115 crystal_logical->SetSensitiveDetector(
m_sensitive);
117 new G4PVPlacement(NULL, G4ThreeVector(), crystal_logical, name.c_str(), wrapped_logical,
false, 0, 0);
118 return wrapped_logical;
123 m_atts[
"wrap"] =
new G4VisAttributes(G4Colour(0.5, 0.5, 1.0));
124 m_atts[
"cryst"] =
new G4VisAttributes(G4Colour(0.7, 0.7, 1.0));
126 m_atts[
"iron"] =
new G4VisAttributes(G4Colour(1., 0.1, 0.1));
127 m_atts[
"iron2"] =
new G4VisAttributes(G4Colour(1., 0.5, 0.5));
128 m_atts[
"alum"] =
new G4VisAttributes(G4Colour(0.25, 0.25, 1.0, 0.5));
129 m_atts[
"alum2"] =
new G4VisAttributes(G4Colour(0.5, 0.5, 1.0));
130 m_atts[
"silv"] =
new G4VisAttributes(G4Colour(0.9, 0., 0.9));
131 m_atts[
"air"] =
new G4VisAttributes(G4Colour(1., 1., 1.));
m_atts[
"air"]->SetVisibility(
false);
132 m_atts[
"preamp"] =
new G4VisAttributes(G4Colour(0.1, 0.1, 0.8));
133 m_atts[
"plate"] =
new G4VisAttributes(G4Colour(0.2, 0.8, 0.2));
134 m_atts[
"connector"] =
new G4VisAttributes(G4Colour(0.1, 0.1, 0.1));
135 m_atts[
"capacitor"] =
new G4VisAttributes(G4Colour(0.1, 0.1, 0.8));
136 m_atts[
"holder"] =
new G4VisAttributes(G4Colour(0.4, 0.8, 0.8));
142 assert(p !=
m_atts.end());
146 G4LogicalVolume* GeoECLCreator::get_preamp()
const
148 static G4LogicalVolume* lv_preamplifier = NULL;
149 if (lv_preamplifier == NULL) {
150 G4VSolid* sv_preamplifier =
new G4Box(
"sv_preamplifier", 58. / 2, 51. / 2, get_pa_box_height() / 2);
151 lv_preamplifier =
new G4LogicalVolume(sv_preamplifier,
Materials::get(
"A5052"),
"lv_preamplifier", 0, 0, 0);
152 G4VSolid* sv_diode =
new G4Box(
"sv_diode", 20. / 2, 20. / 2, 0.3 / 2);
153 G4LogicalVolume* lv_diode =
new G4LogicalVolume(sv_diode,
Materials::get(
"G4_Si"),
"lv_diode", 0, 0, 0);
154 lv_diode->SetUserLimits(
new G4UserLimits(0.01));
156 new G4PVPlacement(G4TranslateZ3D(-get_pa_box_height() / 2 + 0.3 / 2), lv_diode,
"pv_diode", lv_preamplifier,
false, 0,
m_overlap);
164 lv_preamplifier->SetVisAttributes(
att(
"preamp"));
166 return lv_preamplifier;