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

Public Member Functions

 CheckCNNScore (fhicl::ParameterSet const &p)
 
 CheckCNNScore (CheckCNNScore const &)=delete
 
 CheckCNNScore (CheckCNNScore &&)=delete
 
CheckCNNScoreoperator= (CheckCNNScore const &)=delete
 
CheckCNNScoreoperator= (CheckCNNScore &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () 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

art::InputTag fNNetModuleLabel
 
art::InputTag fHitsModuleLabel
 
TTree * ftree
 
int run
 
int subrun
 
int event
 
std::vector< short > channel
 
std::vector< short > tpc
 
std::vector< short > plane
 
std::vector< short > wire
 
std::vector< double > charge
 
std::vector< double > peakt
 
std::vector< double > score_inel
 
std::vector< double > score_el
 
std::vector< double > score_none
 

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 29 of file CheckCNNScore_module.cc.

Constructor & Destructor Documentation

pdsp::CheckCNNScore::CheckCNNScore ( fhicl::ParameterSet const &  p)
explicit

Definition at line 68 of file CheckCNNScore_module.cc.

69  : EDAnalyzer{p}
70  , fNNetModuleLabel(p.get<art::InputTag>("NNetModuleLabel"))
71  , fHitsModuleLabel(p.get<art::InputTag>("HitsModuleLabel"))
72 {}
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
p
Definition: test.py:223
art::InputTag fHitsModuleLabel
art::InputTag fNNetModuleLabel
pdsp::CheckCNNScore::CheckCNNScore ( CheckCNNScore const &  )
delete
pdsp::CheckCNNScore::CheckCNNScore ( CheckCNNScore &&  )
delete

Member Function Documentation

void pdsp::CheckCNNScore::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 75 of file CheckCNNScore_module.cc.

76 {
77 
78  run = e.run();
79  subrun = e.subRun();
80  event = e.id().event();
81  channel.clear();
82  tpc.clear();
83  plane.clear();
84  wire.clear();
85  charge.clear();
86  peakt.clear();
87  score_inel.clear();
88  score_el.clear();
89  score_none.clear();
90 
92 
94  std::vector<art::Ptr<recob::Hit>> hitlist;
95  if (e.getByLabel(fHitsModuleLabel, hitListHandle)) art::fill_ptr_vector(hitlist, hitListHandle);
96 
97  // loop over hits
98  // for (size_t h = 0; h < hitResults.size(); ++h) {
99  for (auto& hit : hitlist) {
100 
101  // Get cnn output for hit h
102  std::array<float, 3> cnn_out = hitResults.getOutput(hit);
103 
104  if (hit->WireID().Plane == 2) {
105  channel.push_back(hit->Channel());
106  tpc.push_back(hit->WireID().TPC);
107  plane.push_back(hit->WireID().Plane);
108  wire.push_back(hit->WireID().Wire);
109  charge.push_back(hit->Integral());
110  peakt.push_back(hit->PeakTime());
111  score_inel.push_back(cnn_out[hitResults.getIndex("inel")]);
112  score_el.push_back(cnn_out[hitResults.getIndex("el")]);
113  score_none.push_back(cnn_out[hitResults.getIndex("none")]);
114  // std::cout<<hit->WireID().TPC<<" "
115  // <<hit->WireID().Wire<<" "
116  // <<hit->PeakTime()<<" "
117  // <<cnn_out[hitResults.getIndex("el")]<<" "
118  // <<cnn_out[hitResults.getIndex("inel")]<<" "
119  // <<cnn_out[hitResults.getIndex("none")]<<std::endl;
120  }
121  }
122  if (!channel.empty()) ftree->Fill();
123 }
std::vector< short > wire
std::vector< short > plane
std::vector< double > score_inel
std::vector< double > charge
const double e
std::vector< double > score_none
Detector simulation of raw signals on wires.
art::InputTag fHitsModuleLabel
std::vector< short > channel
art::InputTag fNNetModuleLabel
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
std::vector< double > peakt
std::vector< short > tpc
std::vector< double > score_el
void pdsp::CheckCNNScore::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 126 of file CheckCNNScore_module.cc.

127 {
128  art::ServiceHandle<art::TFileService> fileServiceHandle;
129  ftree = fileServiceHandle->make<TTree>("ftree", "hit info");
130  ftree->Branch("run", &run, "run/I");
131  ftree->Branch("event", &event, "event/I");
132  ftree->Branch("channel", &channel);
133  ftree->Branch("tpc", &tpc);
134  ftree->Branch("plane", &plane);
135  ftree->Branch("wire", &wire);
136  ftree->Branch("charge", &charge);
137  ftree->Branch("peakt", &peakt);
138  ftree->Branch("score_inel", &score_inel);
139  ftree->Branch("score_el", &score_el);
140  ftree->Branch("score_none", &score_none);
141 }
std::vector< short > wire
std::vector< short > plane
std::vector< double > score_inel
std::vector< double > charge
std::vector< double > score_none
std::vector< short > channel
std::vector< double > peakt
std::vector< short > tpc
Event finding and building.
std::vector< double > score_el
CheckCNNScore& pdsp::CheckCNNScore::operator= ( CheckCNNScore const &  )
delete
CheckCNNScore& pdsp::CheckCNNScore::operator= ( CheckCNNScore &&  )
delete

Member Data Documentation

std::vector<short> pdsp::CheckCNNScore::channel
private

Definition at line 57 of file CheckCNNScore_module.cc.

std::vector<double> pdsp::CheckCNNScore::charge
private

Definition at line 61 of file CheckCNNScore_module.cc.

int pdsp::CheckCNNScore::event
private

Definition at line 56 of file CheckCNNScore_module.cc.

art::InputTag pdsp::CheckCNNScore::fHitsModuleLabel
private

Definition at line 51 of file CheckCNNScore_module.cc.

art::InputTag pdsp::CheckCNNScore::fNNetModuleLabel
private

Definition at line 50 of file CheckCNNScore_module.cc.

TTree* pdsp::CheckCNNScore::ftree
private

Definition at line 53 of file CheckCNNScore_module.cc.

std::vector<double> pdsp::CheckCNNScore::peakt
private

Definition at line 62 of file CheckCNNScore_module.cc.

std::vector<short> pdsp::CheckCNNScore::plane
private

Definition at line 59 of file CheckCNNScore_module.cc.

int pdsp::CheckCNNScore::run
private

Definition at line 54 of file CheckCNNScore_module.cc.

std::vector<double> pdsp::CheckCNNScore::score_el
private

Definition at line 64 of file CheckCNNScore_module.cc.

std::vector<double> pdsp::CheckCNNScore::score_inel
private

Definition at line 63 of file CheckCNNScore_module.cc.

std::vector<double> pdsp::CheckCNNScore::score_none
private

Definition at line 65 of file CheckCNNScore_module.cc.

int pdsp::CheckCNNScore::subrun
private

Definition at line 55 of file CheckCNNScore_module.cc.

std::vector<short> pdsp::CheckCNNScore::tpc
private

Definition at line 58 of file CheckCNNScore_module.cc.

std::vector<short> pdsp::CheckCNNScore::wire
private

Definition at line 60 of file CheckCNNScore_module.cc.


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