Message: Re: stopping simulation once reached a condition Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: stopping simulation once reached a condition 

Forum: Event and Track Management
Re: Question stopping simulation once reached a condition (Antonio De Simone)
Date: 09 Jul, 2009
From: Jacob Castilow <Jacob Castilow>

I'm not sure if this will be helpful, but I would try an if loop in either the main function (not sure this is possible), or an if loop about the event generation- then when the critical amount is reached you could use "break" to have it end the run by going to return 0; For example, define an integer for energy deposition, and have it collect the total energy deposition based on the hits collection of the sensitive detector- a code like this might work:

edep_critical= XXXX*MeV;

    int iHit = 0;
      double totalE = 0.;
    for(int i1=0;i1< number of hits ;i1++)
    {
      EICHadCalorimeterHit* aHit = (*HCHC)[i1];
      double eDep = aHit->GetEdep();
     if(eDep>0.)
       {
       iHit++;
       totalE += eDep;
       }

// then add another loop in your event generation source file to say end the program if totalE > or = edep_critical //coding not exact- just a general idea

if(totalE >=edep_critical) break;

just a general thought- hopefully someone else could build on this or give you a better solution

 Add Message Add Message
to: "Re: stopping simulation once reached a condition"

 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 ]