Message: How to track energy of every single optical photons generated in each events. Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None How to track energy of every single optical photons generated in each events.  

Forum: Processes Involving Optical Photons
Date: 19 Feb, 2013
From: Dat Vu <Dat Vu>

I'm trying to keep track of optical photons in each events. Here is the code i used in main() in sensitive detector:

if (aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName() == "opticalphoton")

 {

		TrackerHit* newHit = new TrackerHit();
                ke = aStep->GetTrack()->GetKineticEnergy();

 		trackerCollection->insert(newHit );
	}		
else
	{
 		return false;
	}        
return true;
}

//...................................................................................
void TrackerSD::EndOfEvent(G4HCofThisEvent*)
{
    	G4int NbHits = trackerCollection->entries();

	aCount += NbHits;
	for (G4int i=0;i<NbHits;i++) 
	{
		(*trackerCollection)[i]->Print();
	}
	std::ofstream fout;
  fout.close();
  fout.open("numberdata_run15.txt", std::fstream::app);
	fout <<NbHits<< " "<<std::endl;;
  fout.close();
  fout.open("energydata_run15.txt", std::fstream::app);
	fout <<ke/eV<< " "<<std::endl;;
  fout.close();
}

However here comes the problem. If I am tracking the energy of every single photons generated, I should have 1000 energy entries for 1000 photons generated in 10 events right? The result i got is only 100 energy entries for 100 events even though the optical photon generated number is 5640. So am I tracking the energy of each photon or energy of each event? How can i keep track of energy of every single photon?

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

1 Feedback: Re: How to track energy of every single optical photons generated in each events.   (Gumplinger Peter - 19 Feb, 2013)
 Add Message Add Message
to: "How to track energy of every single optical photons generated in each events. "

 Subscribe Subscribe

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