test_read_locations.C
Go to the documentation of this file.
1 //
2 // test reading locations text file
3 // this script can be run using:
4 // root -b -q load_dk2nu.C test_read_locations.C+
5 //
6 // rhatcher@fnal.gov 2012-10-02
7 //====================================================================
8 
9 #ifndef __CINT__
10 // hide header stuff from CINT, assume load_dk2nu.C run first
11 
12 #include <string>
13 #include <iostream>
14 #include <fstream>
15 #include <iomanip>
16 
17 // dk2nu includes
18 #include "tree/dkmeta.h"
19 #include "tree/readWeightLocations.h"
20 
21 #endif // ifndef __CINT__
22 
23 void test_read_locations(std::string locfilename = "${DK2NU}/etc/locations.txt")
24 {
25  std::vector<bsim::Location> location;
26  bsim::readWeightLocations(locfilename, location);
27 
28  size_t nl = location.size();
29  std::cout << nl << " locations:\n";
30  for ( size_t l = 0; l < nl; ++l ) {
31  std::cout << " [" << std::setw(2) << l << "] " << location[l] << "\n";
32  }
33  std::cout << endl;
34 
35 }
#define location
void readWeightLocations(std::string locfilename, std::vector< bsim::Location > &locations)
OStream cout
Definition: OStream.cxx:6
void test_read_locations(std::string locfilename="${DK2NU}/etc/locations.txt")
std::string nl(std::size_t i=1)
enum BeamMode string