Vous êtes sur la page 1sur 30

E14 Analysis Quick Start Guide

Tejin Cai
March 20, 2014
Contents
1 Getting Started 2
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Installing E14 Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.2 Setting PATH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.3 Make and Install E14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Using ROOTS 5
2.1 Writing and Accessing Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1 Structure of TTree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2 Accessing Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.3 Know your variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.4 Accessing the Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Plots and Cuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Useful Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 E14 Library Overview 9
3.1 ANALYSIS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.1 csimap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.2 cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1.3 gamma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1.4 pi0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1.5 klong . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1.6 rec2g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1.7 gnana . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 SIMULATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2.1 GsimData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 E14 Using Examples 15
4.1 Whats in examples/? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2 Compiling an Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.3 e14gnana . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.3.1 e14clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.3.2 e14g6ana . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5 Simulation 25
5.1 Creating MC using /example/gsim4test . . . . . . . . . . . . . . . . . . . . . . . . 25
5.2 Access MC output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1
Chapter 1
Getting Started
1.1 Introduction
The K0TO collaboration aims at nding the rare CP-violaing K
L

0
, of which the branching
ratio is directly proportional to the element of the CKM matrix.
In order to analyze the given data, the E14 analysis library has been written and is being developed
by colleagues in Japan. Due to the lack of ocial documentation it might present some diculties
in getting started on the analysis especially for newcomers. This documentation aims to alleviate
the issue by giving a brief overview of the E14 Library as well as ROOT
1.2 Installing E14 Library
1.2.1 Prerequisites
The E14 library is built around 3 packages: ROOT, CLHEP and GEANT4. The ROOT is the default
HEP analysis package developed by CERN. CLHEP provides some useful utilities to make relativistic
computations. GEANT4 is used for Monte Carlo (MC) simulated data.
The latest development version of E14 can be found on KEKCC at
kekcc:/sw/koto/e14lib/dev
The production versions are found at
kekcc:/sw/koto/e14lib/201305v
*
folders
The most important thing, however, is setting up the correct path for the various packages/libraries.
The procedure
There are a few copies available on Uchicago local cluster. An older copy is found at
doewah:/cpv/code/e14 bakcup.
Inside these folders you should see e14/, setup.sh and setup.csh. Copy them to the directory
of your choice.
2
1.2.2 Setting PATH
Before compiling the E14 Library we must set the appropriate path (ROOT, GEANT4, CLHEP and
E14).
On UChicago Machines
Navigate to doewah:/cpv/code/e14 bakcup and copy mye14.sh to your directory.
Open mye14.sh using a text editor, modify the last line:
source /cpv/code/e14/dev/setup.sh
To
source /your/directory/setup.sh
This should take care the path to ROOT, GEANT4 and CLHEP.
Next, open setup.sh and change
export E14 TOP DIR=/blah/blah/blah/e14
to export E14 TOP DIR=/your/directory/e14
Everytime you open an terminal, you have to type
source mye14.sh
You can also add the path to .bashrc to save the trouble of doing it everytime.
NOTE: The above instruction only works for the version in doewah:/cpv/code/e14 bakcup.
If you downloaded the latest version from KEK server, you can follow a similar approach as detailed in
the next section. However you must change the path for GEANT4, ROOT and CLHEP in env.sh
accordingly. I have not tried it myself but it should in principal work.
On KEK Clusters
An useful document to refer to is at
http://kds.kek.jp/conferenceDisplay.py?confId=685
under technote. It details the procedure to install the pro version on KEK cluster. It uses svn to
import the packages from an svn server.
To set up the E14 library manually, go to kekcc:/sw/koto/e14lib/. Here you will nd various
folders ./201305v
*
and ./dev. To use the development version, for example,
1. copy the content of ./dev to a folder of your choice. i.e. /path/to/my/folder/dev.
2. copy env.sh from any of the 201305
*
folder, i.e.
/sw/koto/e14lib/201305v2.29/env.sh to
3
/path/to/my/folder/dev
3. open env.sh with a text editor, i.e. vi
4. go to the last line, change
source blah/blah/blah/setup.sh to
source /path/to/my/folder/dev/setup.sh
Once completed,
source env.sh
You should see
Successfully configured!
If path is set correctly.
1.2.3 Make and Install E14
Go to e14/:
cd e14/
make clean %This will remove everything except the source codes
make install-headers
Once done, type
make %To compile
The entire process can take quite a long time, youll have to be patient.
4
Chapter 2
Using ROOTS
2.1 Writing and Accessing Tree
Most of the times, data taken in experiments are stored in a tree data structure with type TTree.
For detailed information about TTree please visit the ocial tutorial:
http://root.cern.ch/download/doc/ROOTUsersGuideChapters/Trees.pdf
For the purpose of this guide I will just show you how to write and access a tree quickly.
2.1.1 Structure of TTree
Under each TTree object there will be branches that contain the actual data.
2.1.2 Accessing Tree
Suppose you have a le named output.root and that it contains a TTree object named Tree.
There are two ways to access the TTree object.
1. In ROOT, type
TFile
*
inputFile=new TFile("output.root");
TTree
*
inputTree=(TTree
*
) inputFile ->Get("Tree");
Now the pointer variable inputTree will point to the address of the TTree in the le.
2. The second method uses TChain class, which is a derived class from TTree. It can uses all
the functions associated with TTree and plus some more functions:
TChain
*
inputChain=new TChain("Tree");
inputChain ->Add(output.root");
The name of the TTree is set as an input paramter in the declaration of TChain. The TChain
then add the le that contains the particular TTree. This has the advantage that if you have
multiple les containing data using the same TTree structure, you can keep adding these
les to accumulate the events:
5
inputChain ->Add("output1.root");
inputChain ->Add("output2.root");
.
.
.
inputChain ->Add("outputn.root");
2.1.3 Know your variables
Once the inputTree has been dened, we need to map the branches to appropriate variables.
For example, a data of type int can only be assigned to a variable of type int.
You can visually look at the TTree and its branches by opening a browser in ROOT:
TBrowser br;
This will open a browser window as such:
Figure 2.1: TBrowser window
If your right-click on one variable (the one with green leaf sign to the left), and select Inspect, you
will open a new window that shows the variable type information. Here I selected GamClusCsiTime
as an example:
6
Figure 2.2: TBrowser window with variable property
On the top row, from left to right are TBranch, GamClusCsiTime and
GamClusCsiTime[GamClusNumber][120]/D respectively. The variable values are stored in a
TBranch data structure, GamClusCsiTime is the name of the variable. But most importantly
is the third expression. GamClusCsiTime[GamClusNumber][120]/D tells us what kind of variable
is stored, in this case it is a 2-dimensional array of type double.
Here is a list of most used types for E14, you can nd a full list in the ocial user guide.
I int
i unsigned int
S short
s unsigned short
F float
D double
The value of GamClusNumber is actually stored in the variable of the same name inside the tree in
this case. The size of GamClusNumber, when it comes to K
L
3
0
, is 6 because each
0
decays
to 2
2.1.4 Accessing the Variable
To retrieve the values stored in one branch, we rst dene a variable of the same type as shown in
the TBranch property window:
7
double Variable[6][120];
inputTree ->SetBranchAddress(GamClusCsiTime, Variable);
The rst string is the name of the TBranch, the second string gives the address of to store the
values to. If the data is not an array type, for example GamClusNumber, which on the Property
Window will show up as GamClusNumber/I, we can map it by:
int Variable2;
inputTree ->SetBranchAddress(GamClusNumber, &Variable2);
Note the & sign in front of Variable2.
Accessing the data will be very easy:
inputTree ->GetEntries();
will return total number of events in the TTree and
inputTree ->GetEntry(i);
will return the ith entry. If you do so Variable and Variable2 will take on the values for that particular
entry.
2.2 Plots and Cuts
It is very easy to make plots and cuts in ROOT, essentially all you have to do is using Draw(), for
example:
inputTree -> Draw(KlongMass[0]:KlongPos[0][2], abs(KlongChisqZ[0]-KlongChisqZ[1])>20);
The rst string tells us we want to plot KlongMass[0] against KlongPos[0][2], ie the rst recon-
structed Klong Mass against its z-position, and the second string provides the cut conditions.
We do not need to dene the variable address as done in the previous sections, all we have to do is
to use the appropriate names shown in the Property Window.
2.3 Useful Functions
ROOT has some useful string manipulation functions
Form(string%i%i...%i, a
1
,a
2
,a
3
,..,a
n
);
Each %i represents an integer that you can set using a
i
8
Chapter 3
E14 Library Overview
In the E14 top directory, under sources/ there are ana/ and rec, which stands for ANALYSIS
and SIMULATION. Here is a list of frequently used packages.
1. ana/rec
(a) cluster
(b) csimap
(c) gamma
(d) gnana
(e) klong
(f) pi0
(g) rec2g
2. sim/gsim4
(a) GsimData
(b) GsimDetector
(c) GsimE14Detector
Here I will give an overview of their contents.
3.1 ANALYSIS
3.1.1 csimap
CsiMap.h
CsiMap is the class that will give you the CsI mapping information.
void getXYW(int const&ID, double &x, double &y, double &w) const;
will assign the relevant values to variables of your choice. Similarly
9
void getXYWarray(int const&nDigi,int const *ID,double *x,double *y,double *w)
const;
will assign all the CsI block information to relevant arrays.
3.1.2 cluster
Cluster.h
Cluster class has data structure that stores cluster information. When a particle deposits energy
into the CsI calorimeter, the energy is not contained within one crystal but also in the surrounding
crystals forming a cluster. Cluster stores cluster information using a set of private data, such
as total energy, cluster id. It also contains individual CsI crystal data using 3 vectors: m cidVec,
m eVec and m timeVec.
ClusterFinder.h
ClusterFinder class nds clusters from the data input of the 2716 CsI crystals and supply the
results to Cluster. The method that performs this task is
listCluster& ndCluster( int nDigi, int *ID,double *E,double *time);
Where:
nDigi Total number of crystal blocks involved in cluster nding
*ID An array containing block IDs
*E An array containing block energies
*time An array containing block times
This function should nd all clusters on the detector and return the results to a list of Cluster.
3.1.3 gamma
Gamma.h
Gamma is a data storage structure much like Cluster.
GammaFinder.h
GammaFinder will take in a list of Cluster and correct for the energy loss through a function
obtained using Artiial Neural Network during previous calibration work. At this stage the cluster
will be passed as a photon as long as its energy exceeds 20 MeV. Look at the headers and source
codes for more details.
10
3.1.4 pi0
Pi0.h
Pi0 class contains information about
0
reconstructed from 2 photons. This class uses
CLHEP/Vector/ThreeVector.h. CLHEP contains useful classes and functions to store and
calculate using position, velocity and energy.
const CLHEP::Hep3Vector& v() const{return m v;} will return vertice position stored in
Hep3Vector.
Similarly vx(), vy() and vz() return the vertice position of the
0
.
Pi0 also denes 2 Gamma to store data about the 2 photons produced through
0

3.1.5 klong
Klong.h
Klong is very similar to Pi0. It contains the data members and methods to access those members.
It denes a vector of Pi0 to store
0
data, since a K
L
can produce 1, 2 or 3
0
s, and a vector
supports variable number of such Pi0.
RecKlong.h
RecKlong provides the computational functions to reconstruct K
L
from
0
data or from
data.
3.1.6 rec2g
Rec2g.h
Rec2g is the main class used for reconstructing
0
from 2.
void recVtxWithConstM(const Gamma& g1, const Gamma& g2,
double Mass, double *recZ, double recZsig2);
will calculate the vertical decay vertice of a particle decaying to 2 photons by assuming a xed Mass.
During
0
reconstruction this mass is set to 0.1349764 GeV for
0
.
11
3.1.7 gnana
DigiReader.h
The DigiReader class is primary interesting for simulated events, it functions to read values from
various detectors in the experiments. For example, vetos like CBAR, CV, etc, as well as information
pertaining to the main CsI detector.
Each detector is assigned a detector ID through
enum{CC01=0, CC02, CC03, CC04, CC05, CC06,
CBAR, FBAR, CSI, BHPV, CV, BCV, BHCV, NCC, OEV};
While there is a set of functions general to all detectors, the CsI detector has its own set of methods
too.
Examples of methods:
int getDigiSize(int const detID) const; will return the number of individual modules/blocks
double getDigiId(int const detID, int const i) const; will return the id number for the
ith block and so on. The sux Ene pertains to energy and Time pertains to time.
E14GNAnaDataContainer.h
The E14GNAnaDataContainer class is an important class. It reads and creates necessary
TTrees for data input and output.
The void branchOf... methods creates branches for appropriate data.
The bool getData will read data into variables of your choice, void setData serves to supply
the data to variables linked to a TTree
E14GNAnaFunction.h
The E14GNAnaFunction class contains many methods used to correct the energy and position
of a cluster as well as functions that calculates
2
values to determine if a cluster is of photon
origin. Its usage will be seen later when I go through the commonly used codes under example/
folder.
3.2 SIMULATION
3.2.1 GsimData
The GsimData set of codes are the main tools used to access MC data generated through the
GEANT4 based simulation.
12
GsimEventData.h
This is a data class to store the simulated run information of the MC tree. Here is the list of the
variables
UShort_t expMC; // exp=1,MC=2
UInt_t run_number; //
UShort_t spill_number; //
UInt_t event_number; //
UInt_t trigger; // trigger bit pattern
UInt_t time_stamp; // localtime
UInt_t status; // general status
UShort_t version;
GsimTrackData.h
This class stores the track information of a decay which could be written to an output tree, which
includes:
The track ID, parent track ID, parent brief track ID, particle ID (PDG), initial momentum, initial
position, initial energy, initial creation process ID, brief detector ID history (maximum is 8) are
stored.
UInt_t track; //Track ID
Int_t mother; //ID of the parent track
Int_t pid; //particle ID from PDG
TVector3 p; //initial momentum
Float_t ek; //Initial energy
Float_t mass; //Mass
Float_t time; //Initial time
TVector3 v; //Initial position
TVector3 end_p; //Final momentum
Float_t end_ek; //Final energy
Float_t end_time; //Final time
TVector3 end_v; //Final position
Short_t mech; //Initial creation process ID
UShort_t status; //0: stable, 1: decay
UInt_t thisID; //Index of array in which it is stored
ULong64_t history;
/
**
*
@brief The brief IDs of the detectors the track passed through.
*
*
The briefDetectorIDs are 0-30(0-9,a,b,..,u),
*
while 31(v) is blank symbol.
*
ULong64_t = unsigned long long=64bit=2(5
*
12+4)
*
is used as a buffer whose depth is 12
*
For example, 012cdev means the track passed the detectors
*
with brief IDs, 0(start)->1->2->c->d->e(stop).
*
If the number of
*
brief detectors reaches 12,
*
no more brief detector ID is filled in
*
the briefDetectorIDHistory.
*
/
13
GsimGenParticleData.h
This class will store an array of tracks using TCloneArray
GsimDetectorHitData.h
This class stores hit data (on detector) for output, it contains data members similar to GsimTrackData.
GsimDetectorEventData.h
This class stores detector event data for output to a ROOT le. The number of hits, the total
energy deposited, the time of the rst hit, the time of the last hit, and an array of the hits are
stored.
14
Chapter 4
E14 Using Examples
4.1 Whats in examples/?
The examples/ folder contains the utilities written with the E14 packages to create MC, to process
les and compute various parameters. For example, e14clustering/ will operate on MC data
to output les containing clusters. This output can then be further processed by e14g2ana,
e14g4ana or e14g6ana to reconstruct K
L
for various decay modes.
4.2 Compiling an Example
To compile e14clustering, for example, lets go to the e14clustering/ directory:
cd examples/e14gnana/e14clustering
Inside there are bin/, tmp/, e14clustering.cc, Makefile and REQUIREMENTS. Type
make
You should see something similar to the following
Making dependency for le e14clustering.cc ...
installing libs for e14clustering
Compiling e14clustering.cc ...
e14clustering.cc: In function Int t main(Int t, char**):
e14clustering.cc:41: warning: unused variable outerDetID
Using global libraries ...
Linking e14clustering
... Done!
installing bins for e14clustering
The make command will compile e14clustering.cc and install the executable in bin/ folder.
The Makefile contains instructions for make to work:
# -*- Makele -*-
MAINS = e14clustering %The name of the source file and the executable
15
PACKAGE = $(shell basename pwd)
INSTALL LIBS = no
INSTALL BINS = yes
include $(E14 CONFIG DIR)/Makele.g4
You can add
CFLAGS += -g
LDFLAGS += -g
to Makefile to create debugging symbol during compilation.
The REQUIREMENTS tells make what packages to include for compiling:
#cong
gnana
csimap
cluster
gamma
pi0
klong
rec2g
E14Fsim
GsimData
GsimPersistency
During compilation make will search e14/include/ for the appropriate headers
4.3 e14gnana
e14gnana/ utilizes the various packages described previously to process the data for analysis
4.3.1 e14clustering
The original e14clustering works on MC les to produce cluster les for later analysis. Please
open /home/cpv/tejinc/e14/examples/e14gnana/
e14clustering/e14clustering.cc
which is slightly modied from the original e14clustering.cc by adding in commands to include
total energy from veto detectors.
1 #i ncl ude <TFi l e . h>
2 #i ncl ude <TTree . h>
3 #i ncl ude <gnana/ Di gi Reader . h>
4 #i ncl ude <gnana/E14GNAnaDataContai ner . h>
5 #i ncl ude <c l u s t e r / Cl u s t e r Fi n d e r . h>
6
16
7
8 #i ncl ude <c s t d l i b >
9 #i ncl ude <c s t di o >
10
11 #i ncl ude <f s t r eam>
12 #i ncl ude <sst r eam>
13 #i ncl ude <i omani p>
14 #i ncl ude <i os t r eam>
15 #i ncl ude <c s t d l i b >
16 #i ncl ude <cmath>
17
18
19 I n t t mai n ( I n t t ar gc , char ar gv )
20 {
21 // r ead argument
22 i nt nl oop = 1;
23 i f ( ar gc ==4){
24 nl oop = a t o i ( ar gv [ 3 ] ) ;
25 s t d : : cout<< nRequest== <<nl oop<< e v e nt s . <<s t d : : e ndl ;
26 } el s e i f ( ar gc !=3){
27 s t d : : c e r r << Argument e r r o r . <<s t d : : e ndl
28 << us ege : bi n / e 1 4 c l u s t e r i n g i nput out put [ nRequest ]
29 <<s t d : : e ndl ;
30 r etur n 1;
31 }
32
33 s t d : : s t r i n g i f name = ar gv [ 1 ] ;
34 s t d : : s t r i n g ofname = ar gv [ 2 ] ;
35 s t d : : cout<< i nput f i l e : <<i f name<<s t d : : e ndl ;
36 s t d : : cout<< out put f i l e : <<ofname<<s t d : : e ndl ;
37
38 // s e t i nput f i l e
39 TChai n t r i n = new TChai n ( event Tr ee00 ) ;
40 t r i n >Add( i f name . c s t r ( ) ) ;
41 Di gi Reader di gi Re a de r ( t r i n ) ;
42
43 i nt out er Det I D = di gi Re a de r . addDet ect or ( os . ) ;
44 i nt CBARDetID=di gi Re a de r . getDetI D ( CBAR. ) ;
45 i nt FBARDetID=di gi Re a de r . getDetI D ( FBAR. ) ;
46 i nt CVDetID=di gi Re a de r . getDetI D ( CV. ) ;
47 i nt OEVDetID=di gi Re a de r . getDetI D ( OEV. ) ;
48 i nt NCCDetID=di gi Re a de r . getDetI D ( NCC. ) ;
49 i nt CC03DetID=di gi Re a de r . getDetI D ( CC03 . ) ;
50 i nt CC04DetID=di gi Re a de r . getDetI D ( CC04 . ) ;
51 i nt CC05DetID=di gi Re a de r . getDetI D ( CC05 . ) ;
52 i nt CC06DetID=di gi Re a de r . getDetI D ( CC06 . ) ;
53 i nt BHCVDetID=di gi Re a de r . getDetI D ( BHCV. ) ;
54 i nt BHPVDetID=di gi Re a de r . getDetI D ( BHPV. ) ;
55 i nt BCVDetID=di gi Re a de r . getDetI D ( BCV. ) ;
56 // s e t out put f i l e
57 TFi l e f out = new TFi l e ( ofname . c s t r ( ) , RECREATE ) ;
58 TTree t r o ut = new TTree ( t r o , out put f rom e 1 4 c l u s t e r i n g ) ;
59 E14GNAnaDataContai ner dat a ;
60 dat a . br a nc hOf Cl us t e r Li s t ( t r o ut ) ;
61 dat a . br anchOf Di gi ( t r o ut ) ;
62
63
64 // d e c l a r e Cl u s t e r Fi n d e r and v a r i a b l e s
65 i nt nCSI Di gi =0;
17
66 i nt CSI Di gi I D [ 3000] ={0};
67 doubl e CSI Di gi E [ 3000] ={0} , CSI Di gi Ti me [ 3000] ={0};
68 Cl u s t e r Fi n d e r c l u s t e r F i n d e r ( 3 , 0 ) ;
69 doubl e FBAREneTotal , CBAREneTotal , CVEneTotal , OEVEneTotal ;
70 doubl e NCCEneTotal , CC03EneTotal , CC04EneTotal , CC05EneTotal ;
71 doubl e CC06EneTotal , BHCVEneTotal , BHPVEneTotal , BCVEneTotal ;
72
73 t r out >Branch ( CSI Di gi E , CSI Di gi E , CSI Di gi E [ 3000] /D ) ;
74 t r out >Branch ( FBAREneTotal ,&FBAREneTotal , FBAREneTotal /D ) ;
75 t r out >Branch ( CBAREneTotal ,&CBAREneTotal , CBAREneTotal /D ) ;
76 t r out >Branch ( CVEneTotal ,&CVEneTotal , CVEneTotal /D ) ;
77 t r out >Branch ( OEVEneTotal ,&OEVEneTotal , OEVEneTotal /D ) ;
78 t r out >Branch ( NCCEneTotal ,&NCCEneTotal , NCCEneTotal /D ) ;
79 t r out >Branch ( CC03EneTotal ,&CC03EneTotal , CC03EneTotal /D ) ;
80 t r out >Branch ( CC04EneTotal ,&CC04EneTotal , CC04EneTotal /D ) ;
81 t r out >Branch ( CC05EneTotal ,&CC05EneTotal , CC05EneTotal /D ) ;
82 t r out >Branch ( CC06EneTotal ,&CC06EneTotal , CC06EneTotal /D ) ;
83 t r out >Branch ( BHCVEneTotal ,&BHCVEneTotal , BHCVEneTotal /D ) ;
84 t r out >Branch ( BHPVEneTotal ,&BHPVEneTotal , BHPVEneTotal /D ) ;
85 t r out >Branch ( BCVEneTotal ,&BHCVEneTotal , BCVEneTotal /D ) ;
86
87 // l oop a n a l y s i s
88 i nt ne nt r y = t r i n >Ge t Ent r i e s ( ) ;
89 s t d : : cout<<# of e nt r y i n i nput t r e e ==<<nent r y <<s t d : : e ndl ;
90 i f ( nl oop <0 | | nl oop>ne nt r y ) nl oop = ne nt r y ;
91
92 s t d : : cout<<\n s t a r t l oop a n a l y s i s f o r
93 <<nl oop<< e v e nt s . . . <<s t d : : e ndl ;
94
95 f or ( i nt i e v t =0; i e v t <nl oop ; i e v t ++){
96 i f ( nl oop >100&&i e v t %(nl oop /100)==0)
97 s t d : : cout<<i e v t /( nl oop/100)<<%<<s t d : : e ndl ;
98
99 t r i n >Get Ent r y ( i e v t ) ;
100
101 // Cl u s t e r i n g
102 di gi Re a de r . g e t Cs i Di g i ( nCSI Di gi , CSI Di gi I D , CSI Di gi E , CSI Di gi Ti me ) ;
103 FBAREneTotal=di gi Re a de r . get Tot al Ener gy ( FBARDetID ) ;
104 CBAREneTotal=di gi Re a de r . get Tot al Ener gy ( CBARDetID ) ;
105 CVEneTotal=di gi Re a de r . get Tot al Ener gy ( CVDetID ) ;
106 OEVEneTotal=di gi Re a de r . get Tot al Ener gy ( OEVDetID ) ;
107 NCCEneTotal=di gi Re a de r . get Tot al Ener gy ( NCCDetID ) ;
108 CC03EneTotal=di gi Re a de r . get Tot al Ener gy ( CC03DetID ) ;
109 CC04EneTotal=di gi Re a de r . get Tot al Ener gy ( CC04DetID ) ;
110 CC05EneTotal=di gi Re a de r . get Tot al Ener gy ( CC05DetID ) ;
111 CC06EneTotal=di gi Re a de r . get Tot al Ener gy ( CC06DetID ) ;
112 BHCVEneTotal=di gi Re a de r . get Tot al Ener gy ( BHCVDetID) ;
113 BHPVEneTotal=di gi Re a de r . get Tot al Ener gy ( BHPVDetID) ;
114 BCVEneTotal=di gi Re a de r . get Tot al Ener gy ( BCVDetID ) ;
115
116 s t d : : l i s t <Cl us t e r > c l i s t =
117 c l u s t e r F i n d e r . f i n d Cl u s t e r ( nCSI Di gi ,
118 CSI Di gi I D , CSI Di gi E , CSI Di gi Ti me ) ;
119
120 // f i l l i n g di g i dat a and Cl u s t e r i nf omat i on i n TTree
121 dat a . s et Dat a ( di gi Re a de r ) ;
122 dat a . s et Dat a ( c l i s t ) ;
123 t r out >F i l l ( ) ;
124 dat a . event I D++;
18
125 }
126
127
128 // end of a n a l y s i s
129 t r out >Wr i t e ( ) ;
130 f out >Cl os e ( ) ;
131 s t d : : cout<< f i n i s h ! <<s t d : : e ndl ;
132
133 r etur n 0;
134 }
Line 39: a TChain pointer trin is created that takes trees with name eventTree00 (thats the
name in MC output).
Line 41: DigiReader object created and initialized to read trin.
Line 43-55: Get the detector ID for each detector by invoking the getDetID function. The input
string is the name of the detector dened in the MC output, i.e detectorname..
Line 57-61: Dene the output le and tree, setting up branches of trout using branchOf*
functions.
Line 102-114: getCsiDigi and getTotalEnergy will ll up the desired variables.
Line 116: clusterFinder nd clusters and ll each cluster to the list.
4.3.2 e14g6ana
Once we have the raw data clustered, we can run analysis codes on them. For example, e14g6ana.cc
reconstruct K
L
3
0
which most often decays to 6 photons. Here is a modied version of the
e14g6ana.cc:
1 #i ncl ude TFi l e . h
2 #i ncl ude TChai n . h
3 #i ncl ude gnana/E14GNAnaFuncti on . h
4 #i ncl ude gnana/E14GNAnaDataContai ner . h
5 #i ncl ude gamma/GammaFinder . h
6 #i ncl ude r ec2g /Rec2g . h
7 #i ncl ude CLHEP/ Vect or / Thr eeVect or . h
8 #i ncl ude kl ong /RecKl ong . h
9 bool u s e r r e c ( s t d : : l i s t <Gamma> const &g l i s t , s t d : : vect or <Kl ong> &kl Vec ) ;
10 voi d u s e r c u t ( E14GNAnaDataContai ner &data , s t d : : vect or <Kl ong> const &kl Vec ) ;
11
12 i nt mai n ( i nt ar gc , char ar gv ){
13 // r ead argument
14 i f ( ar gc < 3){
15 s t d : : cout<< ar g e r r :<< \n usage : bi n /e14g2ana i nput out put <<s t d : : e ndl
16 << i nput f i l e s houl d be t he out put of e14gnana / e 1 4 c l u s t e r i n g .
17 <<s t d : : e ndl ;
18 r etur n 0;
19 }
20
21
22 i nt n F i l e s=ar gc 2;
23
24 s t d : : s t r i n g i f name = new s t d : : s t r i n g [ n F i l e s ] ;
25 s t d : : s t r i n g ofname = ar gv [ ar gc 1] ;
26 f or ( i nt i =0; i <n F i l e s ; i ++) i f name [ i ]=ar gv [ i +1] ;
19
27
28
29
30
31 E14GNAnaDataContai ner dat a ;
32 // s e t i nput f i l e
33 TChai n i nput Tr e e = new TChai n ( T ) ;
34 // s e t v a r i a b l e s
35 doubl e BHPVEneTotal , CBAREneTotal , FBAREneTotal , CVEneTotal ;
36 doubl e BHCVEneTotal , LCVEneTotal , OEVEneTotal , BCVEneTotal ;
37 doubl e NCCEneTotal , CC03EneTotal , CC04EneTotal , CC05EneTotal , CC06EneTotal ;
38 i nt DetNumber [ 1 3 ] ;
39 doubl e DetEne [ 1 3 ] [ 2 0 0 ] ;
40 // s e t t he a r r a y of p o i n t e r s t o poi nt t o t he addr e s s of t he t o t a l ener gy v a r i a b l e s
41 doubl e DetEneTotal [13]={&BHPVEneTotal , &CBAREneTotal ,
42 &FBAREneTotal , &CVEneTotal , &BHCVEneTotal , &LCVEneTotal ,
43 &OEVEneTotal , &BCVEneTotal , &NCCEneTotal , &CC03EneTotal ,
44 &CC04EneTotal , &CC05EneTotal , &CC06EneTotal };
45 doubl e COER;
46 shor t Tri gTagMi smatch ;
47 unsi gned i nt RawTri gBi t , Sc a l e dTr i gBi t ;
48
49 s t d : : s t r i n g DetName [ 13] ={ BHPV , CBAR , FBAR , CV , BHCV ,
50 LCV , OEV , BCV , NCC , CC03 ,
51 CC04 , CC05 , CC06 };
52
53 f or ( i nt i =0; i <13; i ++){
54 i nput Tr ee >
55 Set Br anchAddr es s ( Form( %sNumber , DetName [ i ] . c s t r ( ) ) , &DetNumber [ i ] ) ;
56
57 i nput Tr ee >
58 Set Br anchAddr es s ( Form( %sEne , DetName [ i ] . c s t r ( ) ) , DetEne [ i ] ) ;
59 }
60
61 i nput Tr ee >Set Br anchAddr es s ( Tri gTagMi smatch,&Tri gTagMi smatch ) ;
62 i nput Tr ee >Set Br anchAddr es s ( RawTr i gBi t ,&RawTr i gBi t ) ;
63 i nput Tr ee >Set Br anchAddr es s ( Sc a l e dTr i gBi t ,&Sc a l e dTr i gBi t ) ;
64
65 of s t r eam i n p u t F i l e L i s t ( e 1 4 g 2 I n p u t Fi l e s . t x t , s t d : : i o s : : t r unc ) ;
66 f or ( i nt i =0; i <n F i l e s ; i ++){
67 i nput Tr ee >Add( i f name [ i ] . c s t r ( ) ) ;
68 i n p u t F i l e L i s t <<i f name [ i ]<<s t d : : e ndl ;
69 }
70 i n p u t F i l e L i s t . c l o s e ( ) ;
71
72 dat a . s et Br anchAddr es s ( i nput Tr e e ) ;
73
74 // s e t out put f i l e
75 TFi l e o u t p u t Fi l e = new TFi l e ( ofname . c s t r ( ) , RECREATE ) ;
76 TTree out put Tr ee = new TTree ( Tree , out put f rom e14g2ana ) ;
77 s t d : : cout<< out put f i l e : <<ofname<<s t d : : e ndl ;
78 dat a . br anchOf Kl ong ( out put Tr ee ) ;
79
80
81
82 out put Tr ee>Branch ( Tri gTagMi smatch,&Tri gTagMi smatch , Tri gTagMi smatch/S ) ;
83 out put Tr ee>Branch ( RawTr i gBi t ,&RawTri gBi t , RawTr i gBi t / i ) ;
84 out put Tr ee>Branch ( Sc a l e dTr i gBi t ,&Sc al e dTr i gBi t , Sc a l e dTr i gBi t / i ) ;
85
20
86 out put Tr ee>Branch ( FBAREneTotal , &FBAREneTotal , FBAREneTotal /D ) ;
87 out put Tr ee>Branch ( CBAREneTotal , &CBAREneTotal , CBAREneTotal /D ) ;
88 out put Tr ee>Branch ( CVEneTotal , &CVEneTotal , CVEneTotal /D ) ;
89 out put Tr ee>Branch ( BHPVEneTotal , &BHPVEneTotal , BHPVEneTotal /D ) ;
90 out put Tr ee>Branch ( BHCVEneTotal , &BHCVEneTotal , BHCVEneTotal /D ) ;
91 out put Tr ee>Branch ( LCVEneTotal , &LCVEneTotal , LCVEneTotal /D ) ;
92 out put Tr ee>Branch ( OEVEneTotal , &OEVEneTotal , OEVEneTotal /D ) ;
93 out put Tr ee>Branch ( NCCEneTotal , &NCCEneTotal , NCCEneTotal /D ) ;
94 out put Tr ee>Branch ( BCVEneTotal , &BCVEneTotal , BCVEneTotal /D ) ;
95 out put Tr ee>Branch ( CC03EneTotal , &CC03EneTotal , CC03EneTotal /D ) ;
96 out put Tr ee>Branch ( CC04EneTotal , &CC04EneTotal , CC04EneTotal /D ) ;
97 out put Tr ee>Branch ( CC05EneTotal , &CC05EneTotal , CC05EneTotal /D ) ;
98 out put Tr ee>Branch ( CC06EneTotal , &CC06EneTotal , CC06EneTotal /D ) ;
99
100 out put Tr ee>Branch ( COER,&COER, COER/D ) ;
101
102 s t d : : cout<< t r e e Se t <<s t d : : e ndl ;
103
104
105
106
107
108
109
110 //
111 GammaFinder gFi nde r ;
112
113 // l oop a n a l y s i s
114
115 i nt nl oop = i nput Tr ee >Ge t Ent r i e s ( ) ;
116 s t d : : cout<< s t a r t l oop a n a l y s i s <<s t d : : e ndl ;
117 s t d : : cout<<# of e nt r y : <<nl oop<<s t d : : e ndl ;
118
119 f or ( i nt i e v t =0; i e v t <nl oop ; i e v t++ ){
120 i f ( i e v t %(nl oop/1000)==0&&nl oop >100)
121 s t d : : cout <<( f l oat ) i e v t /( nl oop /100.)<<%<<s t d : : e ndl ;
122
123 // r ead dat a
124 i nput Tr ee >Get Ent r y ( i e v t ) ;
125 s t d : : l i s t <Cl us t e r > c l i s t ;
126 dat a . getData ( c l i s t ) ;
127
128 // F i l l vet o
129 f or ( i nt i =0; i <13; i ++){
130 DetEneTotal [ i ] =0;
131 i nt N=DetNumber [ i ] ;
132 f or ( i nt j =0; j <N; j ++){
133 DetEneTotal [ i ]+=DetEne [ i ] [ j ] ;
134 }
135 }
136
137
138
139 // gamma f i n d i n g
140 s t d : : l i s t <Gamma> g l i s t ;
141 gFi nde r . findGamma ( c l i s t , g l i s t ) ;
142
143 // k l r e c o n s t r u n c t i o n
144 i f ( g l i s t . s i z e ( ) != 6 ) conti nue ;
21
145 s t d : : vect or <Kl ong> kl Vec ;
146 i f ( ! u s e r r e c ( g l i s t , kl Vec ) ) conti nue ; ;
147 // c ut s
148 u s e r c u t ( data , kl Vec ) ;
149
150 //COER
151 doubl e coex =0, coey =0, e =0;
152 f or ( s t d : : l i s t <Gamma>: : i t e r a t o r i t =g l i s t . begi n ( ) ; i t != g l i s t . end();++ i t ){
153 coex+=(i t >coex ( ) ) ( i t >edep ( ) ) ;
154 coey+=(i t >coey ( ) ) ( i t >edep ( ) ) ;
155 e+=(i t >edep ( ) ) ;
156 }
157 coex=coex /e ;
158 coey=coey /e ;
159
160 COER=s q r t ( coex coex+coey coey ) ;
161
162
163 dat a . s et Dat a ( kl Vec ) ;
164 out put Tr ee>F i l l ( ) ;
165 dat a . event I D++;
166 }
167
168 out put Tr ee>Wr i t e ( ) ;
169 out put Fi l e >Cl os e ( ) ;
170 }
Line 1 to 8: The e14g6ana.cc is a more involved codes, with the inclusion of an array
of analysis and container classes such as E14GNAnaDataContainer, E14GNAnaFunction,
GammaFinder, Rec2g and RecKlong
Line 22 to 26 and Line 64 to 67: I modied the arguments so that the executable could analyze
arbitrary number of input les by attaching them to TChain inputTree.
Line 31: Declaring E14GNAnaDataContainer data.
Line 33 to 49: Declaring variables to map the total energy data from veto detectors. Line 39
creates an array of pointers to the address of the veto energy variables.
Line 53 to 59: Map those pointers to the correct branch address, automated through the for loop
and the Form function.
Line 78: Creating the relevant TBranch objects for Klong in the outputTree.
Line 82 to 100: Here I set additional branches to outputTree.
Line 119: Starting analysis for each clustered event
1. L124: Get the ievt entry of the tree, ll data members of data mapped to the tree.
2. L125: Declare a list (clist) to hold Cluster objects
3. L126: The getData function from E14GNAnaDataContainer creates a Cluster
inside its own scope and invokes getCluster to save cluster info to the Cluster, which
is then stored into the list.
4. L129-135: Modies the veto variables pointed to by the pointers to reect the total energy
in each veto detector.
22
5. L140: Creates a list to hold Gamma
6. L141: findGamma of GammaFinder normally uses findGammaDefault which uses
an iterator to cycle through objects in clist. It saves the entire cluster into a Cluster
data member in Gamma if the total energy of the cluster is greater than a threshold (20 MeV
by default). It then uses
E14GNAnaFunction::getFunction()->correctEnergy(
*
gam);
to calculate the actual energy of the photon taking into account of shower leakage and CsI
eciency, etc.
7. L144: If the number of photons is less than 6, the event is discarded.
8. L145: Declaring a vector to hold Klong objects
9. L146: ./src/user rec.cc contains the instruction to reconstruct KLong from the 6
Gamma.
1
2 #i ncl ude kl ong /RecKl ong . h
3 #i ncl ude gnana/E14GNAnaFuncti on . h
4 #i ncl ude <i os t r eam>
5 #i ncl ude <l i s t >
6
7
8 bool u s e r r e c ( s t d : : l i s t <Gamma> const &g l i s t , s t d : : vect or <Kl ong> &kl Vec ){
9 s t a t i c RecKl ong r e c Kl ;
10 //// r e c o n s t r u c t i o n
11 // kl Vec = r e c Kl . r ecK3pi 0 ( g l i s t , VERTEX FIX XYZERO) ;
12 kl Vec = r e c Kl . r ecK3pi 0 ( g l i s t ) ;
13 i f ( kl Vec . s i z e ()==0) {
14 r etur n f a l s e ;
15 }
16 //// gamma p o s i t i o n & ener gy c o r r e c t i o n f o r angl e dependency
17 E14GNAnaFuncti on : : ge t Func t i on()>c o r r e c t Po s i t i o n ( kl Vec [ 0 ] ) ;
18 E14GNAnaFuncti on : : ge t Func t i on()>cor r ect Ener gyWi t hAngl e ( kl Vec [ 0 ] ) ;
19 //// r er e c o n s t r u c t i o n wi t h c o r r e c t e d gamma
20 s t d : : l i s t <Gamma> g l i s t 2 ;
21 f or ( s t d : : vect or <Pi 0 >: : i t e r a t o r i t =kl Vec [ 0 ] . pi 0 ( ) . begi n ( ) ;
22 i t !=kl Vec [ 0 ] . pi 0 ( ) . end ( ) ; i t ++){
23 g l i s t 2 . pus h back ( i t >g1 ( ) ) ;
24 g l i s t 2 . pus h back ( i t >g2 ( ) ) ;
25 }
26 kl Vec = r e c Kl . r ecK3pi 0 ( g l i s t 2 ) ;
27 i f ( kl Vec . s i z e ()==0) r etur n f a l s e ;
28 //// shape c hi 2 e v a l u a t i o n
29 E14GNAnaFuncti on : : ge t Func t i on()>s hapeChi 2 ( kl Vec [ 0 ] ) ;
30
31 r etur n true ;
32 }
This script denes a function of boolean type, such that if the reconstruction is unsuccessful
it will go to the next event. The RecKlong recKl contains the instruction to reoconstruct
Klong. At Line 12,
klVec = recKl.recK3Pi0(glist);
23
RecKlong::recK3pi0( const std::list<Gamma>& glist,
int vtxflag, double pi0sig2cut )
{
Rec2g rec2g; // pi0 reconstruction
std::list<Pi0> pi0list = rec2g.recPi0withConstM( glist );
return( recK3pi0( pi0list,vtxflag,pi0sig2cut ) );
}
rec2g.recPi0withConstM( glist ); .........(1)
recK3pi0( pi0list,vtxflag,pi0sig2cut ).....(2)
(1) will cycle through all pairs (15 dierent combinations) of gamma in the list to reconstruct
Pi0 Z position assuming Pi0 mass.
(2) will rst identify Pi0s with distinctive photon composition and reconstruct Klong from
them. Each reconstructed Klong will have a KlongChisqZ,
2
z
calcuated.
By default only the 2 Klongs with the lowest
2
z
are recorded.
10. L148: ./src/user cut.cc contains the instruction to write dierent cut bit to the
cutcondition branch in the tree.
The remaining codes are self-evident.
24
Chapter 5
Simulation
5.1 Creating MC using /example/gsim4test
This is a GEANT4 based simulation codes specic to the E14 experiment. To generate a MC, all
you have to do is type:
./bin/gsim4test macrofile.mac output.root N
event
S R
where N
event
is the number of events you want to generate,
S is a number corresponding to the seed for random generation,
R is the run number base.
For further details please review the original gsim4 manual gsim4.pdf
5.2 Access MC output
The folder under tutorial/ in the e14 directory contains codes that illustrate how to access the
MC output. Here is a sample of the various trees and their branches under a single MC le:
25
Figure 5.1: Objects you can nd in an MC le
26
And here is the tutorial codes in the tutorial folder:
1 #i ncl ude Gsi mData/Gsi mEventData . h
2 #i ncl ude Gsi mData/ Gs i mGenPar t i cl eDat a . h
3 #i ncl ude Gsi mData/Gsi mTrackData . h
4 #i ncl ude Gsi mData/ Gsi mDet ect or Event Dat a . h
5 #i ncl ude Gsi mData/ Gs i mDet ect or Hi t Dat a . h
6
7 #i ncl ude <TROOT. h>
8 #i ncl ude <TFi l e . h>
9 #i ncl ude <TTree . h>
10
11 #i ncl ude <f s t r eam>
12 #i ncl ude <i os t r eam>
13 #i ncl ude <c s t d l i b >
14 #i ncl ude <cmath>
15
16
17 i nt mai n ( i nt ar gc , char ar gv )
18 {
19
20 i f ( ar gc !=3) {
21 s t d : : c e r r << # of ar guments e r r o r . << s t d : : e ndl ;
22 r etur n 1;
23 }
24
25 char i f name = ar gv [ 1 ] ;
26 char ofname = ar gv [ 2 ] ;
27
28 Gsi mEventData ev = new Gsi mEventData ( ) ;
29 Gs i mGenPar t i cl eDat a gp = new Gs i mGenPar t i cl eDat a ( ) ;
30 Gsi mDet ect or Event Dat a det = new Gsi mDet ect or Event Dat a ( ) ;
31
32 // f i l e o p e n
33 TFi l e t f i = new TFi l e ( i f name ) ;
34
35 // s e t addr e s s
36 TTree t r = ( TTree ) t f i >Get ( event Tr ee00 ) ;
37 t r >Set Br anchAddr es s ( Event . ,&ev ) ;
38 t r >Set Br anchAddr es s ( Ge nPa r t i c l e . ,&gp ) ;
39 t r >Set Br anchAddr es s ( det . ,&det ) ; // r e p l a c e det . wi t h any
40 // de t e c t o r name , i . e . CSI .
41
42
43 TFi l e t f o = new TFi l e ( ofname , RECREATE ) ;
44 i nt i r u n ;
45 i nt i e v e n t ;
46 i nt maxID ;
47 doubl e maxE;
48 TTree t r o = new TTree ( t r o , t r o ) ;
49 t r o >Branch ( i r u n ,&i r un , i r u n / I ) ;
50 t r o >Branch ( i e v e n t ,&i e v e nt , i e v e n t / I ) ;
51 t r o >Branch ( maxID,&maxID , maxID/ I ) ;
52 t r o >Branch ( maxE,&maxE , maxE/D ) ;
53
54 I n t t nevent = I n t t ( t r >Ge t Ent r i e s ( ) ) ; // Number of e v e nt s
55
56 s t d : : cout << N e v e nt s : << nevent << s t d : : e ndl ;
57 i nt i n=i nt ( nevent /100) ;
27
58 // event l oop s t a r t
59 f or ( I n t t j e n t r y =0; j e nt r y <nevent ; j e n t r y++) {
60
61 i f ( j e n t r y%i n==0) {
62 s t d : : cout << ( j e n t r y / i n ) << % pr oc e s s e d . << s t d : : e ndl ;
63 }
64
65 I n t t i e n t r y = t r >LoadTree ( j e n t r y ) ;
66 i f ( i e n t r y < 0) break ;
67 t r >Get Ent r y ( j e n t r y ) ;
68
69 UShor t t r un number=ev>r un number ;
70 UShor t t event number=ev>event number ;
71
72 i r u n=r un number ;
73 i e v e n t=event number ;
74
75 // get nhi t and p r i n t i t
76 TCl ones Ar r ay GPArray = gp>b r i e f Tr a c k s ;
77 TCl ones Ar r ay Det Di gi Ar r ay = det>d i g i ;
78
79 i nt nGP=GPArray>Ge t Ent r i e s ( ) ;
80 i nt nDet Di gi=Det Di gi Ar r ay >Ge t Ent r i e s ( ) ;
81
82 i f (nGP>1) {
83 gp>dump ( ) ;
84 }
85
86 f or ( I n t t iGP=0; iGP<nGP; iGP++){
87 Gsi mTrackData aTrack = ( Gsi mTrackData ) GPArray>At ( iGP ) ;
88 }
89
90 maxID=1;
91 maxE=0; ;
92 f or ( I n t t i De t Di gi =0; i De t Di gi <nDet Di gi ; i De t Di gi ++){
93 Gsi mDi gi Data aDi gi = ( Gsi mDi gi Data ) Det Di gi Ar r ay >At ( i De t Di gi ) ;
94 i f ( aDi gi >ener gy>maxE) {
95 maxE=aDi gi >ener gy ;
96 maxID=aDi gi >modID;
97 }
98 }
99 t r o >F i l l ( ) ;
100 }
101 t r o >Wr i t e ( ) ;
102 t f o >Cl os e ( ) ;
103 t f i >Cl os e ( ) ;
104
105 r etur n 0;
106 }
L28-30: The code declares the previously mentioned Gsim classes. L37-39: The MC output
was generated with the Gsim data container classes, therefore we have to use the same classes to
access the data, comparing them with g. 5.1
L76-77: A pointer of type TClonesArray was created to get the data stored in the brief-
Tracks data member of GsimGenParticleData, this TClonesArray has the same structure
as GsimTrackData
28
GsimDetectorEventData also contains a TClonesArray object called digi that stores
detector data.
L87: GsimTrackData
*
aTrack was created to read the iGP
th
entry stored in the TClonesArray,
which is part of GsimGenParticleData. L93: A similar thing happens for GsimDigiData
that is part of GsimDetectorEventData
29

Vous aimerez peut-être aussi