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)
Date: 18 Apr, 2013
From: Tsukasa Aso <Tsukasa Aso>

Hi,

  I think your code is OK. 
  I downloaded those files and attached to N02 example.
  It works.  ( I run it on my MacOSX ).
  
  I think you should try cleaning up your build directory and compile all of them again.
  
The following points are not concern to this problem, I believe.
But for clarifying the code, I suggest following modifications.

1) DetectorSD::Initialize()
    
     G4int HCID = -1;   =>    should be    static G4int HCID = -1;

2) DetectorSD::EndOfEvent()

     Following part of code is not necessary. Because you have already done it at Initialze().
     It is better to remove those lines.

  static G4int HCID = -1;                                                     
  if(HCID < 0)                                                                
    {                                                                         
      HCID = GetCollectionID(0);                                              
    }                                                                         

   HCE -> AddHitsCollection(HCID,hitsCollection); 

      

Cheers,
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 - 18 Apr, 2013)
(_ None: Re: Seg Fault when trying to fill HitsCollection   (Tony Price - 19 Apr, 2013)
(_ None: Re: Seg Fault when trying to fill HitsCollection   (Tsukasa Aso - 19 Apr, 2013)
(_ 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 ]