int main(int argc, char *argv[]) { //create output file TFile outputfile("checkHitsOut.root","RECREATE"); //load the root file specified in the argument and add the tree to a TChain TChain telescope("Telescope"); telescope.Add(argv[1]); //specify what we need from the tree telescope.SetBranchStatus("*",false); telescope.SetBranchStatus("Event",true); telescope.SetBranchStatus("roc",true); telescope.SetBranchStatus("col",true); telescope.SetBranchStatus("row",true); telescope.SetBranchStatus("x",true); telescope.SetBranchStatus("y",true); //get some variables long int event; int roc, col, row; double energy, x, y; //set branch addresses telescope.SetBranchAddress("Event",&event); telescope.SetBranchAddress("roc",&roc); telescope.SetBranchAddress("energy",&energy); telescope.SetBranchAddress("col",&col); telescope.SetBranchAddress("row",&row); telescope.SetBranchAddress("x",&x); telescope.SetBranchAddress("y",&y); int temproc = -5; long int tempevent = -1; int temprow = -5; int tempcol = -5; for(int ii = 0; ii < telescope.GetEntries(); ++ii) { if(ii%1000 == 0) std::cout << "Event " << ii << std::endl; telescope.GetEntry(ii); if(event == tempevent) { if(temproc == roc) { if(tempcol == col && temprow == row) { std::cout << "double entry for " << ii << std::endl; } } else { temproc = roc; tempcol = col; temprow = row; } } else { tempevent = event; temproc = roc; } }//for loop over tree outputfile.Close(); }
int main(int argc, char *argv[]) { // parameter check if ( argc < 3 ) { std::cerr << std::endl << "Too few parameters..." << std::endl << std::endl; std::cerr << "The first parameter is the tbb dataset name." << std::endl; std::cerr << "The second parameter is the dipole itentifier. " << "(i.e. \"001002003\").\n" << " The first 3 characters are the " << "station id.\n The next 3 are the rsp id.\n The last 3 are the " << "rcu id." << std::endl; std::cerr << "The third parameter is the station group itentifier." << std::endl; std::cerr << std::endl; return DAL::FAIL; } DAL::dalDataset ds; if ( DAL::FAIL == ds.open( argv[1] ) ) std::cerr << "ERROR: couldn't open file: " << argv[1] << std::endl; std::string id = argv[2]; int start = 25; int length = 20; short data[length]; ds.read_tbb( id, start, length, data ); printf("\n"); printf("Dataset: \n"); for (int jj = 0; jj < length; jj++) { printf("%d ", data[jj]); printf("\n"); } printf("\nStation groups:\n"); std::vector<std::string> groups = ds.getGroupNames(); for (uint idx=0; idx<groups.size(); idx++) std::cerr << groups[idx] << std::endl; std::cerr << std::endl; DAL::dalArray * array = NULL; if ( DAL::FAIL == ( array = ds.openArray( argv[2], argv[3] ) ) ) std::cerr << "ERROR: couldn't open dipole: " << argv[2] << std::endl; std::cerr << "\nGetting TELESCOPE attribute from array..."; std::string telescope(""); if ( DAL::SUCCESS == ds.getAttribute( "TELESCOPE", telescope ) ) std::cerr << telescope << " ...done."; else std::cerr << "FAILED."; std::cerr << "\nGetting TIME attribute from array..."; uint time = 0; if ( DAL::SUCCESS == array->getAttribute( "TIME", time ) ) std::cerr << time << " ...done."; else std::cerr << "FAILED."; std::cerr << "\n\nClosing integer array... "; if ( DAL::SUCCESS == array->close() ) std::cerr << "done." << std::endl; else std::cerr << "FAILED."; if ( DAL::FAIL == ds.close() ) std::cerr << "ERROR: closing dataset failed\n"; std::cerr << "\nSUCCESS" << std::endl; return DAL::SUCCESS; }