Message: Segmentation fault with 12 towers, but works with 11 towers Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Segmentation fault with 12 towers, but works with 11 towers 

Forum: Event and Track Management
Date: 25 Jul, 2018
From: Maria <Maria>


I want to create a box of 12 by 12 towers for em calorimeter. I have created the gaps and absorbers and made them sensitive detectors and put them in layers and then copied the layer along z axis. When I have 11 by 11 towers, everything is working, but as soon as I have more than 11 it gives me segmentation fault. Any ideas? Here is my code:

G4double emcell=5.0*cm;
  G4double absoThickness = 1.5*mm;
  G4double gapThickness =  4.*mm;
    G4double worldSizeXY = 5.0*(5.0* calorSizeXY);
  G4double worldSizeZ  = 5.0 *( 4*calorThickness2+calorThickness);
G4double layerThickness = absoThickness + gapThickness;
G4int num_of_towers=12;

G4LogicalVolume* calorEM[13][13];
G4int copynono=0;
for(int i=0;i<num_of_towers;i++){
        for(int j=0;j<num_of_towers;j++){
        //      sprintf(bu2,"calorem%d%d",i,j);

                  G4VSolid* calorimeterEM
    = new G4Box("CalorimeterEM",     // its name
                 emcell/2, emcell/2, calorThickness/2);
calorEM[i][j] = new G4LogicalVolume(calorimeterEM,defaultMaterial,bu);
        new G4PVPlacement(0,G4ThreeVector(-27.5*cm+i*5.*cm,27.5*cm-j*5.*cm,0.),calorEM[i][j],bu,worldLV,false,copynono,fCheckOverlaps);


G4LogicalVolume* layerEMLV[13][13];
for(int i=0;i<num_of_towers;i++){
        for(int j=0;j<num_of_towers;j++){

                  G4VSolid* layerEM
    = new G4Box("LayerEM",           // its name
                 emcell/2, emcell/2, layerThickness/2); //its size
layerEMLV[i][j]=new G4LogicalVolume(layerEM,defaultMaterial,bu);
new G4PVReplica("LayerEM_",layerEMLV[i][j],calorEM[i][j],kZAxis,nofLayers,layerThickness);



G4LogicalVolume* absorberEMLV[13][13];

for(int i=0;i<num_of_towers;i++){
        for(int j=0;j<num_of_towers;j++){
  G4VSolid* absorberEM
    = new G4Box("AbsoEM",            // its name
                 emcell/2, emcell/2, absoThickness/2); // its size
absorberEMLV[i][j] = new G4LogicalVolume(absorberEM,absorberMaterial,bu);
new G4PVPlacement(0,G4ThreeVector(0.,0.,-gapThickness/2),absorberEMLV[i][j],bu,layerEMLV[i][j],false,i+j,fCheckOverlaps);



G4LogicalVolume* gapEMLV[13][13];

for(int i=0;i<num_of_towers;i++){
        for(int j=0;j<num_of_towers;j++){

  G4VSolid* gapEM
    = new G4Box("GapEM",             // its name
                 emcell/2, emcell/2, gapThickness/2); // its size
gapEMLV[i][j] = new G4LogicalVolume(gapEM,gapMaterial2,bu3);
        new G4PVPlacement(0,G4ThreeVector(0.,0., absoThickness/2),gapEMLV[i][j],bu3,layerEMLV[i][j],false,i+j,fCheckOverlaps);

B4cCalorimeterSD* absoEMSD[13][13];
B4cCalorimeterSD* gapEMSD[13][13];

for(int i=0;i<num_of_towers;i++){
        for(int j=0;j<num_of_towers;j++){
    = new B4cCalorimeterSD(buffer3, buffer2, nofLayers);
  G4SDManager::GetSDMpointer()->AddNewDetector(absoEMSD[i][j] );
    = new B4cCalorimeterSD(buffer5, buffer4, nofLayers);
  G4SDManager::GetSDMpointer()->AddNewDetector(gapEMSD[i][j] );



Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Segmentation fault with 12 towers, but works with 11 towers   (Jonathan Madsen - 25 Jul, 2018)
 Add Message Add Message
to: "Segmentation fault with 12 towers, but works with 11 towers"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]