1 |
#include <iostream> |
2 |
#include "pEvent.h" |
3 |
#include "TROOT.h" |
4 |
#include "TFile.h" |
5 |
#include "TTree.h" |
6 |
|
7 |
using std::cout; |
8 |
using std::endl; |
9 |
|
10 |
struct a{ |
11 |
int _ical; |
12 |
int _ical2; |
13 |
int _ipart; |
14 |
float _xin,_yin,_zin; |
15 |
// float _xout,_yout,_zout; |
16 |
float _erel; |
17 |
// float _time; |
18 |
// float _pathcal; |
19 |
// float _p0; |
20 |
}; |
21 |
union test { |
22 |
a adesc; |
23 |
char b[24]; |
24 |
}; |
25 |
|
26 |
int main(){ |
27 |
TROOT baseapp("baseapp","My first root application"); |
28 |
test prova; |
29 |
// pDetector pcal=pUtil::GetDet("CAL"); |
30 |
pEvent *event=new pEvent(); |
31 |
|
32 |
TFile *mf= new TFile("test.root","recreate"); |
33 |
TTree *mt=new TTree("gptree","GPAMELA Tree"); |
34 |
mt->Branch("pEvent_branch","pEvent",&event,16000,0); |
35 |
|
36 |
event->AddDetector("CAL"); |
37 |
for(int i=0; i<3; ++i){ |
38 |
prova.adesc._ipart=1+i; |
39 |
prova.adesc._ical=2+i; |
40 |
prova.adesc._ical2=22+i; |
41 |
prova.adesc._xin=3.+i; |
42 |
prova.adesc._yin=4.+i; |
43 |
prova.adesc._zin=5.+i; |
44 |
// prova.adesc._xout=6.+i; |
45 |
// prova.adesc._yout=7.+i; |
46 |
// prova.adesc._zout=8.+i; |
47 |
prova.adesc._erel=9.+i; |
48 |
// prova.adesc._time=10.+i; |
49 |
// prova.adesc._pathcal=11.+i; |
50 |
// prova.adesc._p0=12.+i; |
51 |
// pcal.AddHit(new pCalHit(prova.b)); |
52 |
// pcal.AddHit(pUtil::GetpHit(pcal.GetName(),prova.b)); |
53 |
event->AddHit("CAL",prova.b); |
54 |
|
55 |
} |
56 |
// event.AddDetector(pcal.GetName(),&pcal); |
57 |
// pcal.Print(); |
58 |
event->Print(); |
59 |
// pCalHit phit(prova.b); |
60 |
|
61 |
|
62 |
// phit.Print(); |
63 |
// cout << cid->GetIcas() << endl; |
64 |
// cout << phit.GetXin() << endl; |
65 |
// cout << phit.GetYin() << endl; |
66 |
// cout << phit.GetZin() << endl; |
67 |
// cout << phit.GetXout() << endl; |
68 |
// cout << phit.GetYout() << endl; |
69 |
// cout << phit.GetZout() << endl; |
70 |
// cout << phit.GetTime() << endl; |
71 |
// cout << phit.GetErel() << endl; |
72 |
// cout << phit.GetPath() << endl; |
73 |
// cout << phit.GetP0() << endl; |
74 |
// cout << phit.GetIpart() << endl; |
75 |
mt->Fill(); |
76 |
mf->Write(); |
77 |
mf->Close(); |
78 |
return 0; |
79 |
} |