6 #include <phparameter/PHParameters.h>
21 #include <Geant4/G4AssemblyVolume.hh>
22 #include <Geant4/G4Color.hh>
23 #include <Geant4/G4GDMLParser.hh>
24 #include <Geant4/G4GDMLReadStructure.hh>
25 #include <Geant4/G4LogicalVolume.hh>
26 #include <Geant4/G4LogicalVolumeStore.hh>
27 #include <Geant4/G4Material.hh>
28 #include <Geant4/G4PVPlacement.hh>
29 #include <Geant4/G4SolidStore.hh>
30 #include <Geant4/G4SystemOfUnits.hh>
31 #include <Geant4/G4VisAttributes.hh>
33 #include <boost/algorithm/string.hpp>
34 #include <boost/lexical_cast.hpp>
49 const std::string &dnam)
52 , m_Params(parameters)
53 , m_GDMPath(parameters->get_string_param(
"GDMPath"))
54 , m_Active(m_Params->get_int_param(
"active"))
55 , m_AbsorberActive(parameters->get_int_param(
"absorberactive"))
99 G4AssemblyVolume *avol =
reader->GetAssembly(*its);
102 cout << *its <<
"not found" << endl;
105 G4RotationMatrix *rotm =
new G4RotationMatrix();
112 avol->MakeImprint(logicWorld, g4vec, rotm, 0,
OverlapCheck());
114 vector<G4VPhysicalVolume *>::iterator
it = avol->GetVolumesIterator();
115 for (
unsigned int i = 0; i < avol->TotalImprintedVolumes(); i++)
121 for (set<string>::const_iterator its = mysubsys->
logvol_iters().first; its != mysubsys->
logvol_iters().second; ++its)
123 G4LogicalVolume *vol =
reader->GetVolume(*its);
126 cout << *its <<
"not found" << endl;
130 G4RotationMatrix *rotm =
new G4RotationMatrix();
137 G4VPhysicalVolume *phys =
new G4PVPlacement(rotm, g4vec,
149 static int detid = -9999;
163 if (physvol->GetName().find(
"av_") != string::npos && physvol->GetName().find(
"_impr_") != string::npos)
166 std::vector<std::string> splitname;
167 boost::algorithm::split(splitname, physvol->GetName(), boost::is_any_of(
"_"));
168 if (splitname[4].find(
"AluStrips") != string::npos)
174 string detprefix[] = {
"VstStave",
"FstContainerVolume",
"BstContainerVolume",
"Beampipe"};
180 for (
auto toerase : detprefix)
182 size_t pos = splitname[4].find(toerase);
183 if (pos != string::npos)
185 detid = boost::lexical_cast<
int>(splitname[4].erase(pos, toerase.length())) + increase;
194 cout <<
"AllSiliconTrackerDetector::InsertVolumes detid is " << detid <<
" vol name " << physvol->GetName() << endl;
202 G4LogicalVolume *logvol = physvol->GetLogicalVolume();
206 if (physvol->GetName().find(
"MimosaCore") != string::npos)
219 for (
int i = 0; i < (int) logvol->GetNoDaughters(); ++i)
221 G4VPhysicalVolume *physvol = logvol->GetDaughter(i);
231 cout <<
"AllSiliconTracker Detector:" << endl;
232 if (what ==
"ALL" || what ==
"VOLUME")
234 cout <<
"Version 0.1" << endl;
235 cout <<
"Parameters:" << endl;
247 else if (whichactive < 0)
253 cout <<
"AllSiliconTrackerDetector::get_detid invalid whichactive flag = 0" << endl;
266 map<string, int> nodes;
285 DetidSet.insert(iter->second);
287 ostringstream g4hitnodeactive;
288 for (
auto iter = DetidSet.begin(); iter != DetidSet.end(); ++iter)
290 g4hitnodeactive.str(
"");
294 region =
"_CENTRAL_";
298 region =
"_FORWARD_";
302 region =
"_BACKWARD_";
304 g4hitnodeactive <<
"G4HIT_" << myname << region << *iter;
305 nodes.insert(make_pair(g4hitnodeactive.str(), *iter));
309 string g4hitnodename =
"G4HIT_ABSORBER_" + myname;
310 nodes.insert(make_pair(g4hitnodename, -1));
312 for (
auto nodename : nodes)
314 PHG4HitContainer *g4_hits = findNode::getClass<PHG4HitContainer>(DetNode, nodename.first);
333 cout <<
"bad index: " << i << endl;