127 G4GDMLParser
parser(&reader);
134 parser.Read(fullGDMLFileName);
135 G4VPhysicalVolume* World =
parser.GetWorldVolume();
137 std::stringstream ss;
138 ss << World->GetTranslation() <<
"\n\n";
139 ss <<
"Found World: " << World->GetName() <<
"\n";
140 ss <<
"World LV: " << World->GetLogicalVolume()->GetName() <<
"\n";
141 G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
142 ss <<
"Found " << pLVStore->size() <<
" logical volumes." 144 G4PhysicalVolumeStore* pPVStore = G4PhysicalVolumeStore::GetInstance();
145 ss <<
"Found " << pPVStore->size() <<
" physical volumes." 147 G4SDManager* SDman = G4SDManager::GetSDMpointer();
148 const G4GDMLAuxMapType* auxmap =
parser.GetAuxMap();
149 ss <<
"Found " << auxmap->size() <<
" volume(s) with auxiliary information." 151 ss <<
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
152 mf::LogInfo(
"LArG4DetectorService::doBuildLVs") << ss.str();
154 for (
auto const& [
volume, auxes] : *auxmap) {
155 G4cout <<
"Volume " <<
volume->GetName()
156 <<
" has the following list of auxiliary information: \n";
157 for (
auto const& aux : auxes) {
158 G4cout <<
"--> Type: " << aux.type <<
" Value: " << aux.value <<
"\n";
160 G4double
value = atof(aux.value);
161 G4double val_unit = 1;
162 G4String provided_category =
"NONE";
163 if ((aux.unit) && (aux.unit !=
"")) {
164 val_unit = G4UnitDefinition::GetValueOf(aux.unit);
165 provided_category = G4UnitDefinition::GetCategory(aux.unit);
166 mf::LogInfo(
"AuxUnit") <<
" Unit parsed = " << aux.unit
167 <<
" from unit category: " << provided_category.c_str();
172 if (aux.type ==
"StepLimit") {
173 G4UserLimits* fStepLimit =
new G4UserLimits();
174 G4AutoDelete::Register(fStepLimit);
177 G4String steplimit_category =
"Length";
178 if (provided_category == steplimit_category) {
179 mf::LogInfo(
"AuxUnit") <<
"Valid StepLimit unit category obtained: " 180 << provided_category.c_str();
183 fStepLimit->SetMaxAllowedStep(value);
185 <<
"fStepLimit: " << value <<
" " << value /
CLHEP::cm <<
" cm\n";
187 else if (provided_category ==
189 MF_LOG_WARNING(
"StepLimitUnit") <<
"StepLimit in geometry file does not have a unit!" 190 <<
" Defaulting to mm...";
192 fStepLimit->SetMaxAllowedStep(value);
194 <<
"fStepLimit: " << value <<
" " << value /
CLHEP::cm <<
" cm\n";
198 <<
"StepLimit does not have a valid length unit!\n" 199 <<
" Category of unit provided = " << provided_category <<
".\n";
202 volume->SetUserLimits(fStepLimit);
205 <<
"Set stepLimit for volume: " <<
volume->GetName() <<
" from the GDML file.";
208 if (aux.type ==
"SensDet") {
209 if (aux.value ==
"DRCalorimeter") {
210 G4String
name =
volume->GetName() +
"_DRCalorimeter";
211 artg4tk::DRCalorimeterSD* aDRCalorimeterSD =
new artg4tk::DRCalorimeterSD(name);
212 SDman->AddNewDetector(aDRCalorimeterSD);
213 volume->SetSensitiveDetector(aDRCalorimeterSD);
214 std::cout <<
"Attaching sensitive Detector: " << aux.value
215 <<
" to Volume: " <<
volume->GetName() <<
"\n";
218 else if (aux.value ==
"Calorimeter") {
219 G4String name =
volume->GetName() +
"_Calorimeter";
220 artg4tk::CalorimeterSD* aCalorimeterSD =
new artg4tk::CalorimeterSD(name);
221 SDman->AddNewDetector(aCalorimeterSD);
222 volume->SetSensitiveDetector(aCalorimeterSD);
223 std::cout <<
"Attaching sensitive Detector: " << aux.value
224 <<
" to Volume: " <<
volume->GetName() <<
"\n";
227 else if (aux.value ==
"PhotonDetector") {
228 G4String name =
volume->GetName() +
"_PhotonDetector";
229 artg4tk::PhotonSD* aPhotonSD =
new artg4tk::PhotonSD(name);
230 SDman->AddNewDetector(aPhotonSD);
231 volume->SetSensitiveDetector(aPhotonSD);
232 std::cout <<
"Attaching sensitive Detector: " << aux.value
233 <<
" to Volume: " <<
volume->GetName() <<
"\n";
236 else if (aux.value ==
"Tracker") {
237 G4String name =
volume->GetName() +
"_Tracker";
238 artg4tk::TrackerSD* aTrackerSD =
new artg4tk::TrackerSD(name);
239 SDman->AddNewDetector(aTrackerSD);
240 volume->SetSensitiveDetector(aTrackerSD);
241 std::cout <<
"Attaching sensitive Detector: " << aux.value
242 <<
" to Volume: " <<
volume->GetName() <<
"\n";
245 else if (aux.value ==
"SimEnergyDeposit") {
246 G4String name =
volume->GetName() +
"_SimEnergyDeposit";
247 SimEnergyDepositSD* aSimEnergyDepositSD =
new SimEnergyDepositSD(name);
248 SDman->AddNewDetector(aSimEnergyDepositSD);
249 volume->SetSensitiveDetector(aSimEnergyDepositSD);
250 std::cout <<
"Attaching sensitive Detector: " << aux.value
251 <<
" to Volume: " <<
volume->GetName() <<
"\n";
254 else if (aux.value ==
"AuxDet") {
255 G4String name =
volume->GetName() +
"_AuxDet";
256 AuxDetSD* aAuxDetSD =
new AuxDetSD(name);
257 SDman->AddNewDetector(aAuxDetSD);
258 volume->SetSensitiveDetector(aAuxDetSD);
259 std::cout <<
"Attaching sensitive Detector: " << aux.value
260 <<
" to Volume: " <<
volume->GetName() <<
"\n";
263 else if (aux.value ==
"HadInteraction") {
264 G4String name =
volume->GetName() +
"_HadInteraction";
265 artg4tk::HadInteractionSD* aHadInteractionSD =
new artg4tk::HadInteractionSD(name);
268 volume->SetSensitiveDetector(aHadInteractionSD);
269 std::cout <<
"Attaching sensitive Detector: " << aux.value
270 <<
" to Volume: " <<
volume->GetName() <<
"\n";
273 else if (aux.value ==
"HadIntAndEdepTrk") {
274 G4String name =
volume->GetName() +
"_HadIntAndEdepTrk";
275 artg4tk::HadIntAndEdepTrkSD* aHadIntAndEdepTrkSD =
new artg4tk::HadIntAndEdepTrkSD(name);
278 volume->SetSensitiveDetector(aHadIntAndEdepTrkSD);
279 std::cout <<
"Attaching sensitive Detector: " << aux.value
280 <<
" to Volume: " <<
volume->GetName() <<
"\n";
286 <<
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
288 if (
dumpMP_) { G4cout << *(G4Material::GetMaterialTable()) << G4endl; }
290 std::cout <<
"List SD Tree: \n";
292 std::cout <<
" Collection Capacity: " << SDman->GetCollectionCapacity() <<
"\n";
293 G4HCtable* hctable = SDman->GetHCtable();
294 for (G4int j = 0; j < SDman->GetCollectionCapacity(); ++j) {
295 std::cout <<
"HC Name: " << hctable->GetHCname(j) <<
" SD Name: " << hctable->GetSDname(j)
298 std::cout <<
"==================================================\n";
300 std::vector<G4LogicalVolume*> myLVvec;
301 myLVvec.push_back(pLVStore->at(0));
302 std::cout <<
"nr of LV ======================: " << myLVvec.size() <<
"\n";
static constexpr double cm
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
static const std::string volume[nvol]
std::vector< std::pair< std::string, std::string > > detectors_
std::string gdmlFileName_
static constexpr double mm
#define MF_LOG_WARNING(category)
std::unordered_map< std::string, float > setGDMLVolumes_
cet::coded_exception< error, detail::translate > exception