Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Explanation of Driver Code

Below is the complete text of the Analysis101 Driver.

No Format

import org.lcsim.util.aida.AIDA;
import hep.physics.vec.VecOp;
import java.util.List;
import org.lcsim.event.EventHeader;
import org.lcsim.event.MCParticle;
import org.lcsim.util.Driver;

public class Analysis101 extends Driver
{
   private AIDA aida = AIDA.defaultInstance();
   
   protected void process(EventHeader event)
   {
      List<MCParticle> particles = event.get(MCParticle.class,event.MC_PARTICLES);

      aida.cloud1D("nTracks").fill(particles.size());
      
      for (MCParticle particle : particles)
      {
         aida.cloud1D("energy").fill(particle.getEnergy());
         aida.cloud1D("cosTheta").fill(VecOp.cosTheta(particle.getMomentum()));
         aida.cloud1D("phi").fill(VecOp.phi(particle.getMomentum()));
      }
   }
}