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

Public Member Functions

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

const art::InputTag fOpHitLabel
 
const art::InputTag fMCTruthLabel
 
const art::InputTag fGEANTLabel
 
TTree * fTree
 
std::vector< double > fTrueID
 
std::vector< double > fTrue_time
 
std::vector< double > fTrueStartx
 
std::vector< double > fTrueStarty
 
std::vector< double > fTrueStartz
 
std::vector< double > fTruePx
 
std::vector< double > fTruePy
 
std::vector< double > fTruePz
 
std::vector< int64_t > fPDS_time
 
std::vector< double > fOpChan
 
std::vector< double > fPE
 

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 69 of file PDSPmatchmc_module.cc.

Constructor & Destructor Documentation

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

Definition at line 103 of file PDSPmatchmc_module.cc.

104  :
105  EDAnalyzer(p),
106  fOpHitLabel(p.get<art::InputTag>("OpHitLabel_MC")),
107  fMCTruthLabel(p.get<art::InputTag>("MCTruthLabel_MC")),
108  fGEANTLabel(p.get<art::InputTag>("GEANTLabel_MC"))
109  //: EDAnalyzer{p},
110  // ,
111  // More initializers here.
112 {
113  // Call appropriate consumes<>() for any products to be retrieved by this module.
114  consumes<std::vector<recob::OpHit>>(fOpHitLabel);
115  consumes<std::vector<simb::MCTruth>>(fMCTruthLabel);
116  consumes<std::vector<simb::MCParticle>>(fGEANTLabel);
117 }
const art::InputTag fOpHitLabel
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
const art::InputTag fGEANTLabel
p
Definition: test.py:223
const art::InputTag fMCTruthLabel
pdsp::PDSPmatchmc::PDSPmatchmc ( PDSPmatchmc const &  )
delete
pdsp::PDSPmatchmc::PDSPmatchmc ( PDSPmatchmc &&  )
delete
pdsp::PDSPmatchmc::PDSPmatchmc ( fhicl::ParameterSet const &  p)
explicit
pdsp::PDSPmatchmc::PDSPmatchmc ( PDSPmatchmc const &  )
delete
pdsp::PDSPmatchmc::PDSPmatchmc ( PDSPmatchmc &&  )
delete

Member Function Documentation

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

Implements art::EDAnalyzer.

Definition at line 119 of file PDSPmatchmc_module.cc.

120 {
122 
123  bool op = false;
124  // Implementation of required member function here.
125  fTrueID.clear();
126  fTrue_time.clear();
127  fTrueStartx.clear();
128  fTrueStarty.clear();
129  fTrueStartz.clear();
130  fTruePx.clear();
131  fTruePy.clear();
132  fTruePz.clear();
133 
134  fPDS_time.clear();
135  fOpChan.clear();
136  fPE.clear();
137 
138  const auto MClistHandle = e.getValidHandle<std::vector<simb::MCTruth>>(fMCTruthLabel);
139  art::Ptr<simb::MCTruth> mctruth(MClistHandle,0);
140  if(mctruth->NParticles() == 0){
141  mf::LogError("PDSPmatchmc") << "No MCTruth Particles! Skipping.";
142  return;
143  }
144 
145  const auto OpHitHandle = e.getValidHandle<std::vector<recob::OpHit>>(fOpHitLabel);
146 
147  const simb::MCParticle& part(mctruth->GetParticle(0));
148  fTrueID.push_back(part.PdgCode());
149  fTrue_time.push_back(part.T());
150  fTrueStartx.push_back(part.Vx());
151  fTrueStarty.push_back(part.Vy());
152  fTrueStartz.push_back(part.Vz());
153  fTruePx.push_back(part.Px());
154  fTruePy.push_back(part.Py());
155  fTruePz.push_back(part.Pz());
156 
157  for(const auto& OpHit: *OpHitHandle){
158  fPDS_time.push_back((OpHit.PeakTime()));
159  fOpChan.push_back(OpHit.OpChannel());
160  fPE.push_back(OpHit.PE());
161  }
162  if(fPDS_time.size() > 0) op=true;
163 
164  if(op) fTree->Fill();
165 
166 }
std::vector< double > fTrueStartx
std::vector< double > fOpChan
std::vector< int64_t > fPDS_time
const art::InputTag fOpHitLabel
std::vector< double > fTrueID
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
std::vector< double > fTruePx
std::vector< double > fPE
const double e
std::vector< double > fTrue_time
std::vector< double > fTrueStartz
std::vector< double > fTruePz
std::vector< double > fTrueStarty
const art::InputTag fMCTruthLabel
std::vector< double > fTruePy
void pdsp::PDSPmatchmc::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

void pdsp::PDSPmatchmc::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 169 of file PDSPmatchmc_module.cc.

170 {
171  // Implementation of optional member function here.
173 
174  fTree = tFileService->make<TTree>("ProtoDUNE_Evt_Match","ProtoDUNE Matched MC Event Tree");
175 
176  fTree->Branch("fTrueID",&fTrueID);
177  fTree->Branch("fTrue_time",&fTrue_time);
178  fTree->Branch("fTrueStartx",&fTrueStartx);
179  fTree->Branch("fTrueStarty",&fTrueStarty);
180  fTree->Branch("fTrueStartz",&fTrueStartz);
181  fTree->Branch("fTruePx",&fTruePx);
182  fTree->Branch("fTruePy",&fTruePy);
183  fTree->Branch("fTruePz",&fTruePz);
184 
185  fTree->Branch("fPDS_time",&fPDS_time);
186  fTree->Branch("fOpChan",&fOpChan);
187  fTree->Branch("fPE",&fPE);
188 }
std::vector< double > fTrueStartx
std::vector< double > fOpChan
std::vector< int64_t > fPDS_time
std::vector< double > fTrueID
std::vector< double > fTruePx
std::vector< double > fPE
std::vector< double > fTrue_time
std::vector< double > fTrueStartz
std::vector< double > fTruePz
std::vector< double > fTrueStarty
std::vector< double > fTruePy
void pdsp::PDSPmatchmc::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

PDSPmatchmc& pdsp::PDSPmatchmc::operator= ( PDSPmatchmc const &  )
delete
PDSPmatchmc& pdsp::PDSPmatchmc::operator= ( PDSPmatchmc const &  )
delete
PDSPmatchmc& pdsp::PDSPmatchmc::operator= ( PDSPmatchmc &&  )
delete
PDSPmatchmc& pdsp::PDSPmatchmc::operator= ( PDSPmatchmc &&  )
delete

Member Data Documentation

const art::InputTag pdsp::PDSPmatchmc::fGEANTLabel
private

Definition at line 93 of file PDSPmatchmc_module.cc.

const art::InputTag pdsp::PDSPmatchmc::fMCTruthLabel
private

Definition at line 92 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fOpChan
private

Definition at line 100 of file PDSPmatchmc_module.cc.

const art::InputTag pdsp::PDSPmatchmc::fOpHitLabel
private

Definition at line 90 of file PDSPmatchmc_module.cc.

std::vector< int64_t > pdsp::PDSPmatchmc::fPDS_time
private

Definition at line 99 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fPE
private

Definition at line 100 of file PDSPmatchmc_module.cc.

TTree * pdsp::PDSPmatchmc::fTree
private

Definition at line 95 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fTrue_time
private

Definition at line 97 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fTrueID
private

Definition at line 97 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fTruePx
private

Definition at line 97 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fTruePy
private

Definition at line 97 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fTruePz
private

Definition at line 97 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fTrueStartx
private

Definition at line 97 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fTrueStarty
private

Definition at line 97 of file PDSPmatchmc_module.cc.

std::vector< double > pdsp::PDSPmatchmc::fTrueStartz
private

Definition at line 97 of file PDSPmatchmc_module.cc.


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