test_read_dk2nu.C
Go to the documentation of this file.
1 #include <iostream>
2 #include <iomanip>
3 #include <string>
4 using namespace std;
5 
6 #include "TChain.h"
7 
8 #ifndef __CINT__
9 // hide header stuff from CINT, assume load_dk2nu.C run first
10 
11 #include "tree/dk2nu.h"
12 #include "tree/dkmeta.h"
13 
14 #endif // ifndef __CINT__
15 
16 void test_read_dk2nu(string pattern="generic_*_to_dk2nu.root")
17 {
18  TChain* cflux = new TChain("dk2nuTree");
19  TChain* cmeta = new TChain("dkmetaTree");
20 
21  cflux->Add(pattern.c_str());
22  cmeta->Add(pattern.c_str());
23 
26  cflux->SetBranchAddress("dk2nu",&dk2nu);
27  cmeta->SetBranchAddress("dkmeta",&dkmeta);
28 
29  cout << "before reading any entries" << endl;
30  cout << *dk2nu << endl << endl;
31  cout << *dkmeta << endl << endl;
32 
33  Long64_t nflux = cflux->GetEntries();
34  Long64_t nmeta = cmeta->GetEntries();
35  cout << "nentries: " << nflux << " " << nmeta << endl;
36 
37  for (Long64_t i=0; i < nflux; ++i ) {
38  cflux->GetEntry(i);
39  if ( i < 5 ) cout << "ntype " << dk2nu->decay.ntype << endl;
40  }
41  cout << endl << *dk2nu << endl << endl;
42 
43  cmeta->GetEntry(0);
44  cout << *dkmeta << endl;
45 
46 }
void test_read_dk2nu(string pattern="generic_*_to_dk2nu.root")
bsim::Decay decay
basic decay information
Definition: dk2nu.h:327
bsim::Dk2Nu * dk2nu
Int_t ntype
% neutrino flavor (PDG? code)
Definition: dk2nu.h:128
OStream cout
Definition: OStream.cxx:6
bsim::DkMeta * dkmeta