MCNtuple

Contents

Contact Name

Sue Kasahara.

Further Links

The Standard Ntuple web site with ntuple analysis examples, etc. is available as a primary resource for current information about the ntuples. A link to this site is also available off of the main WebDocs page.

This page supplements the material available there.

Overview

The MCNtuple package contains the ntuple class definitions for the Monte Carlo truth ntuple, produced as part of production running and stored in production files ending in .sntp.<release>.root or .snts.<release>.root in ROOT TTree "NtpMC". This ntuple stores a subset of mc truth information, derived from the complete SimSnarlRecord. The files storing the ntuple data are therefore of smaller size and are more easily accessible than the full MC truth data stored as SimSnarlRecords in .cand.<release>.root. The MC ntuple is especially useful for end-user analyses interested in summary results. The MC ntuple can also be used as a starting point in an analysis to select a subset of Snarls of interest, before turning to the .cand files for a deeper analysis of just those selected events.

The MC ntuple is analyzable in a "bare" root session, without the load of minossoft libraries, or alternatively in a loon session. Examples of this are given on the Standard Ntuple site described above. The ntuple may be also be read into a subsequent loon job using job control for further analysis or record selection.

Structure

The MC ntuple consists of a record of class type NtpMCRecord, which is stored in a ROOT TTree of name "NtpMC" with one record per tree entry. One NtpMCRecord contains the ntuple summary data from one Snarl.

The NtpMC tree is constructed with one main branch of name "NtpMCRecord", which has been "split" (automatically, specifying the splitlevel in a root method) to create a branch.subbranch.(...).leaf structure for the NtpMC tree, such that every leaf stores the data of one ntuple variable of basic data type (float,int, etc.). The structure of the NtpMC tree can be viewed in a bare root session using the TTree::Print() command, for example:

{
 //usage: root -bq thisscript.C >& thisscript.log  
 TFile* file = new TFile("filename.sntp.R1.9.root","READ");
 TTree* tree = (TTree*)(file->Get("NtpMC"));
 tree -> Print();
}

The contents of the ntuple can be better understood by looking at the data members of the top level ntuple class, NtpMCRecord. From NtpMCRecord.h:

 TClonesArray* mc;       //-> array of NtpMCTruth
 TClonesArray* stdhep;   //-> array of NtpMCStdHep
 TClonesArray* digihit;  //-> array of NtpMCDigiScintHit
The NtpMCRecord class stores data members organized as arrays of objects. The (TClones)Arrays of objects, for example "mc", represent the different MC Truth entities associated with the snarl:

Brief descriptions of the data members appearing in the ntuple are given in the class definition header files alongside the data members, so that the MCNtuple/*.h files can be a useful introductory resource to the content of the MC ntuple.

Input/Output

NtpMCRecords are produced by the NtpMCModule defined in MCNtuple/Module.

Input Objects

The SimSnarlRecord is the input data source for constructing a NtpMCRecord. SimSnarlRecords from a previously produced .cand.<release>.root file can be used as input to a subsequent job in which only the NtpMCModule is run to produce ntuples. However, because the SimSnarlRecord was incomplete prior to R1.10, this process is only reliable if run on .cand files produced post R1.9.

Output Objects

The output of the NtpMCModule is a NtpMCRecord stored in Mom. The Output module will store the NtpMCRecord in a tree NtpMC in the user specified output file, if requested in the job script. The name of the output tree may be changed by the user from the default NtpMC.

Configuring & Running

A simple script to run the NtpMCModule to generate a file testNtpMC.root with tree NtpMC is shown here. The input file for this script should be a .cand.<release>.root file containing a SimSnarl tree. The commented out line illustrates how to configure the NtpMCModule to activate the fill of the digihit array.
{
  // A job to demonstrate how to run the NtpMCModule
  // usage: loon -bq thisscript.C <cand filename>
  
  JobC j;

  j.Input.Set("Format=input");
  j.Input.Set("Streams=SimSnarl"); // Define the input data streams

  j.Path.Create("Demo","NtpMCModule::Reco "
                       "Output::Put ");

  // Optionally active fill of NtpMCDigiScintHits in digihits array
  // jc.Path("Demo").Mod("NtpMCModule").Set("WriteDigiHit=1");

  j.Path("Demo").Mod("Output").Set("Streams=NtpMC"); // output data stream
  j.Path("Demo").Mod("Output").Set("FileName=testNtpMC.root"); // output file


  j.Path("Demo").Run();
}

Sue Kasahara Last Modified: $Date: 2004/10/23 03:02:25 $