16 fiTQun->SetBranchStatus(
"*", 1);
17 fiTQun->SetBranchStatus(
"fq*pos*",0);
18 fiTQun->SetBranchStatus(
"fq*dir*",0);
19 fiTQunCv = fiTQun->CloneTree();
20 fiTQun->CopyAddresses(fiTQunCv, kTRUE);
23 fiTQun->SetBranchStatus(
"fq*pos*",1);
24 fiTQun->SetBranchStatus(
"fq*dir*",1);
27 const Int_t MAX_TEMP = 100;
29 Float_t fqtwnd_prftpos[MAX_TEMP][3];
30 Float_t fqtwnd_prftposCv[MAX_TEMP][3];
32 Float_t fq1rpos[MAX_TEMP][7][3];
33 Float_t fq1rposCv[MAX_TEMP][7][3];
34 Float_t fq1rdir[MAX_TEMP][7][3];
35 Float_t fq1rdirCv[MAX_TEMP][7][3];
36 Float_t fqpi0pos[2][3];
37 Float_t fqpi0posCv[2][3];
38 Float_t fqpi0dir1[2][3];
39 Float_t fqpi0dir1Cv[2][3];
40 Float_t fqpi0dir2[2][3];
41 Float_t fqpi0dir2Cv[2][3];
42 Float_t fqpi0dirtot[2][3];
43 Float_t fqpi0dirtotCv[2][3];
45 Float_t fqmrpos[MAX_TEMP][6][3];
46 Float_t fqmrposCv[MAX_TEMP][6][3];
47 Float_t fqmrdir[MAX_TEMP][6][3];
48 Float_t fqmrdirCv[MAX_TEMP][6][3];
50 Float_t fqmspos[MAX_TEMP][20][3];
51 Float_t fqmsposCv[MAX_TEMP][20][3];
52 Float_t fqmsdir[MAX_TEMP][20][3];
53 Float_t fqmsdirCv[MAX_TEMP][20][3];
55 Float_t fqtest1rpos[MAX_TEMP][3];
56 Float_t fqtest1rposCv[MAX_TEMP][3];
57 Float_t fqtest1rdir[MAX_TEMP][3];
58 Float_t fqtest1rdirCv[MAX_TEMP][3];
60 Float_t fqtestpi0pos[MAX_TEMP][3];
61 Float_t fqtestpi0posCv[MAX_TEMP][3];
62 Float_t fqtestpi0dir1[MAX_TEMP][3];
63 Float_t fqtestpi0dir1Cv[MAX_TEMP][3];
64 Float_t fqtestpi0dir2[MAX_TEMP][3];
65 Float_t fqtestpi0dir2Cv[MAX_TEMP][3];
66 Float_t fqtestpi0dirtot[MAX_TEMP][3];
67 Float_t fqtestpi0dirtotCv[MAX_TEMP][3];
70 TBranch *bfqtwnd_prftpos = fiTQunCv->Branch(
"fqtwnd_prftpos",fqtwnd_prftposCv,
"fqtwnd_prftpos[fqntwnd][3]/F");
71 TBranch *bfq1rpos = fiTQunCv->Branch(
"fq1rpos",fq1rposCv,
"fq1rpos[fqnse][7][3]/F");
72 TBranch *bfq1rdir = fiTQunCv->Branch(
"fq1rdir",fq1rdirCv,
"fq1rdir[fqnse][7][3]/F");
73 TBranch *bfqpi0pos = fiTQunCv->Branch(
"fqpi0pos",fqpi0posCv,
"fqpi0pos[2][3]/F");
74 TBranch *bfqpi0dir1 = fiTQunCv->Branch(
"fqpi0dir1",fqpi0dir1Cv,
"fqpi0dir1[2][3]/F");
75 TBranch *bfqpi0dir2 = fiTQunCv->Branch(
"fqpi0dir2",fqpi0dir2Cv,
"fqpi0dir2[2][3]/F");
76 TBranch *bfqpi0dirtot = fiTQunCv->Branch(
"fqpi0dirtot",fqpi0dirtotCv,
"fqpi0dirtot[2][3]/F");
77 TBranch *bfqmrpos = fiTQunCv->Branch(
"fqmrpos",fqmrposCv,
"fqmrpos[fqnmrfit][6][3]/F");
78 TBranch *bfqmrdir = fiTQunCv->Branch(
"fqmrdir",fqmrdirCv,
"fqmrdir[fqnmrfit][6][3]/F");
79 TBranch *bfqmspos = fiTQunCv->Branch(
"fqmspos",fqmsposCv,
"fqmspos[fqmsnfit][20][3]/F");
80 TBranch *bfqmsdir = fiTQunCv->Branch(
"fqmsdir",fqmsdirCv,
"fqmsdir[fqmsnfit][20][3]/F");
81 TBranch *bfqtest1rpos = fiTQunCv->Branch(
"fqtest1rpos",fqtest1rposCv,
"fqtest1rpos[fqtestn1r][3]/F");
82 TBranch *bfqtest1rdir = fiTQunCv->Branch(
"fqtest1rdir",fqtest1rdirCv,
"fqtest1rdir[fqtestn1r][3]/F");
83 TBranch *bfqtestpi0pos = fiTQunCv->Branch(
"fqtestpi0pos",fqtestpi0posCv,
"fqtestpi0pos[fqtestnpi0][3]/F");
84 TBranch *bfqtestpi0dir1 = fiTQunCv->Branch(
"fqtestpi0dir1",fqtestpi0dir1Cv,
"fqtestpi0dir1[fqtestnpi0][3]/F");
85 TBranch *bfqtestpi0dir2 = fiTQunCv->Branch(
"fqtestpi0dir2",fqtestpi0dir2Cv,
"fqtestpi0dir2[fqtestnpi0][3]/F");
86 TBranch *bfqtestpi0dirtot = fiTQunCv->Branch(
"fqtestpi0dirtot",fqtestpi0dirtotCv,
"fqtestpi0dirtot[fqtestnpi0][3]/F");
87 fiTQun->SetBranchAddress(
"fqntwnd", &fqntwnd);
88 fiTQun->SetBranchAddress(
"fqtwnd_prftpos", &fqtwnd_prftpos);
89 fiTQun->SetBranchAddress(
"fqnse", &fqnse);
90 fiTQun->SetBranchAddress(
"fq1rpos", &fq1rpos);
91 fiTQun->SetBranchAddress(
"fq1rdir", &fq1rdir);
92 fiTQun->SetBranchAddress(
"fqpi0pos", &fqpi0pos);
93 fiTQun->SetBranchAddress(
"fqpi0dir1", &fqpi0dir1);
94 fiTQun->SetBranchAddress(
"fqpi0dir2", &fqpi0dir2);
95 fiTQun->SetBranchAddress(
"fqpi0dirtot", &fqpi0dirtot);
96 fiTQun->SetBranchAddress(
"fqnmrfit", &fqnmrfit);
97 fiTQun->SetBranchAddress(
"fqmrpos", &fqmrpos);
98 fiTQun->SetBranchAddress(
"fqmrdir", &fqmrdir);
99 fiTQun->SetBranchAddress(
"fqmsnfit", &fqmsnfit);
100 fiTQun->SetBranchAddress(
"fqmspos", &fqmspos);
101 fiTQun->SetBranchAddress(
"fqmsdir", &fqmsdir);
102 fiTQun->SetBranchAddress(
"fqtestn1r", &fqtestn1r);
103 fiTQun->SetBranchAddress(
"fqtest1rpos", &fqtest1rpos);
104 fiTQun->SetBranchAddress(
"fqtest1rdir", &fqtest1rdir);
105 fiTQun->SetBranchAddress(
"fqtestnpi0", &fqtestnpi0);
106 fiTQun->SetBranchAddress(
"fqtestpi0pos", &fqtestpi0pos);
107 fiTQun->SetBranchAddress(
"fqtestpi0dir1", &fqtestpi0dir1);
108 fiTQun->SetBranchAddress(
"fqtestpi0dir2", &fqtestpi0dir2);
109 fiTQun->SetBranchAddress(
"fqtestpi0dirtot", &fqtestpi0dirtot);
112 int fqEntries = fiTQun->GetEntries();
114 double offset = 2151.035;
118 for (
int entry=0;entry<fqEntries;entry++) {
119 fiTQun->GetEntry(entry);
121 for (
int i=0;
i<fqntwnd;
i++) {
122 for (
int axis=0;axis<3;axis++) {
124 fqtwnd_prftposCv[
i][0] = fqtwnd_prftpos[
i][axis];
125 }
else if (axis == 1) {
126 fqtwnd_prftposCv[
i][1] = fqtwnd_prftpos[
i][axis];
127 }
else if (axis == 2) {
128 fqtwnd_prftposCv[
i][2] = fqtwnd_prftpos[
i][axis];
133 for (
int i=0;
i<fqnse;
i++) {
134 for (
int j=0;
j<7;
j++) {
135 for (
int axis=0;axis<3;axis++) {
137 fq1rposCv[
i][
j][0] = fq1rpos[
i][
j][axis];
138 fq1rdirCv[
i][
j][0] = fq1rdir[
i][
j][axis];
139 }
else if (axis == 1) {
140 fq1rposCv[
i][
j][1] = fq1rpos[
i][
j][axis];
141 fq1rdirCv[
i][
j][1] = fq1rdir[
i][
j][axis];
142 }
else if (axis == 2) {
143 fq1rposCv[
i][
j][2] = fq1rpos[
i][
j][axis];
144 fq1rdirCv[
i][
j][2] = fq1rdir[
i][
j][axis];
150 for (
int i=0;
i<2;
i++) {
151 for (
int axis=0;axis<3;axis++) {
153 fqpi0posCv[
i][0] = fqpi0pos[
i][axis];
154 fqpi0dir1Cv[
i][0] = fqpi0dir1[
i][axis];
155 fqpi0dir2Cv[
i][0] = fqpi0dir2[
i][axis];
156 fqpi0dirtotCv[
i][0] = fqpi0dirtot[
i][axis];
157 }
else if (axis == 1) {
158 fqpi0posCv[
i][1] = fqpi0pos[
i][axis];
159 fqpi0dir1Cv[
i][1] = fqpi0dir1[
i][axis];
160 fqpi0dir2Cv[
i][1] = fqpi0dir2[
i][axis];
161 fqpi0dirtotCv[
i][1] = fqpi0dirtot[
i][axis];
162 }
else if (axis == 2) {
163 fqpi0posCv[
i][2] = fqpi0pos[
i][axis];
164 fqpi0dir1Cv[
i][2] = fqpi0dir1[
i][axis];
165 fqpi0dir2Cv[
i][2] = fqpi0dir2[
i][axis];
166 fqpi0dirtotCv[
i][2] = fqpi0dirtot[
i][axis];
171 for (
int i=0;
i<fqnmrfit;
i++) {
172 for (
int j=0;
j<6;
j++) {
173 for (
int axis=0;axis<3;axis++) {
175 fqmrposCv[
i][
j][0] = fqmrpos[
i][
j][axis];
176 fqmrdirCv[
i][
j][0] = fqmrdir[
i][
j][axis];
177 }
else if (axis == 1) {
178 fqmrposCv[
i][
j][1] = fqmrpos[
i][
j][axis];
179 fqmrdirCv[
i][
j][1] = fqmrdir[
i][
j][axis];
180 }
else if (axis == 2) {
181 fqmrposCv[
i][
j][2] = fqmrpos[
i][
j][axis];
182 fqmrdirCv[
i][
j][2] = fqmrdir[
i][
j][axis];
188 for (
int i=0;
i<fqmsnfit;
i++) {
189 for (
int j=0;
j<20;
j++) {
190 for (
int axis=0;axis<3;axis++) {
192 fqmsposCv[
i][
j][0] = fqmspos[
i][
j][axis];
193 fqmsdirCv[
i][
j][0] = fqmsdir[
i][
j][axis];
194 }
else if (axis == 1) {
195 fqmsposCv[
i][
j][1] = fqmspos[
i][
j][axis];
196 fqmsdirCv[
i][
j][1] = fqmsdir[
i][
j][axis];
197 }
else if (axis == 2) {
198 fqmsposCv[
i][
j][2] = fqmspos[
i][
j][axis];
199 fqmsdirCv[
i][
j][2] = fqmsdir[
i][
j][axis];
205 for (
int i=0;
i<fqtestn1r;
i++) {
206 for (
int axis=0;axis<3;axis++) {
208 fqtest1rposCv[
i][0] = fqtest1rpos[
i][axis];
209 fqtest1rdirCv[
i][0] = fqtest1rdir[
i][axis];
210 }
else if (axis == 1) {
211 fqtest1rposCv[
i][1] = fqtest1rpos[
i][axis];
212 fqtest1rdirCv[
i][1] = fqtest1rdir[
i][axis];
213 }
else if (axis == 2) {
214 fqtest1rposCv[
i][2] = fqtest1rpos[
i][axis];
215 fqtest1rdirCv[
i][2] = fqtest1rdir[
i][axis];
220 for (
int i=0;
i<fqtestnpi0;
i++) {
221 for (
int axis=0;axis<3;axis++) {
223 fqtestpi0posCv[
i][0] = fqtestpi0pos[
i][axis];
224 fqtestpi0dir1Cv[
i][0] = fqtestpi0dir1[
i][axis];
225 fqtestpi0dir2Cv[
i][0] = fqtestpi0dir2[
i][axis];
226 fqtestpi0dirtotCv[
i][0] = fqtestpi0dirtot[
i][axis];
227 }
else if (axis == 1) {
228 fqtestpi0posCv[
i][1] = fqtestpi0pos[
i][axis];
229 fqtestpi0dir1Cv[
i][1] = fqtestpi0dir1[
i][axis];
230 fqtestpi0dir2Cv[
i][1] = fqtestpi0dir2[
i][axis];
231 fqtestpi0dirtotCv[
i][1] = fqtestpi0dirtot[
i][axis];
232 }
else if (axis == 2) {
233 fqtestpi0posCv[
i][2] = fqtestpi0pos[
i][axis];
234 fqtestpi0dir1Cv[
i][2] = fqtestpi0dir1[
i][axis];
235 fqtestpi0dir2Cv[
i][2] = fqtestpi0dir2[
i][axis];
236 fqtestpi0dirtotCv[
i][2] = fqtestpi0dirtot[
i][axis];
241 bfqtwnd_prftpos->Fill();
247 bfqpi0dirtot->Fill();
252 bfqtest1rpos->Fill();
253 bfqtest1rdir->Fill();
254 bfqtestpi0pos->Fill();
255 bfqtestpi0dir1->Fill();
256 bfqtestpi0dir2->Fill();
257 bfqtestpi0dirtot->Fill();
260 fiTQunCv->Write(
"",TObject::kOverwrite);
273 wcsimT->SetBranchAddress(
"wcsimrootevent" ,&wcsimrootEvent);
276 const Int_t maxtrack = 200;
278 Int_t parent[maxtrack];
280 Double_t dir[maxtrack][4];
281 Double_t start[maxtrack][4];
282 Double_t stop[maxtrack][4];
283 Double_t mom[maxtrack];
284 Double_t mass[maxtrack];
285 Double_t
energy[maxtrack];
286 Double_t startvol[maxtrack];
287 Double_t stopvol[maxtrack];
288 Double_t
time[maxtrack];
291 wcsimEx->Branch(
"ntrack",&ntrack,
"ntrack/I");
292 wcsimEx->Branch(
"parent",parent,
"parent[ntrack]/I");
293 wcsimEx->Branch(
"pid",
pid,
"pid[ntrack]/I");
294 wcsimEx->Branch(
"dir",dir,
"dir[ntrack][4]/D");
295 wcsimEx->Branch(
"start",start,
"start[ntrack][4]/D");
296 wcsimEx->Branch(
"stop",stop,
"stop[ntrack][4]/D");
297 wcsimEx->Branch(
"mom",mom,
"mom[ntrack]/D");
298 wcsimEx->Branch(
"mass",mass,
"mass[ntrack]/D");
299 wcsimEx->Branch(
"energy",
energy,
"energy[ntrack]/D");
300 wcsimEx->Branch(
"startvol",startvol,
"startvol[ntrack]/D");
301 wcsimEx->Branch(
"stopvol",stopvol,
"stopvol[ntrack]/D");
302 wcsimEx->Branch(
"time",
time,
"time[ntrack]/D");
305 int Entries = wcsimT->GetEntries();
306 for (
int ev=0; ev<Entries; ev++) {
307 wcsimT->GetEvent(ev);
308 wcsimrootTrigger = wcsimrootEvent->
GetTrigger(0);
313 for (
int par=0; par<ntrack; par++) {
317 for (
int axis=0;axis<4;axis++) {
319 start[par][0] = wcsimroottrack->
GetStart(axis)/100;
320 stop[par][0] = wcsimroottrack->
GetStop(axis)/100;
321 dir[par][0] = wcsimroottrack->
GetDir(axis);
322 }
else if (axis == 1) {
323 start[par][1] = wcsimroottrack->
GetStart(axis)/100;
324 stop[par][1] = wcsimroottrack->
GetStop(axis)/100;
325 dir[par][1] = wcsimroottrack->
GetDir(axis);
326 }
else if (axis == 2) {
327 start[par][2] = wcsimroottrack->
GetStart(axis)/100;
328 stop[par][2] = wcsimroottrack->
GetStop(axis)/100;
329 dir[par][2] = wcsimroottrack->
GetDir(axis);
330 }
else if (axis == 3) {
331 start[par][3] = wcsimroottrack->
GetStart(axis)/100;
332 stop[par][3] = wcsimroottrack->
GetStop(axis)/100;
333 dir[par][3] = wcsimroottrack->
GetDir(axis);
338 mom[par]=wcsimroottrack->
GetP();
339 mass[par]=wcsimroottrack->
GetM();
350 wcsimEx->Write(
"",TObject::kOverwrite);
357 char *outfilename = output;
359 bool useFiTQun = dofiTQun;
362 if (!
file->IsOpen()){
363 std::cout <<
"Error, could not open input file: " <<
filename << std::endl;
368 TFile* outFile = TFile::Open(outfilename,
"RECREATE");
369 TTree* fiTQunCv =
new TTree(
"fiTQunCv",
"fiTQun Converted Geometry");
370 TTree* wcsimEx =
new TTree(
"wcsimEx",
"Converted Particle Info");
373 TTree* wcsimT = (TTree*)
file->Get(
"wcsimT");
374 TTree* wcsimGeoT = (TTree*)
file->Get(
"wcsimGeoT");
375 TTree* fiTQun = (TTree*)
file->Get(
"fiTQun");
376 TTree* Settings = (TTree*)
file->Get(
"Settings");
383 newEventTree = wcsimT->CloneTree();
384 newGeomTree = wcsimGeoT->CloneTree();
386 newSettings = Settings->CloneTree();
395 newEventTree->Write();
396 newGeomTree->Write();
398 newSettings->Write();
void convertfiTQun(TTree *fiTQun, TTree *fiTQunCv)
Float_t GetStop(Int_t i=0) const
int convertNuPrism(char *input, char *output, bool dofiTQun=0, bool copy=0)
TClonesArray * GetTracks() const
Float_t GetDir(Int_t i=0) const
Int_t GetParenttype() const
Float_t GetStart(Int_t i=0) const
Class storing trigger information.
WCSimRootTrigger * GetTrigger(int number)
Int_t GetStartvol() const
Class containing event information.
void extractTruth(TTree *wcsimT, TTree *wcsimEx)
Class holding true track information.