#include #include "pEvent.h" #include "TROOT.h" #include "TFile.h" #include "TTree.h" using std::cout; using std::endl; struct a{ int _ical; int _ical2; int _ipart; float _xin,_yin,_zin; // float _xout,_yout,_zout; float _erel; // float _time; // float _pathcal; // float _p0; }; union test { a adesc; char b[24]; }; int main(){ TROOT baseapp("baseapp","My first root application"); test prova; // pDetector pcal=pUtil::GetDet("CAL"); pEvent *event=new pEvent(); TFile *mf= new TFile("test.root","recreate"); TTree *mt=new TTree("gptree","GPAMELA Tree"); mt->Branch("pEvent_branch","pEvent",&event,16000,0); event->AddDetector("CAL"); for(int i=0; i<3; ++i){ prova.adesc._ipart=1+i; prova.adesc._ical=2+i; prova.adesc._ical2=22+i; prova.adesc._xin=3.+i; prova.adesc._yin=4.+i; prova.adesc._zin=5.+i; // prova.adesc._xout=6.+i; // prova.adesc._yout=7.+i; // prova.adesc._zout=8.+i; prova.adesc._erel=9.+i; // prova.adesc._time=10.+i; // prova.adesc._pathcal=11.+i; // prova.adesc._p0=12.+i; // pcal.AddHit(new pCalHit(prova.b)); // pcal.AddHit(pUtil::GetpHit(pcal.GetName(),prova.b)); event->AddHit("CAL",prova.b); } // event.AddDetector(pcal.GetName(),&pcal); // pcal.Print(); event->Print(); // pCalHit phit(prova.b); // phit.Print(); // cout << cid->GetIcas() << endl; // cout << phit.GetXin() << endl; // cout << phit.GetYin() << endl; // cout << phit.GetZin() << endl; // cout << phit.GetXout() << endl; // cout << phit.GetYout() << endl; // cout << phit.GetZout() << endl; // cout << phit.GetTime() << endl; // cout << phit.GetErel() << endl; // cout << phit.GetPath() << endl; // cout << phit.GetP0() << endl; // cout << phit.GetIpart() << endl; mt->Fill(); mf->Write(); mf->Close(); return 0; }