|
|
Go to the documentation of this file.
11 #include "G4LogicalVolume.hh"
12 #include "G4Material.hh"
13 #include "G4PVPlacement.hh"
14 #include "G4ReflectionFactory.hh"
15 #include "G4VPhysicalVolume.hh"
16 #include "G4VSolid.hh"
18 #include "G4SystemOfUnits.hh"
19 #include "G4UnitsTable.hh"
33 LogDebug(
"SimG4CoreGeometry") <<
"DDG4Builder::convertLV(): DDLogicalPart = " <<
part <<
"\n";
38 result =
new G4LogicalVolume(g4s, g4m,
part.name().name());
42 LogDebug(
"SimG4CoreGeometry") <<
"DDG4Builder::convertLV(): new G4LogicalVolume " <<
part.name().name()
43 <<
"\nDDG4Builder: newEvent: dd=" <<
part.ddname() <<
" g4=" <<
result->GetName()
60 LogDebug(
"SimG4CoreGeometry") <<
"DDDetConstr::ConvertMaterial: material=" << material <<
"\n";
61 G4Material *
result =
nullptr;
65 LogDebug(
"SimG4CoreGeometry") <<
" is already converted"
72 <<
" is not valid (in the DDD sense!)";
74 " material is not valid from the Detector Description: " + material.
toString());
79 LogDebug(
"SimG4CoreGeometry") <<
" creating a G4-composite material. c=" <<
c
80 <<
" d=" << material.
density() /
g * mole <<
"\n";
82 for (
int i = 0;
i <
c; ++
i) {
84 LogDebug(
"SimG4CoreGeometry") <<
" adding the composite=" << material.
name()
91 LogDebug(
"SimG4CoreGeometry") <<
" building an elementary material"
92 <<
" z=" << material.
z() <<
" a=" << material.
a() /
g * mole
93 <<
" d=" << material.
density() /
g * cm3 <<
"\n";
101 G4ReflectionFactory *refFact = G4ReflectionFactory::Instance();
102 refFact->SetScalePrecision(100. * refFact->GetScalePrecision());
111 for (; git != gend; ++git) {
114 edm::LogError(
"SimG4CoreGeometry") <<
"DDG4Builder::BuildGeometry() has encountered an undefined "
115 "DDLogicalPart named "
118 " DDG4Builder::BuildGeometry() has encountered an "
119 "undefined DDLogicalPart named " +
126 Graph::edge_list::const_iterator cit = git->begin();
127 Graph::edge_list::const_iterator cend = git->end();
128 for (; cit != cend; ++cit) {
132 std::string err =
" DDG4Builder::BuildGeometry() in processing \"children\" has ";
133 err +=
"encountered an undefined DDLogicalPart named " + ddcurLP.
toString() +
" is a child of " +
142 rm.GetComponents(
x,
y,
z);
143 if ((
x.Cross(
y)).Dot(
z) < 0)
145 <<
"DDG4Builder: Reflection: " << gra.edgeData(cit->second)->ddrot()
146 <<
">>Placement d=" << gra.nodeData(cit->first).ddname() <<
" m=" << ddLP.
ddname()
147 <<
" cp=" << gra.edgeData(cit->second)->copyno() <<
" r=" << gra.edgeData(cit->second)->ddrot().ddname();
148 G4ThreeVector tempTran(gra.edgeData(cit->second)->trans().X(),
149 gra.edgeData(cit->second)->trans().Y(),
150 gra.edgeData(cit->second)->trans().Z());
151 G4Translate3D transl = tempTran;
152 CLHEP::HepRep3x3
temp(
x.X(),
x.Y(),
x.Z(),
y.X(),
y.Y(),
y.Z(),
z.X(),
z.Y(),
z.Z());
153 CLHEP::HepRotation hr(
temp);
156 G4Transform3D trfrm = transl * G4Rotate3D(hr.inverse());
158 refFact->Place(trfrm,
159 gra.nodeData(cit->first).name().name(),
163 gra.edgeData(cit->second)->copyno() +
offset +
tag,
171 std::map<DDLogicalPart, G4LogicalVolume *>::const_iterator ddg4_it =
logs_.begin();
172 for (; ddg4_it !=
logs_.end(); ++ddg4_it) {
173 G4LogicalVolume *reflLogicalVolume = refFact->GetReflectedLV(ddg4_it->second);
174 if (reflLogicalVolume) {
180 <<
"DDG4Builder: dd=" << ddlv.
ddname() <<
" g4=" << reflLogicalVolume->GetName();
197 std::vector<const DDsvalues_type *>
result =
part.specifics();
198 bool foundIt =
false;
199 for (
auto stype :
result) {
205 std::vector<double>
temp =
val.doubles();
206 if (
temp.size() != 1) {
207 edm::LogError(
"SimG4CoreGeometry") <<
" DDG4Builder - ERROR: I need only 1 " <<
ss;
209 " DDG4Builder::getInt() Problem with Region tags - "
210 "one and only one allowed: " +
220 std::vector<const DDsvalues_type *>
result =
part.specifics();
221 bool foundIt =
false;
222 for (
auto stype :
result) {
228 std::vector<std::string>
temp =
val.strings();
229 if (
temp.size() != 1) {
230 edm::LogError(
"SimG4CoreGeometry") <<
" DDG4Builder - ERROR: I need only 1 " <<
ss;
232 " DDG4Builder::getDouble() Problem with Region tags "
233 "- one and only one allowed: " +
238 std::istringstream is(
temp[0]);
240 v =
v * G4UnitDefinition::GetValueOf(
unit.substr(1,
unit.size()));
int getInt(const std::string &s, const DDLogicalPart &dLogical)
std::map< DDLogicalPart, G4LogicalVolume * > logs_
double getDouble(const std::string &s, const DDLogicalPart &dLogical)
G4LogicalVolume * convertLV(const DDLogicalPart &dLogical)
std::vector< DDG4Dispatchable * > DDG4DispContainer
DDG4DispContainer * theVectorOfDDG4Dispatchables_
static HepMC::IO_HEPEVT conv
def_type isDefined() const
double density() const
returns the density
double z() const
retruns the atomic number
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
G4LogicalVolumeToDDLogicalPartMap & map_
const DDCompactView * compactView_
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
void insert(const KeyType &, const ValueType &)
insert a new key-value-pair
DDMaterial is used to define and access material information.
G4LogicalVolume * BuildGeometry(SensitiveDetectorCatalog &)
const Graph & graph() const
Provides read-only access to the data structure of the compact-view.
std::string toString() const
Graph::const_adj_iterator adjl_iterator
Compact representation of the geometrical detector hierarchy.
std::map< DDSolid, G4VSolid * > sols_
double a() const
returns the atomic mass
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
DDG4Builder(const DDCompactView *, G4LogicalVolumeToDDLogicalPartMap &, bool check)
math::Graph< DDLogicalPart, DDPosData * > Graph
DDG4SolidConverter * solidConverter_
G4Material * convertMaterial(const DDMaterial &dMaterial)
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
std::map< DDMaterial, G4Material * > mats_
const std::string & name() const
Returns the name.
Basic3DVector unit() const
const DDLogicalPart & root() const
returns the DDLogicalPart representing the root of the geometrical hierarchy
G4VSolid * convertSolid(const DDSolid &dSolid)
G4VSolid * convert(const DDSolid &)
std::vector< double >::size_type index_type
A DDSolid represents the shape of a part.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
adj_list::const_iterator const_adj_iterator