16 #include "art_root_io/TFileDirectory.h" 17 #include "art_root_io/TFileService.h" 22 #include "TDirectory.h" 28 #include "CLHEP/Units/SystemOfUnits.h" 32 class CheckMCParticle;
44 TH1F* _hnParts{
nullptr};
48 :
art::EDAnalyzer(p), _myName(p.
get<
std::string>(
"name",
"CheckMCParticle"))
54 _hnParts = tfs->make<TH1F>(
"hnParts",
"Number of generated Particles", 100, 0., 2000.);
63 for (
auto const& maps : allDropped) {
64 auto const& map = maps->
GetMap();
65 for (
auto const& [parent, daughters] : map) {
66 std::cout <<
"Parent of dropped Tracks: " << parent << std::endl;
67 std::cout <<
" droppedid size: " << daughters.size() << std::endl;
68 for (
auto const& droppedid : daughters) {
69 std::cout << droppedid <<
" ";
71 std::cout << std::endl;
76 auto allGens =
event.getMany<std::vector<simb::MCParticle>>();
77 for (
auto const& gens : allGens) {
80 for (
auto const& genpart : *gens) {
81 if (genpart.Mother() == 0) {
82 cout <<
"Primary momentum: " << genpart.P();
83 cout <<
" position: " << genpart.Vx() <<
" " << genpart.Vy() <<
" " << genpart.Vz()
86 cout <<
"Part id: " << genpart.TrackId();
87 cout <<
" PDG id: " << genpart.PdgCode();
88 cout <<
" Status Code: " << genpart.StatusCode();
89 cout <<
" Mother: " << genpart.Mother();
90 cout <<
" Creation Process: " << genpart.Process();
91 cout <<
" End Process: " << genpart.EndProcess();
96 cout <<
" Nr. of Daughters: " << genpart.NumberDaughters();
97 cout <<
" FirstDaughter:" << genpart.FirstDaughter() << endl;
99 for (
int i = 0; i < genpart.NumberDaughters(); i++) {
100 cout << genpart.Daughter(i) <<
",";
CheckMCParticle(fhicl::ParameterSet const &p)
void analyze(const art::Event &event) override
#define DEFINE_ART_MODULE(klass)
decltype(auto) get(T &&obj)
ADL-aware version of std::to_string.
std::string const _myName
std::map< int, std::set< int > > const & GetMap() const
Event finding and building.