gRwghtZExpAxFF.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \program gRwghtZExpAxFF
5 
6 \brief A simple program to illustrate how to use the GENIE event reweighting
7  for use with the z-expansion axial form factor
8 
9 \syntax grwghtzexpaxff -f filename -t NTwk1,NTwk2,... [-n nev] [-o fileOutName]
10  [-s SigmaLo1,SigmaHi1,SigmaLo2,SigmaHi2,...] [-m NTwkN]
11 
12  where
13  [] is an optional argument
14  -f specifies a GENIE event file (GHEP format)
15  -o specifies a GENIE output filename
16  -n specifies the number of events to process (default: all)
17  -t specify number of tweaks on each z-expansion coefficient
18  values are comma separated (# < 2 are ignored)
19  -s specify +- one-sigma bounds on all coefficients up to max
20  values are comma separated, given as percentages
21  requires 2x number of fields from -t option
22  default value is 10% on all coefficients
23  -m number of tweaks on normalization
24  puts reweighting into norm+shape mode
25 
26 \author Aaron Meyer <asmeyer2012 \at uchicago.edu>
27  University of Chicago, Fermi National Accelerator Laboratory
28 
29  based on gtestRewght by
30 
31  Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
32  STFC, Rutherford Appleton Laboratory
33 
34 \created Dec 26, 2014
35 
36 \cpright Copyright (c) 2003-2013, GENIE Neutrino MC Generator Collaboration
37  For the full text of the license visit http://copyright.genie-mc.org
38  or see $GENIE/LICENSE
39 */
40 //____________________________________________________________________________
41 
42 
43 #include <string>
44 #include <sstream>
45 
46 #include <TSystem.h>
47 #include <TFile.h>
48 #include <TTree.h>
49 #include <TArrayF.h>
50 
52 #include "Conventions/Controls.h"
53 #include "EVGCore/EventRecord.h"
54 #include "Ntuple/NtpMCFormat.h"
55 #include "Ntuple/NtpMCTreeHeader.h"
57 #include "Messenger/Messenger.h"
58 #include "ReWeight/GReWeightI.h"
59 #include "ReWeight/GSystSet.h"
60 #include "ReWeight/GReWeight.h"
61 #include "ReWeight/GReWeightNuXSecCCQE.h"
62 #include "ReWeight/GReWeightNuXSecCCQEvec.h"
63 #include "ReWeight/GReWeightNuXSecCCRES.h"
64 #include "ReWeight/GReWeightNuXSecNCRES.h"
65 #include "ReWeight/GReWeightNuXSecDIS.h"
66 #include "ReWeight/GReWeightNuXSecCOH.h"
67 #include "ReWeight/GReWeightNonResonanceBkg.h"
68 #include "ReWeight/GReWeightFGM.h"
69 #include "ReWeight/GReWeightDISNuclMod.h"
70 #include "ReWeight/GReWeightResonanceDecay.h"
71 #include "ReWeight/GReWeightFZone.h"
72 #include "ReWeight/GReWeightINuke.h"
73 #include "ReWeight/GReWeightAGKY.h"
74 #include "ReWeight/GSystUncertainty.h"
75 #include "Utils/CmdLnArgParser.h"
76 #include "Utils/StringUtils.h"
77 
78 // number of coefficient values to vary
79 #define MAX_COEF 4
80 
81 using namespace genie;
82 using namespace genie::rew;
83 using std::string;
84 using std::ostringstream;
85 
86 void PrintSyntax();
87 void GetEventRange (Long64_t nev_in_file, Long64_t & nfirst, Long64_t & nlast);
88 void GetCommandLineArgs (int argc, char ** argv);
89 int GetNumberOfWeights (int* ntwk, int kmaxinc, int normtwk, bool donorm);
90 bool IncrementCoefficients(int* ntwk, int kmaxinc, int normtwk, bool donorm,
91  float* twkvals, GSystSet& syst);
92 GSyst_t GetZExpSystematic(int ip);
93 
96 //int gOptNEvt;
97 Long64_t gOptNEvt1;
98 Long64_t gOptNEvt2;
99 int gOptKmaxInc = 0;
101 bool gOptDoNorm = false; // whether to be in norm+shape mode or not
102 bool gOptSigmaDefined = false; // handles setting of SigMin, SigMax
103 int gOptNTweaks[MAX_COEF] = {0 };
104 float gOptSigMin [MAX_COEF] = {0.};
105 float gOptSigMax [MAX_COEF] = {0.};
106 
107 //___________________________________________________________________
108 int main(int argc, char ** argv)
109 {
110  GetCommandLineArgs (argc, argv);
111 
112  // open the ROOT file and get the TTree & its header
113  TTree * tree = 0;
114  NtpMCTreeHeader * thdr = 0;
115  TFile file(gOptInpFilename.c_str(),"READ");
116  tree = dynamic_cast <TTree *> ( file.Get("gtree") );
117  thdr = dynamic_cast <NtpMCTreeHeader *> ( file.Get("header") );
118  LOG("rwghtzexpaxff", pNOTICE) << "Input tree header: " << *thdr;
119  if(!tree){
120  LOG("grwghtzexpaxff", pFATAL)
121  << "Can't find a GHEP tree in input file: "<< file.GetName();
122  gAbortingInErr = true;
123  PrintSyntax();
124  exit(1);
125  }
126  NtpMCEventRecord * mcrec = 0;
127  tree->SetBranchAddress("gmcrec", &mcrec);
128 
129  Long64_t nev_in_file = tree->GetEntries();
130  Long64_t nfirst = 0;
131  Long64_t nlast = 0;
132  GetEventRange(nev_in_file, nfirst, nlast);
133  int nev = int(nlast - nfirst + 1);
134 
135  LOG("rwghtzexpaxff", pNOTICE) << "Will process " << nev << " events";
136 
137  //
138  // Create a GReWeight object and add to it a set of
139  // weight calculators
140  //
141  // If seg-faulting here, need to change
142  // AxialFormFactorModel in UserPhysicsOptions.xml and LwlynSmithFFCC.xml
143  //
144 
145  GReWeight rw;
146  rw.AdoptWghtCalc( "xsec_ccqe", new GReWeightNuXSecCCQE );
147 
148  //
149  // Create a list of systematic params (more to be found at GSyst.h)
150  // set non-default values and re-configure.
151  // Weight calculators included above must be able to handle the tweaked params.
152  // Each tweaking dial t modifies a physics parameter p as:
153  // p_{tweaked} = p_{default} ( 1 + t * dp/p )
154  // So setting a tweaking dial to +/-1 modifies a physics quantity
155  // by +/- 1sigma.
156  // Default fractional errors are defined in GSystUncertainty
157  // and can be overriden.
158  //
159 
160  GSystSet & syst = rw.Systematics();
161 
162  // Create a concrete weight calculator to fine-tune
163  GReWeightNuXSecCCQE * rwccqe =
164  dynamic_cast<GReWeightNuXSecCCQE *> (rw.WghtCalc("xsec_ccqe"));
165  rwccqe->SetMode(GReWeightNuXSecCCQE::kModeZExp);
166  // In case uncertainties need to be altered
167  GSystUncertainty * unc = GSystUncertainty::Instance();
168 
169  // further optional fine-tuning
170  //rwccqe -> RewNue (false);
171  //rwccqe -> RewNuebar (false);
172  //rwccqe -> RewNumubar(false);
173 
174  // Declare the weights and twkvals arrays
175  const int n_events = (const int) nev;
176  const int n_params = (const int) (gOptKmaxInc + 1); // +1 for norm
177  const int n_points =
179  // if segfaulting here, may need to increase MAX_COEF
180  // copied from gtestRwght... seems inefficient
181  // -- couldn't we just load straight to the tree? doing so would prevent segfaults
182  float weights [n_events][n_points];
183  float twkvals [n_points][n_params];
184 
185  // Initialize
186  for (int ipt = 0; ipt < n_points; ipt++)
187  {
188  for (int iev = 0; iev < nev; iev++) { weights[iev][ipt] = 1.; }
189  twkvals[ipt][0] = (gOptDoNorm && (gOptNormTweaks > 1)) ? -1 : 0;
190  for (int ipr = 1; ipr < n_params; ipr++)
191  {
192  twkvals[ipt][ipr] = (gOptNTweaks[ipr-1] > 1 ? -1 : 0);
193  }
194  }
195 
196  // set first values for weighting
197  if (gOptDoNorm)
198  {
199  syst.Set(kXSecTwkDial_ZNormCCQE, twkvals[0][0]);
200  LOG("rwghtzexpaxff", pNOTICE) << "Setting z-expansion tweak for norm : "
201  << twkvals[0][0];
202  }
203  GSyst_t gsyst;
204  for (int ipr = 1; ipr < n_params; ipr++)
205  {
206  gsyst = GetZExpSystematic(ipr);
207  syst.Set(gsyst, twkvals[0][ipr]);
208  LOG("rwghtzexpaxff", pNOTICE) << "Setting z-expansion tweak for param "
209  <<ipr<<" : " << twkvals[0][ipr];
210  if (gOptSigmaDefined)
211  {
212  unc->SetUncertainty(gsyst,gOptSigMin[ipr-1],gOptSigMax[ipr-1]);
213  LOG("rwghtzexpaxff", pNOTICE) << "Setting z-expansion sigma for param "
214  <<ipr<<" : " << gOptSigMin[ipr-1] <<","<< gOptSigMax[ipr-1];
215  }
216  }
217 
218  // point loop (number of parameter combinations)
219  for (int ipt = 0; ipt < n_points; ipt++) {
220  rw.Reconfigure();
221  // Event loop
222  for(int iev = nfirst; iev <= nlast; iev++) {
223  tree->GetEntry(iev);
224 
225  EventRecord & event = *(mcrec->event);
226  LOG("rwghtzexpaxff", pNOTICE) << "Event number = " << iev;
227  LOG("rwghtzexpaxff", pNOTICE) << event;
228 
229  double wght = rw.CalcWeight(event);
230 
231  LOG("rwghtzexpaxff", pNOTICE) << "Overall weight = " << wght;
232 
233  // add to arrays
234  weights[iev - nfirst][ipt] = wght;
235 
236  mcrec->Clear();
237  } // events
238 
239  // set the next set of coefficients to match the previous, then increment
240  if (ipt < n_points-1) {
241  for (int ipr=0;ipr<n_params;ipr++)
242  {
243  twkvals[ipt+1][ipr] = twkvals[ipt][ipr];
244  }
246  twkvals[ipt+1],syst);
247  }
248  } // points
249 
250  // Close event file
251  file.Close();
252 
253  //
254  // Save weights
255  //
256 
257  // Make an output tree for saving the weights.
258  TFile * wght_file = new TFile(gOptOutFilename.c_str(), "RECREATE");
259  TTree * wght_tree = new TTree("ZExpCCQE","GENIE weights tree");
260  // objects to pass elements into tree
261  int branch_eventnum = 0;
262  TArrayF * branch_weight_array = new TArrayF(n_points);
263  TArrayF ** branch_twkdials_array = new TArrayF* [n_params];
264 
265  wght_tree->Branch("eventnum", &branch_eventnum);
266  wght_tree->Branch("weights", &branch_weight_array);
267 
268  // create and add branches for each z-expansion coefficient
269  ostringstream twk_dial_brnch_name;
270  for (int ipr = 0; ipr < n_params; ipr++) {
271  if (!gOptDoNorm && ipr == 0) { continue; } // skip norm if not requested
272  twk_dial_brnch_name.str("");
273  if (ipr == 0) { twk_dial_brnch_name << "twk_dial_param_norm"; }
274  else { twk_dial_brnch_name << "twk_dial_param_" << ipr; }
275  LOG("rwghtzexpaxff", pWARN) << "Branch name = " << twk_dial_brnch_name.str();
276  branch_twkdials_array[ipr] = new TArrayF(n_points);
277  wght_tree->Branch(twk_dial_brnch_name.str().c_str(), branch_twkdials_array[ipr]);
278  }
279 
280  ostringstream str_wght;
281  for(int iev = nfirst; iev <= nlast; iev++) {
282  branch_eventnum = iev;
283 
284  for(int ipt = 0; ipt < n_points; ipt++){
285 
286  // printout
287  str_wght.str("");
288  str_wght << ", tweaked parameter values : ";
289  for (int ipr = 0; ipr < n_params; ipr++) {
290  if (ipr > 0) str_wght << ", ";
291  str_wght << ipr << " -> " << twkvals[ipt][ipr];
292  }
293  LOG("grwghtzexpaxff", pNOTICE)
294  << "Filling tree with wght = " << weights[iev - nfirst][ipt] << str_wght.str();
295 
296  // fill tree
297  branch_weight_array -> AddAt (weights [iev - nfirst][ipt], ipt);
298  for (int ipr = (gOptDoNorm ? 0 : 1); ipr < n_params; ipr++) // skip norm if not requested
299  { branch_twkdials_array[ipr] -> AddAt (twkvals[ipt][ipr], ipt); }
300 
301  } // twk_dial loop
302  wght_tree->Fill();
303  }
304 
305  wght_file->cd();
306  wght_tree->Write();
307  wght_tree = 0;
308  wght_file->Close();
309 
310  // free memory
311  delete wght_tree;
312  delete wght_file;
313  for (int ipr = 0; ipr < n_params; ipr++) {
314  if (!gOptDoNorm && ipr == 0) { continue; }
315  delete branch_twkdials_array[ipr];
316  }
317  delete branch_twkdials_array;
318  delete branch_weight_array;
319 
320  LOG("rwghtzexpaxff", pNOTICE) << "Done!";
321  return 0;
322 }
323 //___________________________________________________________________
324 void GetCommandLineArgs(int argc, char ** argv)
325 {
326  LOG("rwghtzexpaxff", pINFO) << "*** Parsing command line arguments";
327 
328  CmdLnArgParser parser(argc,argv);
329 
330  // get GENIE event sample
331  if( parser.OptionExists('f') ) {
332  LOG("rwghtzexpaxff", pINFO) << "Reading event sample filename";
333  gOptInpFilename = parser.ArgAsString('f');
334  } else {
335  LOG("rwghtzexpaxff", pFATAL)
336  << "Unspecified input filename - Exiting";
337  PrintSyntax();
338  exit(1);
339  }
340 
341  // output weight file
342  if(parser.OptionExists('o')) {
343  LOG("rwghtzexpaxff", pINFO) << "Reading requested output filename";
344  gOptOutFilename = parser.ArgAsString('o');
345  } else {
346  LOG("rwghtzexpaxff", pINFO) << "Setting default output filename";
347  gOptOutFilename = "test_rw_zexp_axff.root";
348  }
349 
350  if ( parser.OptionExists('n') ) {
351  //
352  LOG("grwghtzexpaxff", pINFO) << "Reading number of events to analyze";
353  string nev = parser.ArgAsString('n');
354  if (nev.find(",") != string::npos) {
355  vector<long> vecn = parser.ArgAsLongTokens('n',",");
356  if(vecn.size()!=2) {
357  LOG("grwghtzexpaxff", pFATAL) << "Invalid syntax";
358  gAbortingInErr = true;
359  PrintSyntax();
360  exit(1);
361  }
362  // User specified a comma-separated set of values n1,n2.
363  // Use [n1,n2] as the event range to process.
364  gOptNEvt1 = vecn[0];
365  gOptNEvt2 = vecn[1];
366  } else {
367  // User specified a single number n.
368  // Use [0,n] as the event range to process.
369  gOptNEvt1 = -1;
370  gOptNEvt2 = parser.ArgAsLong('n');
371  }
372  } else {
373  LOG("grwghtzexpaxff", pINFO)
374  << "Unspecified number of events to analyze - Use all";
375  gOptNEvt1 = -1;
376  gOptNEvt2 = -1;
377  }
378  LOG("grwghtzexpaxff", pDEBUG)
379  << "Input event range: " << gOptNEvt1 << ", " << gOptNEvt2;
380 
381  // number of tweaks:
382  if( parser.OptionExists('t') ) {
383  LOG("rwghtzexpaxff", pINFO) << "Reading number of tweaks";
384  string coef = parser.ArgAsString('t');
385 
386  // split into sections of min,max,inc(rement)
387  vector<string> coefrange = utils::str::Split(coef, ",");
388  gOptKmaxInc = coefrange.size();
389  if (gOptKmaxInc > MAX_COEF)
390  {
391  LOG("rwghtzexpaxff", pFATAL)
392  << "Too many coefficients: increase MAX_COEF in source code and recompile";
393  exit(1);
394  }
395  //AlgConfigPool * confp = AlgConfigPool::Instance();
396  //const Registry * gc = confp->GlobalParameterList();
397  //int kDef = fConfig->GetIntDef("QEL-Kmax",gc->GetInt("QEL-Kmax"));
398  //else if (gOptKmaxInc > kDef)
399  //{
400  // LOG("rwghtzexpaxff", pFATAL)
401  // << "Too many coefficients:
402  // requested number of coefficients is more than defined in UserPhysicsOptions.xml";
403  // exit(1);
404  //}
405 
406  LOG("rwghtzexpaxff", pINFO) << "Largest coefficient to tweak : " << gOptKmaxInc;
407  for (int ik = 0;ik<gOptKmaxInc;ik++)
408  {
409  gOptNTweaks[ik] = atof(coefrange[ik].c_str());
410  }
411  for (int ik = 0;ik<gOptKmaxInc;ik++)
412  {
413  LOG("rwghtzexpaxff",pINFO)<<"Number of tweaks on coefficient "<<ik+1<<" : "<< gOptNTweaks[ik];
414  }
415  } else {
416  LOG("rwghtzexpaxff", pFATAL)
417  << "Unspecified tweaks for parameters - Exiting";
418  PrintSyntax();
419  exit(1);
420  }
421 
422  // lower/upper sigma:
423  if( parser.OptionExists('s') ) {
424  LOG("rwghtzexpaxff", pINFO) << "Reading specified parameter uncertainties";
425  string coef = parser.ArgAsString('s');
426 
427  // split into sections of min,max
428  vector<string> sigrange = utils::str::Split(coef, ",");
429  // gOptKmaxInc defined by number of tweaks (-t)
430  assert(sigrange.size() == (unsigned int) 2*gOptKmaxInc);
431  gOptSigmaDefined = true;
432  for (int ik = 0;ik<gOptKmaxInc;ik++)
433  {
434  gOptSigMin[ik] = atof(sigrange[ik*2 ].c_str());
435  gOptSigMax[ik] = atof(sigrange[ik*2+1].c_str());
436  }
437  for (int ik = 0;ik<gOptKmaxInc;ik++)
438  {
439  LOG("rwghtzexpaxff",pINFO)<<ik+1<<": "<< gOptSigMin[ik] <<","<< gOptSigMax[ik];
440  }
441  }
442 
443  // number of norm tweaks:
444  if( parser.OptionExists('m') ) {
445  LOG("rwghtzexpaxff", pINFO) << "Reading number of tweaks on normalization";
446  string coef = parser.ArgAsString('m');
447  gOptDoNorm = true;
448  gOptNormTweaks = atof(coef.c_str());
449  LOG("rwghtzexpaxff",pINFO)<<"Number of tweaks on norm : "<< gOptNormTweaks;
450  }
451 }
452 //_________________________________________________________________________________
453 void GetEventRange(Long64_t nev_in_file, Long64_t & nfirst, Long64_t & nlast)
454 {
455  nfirst = 0;
456  nlast = 0;
457 
458  if(gOptNEvt1>=0 && gOptNEvt2>=0) {
459  // Input was `-n N1,N2'.
460  // Process events [N1,N2].
461  // Note: Incuding N1 and N2.
462  nfirst = gOptNEvt1;
463  nlast = TMath::Min(nev_in_file-1, gOptNEvt2);
464  }
465  else
466  if(gOptNEvt1<0 && gOptNEvt2>=0) {
467  // Input was `-n N'.
468  // Process first N events [0,N).
469  // Note: Event N is not included.
470  nfirst = 0;
471  nlast = TMath::Min(nev_in_file-1, gOptNEvt2-1);
472  }
473  else
474  if(gOptNEvt1<0 && gOptNEvt2<0) {
475  // No input. Process all events.
476  nfirst = 0;
477  nlast = nev_in_file-1;
478  }
479 
480  assert(nfirst <= nlast && nfirst >= 0 && nlast <= nev_in_file-1);
481 }
482 //_________________________________________________________________________________
483 bool IncrementCoefficients(int* ntwk, int kmaxinc, int normtwk, bool donorm,
484  float* twkvals, GSystSet& syst)
485 {
486  if (kmaxinc < 2 && ! donorm)
487  {
488  LOG("grwghtzexpaxff",pERROR) << "No coefficients to increment";
489  return false;
490  } else {
491 
492  int ip = -1;
493  bool stopflag = false;
494  GSyst_t gsyst = kXSecTwkDial_ZNormCCQE;
495  do
496  {
497  if (ip > 0 || (ip == 0 && donorm))
498  { // fully incremented a coefficient; reset it and continue to the next
499  if (ip == 0) { twkvals[0 ] = (normtwk > 1 ? -1. : 0.); }
500  else { twkvals[ip] = (ntwk[ip-1] > 1 ? -1. : 0.); }
501 
502  // set the value manually
503  syst.Set(gsyst, twkvals[ip]);
504  LOG("rwghtzexpaxff", pNOTICE) << "Setting z-expansion tweak for param "
505  <<ip<<" : " << twkvals[ip];
506  }
507  stopflag = true;
508 
509  ip++; // increment index
510  if (ip == kmaxinc) { return false; } // done with incrementing
511  if (ip == 0 && ! donorm)
512  {
513  stopflag = false;
514  continue; // skip when not doing norm
515  }
516  // set to next systematic
517  if (ip == 0) { gsyst = kXSecTwkDial_ZNormCCQE; }
518  else { gsyst = GetZExpSystematic(ip); }
519 
520  // increment systematic
521  if (ip == 0)
522  {
523  if (normtwk > 1) { twkvals[0] += 2./float(normtwk-1); }
524  else { stopflag = false; continue; }
525  }
526  else
527  {
528  if (ntwk[ip-1] > 1) { twkvals[ip] += 2./float(ntwk[ip-1]-1); }
529  else { stopflag = false; continue; }
530  }
531 
532  // set the systematic to the new tweak value
533  // actual updating of this will be handled by GReWeight::Reconfigure
534  syst.Set(gsyst, twkvals[ip]);
535  LOG("rwghtzexpaxff", pNOTICE) << "Setting z-expansion tweak for param "
536  <<ip<<" : " << twkvals[ip];
537  if (twkvals[ip] > 1. + controls::kASmallNum) { stopflag=false; } // went over
538 
539  } while (! stopflag); // loop
540 
541  return true;
542  } // if kmaxinc >= 1
543 
544  return false;
545 }
546 //_________________________________________________________________________________
547 int GetNumberOfWeights(int* ntwk, int kmaxinc, int normtwk, bool donorm)
548 {
549  int num_pts = 1;
550  for (int i=0;i<kmaxinc;i++)
551  {
552  if (ntwk[i] > 1) num_pts *= ntwk[i];
553  }
554  if (donorm)
555  {
556  if (normtwk > 1) num_pts *= normtwk;
557  }
558  return num_pts;
559 }
560 //_________________________________________________________________________________
561 GSyst_t GetZExpSystematic(int ip)
562 {
563  switch(ip){
564  case 1: return kXSecTwkDial_ZExpA1CCQE; break;
565  case 2: return kXSecTwkDial_ZExpA2CCQE; break;
566  case 3: return kXSecTwkDial_ZExpA3CCQE; break;
567  case 4: return kXSecTwkDial_ZExpA4CCQE; break;
568  default:
569  LOG("rwghtzexpaxff", pFATAL)
570  << "Cannot find systematic corresponding to parameter " << ip;
571  exit(0);
572  break;
573  }
574 }
575 //_________________________________________________________________________________
576 void PrintSyntax(void)
577 {
578  LOG("grwghtzexpaxff", pFATAL)
579  << "\n\n"
580  << "grwghtzexpaxff \n"
581  << " -f input_event_file \n"
582  << " -t ntwk1[,ntwk2[,...]] \n"
583  << " [-n nev] \n"
584  << " [-s sigLo1,sigHi1[,...]] \n"
585  << " [-o output_weights_file] \n"
586  << " [-m ntwkNorm]" ;
587 }
588 //_________________________________________________________________________________
int iev
Definition: runWimpSim.h:118
int gOptNormTweaks
long ArgAsLong(char opt)
GSyst_t GetZExpSystematic(int ip)
string ArgAsString(char opt)
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
#define pERROR
Definition: Messenger.h:60
float gOptSigMax[MAX_COEF]
bool gOptDoNorm
MINOS-style ntuple record. Each such ntuple record holds a generated EventRecord object. Ntuples of this type are intended for feeding GENIE events into other applications (for example the GEANT4 based MC generation framework of an experiment) if no direct interface exists.
#define pFATAL
Definition: Messenger.h:57
vector< long > ArgAsLongTokens(char opt, string delimeter)
int gOptKmaxInc
float gOptSigMin[MAX_COEF]
TString ip
Definition: loadincs.C:5
void GetEventRange(Long64_t nev_in_file, Long64_t &nfirst, Long64_t &nlast)
int gOptNTweaks[MAX_COEF]
Long64_t gOptNEvt1
string gOptInpFilename
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
void PrintSyntax()
MINOS-style Ntuple Class to hold an output MC Tree Header.
int GetNumberOfWeights(int *ntwk, int kmaxinc, int normtwk, bool donorm)
Var weights
bool gOptSigmaDefined
static const double kASmallNum
Definition: Controls.h:40
#define pINFO
Definition: Messenger.h:63
Long64_t gOptNEvt2
#define pWARN
Definition: Messenger.h:61
void GetCommandLineArgs(int argc, char **argv)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition: EventRecord.h:38
bool IncrementCoefficients(int *ntwk, int kmaxinc, int normtwk, bool donorm, float *twkvals, GSystSet &syst)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
vector< string > Split(string input, string delim)
Definition: StringUtils.cxx:42
int main(int argc, char **argv)
exit(0)
TFile * file
Definition: cellShifts.C:17
assert(nhit_max >=nhit_nbins)
Command line argument parser.
#define pNOTICE
Definition: Messenger.h:62
string gOptOutFilename
void Clear(Option_t *opt="")
bool gAbortingInErr
Definition: Messenger.cxx:56
int n_events
Definition: test_Tier.py:22
bool OptionExists(char opt)
was option set?
EventRecord * event
event
#define pDEBUG
Definition: Messenger.h:64
#define MAX_COEF
A simple program to illustrate how to use the GENIE event reweighting for use with the z-expansion ax...