[Feedback][Day 1][Day 2][Welcome Page]
If you have worked through the previous tutorials in
this series, then you should know how to open a stdhep file and compile and
load the analysis routine provided below. The example makes use of the ability
of a Driver
to have one or more Processors
added to it. By default the process method of Driver will call each of the
Processors in turn. In this example we add two Processors to our main Driver, MCFast
,
which is a Processor provided with the LCD extensions, and ResCheck, which is a
user supplied processor where we do some histogramming on the output of the
FastMC.
Note that since we are reading generator level data we have to explicitly tell the lcd software which detector geometry to use. The statements
String detector = "sdmar01"; Detector.setCurrentDetector(new Detector(detector));
do that. (We could also have used ldmar01 as the detector name).
The ResCheck class is also defined in the example. It extends AbstractProcessor
and overrides the process method as we did in the previous example. The
example also shows how to use profile plots
in AIDA/JAS3.
import hep.physics.*; import hep.lcd.event.*; import hep.lcd.mc.fast.*; import hep.lcd.util.driver.*; import hep.lcd.geometry.*; import java.util.*; final public class CheckFast extends Driver { public CheckFast() throws java.io.IOException { String detector = "sdmar01"; Detector.setCurrentDetector(new Detector(detector)); tree().mkdirs("/"+detector); add(new MCFast()); add(new ResCheck(detector)); // user analysis routine } } class ResCheck extends AbstractProcessor { private String folder; ResCheck(String folder) { // create some special histograms this.folder = folder; } public void process(LCDEvent event) { tree().cd("/"+folder); // Loop over tracks Enumeration e = event.getTrackList().getTracks(); while (e.hasMoreElements()) { Track t = (Track) e.nextElement(); double ptot = Math.sqrt(t.getMomentumX()*t.getMomentumX() + t.getMomentumY()*t.getMomentumY() + t.getMomentumZ()*t.getMomentumZ()); // Get associated MC particle MCParticle mc = t.getMCParticle(); double mcptot = Math.sqrt(mc.getPX()*mc.getPX() + mc.getPY()*mc.getPY() + mc.getPZ()*mc.getPZ()); double cosTheta = mc.getPZ()/mcptot; double pdiff = mcptot - ptot; // Make some plots cloud1D("pdiff").fill(pdiff); cloud1D("ptot").fill(ptot); cloud1D("mcptot").fill(mcptot); profile1D("pdiff vs ptot",50,0,50).fill(ptot,pdiff); profile1D("pdiff vs costheta",50,-1,1).fill(cosTheta,pdiff); } } }
The ResCheck class in the above example puts all of the created histograms into a folder named after the detector used. This makes is possible to run the routine more than once on the same input data to compare the responses of the two detectors. You would do this as follows:
The WIRED event display described in the earlier tutorial with work with the results of the FastMC. You can use it to compare the MC truth tracks with the Fast MC output.
Go to the next tutorial.