#include #include #include #include #include struct MOCK_EVENT { double event_energy; double event_rect; double event_decl; double event_l; double event_b; double source_energy; char source_name[256]; double source_redshift; double source_rect; double source_decl; double source_l; double source_b; double event_defl; }; void Mock_File_Parser_Test(){ MOCK_EVENT mock_sample; ifstream mock_stream; TFile *mock_file = new TFile("mock_tree.root","RECREATE"); TTree *mock_tree = new TTree("T","Mock Events"); mock_tree->Branch("mock_sample", &mock_sample, "event_energy/D:event_rect/D:event_decl/D:event_l/D:event_b/D:source_energy/D:source_name/C[256]:source_redshift/D:source_rect/D:source_decl/D:source_l/D:source_b/D:event_defl/D"); mock_stream.open("test.txt"); string name; mock_stream >> mock_sample.event_energy >> mock_sample.event_rect >> mock_sample.event_decl >> mock_sample.event_l >> mock_sample.event_b >> mock_sample.source_energy >> name >> mock_sample.source_redshift >> mock_sample.source_rect >> mock_sample.source_decl >> mock_sample.source_l >> mock_sample.source_b; mock_sample.event_defl=1.; strcpy(mock_sample.source_name ,name.c_str()); mock_tree->Fill(); mock_stream.close(); mock_file->Write(); mock_file->Close(); return; }