Message: Memory problem with optical photons Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Memory problem with optical photons 

Forum: Processes Involving Optical Photons
Date: 23 May, 2011
From: Davinder Siwal <Davinder Siwal>

Hii Geant4 users

I am trying to simulate the LYSO scintillator for imaging application

I have manually created optical photon hits inside the scintillator

G4bool PlanarPhotoCathodeSD::ProcessHits_constStep(const G4Step* aStep,
  if (aStep == NULL) return false;
  G4Track* theTrack = aStep->GetTrack();

  // Need to know if this is an optical photon
     != G4OpticalPhoton::OpticalPhotonDefinition()) return false;

  // Find out information regarding the hit
  G4StepPoint* thePostPoint = aStep->GetPostStepPoint();

  G4TouchableHistory* theTouchable
      = (G4TouchableHistory*)(thePostPoint->GetTouchable());

  // G4ThreeVector photonExit   = trackInformation -> GetExitPosition();
  G4ThreeVector photonArrive = thePostPoint -> GetPosition();
  G4double      arrivalTime  = theTrack -> GetGlobalTime();

  // Convert the global coordinate for arriving photons into
  // the local coordinate of the detector
  photonArrive = theTouchable->GetHistory()->

  // Creating the hit and add it to the collection

  PlanarPhotoCathodeHit* hit = new PlanarPhotoCathodeHit(photonArrive, arrivalTime);

      delete hit;
      //G4cout<<"hit pointer is deleted from PlanarPhotoCathodeSD"<<G4endl;
  return true;

and store the photocathode hits and hits position vector into static variable and static array respectively

PlanarPhotoCathodeHit::PlanarPhotoCathodeHit(G4ThreeVector pArrive,
					     G4double pTime)
  posArrive   = pArrive;
  arrivalTime = pTime;


where setPosition() and IncPhotonCount() is given as

 inline void IncPhotonCount(){ counter++;}
 inline void SetPosition(G4ThreeVector pos){ Position[counter] = pos;};

these values I am retrieving in EventAction class

 PlanarPhotoCathodeHit *photoHit = new PlanarPhotoCathodeHit();
  photo_hit = photoHit->GetPhotonCount();
  for(int j=0;j<photo_hit;j++)
      Pos_x[j] = photoHit->GetPosition(j).x();
      Pos_y[j] = photoHit->GetPosition(j).y();

and also doing
      delete photoHit;
      G4cout<<"Memory is released from PhotoCathode Pointer !!!!!"<<G4endl;

In this simulation I am throwing gamma of 511Kev and recording the energy deposit inside the scintillator and photcathode position hits, energy depostion of gammas I am collecting in a normal way . The overall simulation is running fine. Initially there was problem with memory so I decided to delete the photoCathodeHit pointer during run time which force me to define the static variables. But now when the simulation finished my computer is not getting back to the original memory infact it always exit with occupying the memory of around 1GB for 100000 events. I do not where is my fault

Can anybody help to figureout the problem

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

1 Feedback: Re: Memory problem with optical photons   (Gumplinger Peter - 24 May, 2011)
(_ None: Re: Memory problem with optical photons   (Davinder Siwal - 29 May, 2011)
 Add Message Add Message
to: "Memory problem with optical photons"

 Subscribe Subscribe

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