Message: Re: Seg Fault when trying to fill HitsCollection Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Seg Fault when trying to fill HitsCollection 

Forum: Hits, Digitization and Pileup
Re: None Seg Fault when trying to fill HitsCollection (Tony Price)
Re: None Re: Seg Fault when trying to fill HitsCollection (Tsukasa Aso)
Re: None Re: Seg Fault when trying to fill HitsCollection (Tony Price)
Re: None Re: Seg Fault when trying to fill HitsCollection (Tony Price)
Date: 19 Apr, 2013
From: Tsukasa Aso <Tsukasa Aso>

Hi,

  We usually does not edit your code or run your application, because it will be very hard
to do so for all of users. 

  Anyway, I understand that your trouble occurs when you did:
     hisCollection->insert(newHit);
     /det/update

 So, the problem will be in the DetectorConstruction class, and 
specially relevant to the sequence of UpdateGeometry().

  My suggestions are:

 1) DetectorConstruction::UpdateGeometry() 

     remove the line:
    G4RunManager::GetRunManager()->GeometryHasBeenModified();     

    * You do not need this line, because you are creating a new world volume in
     the next line, i.e.    G4RunManager::GetRunManager()->DefineWorldVolume(Construct());
   *  This is not concern to your trouble. Just, the line in your code is redundant.

2)  DetectorConstruction::Constuct()

   Modify like following lines where you are attaching a SensitiveDetector.

  // Set sensitive layers                                                                                                                                      
  SDman = G4SDManager::GetSDMpointer();
  absorber_sd = dynamic_cast<DetectorSD*>(SDman->FindSensitiveDetector("absorber_sd",false));
  if ( !absorber_sd ) {
    absorber_sd = new DetectorSD("absorber_sd");
    SDman->AddNewDetector(absorber_sd);
  }
  absorber_log->SetSensitiveDetector(absorber_sd);
 

  * When the whole geometry (i.e. A World volume and subsequent volumes )  are
re-constructed by G4RunManager::GetRunManager()->DefineWorldVolume(Construct());,
 all of the "previous" geometries are destroyed and clean-up. 
 However, the SensitiveDetector is still and not clean-up. Therefore, you should check its
existence and reuse it in "new" geometry too. The above code is doing this.
 * I think your trouble is caused by duplicating SDs.

Best regards,
Tsukasa Aso

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

1 None: Re: Seg Fault when trying to fill HitsCollection   (Tony Price - 22 Apr, 2013)
 Add Message Add Message
to: "Re: Seg Fault when trying to fill HitsCollection"

 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 ]