Commit in hps-java/scripts on MAIN | |||
makeTTreeFromTxtFile.C | +21 | added 1.1 |
conv script
diff -N makeTTreeFromTxtFile.C --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ makeTTreeFromTxtFile.C 14 Nov 2013 02:43:23 -0000 1.1 @@ -0,0 +1,21 @@
+void makeTTreeFromTxtFile(const char* txtfile="../../reco/run/twotrackAnlysisTuple.txt") { + + TString file = gSystem->BaseName(txtfile); + TString outfile(file); + outfile.ReplaceAll(".txt",".root"); + TString dir = txtfile; + dir.ReplaceAll(file,""); + if(dir.Length()==0) dir = "./"; + cout << "Input file: " << file << endl; + cout << "Output file: " << outfile << endl; + cout << "output dir: " << dir << endl; + + TFile* f = new TFile(TString::Format("%s/%s",dir.Data(),outfile.Data()),"RECREATE"); + TTree* T = new TTree("tree","data from ascii file"); + Long64_t nline = T->ReadFile(txtfile,"",' '); + cout << "Read " << nline << " lines" << endl; + T->Write(); + if(f->IsOpen()) f->Close(); + + +}
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1