正在加载图片...
如何生成Ntuple数据库 subroutine readin integer nevent,pmtid 在ROOT平台 real time,charge,vect(4) gROOT->Reset(); #include "Riostream.h" parameter (nwpawc=50000,ndim=4) ifstream in; character*15 ntit(ndim) in.open("run_615026.dat"); data ntit/"nevent','pmtid','time','charge'/ Float t nevent,pmtid,time,charge; TFile *f =new TFile("run_615026.root","RECREATE"); common/pawc/h(nwpawc) TNtuple *ntuple=new TNtuple("ntuple", call hbookn(100,'Test',ndim,'',1024,ntit) "data from ascii file","nevent:pmtid:time:charge"); open(61,file='run_615026.dat') while (1){ read(61,*,end=10)nevent,pmtid,time,charge in >nevent>>pmtid >time >charge; vect(1)=nevent if (!in.good())break; ntuple->Fill(nevent,pmtid,time,charge); vect(2)=pmtid vect(3)=time in.close(); vect(4)=charge f->WriteO); root -b -q readin.C+ call hfn(100,vect) go to 1 PAW>call readin.f 10 close(61) PAW>h/fil 1 run_615026.ntuple N;cd //lun1;hrout 0;close 1 return end PAWROOT:h2root run_615026.ntuple run_615026.root10 如何生成Ntuple数据库 subroutine readin integer nevent,pmtid real time,charge,vect(4) parameter (nw pawc=50000,ndim=4) character*15 ntit(ndim) data ntit/'nevent','pmtid','time','charg e'/ common/pawc/h(nwpaw c) call hbook n(100,'Test',ndim,' ',1024,ntit) open(61,file=‘run_615026.dat') 1 read(61,*,end=10)nevent,pmtid,tim e,charge vect(1)=nevent vect(2)=pmtid vect(3)=time vect(4)=charge call hfn(100,vect) go to 1 10 clos e(61) return end { gROOT->Reset(); #include "Riostrea m.h" ifstream in; in.open("run_615026.dat”); Float_t nevent,pmtid,time,charge; TFile *f =new TFile( "run_615026.root ","RECREATE"); TNtuple *ntuple = new TNtuple("ntuple", "data from ascii file ","nevent:pmtid:time:charg e "); w hile (1) { in >> nevent >> pmtid >> time >> charge; if (!in.good()) brea k; ntuple->Fill(nevent,pmtid,time,charge); } in.close(); f->Write(); } root –b –q readin.C+ PAW>call readin.f PAW>h/fil 1 run_615026.ntuple ! N;cd //lun1;hrout 0;close 1 在ROOT平台 从PAW 到ROOT: h2root run_615026. ntu ple ru n_615026.ro o t
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有