19 #include "art_root_io/TFileService.h" 20 #include "art_root_io/TFileDirectory.h" 33 class RegCNNVertexAna;
105 fTree =
tfs->make<TTree>(
"anatree",
"anatree");
106 fTree->Branch(
"ievent", &
ievt,
"ievent/I");
172 std::vector<art::Ptr<simb::MCTruth> > mclist;
175 if (mctruthListHandle)
180 std::vector<art::Ptr<recob::Hit> > hits;
190 auto cnnresultListHandle = evt.
getHandle<std::vector<cnn::RegCNNResult>>(itag);
193 auto cnnvtxresultListHandle = evt.
getHandle<std::vector<cnn::RegCNNResult>>(itag2);
196 auto cnnvtxresultListHandle1st = evt.
getHandle<std::vector<cnn::RegCNNResult>>(itag3);
199 auto cnnvtxresultListHandle2nd = evt.
getHandle<std::vector<cnn::RegCNNResult>>(itag4);
202 auto cnnvtxresultListHandle2 = evt.
getHandle<std::vector<cnn::RegCNNResult>>(itag5);
208 for(
size_t iList = 0; (iList < mclist.size()) && (neutrino_i <
kMax) ; ++iList)
210 if (mclist[iList]->NeutrinoSet())
212 nueng_truth[neutrino_i] = mclist[iList]->GetNeutrino().Nu().Momentum().E();
213 nupdg_truth[neutrino_i] = mclist[iList]->GetNeutrino().Nu().PdgCode();
214 nuccnc_truth[neutrino_i] = mclist[iList]->GetNeutrino().CCNC();
215 numode_truth[neutrino_i] = mclist[iList]->GetNeutrino().Mode();
217 nuvtxx_truth[neutrino_i] = mclist[iList]->GetNeutrino().Nu().Vx();
218 nuvtxy_truth[neutrino_i] = mclist[iList]->GetNeutrino().Nu().Vy();
219 nuvtxz_truth[neutrino_i] = mclist[iList]->GetNeutrino().Nu().Vz();
244 double xyz_temp[3] = {0.0, 0.0, 0.0} ;
245 for (
unsigned int ipfp = 0; ipfp < particleVector.size(); ipfp++){
251 if (particlesToVertices.end() != vIter)
254 if (!vertexVector.empty())
256 if (vertexVector.size() !=1)
257 std::cout <<
" Warning: Found particle with more than one associated vertex " <<
std::endl;
260 vertex_pfp->
XYZ(xyz_temp);
273 if (!engrecoHandle.failedToGet())
275 ErecoNue = engrecoHandle->fNuLorentzVector.E();
283 if (!cnnresultListHandle.failedToGet())
285 if (!cnnresultListHandle->empty())
287 const std::vector<float>& v = (*cnnresultListHandle)[0].fOutput;
288 for (
unsigned int ii = 0; ii < 1; ii++){
296 if (!cnnvtxresultListHandle.failedToGet())
298 if (!cnnvtxresultListHandle->empty())
300 const std::vector<float>& v = (*cnnvtxresultListHandle)[0].fOutput;
301 for (
unsigned int ii = 0; ii < 3; ii++){
308 if (!cnnvtxresultListHandle2.failedToGet())
310 if (!cnnvtxresultListHandle2->empty())
312 const std::vector<float>& v = (*cnnvtxresultListHandle2)[0].fOutput;
313 for (
unsigned int ii = 0; ii < 3; ii++){
320 if (!cnnvtxresultListHandle1st.failedToGet())
322 if (!cnnvtxresultListHandle1st->empty())
324 const std::vector<float>& v = (*cnnvtxresultListHandle1st)[0].fOutput;
326 for (
unsigned int ii = 0; ii < 3; ii++){
332 if (!cnnvtxresultListHandle2nd.failedToGet())
334 if (!cnnvtxresultListHandle2nd->empty())
336 const std::vector<float>& v = (*cnnvtxresultListHandle2nd)[0].fOutput;
338 for (
unsigned int ii = 0; ii < 3; ii++){
360 for (
int ii = 0; ii < 3; ii++){
367 for (
int ii = 0; ii <
kMax; ++ii)
void XYZ(double *xyz) const
Legacy method to access vertex position, preserved to avoid breaking code. Please try to use Vertex::...
void analyze(art::Event const &evt)
double nuvtxx_truth[kMax]
std::string fEnergyRecoNueLabel
std::string fRegCNNVtx2ndstepResultLabel
art::ServiceHandle< art::TFileService > tfs
Handle< PROD > getHandle(SelectorBase const &) const
std::string fHitsModuleLabel
double nuvtxz_truth[kMax]
float CNN_vertex2ndstep[3]
std::string fMCGenModuleLabel
EDAnalyzer(fhicl::ParameterSet const &pset)
std::string fRegCNNVtxResultLabel
std::map< art::Ptr< recob::PFParticle >, VertexVector > PFParticlesToVertices
void reconfigure(fhicl::ParameterSet const &p)
std::string fPandoraNuVertexModuleLabel
std::string fRegCNNVtx1ststepResultLabel
#define DEFINE_ART_MODULE(klass)
std::vector< art::Ptr< recob::PFParticle > > PFParticleVector
T get(std::string const &key) const
static void CollectVertices(const art::Event &evt, const std::string &label, VertexVector &vertexVector, PFParticlesToVertices &particlesToVertices)
Collect the reconstructed PFParticles and associated Vertices from the ART event record.
RegCNNVertexAna(fhicl::ParameterSet const &pset)
bool IsPrimary() const
Returns whether the particle is the root of the flow.
float CNN_vertex1ststep[3]
std::string fRegCNNModuleLabel
std::string fRegCNNVtxResult2Label
static void CollectPFParticles(const art::Event &evt, const std::string &label, PFParticleVector &particleVector)
Collect the reconstructed PFParticles from the ART event record.
std::string fRegCNNVtxModule2Label
RegCNNResult for RegCNN modified from Result.h.
Declaration of signal hit object.
double nuvtxy_truth[kMax]
std::vector< art::Ptr< recob::Vertex > > VertexVector
EventNumber_t event() const
std::string fRegCNNResultLabel
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
std::string fRegCNNVtx1ststepModuleLabel
helper function for LArPandoraInterface producer module
std::string fRegCNNVtx2ndstepModuleLabel
std::string fRegCNNVtxModuleLabel
QTextStream & endl(QTextStream &s)