/[PAMELA software]/gp2root/testcashit.cpp
ViewVC logotype

Annotation of /gp2root/testcashit.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Sun Oct 22 08:27:23 2006 UTC (18 years, 1 month ago) by cafagna
Branch: MAIN
CVS Tags: v0r9, v0r10, HEAD
Changes since 1.1: +36 -25 lines
Stable version, lot of changes, ROOT support included, persistency not yet activated

1 pamela 1.1 #include <iostream>
2     #include "pEvent.h"
3 cafagna 1.2 #include "TROOT.h"
4     #include "TFile.h"
5     #include "TTree.h"
6 pamela 1.1
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 cafagna 1.2 TROOT baseapp("baseapp","My first root application");
28 pamela 1.1 test prova;
29     // pDetector pcal=pUtil::GetDet("CAL");
30 cafagna 1.2 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 pamela 1.1 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 cafagna 1.2 // prova.adesc._xout=6.+i;
45     // prova.adesc._yout=7.+i;
46     // prova.adesc._zout=8.+i;
47 pamela 1.1 prova.adesc._erel=9.+i;
48 cafagna 1.2 // 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 pamela 1.1
55     }
56     // event.AddDetector(pcal.GetName(),&pcal);
57     // pcal.Print();
58 cafagna 1.2 event->Print();
59 pamela 1.1 // pCalHit phit(prova.b);
60    
61    
62     // phit.Print();
63 cafagna 1.2 // 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 pamela 1.1 return 0;
79     }

  ViewVC Help
Powered by ViewVC 1.1.23