13 #include "art/Framework/Core/ModuleMacros.h"
14 #include "art/Framework/Core/EDFilter.h"
15 #include "art/Framework/Principal/Event.h"
16 #include "art/Framework/Principal/Handle.h"
17 #include "art/Framework/Principal/Run.h"
18 #include "art/Framework/Principal/SubRun.h"
19 #include "canvas/Utilities/InputTag.h"
20 #include "fhiclcpp/ParameterSet.h"
21 #include "messagefacility/MessageLogger/MessageLogger.h"
24 #include "art_root_io/TFileService.h"
25 #include "art/Framework/Services/Registry/ServiceHandle.h"
26 #include "art_root_io/TFileDirectory.h"
28 #include "nusimdata/SimulationBase/MCTruth.h"
59 size_t const mct_index,
60 size_t const parent_index,
61 bool const is_nc_delta_radiative);
63 bool filter(art::Event &
e)
override;
72 art::ServiceHandle<art::TFileService>
tfs;
73 ftree = tfs->make<TTree>(
"NCRadiativeResonantFilter",
"");
91 art::ValidHandle<std::vector<simb::MCTruth>>
const & ev_mct =
92 e.getValidHandle<std::vector<simb::MCTruth>>(
"generator");
95 <<
"===========Summary of Truth info===============\n";
96 for(simb::MCTruth
const & mct : *ev_mct) {
100 std::cout<<std::setw(11)<<
"Status code "<<std::endl;
101 std::cout <<
"----------------------------\n";
102 for(
int i = 0; i < mct.NParticles(); ++i) {
103 simb::MCParticle
const & mcp = mct.GetParticle(i);
105 std::cout<<std::setw(12)<< mcp.PdgCode();
107 std::cout<<std::setw(11)<< mcp.StatusCode() <<
"\n";
132 size_t const parent_index,
133 bool const is_nc_delta_radiative) {
141 art::ValidHandle<std::vector<simb::MCTruth>>
const & ev_mct =
142 e.getValidHandle<std::vector<simb::MCTruth>>(
"generator");
143 simb::MCNeutrino
const & mcn = ev_mct->at(mct_index).GetNeutrino();
152 if(parent_index != SIZE_MAX) {
154 fparent_pdg = ev_mct->at(mct_index).GetParticle(parent_index).PdgCode();
165 art::ValidHandle<std::vector<simb::MCTruth>>
const & ev_mct =
166 e.getValidHandle<std::vector<simb::MCTruth>>(
"generator");
175 for(
size_t ith = 0; ith < ev_mct->size(); ++ith) {
177 simb::MCTruth
const & mct = ev_mct->at(ith);
179 if(mct.GetNeutrino().CCNC() != 1)
continue;
181 std::vector<size_t> exiting_photon_parents;
182 for(
int jth = 0; jth < mct.NParticles(); ++jth) {
183 simb::MCParticle
const & mcp = mct.GetParticle(jth);
186 if(
abs(mcp.Vx())>210 ||
abs(mcp.Vy())>210||mcp.Vz()>510 || mcp.Vz()<-1){
187 std::cout<<
"OUTSIDE TPC x y z ="<<mcp.Vx()<<
" "<<mcp.Vy()<<
" "<<mcp.Vz()<<std::endl;
191 if(mcp.TrackId() != jth) {
192 std::cout <<
"ERROR: " << __LINE__ <<
" " << __PRETTY_FUNCTION__ <<
"\nTrackId does not match index\n";
195 if(!(mcp.StatusCode() == 1 && mcp.PdgCode() == 22))
continue;
196 exiting_photon_parents.push_back(mcp.Mother());
200 std::vector<size_t> in_nucleus_photons;
201 for(
size_t const s : exiting_photon_parents) {
202 simb::MCParticle
const & mcp = mct.GetParticle(
s);
204 if(
abs(mcp.PdgCode()) != 2114 &&
abs(mcp.PdgCode()) != 2214 ) {
209 std::cout<<
"\nYES a resonant evt: "<<mcp.PdgCode()<<std::endl;
211 }
else if(mcp.PdgCode() == 22) {
212 in_nucleus_photons.push_back(mcp.Mother());
216 for(
size_t const s : in_nucleus_photons) {
217 simb::MCParticle
const & mcp = mct.GetParticle(
s);
218 if(
abs(mcp.PdgCode()) != 2114 &&
abs(mcp.PdgCode()) != 2214) {
221 std::cout<<
"\nYES a resonant evt with 2 photons: "<<mcp.PdgCode()<<std::endl;
NCRadiativeResonant & operator=(NCRadiativeResonant const &)=delete
bool filter(art::Event &e) override
int fis_nc_delta_radiative
void FillTree(art::Event &e, size_t const mct_index, size_t const parent_index, bool const is_nc_delta_radiative)
NCRadiativeResonant(fhicl::ParameterSet const &p)
void cout_stuff(art::Event &e, bool passed)
then echo File list $list not found else cat $list while read file do echo $file sed s
art::ServiceHandle< art::TFileService > tfs
BEGIN_PROLOG could also be cout