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

Public Member Functions

 EvalVtx (const fhicl::ParameterSet &pset)
 
void analyze (const art::Event &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 fTruthLabel
 
std::vector< std::stringfVertexLabels
 
TTree * fTree
 
int gEvt
 
double gTrueX
 
double gTrueY
 
double gTrueZ
 
std::vector< double > gRecoX
 
std::vector< double > gRecoY
 
std::vector< double > gRecoZ
 

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 21 of file EvalVtx_module.cc.

Constructor & Destructor Documentation

quad::EvalVtx::EvalVtx ( const fhicl::ParameterSet pset)
explicit

Definition at line 43 of file EvalVtx_module.cc.

43  :
44  EDAnalyzer(pset),
45  fTruthLabel(pset.get<std::string>("TruthLabel")),
46  fVertexLabels(pset.get<std::vector<std::string>>("VertexLabels"))
47 {
49 
50  fTree = tfs->make<TTree>("vtxs", "vtxs");
51 
52  fTree->Branch("evt", &gEvt);
53  fTree->Branch("true_x", &gTrueX);
54  fTree->Branch("true_y", &gTrueY);
55  fTree->Branch("true_z", &gTrueZ);
56 
57  gRecoX.resize(fVertexLabels.size());
58  gRecoY.resize(fVertexLabels.size());
59  gRecoZ.resize(fVertexLabels.size());
60 
61  for(unsigned int i = 0; i < fVertexLabels.size(); ++i){
62  const std::string& l = fVertexLabels[i];
63  fTree->Branch((l+"_x").c_str(), &gRecoX[i]);
64  fTree->Branch((l+"_y").c_str(), &gRecoY[i]);
65  fTree->Branch((l+"_z").c_str(), &gRecoZ[i]);
66  }
67 }
std::string string
Definition: nybbler.cc:12
std::vector< std::string > fVertexLabels
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::vector< double > gRecoZ
static QStrList * l
Definition: config.cpp:1044
std::vector< double > gRecoX
T get(std::string const &key) const
Definition: ParameterSet.h:271
std::vector< double > gRecoY
std::string fTruthLabel

Member Function Documentation

void quad::EvalVtx::analyze ( const art::Event evt)
override

Definition at line 111 of file EvalVtx_module.cc.

112 {
113  const auto& truths = *evt.getValidHandle<std::vector<simb::MCTruth>>(fTruthLabel);
114  if(truths.empty()) return;
115 
116  const simb::MCParticle& nu = truths[0].GetNeutrino().Nu();
117 
118  gEvt = evt.event();
119 
120  gTrueX = nu.Vx();
121  gTrueY = nu.Vy();
122  gTrueZ = nu.Vz();
123 
124  for(unsigned int i = 0; i < fVertexLabels.size(); ++i){
125  // NB - vertices returned by these functions can be invalid (default
126  // constructed) in case no vertex exists. We stil have to write them, since
127  // another algorithm may have made a valid vertex for this
128  // event. Downstream plotting code should be aware and treat (0,0,0)
129  // vertices specially.
130  const recob::Vertex vtx = (fVertexLabels[i] == "pandora") ? GetVtxByAssns(fVertexLabels[i], evt) : GetFirstVertex(fVertexLabels[i], evt);
131  const recob::Vertex::Point_t reco_vtx = vtx.position();
132 
133  gRecoX[i] = reco_vtx.x();
134  gRecoY[i] = reco_vtx.y();
135  gRecoZ[i] = reco_vtx.z();
136  } // end for i
137 
138  fTree->Fill();
139 }
EventNumber_t event() const
Definition: DataViewImpl.cc:85
recob::Vertex GetVtxByAssns(const std::string &label, const art::Event &evt)
std::vector< std::string > fVertexLabels
std::vector< double > gRecoZ
Definition of vertex object for LArSoft.
Definition: Vertex.h:35
tracking::Point_t Point_t
Definition: Vertex.h:39
std::vector< double > gRecoX
recob::Vertex GetFirstVertex(const std::string &label, const art::Event &evt)
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
std::vector< double > gRecoY
double Vx(const int i=0) const
Definition: MCParticle.h:221
std::string fTruthLabel
double Vz(const int i=0) const
Definition: MCParticle.h:223
const Point_t & position() const
Return vertex 3D position.
Definition: Vertex.h:60
double Vy(const int i=0) const
Definition: MCParticle.h:222

Member Data Documentation

TTree* quad::EvalVtx::fTree
private

Definition at line 32 of file EvalVtx_module.cc.

std::string quad::EvalVtx::fTruthLabel
private

Definition at line 29 of file EvalVtx_module.cc.

std::vector<std::string> quad::EvalVtx::fVertexLabels
private

Definition at line 30 of file EvalVtx_module.cc.

int quad::EvalVtx::gEvt
private

Definition at line 35 of file EvalVtx_module.cc.

std::vector<double> quad::EvalVtx::gRecoX
private

Definition at line 37 of file EvalVtx_module.cc.

std::vector<double> quad::EvalVtx::gRecoY
private

Definition at line 37 of file EvalVtx_module.cc.

std::vector<double> quad::EvalVtx::gRecoZ
private

Definition at line 37 of file EvalVtx_module.cc.

double quad::EvalVtx::gTrueX
private

Definition at line 36 of file EvalVtx_module.cc.

double quad::EvalVtx::gTrueY
private

Definition at line 36 of file EvalVtx_module.cc.

double quad::EvalVtx::gTrueZ
private

Definition at line 36 of file EvalVtx_module.cc.


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