Message: Manually creating PMT hits like in the LXe example Not Logged In (login)

Question Manually creating PMT hits like in the LXe example 

Forum: Processes Involving Optical Photons
Date: 26 Mar, 2009
From: Clarisse <Clarisse>

Hi, I have written a code for a NaI detector covered with teflon and coupled to one PMT. I implemented the optical photon and the code compiled and ran fine until I tried to make the PMT a sensitive detector and collect some information about my optical photons.

What happens now is that the code compiles fine, and runs fine if no optical photons are generated. However I get a "Segmentation Fault" when the event involves optical photons. My hunch is that I am making some mistake when I try to "manually create a hit" at my photocathode interface (I tried to follow what is being done for LXe), i.e. in my myDetPMTSD.cc file. Another file where there may be a mistake is myDetSteppingAction.cc or myDetEventAction.cc (this also follows what is done in LXe).

I reread those files, however I am not able to spot my mistake. I am attaching the files where I think the problem may be. I would appreciate if you could please look at the above mentioned files in particular (i.e. myDetPMTSD.cc, myDetSteppingAction.cc, myDetEventAction.cc) and let me know where you think my mistake is and how to correct for it.

Thank you, Clarisse

   Attachment:
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.19-63612-tDetectorConstruction.cxx
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.16-1921-etDetectorConstruction.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.19-71258-cint_myDetEventAction.cxx
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.16-73563-Scint_myDetEventAction.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.19-33234-withScint_myDetPMTHit.cxx
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.16-23255-_withScint_myDetPMTHit.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.19-62708-_withScint_myDetPMTSD.cxx
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.16-36928-I_withScint_myDetPMTSD.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.19-40014-t_myDetSteppingAction.cxx
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.19-66703-nt_myDetSteppingAction.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.24-15312-tUserEventInformation.cxx
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/03/26/11.24-18806-etUserEventInformation.hh

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

Feedback Re: Manually creating PMT hits like in the LXe example  by Gumplinger Peter <Gumplinger Peter>,   26 Mar, 2009
Re: Question Manually creating PMT hits like in the LXe example (Clarisse)
Dear Clarisse,

You can't really expect me to debug your code, but I did....

Also, do you know about gdb? You can run it:

> gdb ../../../bin/Linux-g++/executable core.###

......

(gdb) where

It'll tell you at least which method/class it segment faulted.

The LXe example reads:

  G4int n=pmtHitCollection->entries();

  LXePMTHit* hit=NULL;

  for(G4int i=0;i<n;i++){

    if((*pmtHitCollection)[i]->GetPMTNumber()==pmtNumber){

      hit=(*pmtHitCollection)[i];

      break;

    }

  }

You only have:

  myDetPMTHit* hit = (*pmtHitCollection)[0];

I can see why this happened - the comment: "//Find the correct hit collection" is misleading - wrong; we are looking for how many hits have already been collected. G4int n is the number of hits already stored in the pmtHitCollection.

Peter

 Add Message Add Message
to: "Manually creating PMT hits like in the LXe example"

 Subscribe Subscribe

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