Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

This tutorial shows you how to run a simple analysis using a LCIO reconstructed Particle Collection either generated by fastMC (Tutorial 1) or PerfectPFA( Tutorial 2 PPFA and Jet Clustering) and making a nice Z mass peak

 Requirements

  1. JAS3
  2. latest org.lcsim from CVS (see here)
  3. Output from either Tutorial 1 FastSim and Jet Clustering or Tutorial 2 PPFA and Jet Clustering

 The Code

 Here is the sample driver Code

Code Block
import hep.physics.jet.FixNumberOfJetsFinder;
import hep.physics.jet.JetFinder;
import hep.physics.vec.BasicHepLorentzVector;
import hep.physics.vec.HepLorentzVector;
import hep.physics.vec.VecOp;

import java.util.ArrayList;
import java.util.List;

import org.lcsim.event.EventHeader;
import org.lcsim.event.MCParticle;
import org.lcsim.event.ReconstructedParticle;
import org.lcsim.event.util.JetDriver;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;

public class SimpleAnalysis extends Driver{
	int ievt = 0;
	private AIDA aida = AIDA.defaultInstance();
// change this to 	MCFastReconstructedParticles for running with MCfast
	String reconname = "PPRReconParticles";

	String mcparticlename = "MCParticles";
	String jetlistname = "Jets";
	public SimpleAnalysis() {


	}

	// process events
	protected void process(EventHeader event) {
		super.process(event);
		// the particle lists
        List<MCParticle> mcparticles = event
				.get(MCParticle.class, mcparticlename);
	List<ReconstructedParticle> jets = event.get(
				ReconstructedParticle.class, jetlistname);
	List<ReconstructedParticle>recparticles =
		event.get(ReconstructedParticle.class,reconname);

		aida.cloud1D("n MC particles").fill(mcparticles.size());
		aida.cloud1D("n jets").fill(jets.size());



		// loop over the jet collection
		for (ReconstructedParticle jet : jets) {
			aida.cloud1D("Jet energy").fill(jet.getEnergy());
			aida.cloud1D("Jet angle").fill(VecOp.cosTheta(jet.getMomentum()));

		}

		// look at two jets only
		if (jets.size() == 2) {
			HepLorentzVector Z = new BasicHepLorentzVector();
			// Get the sum of the 4-vectors (momentum and energy)
			Z = VecOp.add(jets.get(0).asFourVector(), jets.get(1)
					.asFourVector());
			aida.cloud1D("Z mass").fill(Z.magnitude());

			// look at Barrel
			if ((VecOp.cosTheta(jets.get(0).getMomentum()) < 0.7)
					&& (VecOp.cosTheta(jets.get(1).getMomentum()) < 0.7)) {
				aida.cloud1D("Z mass barrel").fill(Z.magnitude());
			}
			// look at endcap
			if ((VecOp.cosTheta(jets.get(0).getMomentum()) > 0.7)
					&& (VecOp.cosTheta(jets.get(1).getMomentum()) < 0.7)) {
				aida.cloud1D("Z mass endcap").fill(Z.magnitude());
			}
		}

		// print out a status line
		if (ievt % 50 == 0) {
			System.out.println("Processed Events  " + ievt);
		}
		ievt++;
	}
}

This driver opens three LCIO collections

  1. MC Particles (the truth)
  2. The reconstructedparticles made by the org.lcsim construction (either PPFA or FastMC)
  3. The Jets clustered before
Code Block
List<MCParticle> mcparticles = event
				.get(MCParticle.class, mcparticlename);
List<ReconstructedParticle> jets = event.get(
				ReconstructedParticle.class, jetlistname);
List<ReconstructedParticle>recparticles =
		event.get(ReconstructedParticle.class,reconname);

 The simple aida plots contains the number of particles in this collection

Code Block
aida.cloud1D("n MC particles").fill(mcparticles.size());
aida.cloud1D("n jets").fill(jets.size());

we can then loop over the Jet collection

Code Block
// loop over the jet collection
		for (ReconstructedParticle jet : jets) {
			aida.cloud1D("Jet energy").fill(jet.getEnergy());
			aida.cloud1D("Jet angle").fill(VecOp.cosTheta(jet.getMomentum()));

		}

and fill information about the Jets into the AIDA file

Finally we can make a Z peak using the Jets clustered before

Code Block
if (jets.size() == 2) {
			HepLorentzVector Z = new BasicHepLorentzVector();
			// Get the sum of the 4-vectors (momentum and energy)
			Z = VecOp.add(jets.get(0).asFourVector(), jets.get(1)
					.asFourVector());
			aida.cloud1D("Z mass").fill(Z.magnitude());

			// look at Barrel
			if ((VecOp.cosTheta(jets.get(0).getMomentum()) < 0.7)
					&& (VecOp.cosTheta(jets.get(1).getMomentum()) < 0.7)) {
				aida.cloud1D("Z mass barrel").fill(Z.magnitude());
			}
			// look at endcap
			if ((VecOp.cosTheta(jets.get(0).getMomentum()) > 0.7)
					&& (VecOp.cosTheta(jets.get(1).getMomentum()) > 0.7)) {
				aida.cloud1D("Z mass endcap").fill(Z.magnitude());
			}
		}

where we use all the operations from the VecOp package which takes care of FourVector operations

e.g.

Code Block
Z = VecOp.add(jets.get(0).asFourVector(), jets.get(1)
					.asFourVector());

will add the FourVectors from the two Jets.


The Two plots show the mass of the Z done with PPFA (top) and FastMc (bottom), using then same code for Analysis