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

Public Member Functions

 CVNValidation (fhicl::ParameterSet const &pset)
 
 ~CVNValidation ()
 
void analyze (const art::Event &evt) override
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void beginJob () override
 
void endJob () 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 fResultLabel
 
std::string fTruthLabel
 
std::string fNumuEnergyLabel
 
std::string fNueEnergyLabel
 
TTree * fValidTree
 
float fNumuProb
 
float fNueProb
 
float fNutauProb
 
float fNCProb
 
float fNumuEnergy
 Reco energy for numu and nue probabilities. More...
 
float fNueEnergy
 
int fPDG
 Truth information. More...
 

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 39 of file CVNValidation_module.cc.

Constructor & Destructor Documentation

cvn::CVNValidation::CVNValidation ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 74 of file CVNValidation_module.cc.

75  : EDAnalyzer(pset)
76  {
77  this->reconfigure(pset);
78  }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
void reconfigure(const fhicl::ParameterSet &pset)
cvn::CVNValidation::~CVNValidation ( )

Definition at line 81 of file CVNValidation_module.cc.

82  { }

Member Function Documentation

void cvn::CVNValidation::analyze ( const art::Event evt)
override

Definition at line 116 of file CVNValidation_module.cc.

117  {
118 
119  // Get the CVN results
120  auto cvnResults = evt.getValidHandle<std::vector<cvn::Result>>(fResultLabel);
121  if(!cvnResults.isValid()) return;
122  if(cvnResults->size()==0) return;
123 
124  // Get the truth information
125  auto truthInfo = evt.getValidHandle<std::vector<simb::MCTruth>>(fTruthLabel);
126  if(!truthInfo.isValid()) return;
127  if(truthInfo->size()==0) return;
128  if(!truthInfo->at(0).NeutrinoSet()) return;
129 
130  // Get the energy results
131  auto numuEnergy = evt.getValidHandle<dune::EnergyRecoOutput>(fNumuEnergyLabel);
132  auto nueEnergy = evt.getValidHandle<dune::EnergyRecoOutput>(fNueEnergyLabel);
133  if(!numuEnergy.isValid() || !nueEnergy.isValid()) return;
134 
135  // Fill the CVN flavour branches
136  fNumuProb = cvnResults->at(0).GetNumuProbability();
137  fNueProb = cvnResults->at(0).GetNueProbability();
138  fNutauProb = cvnResults->at(0).GetNutauProbability();
139  fNCProb = cvnResults->at(0).GetNCProbability();
140  // Reconstructed energy
141  fNumuEnergy = numuEnergy->fNuLorentzVector.E();
142  fNueEnergy = nueEnergy->fNuLorentzVector.E();
143  // PDG
144  fPDG = truthInfo->at(0).GetNeutrino().Nu().PdgCode();
145  if(truthInfo->at(0).GetNeutrino().CCNC() == simb::kNC){
146  fPDG = 0;
147  }
148 
149  fValidTree->Fill();
150 
151  }
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
int fPDG
Truth information.
float fNumuEnergy
Reco energy for numu and nue probabilities.
void cvn::CVNValidation::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 94 of file CVNValidation_module.cc.

95  {
96 
98 
99  fValidTree = tfs->make<TTree>("CVNOutput", "CVN Output");
100  fValidTree->Branch("pNumu",&fNumuProb,"fNumuProb/F");
101  fValidTree->Branch("pNue",&fNueProb,"fNueProb/F");
102  fValidTree->Branch("pNutau",&fNutauProb,"fNutauProb/F");
103  fValidTree->Branch("pNC",&fNCProb,"fNCProb/F");
104  fValidTree->Branch("numuEnergy",&fNumuEnergy,"fNumuEnergy/F");
105  fValidTree->Branch("nueEnergy",&fNueEnergy,"fNueEnergy/F");
106  fValidTree->Branch("pdg",&fPDG,"fPDG/I");
107  }
int fPDG
Truth information.
float fNumuEnergy
Reco energy for numu and nue probabilities.
void cvn::CVNValidation::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 110 of file CVNValidation_module.cc.

111  {
112 
113  }
void cvn::CVNValidation::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 85 of file CVNValidation_module.cc.

86  {
87  fResultLabel = pset.get<std::string>("CVNResultLabel");
88  fTruthLabel = pset.get<std::string>("TruthLabel");
89  fNumuEnergyLabel = pset.get<std::string> ("NumuEnergyLabel");
90  fNueEnergyLabel = pset.get<std::string> ("NueEnergyLabel");
91  }
std::string string
Definition: nybbler.cc:12
T get(std::string const &key) const
Definition: ParameterSet.h:271

Member Data Documentation

float cvn::CVNValidation::fNCProb
private

Definition at line 64 of file CVNValidation_module.cc.

float cvn::CVNValidation::fNueEnergy
private

Definition at line 67 of file CVNValidation_module.cc.

std::string cvn::CVNValidation::fNueEnergyLabel
private

Definition at line 55 of file CVNValidation_module.cc.

float cvn::CVNValidation::fNueProb
private

Definition at line 62 of file CVNValidation_module.cc.

float cvn::CVNValidation::fNumuEnergy
private

Reco energy for numu and nue probabilities.

Definition at line 66 of file CVNValidation_module.cc.

std::string cvn::CVNValidation::fNumuEnergyLabel
private

Definition at line 54 of file CVNValidation_module.cc.

float cvn::CVNValidation::fNumuProb
private

Tree branch variables Neutrino flavour probabilities

Definition at line 61 of file CVNValidation_module.cc.

float cvn::CVNValidation::fNutauProb
private

Definition at line 63 of file CVNValidation_module.cc.

int cvn::CVNValidation::fPDG
private

Truth information.

Definition at line 69 of file CVNValidation_module.cc.

std::string cvn::CVNValidation::fResultLabel
private

Definition at line 52 of file CVNValidation_module.cc.

std::string cvn::CVNValidation::fTruthLabel
private

Definition at line 53 of file CVNValidation_module.cc.

TTree* cvn::CVNValidation::fValidTree
private

Definition at line 57 of file CVNValidation_module.cc.


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