Hello, I’ve to import an old simulation in a new one. In the old simulation, all the geometry was implemented in the DetectorConstruction, this is the old DetectorConstruction.
myDetectorConstruction.hh (9.6 KB)
myDetectorConstruction.cc (152.6 KB)
According to the phylosophy of the new one, the full geometry must NOT be implemented in the detector construction. Then I splitted the Detector construction of the old simulation in two files, one for detectors, one for targets and I call the function of the two files in the detector construction.
The simulation compiles without errors, but when I run it I get a segmentation fault error then the simulation crashes. This is the gdb output
gdb output.txt (8.2 KB)
I commented, in the Clusterspddresda.cc, the full
void Clusterspddresda::TripleClusterGeometry(G4int nbCluster, G4Transform3D positionTripleCluster, G4bool shieldingOption = 0)
except the lines
G4GDMLParser parser3;
G4RotationMatrix rotationTripleCluster = G4RotationMatrix();
rotationTripleCluster.rotateY(-180.*deg);
//MB1 and MB2 different geometry and crystal ordering
if (strcmp("MB1", nameCluster[nbCluster]) == 0) {
rotationTripleCluster.rotateZ(-30.*deg);
//parser3.Read("gdml/TripleCluster/TripleClusterMB1.gdml",false);
parser3.Read(Mb1fileName,false);
}
else if (strcmp("MB2", nameCluster[nbCluster]) == 0) {
rotationTripleCluster.rotateZ(30.*deg);
//parser3.Read("gdml/TripleCluster/TripleClusterMB2.gdml",false);
parser3.Read(Mb2fileName,false);
}
and I got segmentation fault error.
Then I commented the full void Clusterspddresda::SeptupleClusterHousing(G4int nbCluster, G4Transform3D positionSeptupleCluster, G4bool shieldingOption = 0){
except the lines for importing the gdml files and the simulation crashes
@@@ G4ParticleHPInelastic instantiated for particle He3 data directory variable is G4HE3HPDATA pointing to GEANT4/geant4-v11.0.0-install/share/Geant4-11.0.0/data/G4TENDL1.4/He3/Inelastic
Killed
Then it looked like to me that the problem is in the gdml files that I got from the old simulation. But my collegue (the developer of the new simulation that I’m currently using and modifying) thinks the problem is problem here with the arrays in the TripleClusterGeometry function
in Clusterspddresda.cc:
if(CompName.contains("Crystal"))
{
TripleClusterComp_physical[i]->GetLogicalVolume()->SetVisAttributes(vacVisAtt);
for(G4int nbCrystal=0; nbCrystal<NbOfCrystals[nbCluster]; nbCrystal++)
{
if(CompName.contains(G4UIcommand::ConvertToString(nbCrystal+1)))
{
TripleClusterCrystal_physical[nbCluster][nbCrystal] = TripleClusterComp_physical[i];
TripleClusterCrystal_logical[nbCluster][nbCrystal] = TripleClusterCrystal_physical[nbCluster][nbCrystal]->GetLogicalVol\
ume();
CrystalwDeadLayersGeometry(nbCluster, nbCrystal, TripleClusterCrystal_physical[nbCluster][nbCrystal], dDeadLayerCap[nbC\
luster][nbCrystal], hDeadLayerCone[nbCluster][nbCrystal]);
}
}
But I don’t understand what should be the problem, even because I copied this piece of code from the old simulation (and I guess the old simulation worked, even if I never used it). Anyway, looking the code values of nbCluster
is declared but I don’t read its value (or at least I don’t see where it is assigned).
Here the Clusterspddresda , the DetectorConstruction and the gdml files
gdml files WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free
Clusterspddresda.hh (7.8 KB)
Clusterspddresda.cc (96.6 KB)
DetectorConstruction.cc (3.8 KB)
DetectorConstruction.hh (1.5 KB)