Warning, file /snippets/PID/read_pid.C was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #include <edm4eic/ReconstructedParticleCollection.h>
0002 #include <podio/Frame.h>
0003 #include <podio/ROOTFrameReader.h>
0004
0005 void read_pid(std::string input_file="simu/podio_output.root") {
0006 auto reader = podio::ROOTFrameReader();
0007 reader.openFile(input_file);
0008 for (size_t i = 0; i < reader.getEntries(podio::Category::Event); i++) {
0009 auto frame = podio::Frame(reader.readNextEntry(podio::Category::Event));
0010 std::cerr << "event " << i << std::endl;
0011 auto &part_coll = frame.get<edm4eic::ReconstructedParticleCollection>("ReconstructedChargedParticles");
0012 for (auto part : part_coll) {
0013 std::cerr << "particle energy " << part.getEnergy() << std::endl;;
0014 std::cerr << "PID PDG " << part.getPDG() << std::endl;;
0015 for (auto partid : part.getParticleIDs()) {
0016 std::cerr << "\tdetector " << partid.getType()
0017 << " PDG " << partid.getPDG()
0018 << " probability " << partid.getLikelihood();
0019 }
0020 }
0021 }
0022 }