37 bool using_new_version =
false;
41 TFile
file(filename,
"READ");
42 TTree *
tree = (TTree *)
file.Get(
"gRooTracker");
46 TObjString* EvtCode = 0;
57 double StdHepX4 [
kNPmax][4];
58 double StdHepP4 [
kNPmax][4];
59 double StdHepPolz [
kNPmax][3];
67 double NuParentDecP4 [4];
68 double NuParentDecX4 [4];
69 double NuParentProP4 [4];
70 double NuParentProX4 [4];
74 TBranch * brEvtFlags = tree -> GetBranch (
"EvtFlags");
75 TBranch * brEvtCode = tree -> GetBranch (
"EvtCode");
76 TBranch * brEvtNum = tree -> GetBranch (
"EvtNum");
77 TBranch * brEvtXSec = tree -> GetBranch (
"EvtXSec");
78 TBranch * brEvtDXSec = tree -> GetBranch (
"EvtDXSec");
79 TBranch * brEvtWght = tree -> GetBranch (
"EvtWght");
80 TBranch * brEvtProb = tree -> GetBranch (
"EvtProb");
81 TBranch * brEvtVtx = tree -> GetBranch (
"EvtVtx");
82 TBranch * brStdHepN = tree -> GetBranch (
"StdHepN");
83 TBranch * brStdHepPdg = tree -> GetBranch (
"StdHepPdg");
84 TBranch * brStdHepStatus = tree -> GetBranch (
"StdHepStatus");
85 TBranch * brStdHepRescat = (using_new_version) ? tree -> GetBranch (
"StdHepRescat") : 0;
86 TBranch * brStdHepX4 = tree -> GetBranch (
"StdHepX4");
87 TBranch * brStdHepP4 = tree -> GetBranch (
"StdHepP4");
88 TBranch * brStdHepPolz = tree -> GetBranch (
"StdHepPolz");
89 TBranch * brStdHepFd = tree -> GetBranch (
"StdHepFd");
90 TBranch * brStdHepLd = tree -> GetBranch (
"StdHepLd");
91 TBranch * brStdHepFm = tree -> GetBranch (
"StdHepFm");
92 TBranch * brStdHepLm = tree -> GetBranch (
"StdHepLm");
93 TBranch * brG2NeutEvtCode = (using_new_version) ? tree -> GetBranch (
"G2NeutEvtCode") : 0;
94 TBranch * brNuParentPdg = tree -> GetBranch (
"NuParentPdg");
95 TBranch * brNuParentDecMode = tree -> GetBranch (
"NuParentDecMode");
96 TBranch * brNuParentDecP4 = tree -> GetBranch (
"NuParentDecP4");
97 TBranch * brNuParentDecX4 = tree -> GetBranch (
"NuParentDecX4");
98 TBranch * brNuParentProP4 = tree -> GetBranch (
"NuParentProP4");
99 TBranch * brNuParentProX4 = tree -> GetBranch (
"NuParentProX4");
100 TBranch * brNuParentProNVtx = tree -> GetBranch (
"NuParentProNVtx");
103 brEvtFlags -> SetAddress ( &EvtFlags );
104 brEvtCode -> SetAddress ( &EvtCode );
105 brEvtNum -> SetAddress ( &EvtNum );
106 brEvtXSec -> SetAddress ( &EvtXSec );
107 brEvtDXSec -> SetAddress ( &EvtDXSec );
108 brEvtWght -> SetAddress ( &EvtWght );
109 brEvtProb -> SetAddress ( &EvtProb );
110 brEvtVtx -> SetAddress ( EvtVtx );
111 brStdHepN -> SetAddress ( &StdHepN );
112 brStdHepPdg -> SetAddress ( StdHepPdg );
113 brStdHepStatus -> SetAddress ( StdHepStatus );
114 if(using_new_version) {
115 brStdHepRescat -> SetAddress ( StdHepRescat );
117 brStdHepX4 -> SetAddress ( StdHepX4 );
118 brStdHepP4 -> SetAddress ( StdHepP4 );
119 brStdHepPolz -> SetAddress ( StdHepPolz );
120 brStdHepFd -> SetAddress ( StdHepFd );
121 brStdHepLd -> SetAddress ( StdHepLd );
122 brStdHepFm -> SetAddress ( StdHepFm );
123 brStdHepLm -> SetAddress ( StdHepLm );
124 if(using_new_version) {
125 brG2NeutEvtCode -> SetAddress ( &G2NeutEvtCode );
127 brNuParentPdg -> SetAddress ( &NuParentPdg );
128 brNuParentDecMode -> SetAddress ( &NuParentDecMode );
129 brNuParentDecP4 -> SetAddress ( NuParentDecP4 );
130 brNuParentDecX4 -> SetAddress ( NuParentDecX4 );
131 brNuParentProP4 -> SetAddress ( NuParentProP4 );
132 brNuParentProX4 -> SetAddress ( NuParentProX4 );
133 brNuParentProNVtx -> SetAddress ( &NuParentProNVtx );
135 int n = tree->GetEntries();
136 printf(
"Number of entries: %d", n);
140 for(
int i=0;
i < tree->GetEntries();
i++) {
141 printf(
"\n\n ** Current entry: %d \n",
i);
144 printf(
"\n -----------------------------------------------------------------------------------------------------------------");
145 printf(
"\n Event code : %s", EvtCode->String().Data());
146 printf(
"\n Event x-section : %10.5f * 1E-38* cm^2", EvtXSec);
147 printf(
"\n Event kinematics x-section : %10.5f * 1E-38 * cm^2/{K^n}", EvtDXSec);
148 printf(
"\n Event weight : %10.8f", EvtWght);
149 printf(
"\n Event vertex : x = %8.2f mm, y = %8.2f mm, z = %8.2f mm", EvtVtx[0], EvtVtx[1], EvtVtx[2]);
150 printf(
"\n *Particle list:");
151 printf(
"\n --------------------------------------------------------------------------------------------------------------------------");
152 printf(
"\n | Idx | Ist | PDG | Rescat | Mother | Daughter | Px | Py | Pz | E | x | y | z |");
153 printf(
"\n | | | | | | |(GeV/c) |(GeV/c) |(GeV/c) | (GeV) | (fm) | (fm) | (fm) |");
154 printf(
"\n --------------------------------------------------------------------------------------------------------------------------");
156 for(
int ip=0;
ip<StdHepN;
ip++) {
157 printf(
"\n | %3d | %3d | %10d | %6d | %3d | %3d | %3d | %3d | %6.3f | %6.3f | %6.3f | %6.3f | %6.3f | %6.3f | %6.3f |",
158 ip, StdHepStatus[
ip], StdHepPdg[ip], StdHepRescat[ip],
159 StdHepFm[ip], StdHepLm[ip], StdHepFd[ip], StdHepLd[ip],
160 StdHepP4[ip][0], StdHepP4[ip][1], StdHepP4[ip][2], StdHepP4[ip][3],
161 StdHepX4[ip][0], StdHepX4[ip][1], StdHepX4[ip][2]);
163 printf(
"\n --------------------------------------------------------------------------------------------------------------------------");
164 printf(
"\n *Flux Info:");
165 printf(
"\n Parent hadron pdg code : %d", NuParentPdg);
166 printf(
"\n Parent hadron decay mode : %d", NuParentDecMode);
167 printf(
"\n Parent hadron 4p at decay : Px = %6.3f GeV/c, Py = %6.3f GeV/c, Pz = %6.3f GeV/c, E = %6.3f GeV",
168 NuParentDecP4[0], NuParentDecP4[1], NuParentDecP4[2], NuParentDecP4[3]);
169 printf(
"\n Parent hadron 4p at prod. : Px = %6.3f GeV/c, Py = %6.3f GeV/c, Pz = %6.3f GeV/c, E = %6.3f GeV",
170 NuParentProP4[0], NuParentProP4[1], NuParentProP4[2], NuParentProP4[3]);
171 printf(
"\n Parent hadron 4x at decay : x = %6.3f m, y = %6.3f m, z = %6.3f m, t = %6.3f s",
172 NuParentDecX4[0], NuParentDecX4[1], NuParentDecX4[2], NuParentDecX4[3]);
173 printf(
"\n Parent hadron 4x at prod. : x = %6.3f m, y = %6.3f m, z = %6.3f m, t = %6.3f s",
174 NuParentProX4[0], NuParentProX4[1], NuParentProX4[2], NuParentProX4[3]);
175 printf(
"\n -------------------------------------------------------------------------------------------------------------------------- \n");
*file AnalysisTree_module cc *brief Module to create a TTree for analysis *authors tjyang fnal sowjanyag phys ksu edu **Taken from uboone code Imported by Karl k warburton sheffield ac uk *with the help of Tingjun Yang **Current implementation with one set of branches for each tracking algorithm *The data structure which hosts the addresses of the tree branches is *dynamically allocated on and it can be optionally destroyed at the *end of each event *The data and it is contained in a C vector of *one per algorithm These structures can also be allocated on demand *Each of these structures is connected to a set of one branch per *data member Data members are vectors of numbers or vectors of fixed size *C arrays The vector index represents the tracks reconstructed by the and each has a fixed size pool for connect to a *ROOT tree(creating the branches they need) and resize.*The AnalysisTreeDataStruct is const ructed with as many tracking algorithms as *there are named in the module configuration(even if they are not backed by *any available tracking data).*By default const ruction
< separator(=)> module_type Type Source location< separator(-)> DummyAnalyzer analyzer< path > DummyAnalyzer_module cc DummyFilter filter< path > DummyFilter_module cc *DummyProducer producer< path > DummyProducer_module cc *DummyProducer producer< path > DummyProducer_module cc< separator(=)> The modules marked *above are degenerate i e specifying the short module_type value leads to an ambiguity In order to use a degenerate in your configuration file