1 |
// |
2 |
// this include is needed to read tracker NTUPLES |
3 |
// |
4 |
#include <ctrkstruct.h> |
5 |
// |
6 |
// how to open and read the tracker LEVEL1 NTUPLE from ROOT |
7 |
// |
8 |
void trktesting(TString filename){ |
9 |
TString startingdir = gSystem->WorkingDirectory(); |
10 |
char *bdir; |
11 |
char *sdir=gSystem->Getenv("PAM_LIB"); |
12 |
bdir = Form("%s/liboptrklev1.so",sdir); |
13 |
gSystem->Load(bdir); |
14 |
bdir = Form("%s/liboptrklev1_C.so",sdir); |
15 |
gSystem->Load(bdir); |
16 |
bdir = Form("%s/libretrklev1.so",sdir); |
17 |
gSystem->Load(bdir); |
18 |
bdir = Form("%s/libretrklev1_C.so",sdir); |
19 |
gSystem->Load(bdir); |
20 |
bdir = Form("%s/libcltrklev1.so",sdir); |
21 |
gSystem->Load(bdir); |
22 |
bdir = Form("%s/libcltrklev1_C.so",sdir); |
23 |
gSystem->Load(bdir); |
24 |
Int_t trnev = 0; |
25 |
struct Tracklev1 trklev1; |
26 |
char *name; |
27 |
name = filename; |
28 |
// |
29 |
coptrklev1(name,trklev1,trnev); |
30 |
// |
31 |
printf("The tracker ntuple contains %i events\n",trnev); |
32 |
for ( Int_t i = 1; i < trnev+1; i++){ |
33 |
cretrklev1(i,trklev1); |
34 |
printf("Event number %i ---> OBT %i \n",i,trklev1.obt1); |
35 |
printf(" ---> PKTnum %i \n",trklev1.pkt_num1); |
36 |
printf(" ---> PKTtype %x \n",trklev1.pkt_type1); |
37 |
printf(" ---> nev1 %i \n",trklev1.nev1); |
38 |
printf(" ---> good %i \n",trklev1.good1); |
39 |
printf(" ---> nclstr %i \n",trklev1.nclstr1); |
40 |
}; |
41 |
ccltrklev1(trklev1); |
42 |
} |
43 |
|
44 |
// |
45 |
// how to open and read the tracker LEVEL2 NTUPLE from ROOT |
46 |
// |
47 |
void trktesting2(TString filename){ |
48 |
TString startingdir = gSystem->WorkingDirectory(); |
49 |
char *bdir; |
50 |
char *sdir; |
51 |
sdir = startingdir; |
52 |
bdir = Form("%s/tracker/liboptrklev2.so",sdir); |
53 |
gSystem->Load(bdir); |
54 |
bdir = Form("%s/tracker/coptrklev2_C.so",sdir); |
55 |
gSystem->Load(bdir); |
56 |
bdir = Form("%s/tracker/libretrklev2.so",sdir); |
57 |
gSystem->Load(bdir); |
58 |
bdir = Form("%s/tracker/cretrklev2_C.so",sdir); |
59 |
gSystem->Load(bdir); |
60 |
bdir = Form("%s/tracker/libcltrklev2.so",sdir); |
61 |
gSystem->Load(bdir); |
62 |
bdir = Form("%s/tracker/ccltrklev2_C.so",sdir); |
63 |
gSystem->Load(bdir); |
64 |
Int_t trnev = 0; |
65 |
struct Tracklev2 trklev2; |
66 |
char *name; |
67 |
name = filename; |
68 |
coptrklev2(name,trklev2,trnev); |
69 |
printf("The tracker ntuple contains %i events\n",trnev); |
70 |
for ( Int_t i = 1; i < trnev+1; i++){ |
71 |
cretrklev2(i,trklev2); |
72 |
printf("Event number %i ---> OBT %i \n",i,trklev2.obt); |
73 |
printf(" ---> PKTnum %i \n",trklev2.pkt_num); |
74 |
printf(" ---> PKTtype %x \n",trklev2.pkt_type); |
75 |
printf(" ---> nev2 %i \n",trklev2.nev2); |
76 |
printf(" ---> good2 %i \n",trklev2.good2); |
77 |
printf(" ---> ntrk %i \n",trklev2.ntrk); |
78 |
if ( trklev2.ntrk == 1 && trklev2.al[0][4] != 0. ) printf("c-> RIG = %.9f \n",1./trklev2.al[0][4]); |
79 |
}; |
80 |
ccltrklev2(trklev2); |
81 |
} |
82 |
|
83 |
|
84 |
|
85 |
|
86 |
// |
87 |
// this include is needed to read tracker ROOTPLES |
88 |
// |
89 |
#include <ctrkinclude.h> |
90 |
// |
91 |
// how to open and read the tracker LEVEL2 ROOTPLE from ROOT |
92 |
// |
93 |
void trkhtestlev2(TString filename){ |
94 |
TFile *f = getFile(filename,"Physics.Level2","Tracker"); |
95 |
TTree *tr = (TTree*) f->Get("TrkLevel2"); |
96 |
struct Tracklev2 trk; |
97 |
struct CTracklev2 track; |
98 |
// |
99 |
// settrklev2 allows you to have all variables in trk.nameofvariable |
100 |
// BUT all matrixes have columns inverted with rows (instead of al[5][ntrk] you have al[ntrk][5]). |
101 |
// |
102 |
settrklev2(tr,trk); |
103 |
Int_t nevents = tr->GetEntries(); |
104 |
for ( Int_t i = 0; i<nevents ; i++){ |
105 |
tr->GetEntry(i); |
106 |
// |
107 |
// accesstrklev2 put in trak.nameofvariable the same variables you have in trk but with |
108 |
// matrixes in the correct order. You can skip this accesstrklev2 and use directly trk instead of track |
109 |
// but you must remember to invert all matrixes columns and rows. |
110 |
// |
111 |
accesstrklev2(trk,track); |
112 |
printf("Event %i tracker OBT = %i \n",i,track.obt); |
113 |
if ( track.ntrk>0 ) printf("Event %i tracker RIG = %f \n",i,1./track.al[4][0]); |
114 |
}; |
115 |
} |
116 |
|
117 |
// |
118 |
// how to open and read the tracker LEVEL1 ROOTPLE from ROOT |
119 |
// |
120 |
void trkhtest(TString filename){ |
121 |
TFile *f = getFile(filename,"Physics.Level1","Tracker"); |
122 |
TTree *tr = (TTree*) f->Get("TrkLevel1"); |
123 |
struct Tracklev1 trk; |
124 |
struct CTracklev1 track; |
125 |
settrklev1(tr,trk); |
126 |
Int_t nevents = tr->GetEntries(); |
127 |
for ( Int_t i = 0; i<nevents ; i++){ |
128 |
tr->GetEntry(i); |
129 |
accesstrklev1(trk,track); |
130 |
printf("Event %i tracker OBT1 = %i \n",i,track.obt1); |
131 |
}; |
132 |
} |
133 |
|
134 |
|