Public Member Functions | Private Attributes | List of all members
dunemva::CAFMaker Class Reference
Inheritance diagram for dunemva::CAFMaker:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 CAFMaker (fhicl::ParameterSet const &pset)
 
virtual ~CAFMaker ()
 
void beginJob () override
 
void endJob () override
 
void beginSubRun (const art::SubRun &sr) override
 
void endSubRun (const art::SubRun &sr) override
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void analyze (art::Event const &evt) override
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

std::string fMVASelectLabel
 
std::string fMVASelectNueLabel
 
std::string fMVASelectNumuLabel
 
std::string fCVNLabel
 
std::string fRegCNNLabel
 
std::string fEnergyRecoNueLabel
 
std::string fEnergyRecoNumuLabel
 
std::string fMVAMethod
 
float fOscPro
 
double fWeight
 
TTree * fTree
 
TTree * fMetaTree
 
int fNwgt [knShifts]
 
double fCvWgts [knShifts]
 
double fWgts [knShifts][kmaxRwgts]
 
int fIsFD
 
int fIsFHC
 
int fRun
 
int fSubrun
 
int fEvent
 
int fIsCC
 
int fNuPDG
 
int fNuPDGunosc
 
int fMode
 
int fLepPDG
 
double fEv
 
double fQ2
 
double fW
 
double fX
 
double fY
 
double fNuMomX
 
double fNuMomY
 
double fNuMomZ
 
double fLepMomX
 
double fLepMomY
 
double fLepMomZ
 
double fLepE
 
double fLepNuAngle
 
int nP
 
int nN
 
int nPip
 
int nPim
 
int nPi0
 
int nKp
 
int nKm
 
int nK0
 
int nEM
 
int nOtherHad
 
int nNucleus
 
int nUNKNOWN
 
double eP
 
double eN
 
double ePip
 
double ePim
 
double ePi0
 
double eOther
 
double vtx_x
 
double vtx_y
 
double vtx_z
 
double fErecoNue
 
double fRecoLepEnNue
 
double fRecoHadEnNue
 
int fRecoMethodNue
 
double fErecoNumu
 
double fRecoLepEnNumu
 
double fRecoHadEnNumu
 
int fRecoMethodNumu
 
int fLongestTrackContNumu
 
int fTrackMomMethodNumu
 
double fMVAResult
 
double fMVAResultNue
 
double fMVAResultNumu
 
double fCVNResultIsAntineutrino
 
double fCVNResultNue
 
double fCVNResultNumu
 
double fCVNResultNutau
 
double fCVNResultNC
 
double fCVNResult0Protons
 
double fCVNResult1Protons
 
double fCVNResult2Protons
 
double fCVNResultNProtons
 
double fCVNResult0Pions
 
double fCVNResult1Pions
 
double fCVNResult2Pions
 
double fCVNResultNPions
 
double fCVNResult0Pizeros
 
double fCVNResult1Pizeros
 
double fCVNResult2Pizeros
 
double fCVNResultNPizeros
 
double fCVNResult0Neutrons
 
double fCVNResult1Neutrons
 
double fCVNResult2Neutrons
 
double fCVNResultNNeutrons
 
double fRegCNNNueE
 
double meta_pot
 
int meta_run
 
int meta_subrun
 
int meta_version
 
systtools::provider_list_t fSystProviders
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 61 of file CAFMaker_module.cc.

Constructor & Destructor Documentation

dunemva::CAFMaker::CAFMaker ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 145 of file CAFMaker_module.cc.

146  : EDAnalyzer(pset)
147  {
148  this->reconfigure(pset);
149  }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
void reconfigure(fhicl::ParameterSet const &pset)
dunemva::CAFMaker::~CAFMaker ( )
virtual

Definition at line 151 of file CAFMaker_module.cc.

151 {}

Member Function Documentation

void dunemva::CAFMaker::analyze ( art::Event const &  evt)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 323 of file CAFMaker_module.cc.

324  {
325  auto pidin = evt.getHandle<dunemva::MVASelectPID>(fMVASelectLabel);
326  auto pidinnue = evt.getHandle<dunemva::MVASelectPID>(fMVASelectNueLabel);
327  auto pidinnumu = evt.getHandle<dunemva::MVASelectPID>(fMVASelectNumuLabel);
328  art::InputTag itag1(fCVNLabel, "cvnresult");
329  auto cvnin = evt.getHandle<std::vector<cvn::Result>>(itag1);
330  art::InputTag itag2(fRegCNNLabel, "regcnnresult");
331  auto regcnnin = evt.getHandle<std::vector<cnn::RegCNNResult>>(itag2);
332  auto ereconuein = evt.getHandle<dune::EnergyRecoOutput>(fEnergyRecoNueLabel);
333  auto ereconumuin = evt.getHandle<dune::EnergyRecoOutput>(fEnergyRecoNumuLabel);
334 
335  fRun = evt.id().run();
336  fSubrun = evt.id().subRun();
337  fEvent = evt.id().event();
338  meta_run = fRun;
340 
341  if( !pidin.failedToGet() ) {
342  fMVAResult = pidin->pid;
343 
344  //Fill MVA reco stuff
345  fErecoNue = ereconuein->fNuLorentzVector.E();
346  fRecoLepEnNue = ereconuein->fLepLorentzVector.E();
347  fRecoHadEnNue = ereconuein->fHadLorentzVector.E();
348  fRecoMethodNue = ereconuein->recoMethodUsed;
349  fErecoNumu = ereconumuin->fNuLorentzVector.E();
350  fRecoLepEnNumu = ereconumuin->fLepLorentzVector.E();
351  fRecoHadEnNumu = ereconumuin->fHadLorentzVector.E();
352  fRecoMethodNumu = ereconumuin->recoMethodUsed;
354  fTrackMomMethodNumu = ereconumuin->trackMomMethod;
355  }
356 
357  if( !pidinnue.failedToGet() ) {
358  fMVAResultNue = pidinnue->pid;
359  }
360 
361  if( !pidinnumu.failedToGet() ) {
362  fMVAResultNumu = pidinnumu->pid;
363  }
364 
365  if( !cvnin.failedToGet() ) {
366  //using i = cvn::Interaction;
367  //if(cvnin->empty() || (*cvnin)[0].fOutput.size() <= i::kNutauOther){
368  if(cvnin->empty()){
370  fCVNResult0Protons = fCVNResult1Protons = fCVNResult2Protons = fCVNResultNProtons = \
371  fCVNResult0Pions = fCVNResult1Pions = fCVNResult2Pions = fCVNResultNPions = \
372  fCVNResult0Pizeros = fCVNResult1Pizeros = fCVNResult2Pizeros = fCVNResultNPizeros = \
373  fCVNResult0Neutrons = fCVNResult1Neutrons = fCVNResult2Neutrons = fCVNResultNNeutrons = -3;
374  }
375  else{
376  //const std::vector<float>& v = (*cvnin)[0].fOutput;
377  //fCVNResultNue = v[i::kNueQE] + v[i::kNueRes] + v[i::kNueDIS] + v[i::kNueOther];
378  //fCVNResultNumu = v[i::kNumuQE] + v[i::kNumuRes] + v[i::kNumuDIS] + v[i::kNumuOther];
379  //fCVNResultNutau = v[i::kNutauQE] + v[i::kNutauRes] + v[i::kNutauDIS] + v[i::kNutauOther]
380 
381  fCVNResultIsAntineutrino = (*cvnin)[0].GetIsAntineutrinoProbability();
382 
383  fCVNResultNue = (*cvnin)[0].GetNueProbability();
384  fCVNResultNumu = (*cvnin)[0].GetNumuProbability();
385  fCVNResultNutau = (*cvnin)[0].GetNutauProbability();
386  fCVNResultNC = (*cvnin)[0].GetNCProbability();
387 
388  fCVNResult0Protons = (*cvnin)[0].Get0protonsProbability();
389  fCVNResult1Protons = (*cvnin)[0].Get1protonsProbability();
390  fCVNResult2Protons = (*cvnin)[0].Get2protonsProbability();
391  fCVNResultNProtons = (*cvnin)[0].GetNprotonsProbability();
392 
393  fCVNResult0Pions = (*cvnin)[0].Get0pionsProbability();
394  fCVNResult1Pions = (*cvnin)[0].Get1pionsProbability();
395  fCVNResult2Pions = (*cvnin)[0].Get2pionsProbability();
396  fCVNResultNPions = (*cvnin)[0].GetNpionsProbability();
397 
398  fCVNResult0Pizeros = (*cvnin)[0].Get0pizerosProbability();
399  fCVNResult1Pizeros = (*cvnin)[0].Get1pizerosProbability();
400  fCVNResult2Pizeros = (*cvnin)[0].Get2pizerosProbability();
401  fCVNResultNPizeros = (*cvnin)[0].GetNpizerosProbability();
402 
403  fCVNResult0Neutrons = (*cvnin)[0].Get0neutronsProbability();
404  fCVNResult1Neutrons = (*cvnin)[0].Get1neutronsProbability();
405  fCVNResult2Neutrons = (*cvnin)[0].Get2neutronsProbability();
406  fCVNResultNNeutrons = (*cvnin)[0].GetNneutronsProbability();
407  }
408  }
409 
410  fRegCNNNueE = -1.; // initializing
411  if(!regcnnin.failedToGet()){
412  if (!regcnnin->empty()){
413  const std::vector<float>& v = (*regcnnin)[0].fOutput;
414  fRegCNNNueE = v[0];
415  }
416  }
417 
418  std::vector< art::Ptr<simb::MCTruth> > truth;
419  auto mct = evt.getHandle< std::vector<simb::MCTruth> >("generator");
420  if ( mct )
421  art::fill_ptr_vector(truth, mct);
422  else
423  mf::LogWarning("CAFMaker") << "No MCTruth.";
424 
425  std::vector< art::Ptr<simb::MCFlux> > flux;
426  auto mcf = evt.getHandle< std::vector<simb::MCFlux> >("generator");
427  if ( mcf )
428  art::fill_ptr_vector(flux, mcf);
429  else
430  mf::LogWarning("CAFMaker") << "No MCFlux.";
431 /*
432  std::vector< art::Ptr<simb::GTruth> > gtru;
433  auto gt = evt.getHandle< std::vector<simb::GTruth> >("generator");
434  if ( gt )
435  art::fill_ptr_vector(gtru, gt);
436  else
437  mf::LogWarning("CAFMaker") << "No GTruth.";
438 */
439 
440  for(size_t i=0; i<truth.size(); i++){
441 
442  if(i>1){
443  mf::LogWarning("CAFMaker") << "Skipping MC truth index " << i;
444  continue;
445  }
446 
447  fIsFD = 1; // always FD
448  fIsFHC = 999; // don't know how to get this?
449  fIsCC = !(truth[i]->GetNeutrino().CCNC()); // ccnc is 0=CC 1=NC
450  fNuPDG = truth[i]->GetNeutrino().Nu().PdgCode();
451  fNuPDGunosc = flux[i]->fntype;
452  fMode = truth[i]->GetNeutrino().Mode(); //0=QE/El, 1=RES, 2=DIS, 3=Coherent production; this is different than mode in ND
453  fEv = truth[i]->GetNeutrino().Nu().E();
454  fQ2 = truth[i]->GetNeutrino().QSqr();
455  fW = truth[i]->GetNeutrino().W();
456  fX = truth[i]->GetNeutrino().X();
457  fY = truth[i]->GetNeutrino().Y();
458  fNuMomX = truth[i]->GetNeutrino().Nu().Momentum().X();
459  fNuMomY = truth[i]->GetNeutrino().Nu().Momentum().Y();
460  fNuMomZ = truth[i]->GetNeutrino().Nu().Momentum().Z();
461 
462  vtx_x = truth[i]->GetNeutrino().Lepton().Vx();
463  vtx_y = truth[i]->GetNeutrino().Lepton().Vy();
464  vtx_z = truth[i]->GetNeutrino().Lepton().Vz();
465 
466  //Lepton stuff
467  fLepPDG = truth[i]->GetNeutrino().Lepton().PdgCode();
468  fLepMomX = truth[i]->GetNeutrino().Lepton().Momentum().X();
469  fLepMomY = truth[i]->GetNeutrino().Lepton().Momentum().Y();
470  fLepMomZ = truth[i]->GetNeutrino().Lepton().Momentum().Z();
471  fLepE = truth[i]->GetNeutrino().Lepton().Momentum().T();
472  fLepNuAngle = truth[i]->GetNeutrino().Nu().Momentum().Vect().Angle(truth[i]->GetNeutrino().Lepton().Momentum().Vect());
473 
474  // TODO
475  fWeight = 0.;
476  fOscPro = 0.;
477  // fOscPro = fMVAAlg.OscPro(fCCNC,fBeamPdg,fNuPDG,fEtrue);
478 
479  nP = 0;
480  nN = 0;
481  nPip = 0;
482  nPim = 0;
483  nPi0 = 0;
484  nKp = 0;
485  nKm = 0;
486  nK0 = 0;
487  nEM = 0;
488  nOtherHad = 0;
489  nNucleus = 0;
490  nUNKNOWN = 0;
491 
492  eP = 0.;
493  eN = 0.;
494  ePip = 0.;
495  ePim = 0.;
496  ePi0 = 0.;
497  eOther = 0.;
498 
499  for( int p = 0; p < truth[i]->NParticles(); p++ ) {
500  if( truth[i]->GetParticle(p).StatusCode() == genie::kIStHadronInTheNucleus ) {
501 
502  int pdg = truth[i]->GetParticle(p).PdgCode();
503  double ke = truth[i]->GetParticle(p).E() - truth[i]->GetParticle(p).Mass();
504  if ( pdg == genie::kPdgProton ) {
505  nP++;
506  eP += ke;
507  } else if( pdg == genie::kPdgNeutron ) {
508  nN++;
509  eN += ke;
510  } else if( pdg == genie::kPdgPiP ) {
511  nPip++;
512  ePip += ke;
513  } else if( pdg == genie::kPdgPiM ) {
514  nPim++;
515  ePim += ke;
516  } else if( pdg == genie::kPdgPi0 ) {
517  nPi0++;
518  ePi0 += ke;
519  } else if( pdg == genie::kPdgKP ) {
520  nKp++;
521  eOther += ke;
522  } else if( pdg == genie::kPdgKM ) {
523  nKm++;
524  eOther += ke;
525  } else if( pdg == genie::kPdgK0 || pdg == genie::kPdgAntiK0 || pdg == genie::kPdgK0L || pdg == genie::kPdgK0S ) {
526  nK0++;
527  eOther += ke;
528  } else if( pdg == genie::kPdgGamma ) {
529  nEM++;
530  eOther += ke;
531  } else if( genie::pdg::IsHadron(pdg) ) {
532  nOtherHad++; // charm mesons, strange and charm baryons, antibaryons, etc.
533  eOther += ke;
534  } else if( genie::pdg::IsIon(pdg) ) {
535  nNucleus++;
536  } else {
537  nUNKNOWN++;
538  }
539 
540  }
541  }
542 
543  // Reweighting variables
544  //systtools::ScrubUnityEventResponses(er);
545 
546  // struct ParamResponses {
547  // paramId_t pid;
548  // std::vector<double> responses;
549  // }
550  // typedef std::vector<ParamResponses> event_unit_response_t;
551  // typedef std::vector<event_unit_response_t> EventResponse;
552 
553  for( auto &sp : fSystProviders ) {
554  std::unique_ptr<systtools::EventResponse> syst_resp = sp->GetEventResponse(evt);
555  if( !syst_resp ) {
556  std::cout << "[ERROR]: Got nullptr systtools::EventResponse from provider "
557  << sp->GetFullyQualifiedName();
558  continue;
559  }
560 
561  for( systtools::EventResponse::iterator itResp = syst_resp->begin(); itResp != syst_resp->end(); ++itResp ) {
562  systtools::event_unit_response_t resp = *itResp;
563  for( systtools::event_unit_response_t::iterator it = resp.begin(); it != resp.end(); ++it ) {
564  fNwgt[(*it).pid] = (*it).responses.size();
565  //fCvWgts[(*it).pid] = (*it).CV_weight;
566  for( unsigned int i = 0; i < (*it).responses.size(); ++i ) {
567  fWgts[(*it).pid][i] = (*it).responses[i];
568  }
569  }
570  }
571  }
572  } // loop through MC truth i
573 
574  fTree->Fill();
575  return;
576  }
intermediate_table::iterator iterator
unsigned int event
Definition: DataStructs.h:636
systtools::provider_list_t fSystProviders
unsigned int run
Definition: DataStructs.h:637
int fNwgt[knShifts]
std::string fCVNLabel
std::string fMVASelectNueLabel
const int kPdgK0
Definition: PDGCodes.h:174
bool IsHadron(int pdgc)
Definition: PDGUtils.cxx:389
std::string fEnergyRecoNueLabel
const int kPdgKM
Definition: PDGCodes.h:173
const int kPdgGamma
Definition: PDGCodes.h:189
const int kPdgKP
Definition: PDGCodes.h:172
p
Definition: test.py:223
const int kPdgPiP
Definition: PDGCodes.h:158
const int kPdgPi0
Definition: PDGCodes.h:160
std::string fRegCNNLabel
const int kPdgAntiK0
Definition: PDGCodes.h:175
const int kPdgK0L
Definition: PDGCodes.h:176
std::string fEnergyRecoNumuLabel
std::string fMVASelectNumuLabel
bool IsIon(int pdgc)
Definition: PDGUtils.cxx:39
std::string fMVASelectLabel
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
const int kPdgPiM
Definition: PDGCodes.h:159
unsigned int subRun
Definition: DataStructs.h:638
const int kPdgProton
Definition: PDGCodes.h:81
double pid
How confident are we?
Definition: MVASelectPID.h:11
TCEvent evt
Definition: DataStructs.cxx:7
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
const int kPdgK0S
Definition: PDGCodes.h:177
double fWgts[knShifts][kmaxRwgts]
const int kPdgNeutron
Definition: PDGCodes.h:83
void dunemva::CAFMaker::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 182 of file CAFMaker_module.cc.

183  {
184 
186  fTree = tfs->make<TTree>("caf", "caf");
187  fMetaTree = tfs->make<TTree>("meta", "meta");
188 
189  // book-keeping
190  fTree->Branch("run", &fRun, "run/I");
191  fTree->Branch("subrun", &fSubrun, "subrun/I");
192  fTree->Branch("event", &fEvent, "event/I");
193  fTree->Branch("isFD", &fIsFD, "isFD/I");
194  fTree->Branch("isFHC", &fIsFHC, "isFHC/I");
195  fTree->Branch("isCC", &fIsCC, "isCC/I");
196 
197  // true interaction quantities
198  fTree->Branch("nuPDG", &fNuPDG, "nuPDG/I");
199  fTree->Branch("nuPDGunosc", &fNuPDGunosc, "nuPDGunosc/I");
200  fTree->Branch("NuMomX", &fNuMomX, "NuMomX/D");
201  fTree->Branch("NuMomY", &fNuMomY, "NuMomY/D");
202  fTree->Branch("NuMomZ", &fNuMomZ, "NuMomZ/D");
203  fTree->Branch("Ev", &fEv, "Ev/D");
204  fTree->Branch("mode", &fMode, "mode/I");
205  fTree->Branch("LepPDG", &fLepPDG, "LepPDG/I");
206  fTree->Branch("LepMomX", &fLepMomX, "LepMomX/D");
207  fTree->Branch("LepMomY", &fLepMomY, "LepMomY/D");
208  fTree->Branch("LepMomZ", &fLepMomZ, "LepMomZ/D");
209  fTree->Branch("LepE", &fLepE, "LepE/D");
210  fTree->Branch("LepNuAngle", &fLepNuAngle, "LepNuAngle/D");
211  fTree->Branch("Q2", &fQ2, "Q2/D");
212  fTree->Branch("W", &fW, "W/D");
213  fTree->Branch("X", &fX, "X/D");
214  fTree->Branch("Y", &fY, "Y/D");
215 
216  // FS particle counts
217  fTree->Branch("nP", &nP, "nP/I");
218  fTree->Branch("nN", &nN, "nN/I");
219  fTree->Branch("nipip", &nPip, "nipip/I");
220  fTree->Branch("nipim", &nPim, "nipim/I");
221  fTree->Branch("nipi0", &nPi0, "nipi0/I");
222  fTree->Branch("nikp", &nKp, "nikp/I");
223  fTree->Branch("nikm", &nKm, "nikm/I");
224  fTree->Branch("nik0", &nK0, "nik0/I");
225  fTree->Branch("niem", &nEM, "niem/I");
226  fTree->Branch("niother", &nOtherHad, "niother/I");
227  fTree->Branch("nNucleus", &nNucleus, "nNucleus/I");
228  fTree->Branch("nUNKNOWN", &nUNKNOWN, "nUNKNOWN/I");
229  fTree->Branch("eP", &eP, "eP/D");
230  fTree->Branch("eN", &eN, "eN/D");
231  fTree->Branch("ePip", &ePip, "ePip/D");
232  fTree->Branch("ePim", &ePim, "ePim/D");
233  fTree->Branch("ePi0", &ePi0, "ePi0/D");
234  fTree->Branch("eOther", &eOther, "eOther/D");
235 
236  // vertex position
237  fTree->Branch("vtx_x", &vtx_x, "vtx_x/D");
238  fTree->Branch("vtx_y", &vtx_y, "vtx_y/D");
239  fTree->Branch("vtx_z", &vtx_z, "vtx_z/D");
240 
241  // Reco variables
242  fTree->Branch("mvaresult", &fMVAResult, "mvaresult/D");
243  fTree->Branch("mvanue", &fMVAResultNue, "mvanue/D");
244  fTree->Branch("mvanumu", &fMVAResultNumu, "mvanumu/D");
245 
246  fTree->Branch("cvnisantineutrino", &fCVNResultIsAntineutrino, "cvnisantineutrino/D");
247  fTree->Branch("cvnnue", &fCVNResultNue, "cvnnue/D");
248  fTree->Branch("cvnnumu", &fCVNResultNumu, "cvnnumu/D");
249  fTree->Branch("cvnnutau", &fCVNResultNutau, "cvnnutau/D");
250  fTree->Branch("cvnnc", &fCVNResultNC, "cvnnc/D");
251  fTree->Branch("cvn0protons", &fCVNResult0Protons, "cvn0protons/D");
252  fTree->Branch("cvn1protons", &fCVNResult1Protons, "cvn1protons/D");
253  fTree->Branch("cvn2protons", &fCVNResult2Protons, "cvn2protons/D");
254  fTree->Branch("cvnNprotons", &fCVNResultNProtons, "cvnNprotons/D");
255  fTree->Branch("cvn0pions", &fCVNResult0Pions, "cvn0pions/D");
256  fTree->Branch("cvn1pions", &fCVNResult1Pions, "cvn1pions/D");
257  fTree->Branch("cvn2pions", &fCVNResult2Pions, "cvn2pions/D");
258  fTree->Branch("cvnNpions", &fCVNResultNPions, "cvnNpions/D");
259  fTree->Branch("cvn0pizeros", &fCVNResult0Pizeros, "cvn0pizeros/D");
260  fTree->Branch("cvn1pizeros", &fCVNResult1Pizeros, "cvn1pizeros/D");
261  fTree->Branch("cvn2pizeros", &fCVNResult2Pizeros, "cvn2pizeros/D");
262  fTree->Branch("cvnNpizeros", &fCVNResultNPizeros, "cvnNpizeros/D");
263  fTree->Branch("cvn0neutrons", &fCVNResult0Neutrons, "cvn0neutrons/D");
264  fTree->Branch("cvn1neutrons", &fCVNResult1Neutrons, "cvn1neutrons/D");
265  fTree->Branch("cvn2neutrons", &fCVNResult2Neutrons, "cvn2neutrons/D");
266  fTree->Branch("cvnNneutrons", &fCVNResultNNeutrons, "cvnNneutrons/D");
267 
268  fTree->Branch("RegCNNNueE", &fRegCNNNueE, "RegCNNNueE/D");
269  fTree->Branch("weight", &fWeight, "weight/D");
270  fTree->Branch("oscpro", &fOscPro, "oscpro/F");
271 
272  fTree->Branch("Ev_reco_nue", &fErecoNue, "Ev_reco_nue/D");
273  fTree->Branch("RecoLepEnNue", &fRecoLepEnNue, "RecoLepEnNue/D");
274  fTree->Branch("RecoHadEnNue", &fRecoHadEnNue, "RecoHadEnNue/D");
275  fTree->Branch("RecoMethodNue", &fRecoMethodNue, "RecoMethodNue/I");
276  fTree->Branch("Ev_reco_numu", &fErecoNumu, "Ev_reco_numu/D");
277  fTree->Branch("RecoLepEnNumu", &fRecoLepEnNumu, "RecoLepEnNumu/D");
278  fTree->Branch("RecoHadEnNumu", &fRecoHadEnNumu, "RecoHadEnNumu/D");
279  fTree->Branch("RecoMethodNumu", &fRecoMethodNumu, "RecoMethodNumu/I");
280  fTree->Branch("LongestTrackContNumu", &fLongestTrackContNumu, "LongestTrackContNumu/I");
281  fTree->Branch("TrackMomMethodNumu", &fTrackMomMethodNumu, "TrackMomMethodNumu/I");
282 
283  fMetaTree->Branch("pot", &meta_pot, "pot/D");
284  fMetaTree->Branch("run", &meta_run, "run/I");
285  fMetaTree->Branch("subrun", &meta_subrun, "subrun/I");
286  fMetaTree->Branch("version", &meta_version, "version/I");
287 
288  // make DUNErw variables
289  for( auto &sp : fSystProviders ) {
290  systtools::SystMetaData metaData = sp->GetSystMetaData();
291  for( systtools::SystMetaData::iterator itMeta = metaData.begin(); itMeta != metaData.end(); ++itMeta ) {
292  systtools::SystParamHeader head = *itMeta;
293  std::string name = head.prettyName;
294  unsigned int parId = head.systParamId;
295  std::cout << "Adding reweight branch " << parId << " for " << name << " with " << head.paramVariations.size() << " shifts" << std::endl;
296  fTree->Branch( Form("%s_nshifts", name.c_str()), &fNwgt[parId], Form("%s_nshifts/I", name.c_str()) );
297  fTree->Branch( Form("%s_cvwgt", name.c_str()), &fCvWgts[parId], Form("%s_cvwgt/D", name.c_str()) );
298  fTree->Branch( Form("wgt_%s", name.c_str()), fWgts[parId], Form("wgt_%s[%s_nshifts]/D", name.c_str(), name.c_str()) );
299  }
300  }
301 
302  // initialize weight variables -- some won't ever be set
303  for( int i = 0; i < knShifts; ++i ) {
304  fNwgt[i] = 0;
305  fCvWgts[i] = 1.;
306  for( int j = 0; j < kmaxRwgts; ++j ) {
307  fWgts[i][j] = 0.;
308  }
309  }
310 
311  meta_pot = 0.;
312  meta_version = 1;
313  }
static QCString name
Definition: declinfo.cpp:673
intermediate_table::iterator iterator
systtools::provider_list_t fSystProviders
int fNwgt[knShifts]
std::string string
Definition: nybbler.cc:12
double fCvWgts[knShifts]
constexpr int knShifts
uint size() const
Definition: qcstring.h:201
double fWgts[knShifts][kmaxRwgts]
QTextStream & endl(QTextStream &s)
constexpr int kmaxRwgts
void dunemva::CAFMaker::beginSubRun ( const art::SubRun sr)
override

Definition at line 316 of file CAFMaker_module.cc.

317  {
318  auto pots = sr.getHandle< sumdata::POTSummary >("generator");
319  if( pots ) meta_pot += pots->totpot;
320  }
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
void dunemva::CAFMaker::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 584 of file CAFMaker_module.cc.

585  {
586  fMetaTree->Fill();
587  }
void dunemva::CAFMaker::endSubRun ( const art::SubRun sr)
override

Definition at line 581 of file CAFMaker_module.cc.

581  {
582  }
void dunemva::CAFMaker::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 154 of file CAFMaker_module.cc.

155  {
156 
157  fMVASelectLabel = pset.get<std::string>("MVASelectLabel");
158  fMVASelectNueLabel = pset.get<std::string>("MVASelectNueLabel");
159  fMVASelectNumuLabel = pset.get<std::string>("MVASelectNumuLabel");
160  fCVNLabel = pset.get<std::string>("CVNLabel");
161  fRegCNNLabel = pset.get<std::string>("RegCNNLabel");
162 
163  fEnergyRecoNueLabel = pset.get<std::string>("EnergyRecoNueLabel");
164  fEnergyRecoNumuLabel = pset.get<std::string>("EnergyRecoNumuLabel");
165 
166  // Get DUNErw stuff from its fhicl, which should be included on the CAFMaker config file
167  //if( !pset.has_key("generated_systematic_provider_configuration") ) {
168  // std::cout << "[ERROR]: Could not find producer key: "
169  // "\"generated_systematic_provider_configuration\". This should "
170  // "contain a list of configured systematic providers generated by "
171  // "GenerateSystProviderConfig." << std::endl;
172  // return;
173  //}
174 
175  fhicl::ParameterSet syst_provider_config = pset.get<fhicl::ParameterSet>("generated_systematic_provider_configuration");
176 
177  fSystProviders = systtools::ConfigureISystProvidersFromParameterHeaders(syst_provider_config);
178  }
systtools::provider_list_t fSystProviders
std::string string
Definition: nybbler.cc:12
std::string fCVNLabel
std::string fMVASelectNueLabel
std::string fEnergyRecoNueLabel
T get(std::string const &key) const
Definition: ParameterSet.h:271
std::string fRegCNNLabel
std::string fEnergyRecoNumuLabel
std::string fMVASelectNumuLabel
std::string fMVASelectLabel

Member Data Documentation

double dunemva::CAFMaker::eN
private

Definition at line 107 of file CAFMaker_module.cc.

double dunemva::CAFMaker::eOther
private

Definition at line 107 of file CAFMaker_module.cc.

double dunemva::CAFMaker::eP
private

Definition at line 107 of file CAFMaker_module.cc.

double dunemva::CAFMaker::ePi0
private

Definition at line 107 of file CAFMaker_module.cc.

double dunemva::CAFMaker::ePim
private

Definition at line 107 of file CAFMaker_module.cc.

double dunemva::CAFMaker::ePip
private

Definition at line 107 of file CAFMaker_module.cc.

std::string dunemva::CAFMaker::fCVNLabel
private

Definition at line 80 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult0Neutrons
private

Definition at line 132 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult0Pions
private

Definition at line 130 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult0Pizeros
private

Definition at line 131 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult0Protons
private

Definition at line 129 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult1Neutrons
private

Definition at line 132 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult1Pions
private

Definition at line 130 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult1Pizeros
private

Definition at line 131 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult1Protons
private

Definition at line 129 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult2Neutrons
private

Definition at line 132 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult2Pions
private

Definition at line 130 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult2Pizeros
private

Definition at line 131 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResult2Protons
private

Definition at line 129 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResultIsAntineutrino
private

Definition at line 127 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResultNC
private

Definition at line 128 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResultNNeutrons
private

Definition at line 132 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResultNPions
private

Definition at line 130 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResultNPizeros
private

Definition at line 131 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResultNProtons
private

Definition at line 129 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResultNue
private

Definition at line 128 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResultNumu
private

Definition at line 128 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCVNResultNutau
private

Definition at line 128 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fCvWgts[knShifts]
private

Definition at line 94 of file CAFMaker_module.cc.

std::string dunemva::CAFMaker::fEnergyRecoNueLabel
private

Definition at line 83 of file CAFMaker_module.cc.

std::string dunemva::CAFMaker::fEnergyRecoNumuLabel
private

Definition at line 84 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fErecoNue
private

Definition at line 111 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fErecoNumu
private

Definition at line 115 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fEv
private

Definition at line 104 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fEvent
private

Definition at line 101 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fIsCC
private

Definition at line 103 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fIsFD
private

Definition at line 99 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fIsFHC
private

Definition at line 99 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fLepE
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fLepMomX
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fLepMomY
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fLepMomZ
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fLepNuAngle
private

Definition at line 104 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fLepPDG
private

Definition at line 103 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fLongestTrackContNumu
private

Definition at line 119 of file CAFMaker_module.cc.

TTree* dunemva::CAFMaker::fMetaTree
private

Definition at line 90 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fMode
private

Definition at line 103 of file CAFMaker_module.cc.

std::string dunemva::CAFMaker::fMVAMethod
private

Definition at line 85 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fMVAResult
private

Definition at line 122 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fMVAResultNue
private

Definition at line 123 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fMVAResultNumu
private

Definition at line 124 of file CAFMaker_module.cc.

std::string dunemva::CAFMaker::fMVASelectLabel
private

Definition at line 76 of file CAFMaker_module.cc.

std::string dunemva::CAFMaker::fMVASelectNueLabel
private

Definition at line 77 of file CAFMaker_module.cc.

std::string dunemva::CAFMaker::fMVASelectNumuLabel
private

Definition at line 78 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fNuMomX
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fNuMomY
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fNuMomZ
private

Definition at line 104 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fNuPDG
private

Definition at line 103 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fNuPDGunosc
private

Definition at line 103 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fNwgt[knShifts]
private

Definition at line 93 of file CAFMaker_module.cc.

float dunemva::CAFMaker::fOscPro
private

Definition at line 87 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fQ2
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fRecoHadEnNue
private

Definition at line 113 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fRecoHadEnNumu
private

Definition at line 117 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fRecoLepEnNue
private

Definition at line 112 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fRecoLepEnNumu
private

Definition at line 116 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fRecoMethodNue
private

Definition at line 114 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fRecoMethodNumu
private

Definition at line 118 of file CAFMaker_module.cc.

std::string dunemva::CAFMaker::fRegCNNLabel
private

Definition at line 81 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fRegCNNNueE
private

Definition at line 134 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fRun
private

Definition at line 101 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fSubrun
private

Definition at line 101 of file CAFMaker_module.cc.

systtools::provider_list_t dunemva::CAFMaker::fSystProviders
private

Definition at line 139 of file CAFMaker_module.cc.

int dunemva::CAFMaker::fTrackMomMethodNumu
private

Definition at line 120 of file CAFMaker_module.cc.

TTree* dunemva::CAFMaker::fTree
private

Definition at line 89 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fW
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fWeight
private

Definition at line 88 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fWgts[knShifts][kmaxRwgts]
private

Definition at line 95 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fX
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::fY
private

Definition at line 104 of file CAFMaker_module.cc.

double dunemva::CAFMaker::meta_pot
private

Definition at line 136 of file CAFMaker_module.cc.

int dunemva::CAFMaker::meta_run
private

Definition at line 137 of file CAFMaker_module.cc.

int dunemva::CAFMaker::meta_subrun
private

Definition at line 137 of file CAFMaker_module.cc.

int dunemva::CAFMaker::meta_version
private

Definition at line 137 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nEM
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nK0
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nKm
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nKp
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nN
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nNucleus
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nOtherHad
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nP
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nPi0
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nPim
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nPip
private

Definition at line 106 of file CAFMaker_module.cc.

int dunemva::CAFMaker::nUNKNOWN
private

Definition at line 106 of file CAFMaker_module.cc.

double dunemva::CAFMaker::vtx_x
private

Definition at line 108 of file CAFMaker_module.cc.

double dunemva::CAFMaker::vtx_y
private

Definition at line 108 of file CAFMaker_module.cc.

double dunemva::CAFMaker::vtx_z
private

Definition at line 108 of file CAFMaker_module.cc.


The documentation for this class was generated from the following file: