26 tree->SetBranchAddress(
"ievt", &ievt );
27 tree->SetBranchAddress(
"ifileNo", &ifileNo );
28 int current_file = -1;
29 TFile * ghep_file = NULL;
34 nusyst::response_helper rh( fhicl_filename );
36 std::vector<unsigned int> parIds = rh.GetParameters();
37 for(
unsigned int i = 0; i < parIds.size(); ++i ) {
38 systtools::SystParamHeader head = rh.GetHeader(parIds[i]);
39 printf(
"Adding reweight branch %u for %s with %lu shifts\n", parIds[i], head.prettyName.c_str(), head.paramVariations.size() );
40 bool is_wgt = head.isWeightSystematicVariation;
42 caf.
addRWbranch( parIds[i], head.prettyName, wgt_var, head.paramVariations );
43 caf.
iswgt[parIds[i]] = is_wgt;
48 int N =
tree->GetEntries();
49 if( par.
n > 0 && par.
n < N ) N = par.
n + par.
first;
50 for(
int ii = par.
first; ii < N; ++ii ) {
53 if( ii % 100 == 0 ) printf(
"Event %d of %d...\n", ii, N );
57 for(
int j = 0; j < 100; ++j ) {
60 for(
unsigned int k = 0;
k < 100; ++
k ) {
61 caf.
wgt[j][
k] = ( caf.
iswgt[j] ? 1. : 0. );
66 if( ifileNo != current_file ) {
68 if( ghep_file ) ghep_file->Close();
70 if( par.
grid ) ghep_file =
new TFile( Form(
"genie.%d.root", ifileNo) );
71 else ghep_file =
new TFile( Form(
"%s/GAr.%s.%d.ghep.root", ghepdir.c_str(), mode.c_str(), ifileNo) );
73 gtree = (TTree*) ghep_file->Get(
"gtree" );
76 gtree->SetBranchAddress(
"gmcrec", &caf.
mcrec );
77 current_file = ifileNo;
84 gtree->GetEntry( ievt );
99 systtools::event_unit_response_w_cv_t resp = rh.GetEventVariationAndCVResponse(*
event);
101 caf.
nwgt[(*it).pid] = (*it).responses.size();
102 caf.
cvwgt[(*it).pid] = (*it).CV_response;
103 for(
unsigned int i = 0; i < (*it).responses.size(); ++i ) {
104 caf.
wgt[(*it).pid][i] = (*it).responses[i];
void addRWbranch(int parId, std::string name, std::string wgt_var, std::vector< double > &vars)
genie::NtpMCEventRecord * mcrec
Summary information for an interaction.
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
const InitialState & InitState(void) const
TLorentzVector * GetProbeP4(RefFrame_t rf=kRfHitNucRest) const
Event finding and building.