// // This file primarly test the array indexing capability // of HepNtuples // #include #include void indexWrite(HepNtuple& tuple); void indexRead(HepNtuple& tuple); int main (int argc, Int1* argv[]) { HepFileManager* manager = new HepHBookFileManager("index.rz"); HepNtuple& hep = manager->ntuple("indexed",1); hep.setColumnWise(); indexWrite(hep); indexRead(hep); delete manager; return 0; } void indexWrite(HepNtuple& tuple) { // create default value and value holders. Int4 indexDefault = 0; Int4 intDefault = 99; Int4 indexVal = true; Int4 intVal[10]; // Construct the HepNtuple. tuple.columnAt("index",&indexVal).span(1,10); tuple.columnAt("array",&intVal).dimenstion(10).index("index"); // Capture for (indexVal = 2; indexVal < 7 ; i++ ) { for ( int j = 0; j < indexVal; j++ ) { intVal[j] = indexVal*(j+1); } for ( int j = indexVal; j < 10; j++ ) { intVal[j] = 77; } tuple.captureThenStore(); } } void indexRead(HepNtuple& tuple) { Int4 indexVal = true; Int4 intVal[10]; // Set where to grab the information. // we assume that the ntuple is has described in indexWrite tuple.destinationAt("index",&indexVal); tuple.destinationAt("array",&intVal); for (i = 2; i < 7 ; i++ ) { tuple.captureThenStore(); for ( int j = 0; j < indexVal; j++ ) { if ( intVal[j] == indexVal*(j+1) ) { } else { } } } }