10 #include "art/Framework/Core/EDFilter.h"
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Principal/Event.h"
13 #include "art/Framework/Principal/Handle.h"
14 #include "art/Framework/Principal/Run.h"
15 #include "art/Framework/Principal/SubRun.h"
16 #include "canvas/Utilities/InputTag.h"
17 #include "fhiclcpp/ParameterSet.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
20 #include "art_root_io/TFileService.h"
21 #include "art/Framework/Services/Registry/ServiceHandle.h"
22 #include "art_root_io/TFileDirectory.h"
26 #include "nusimdata/SimulationBase/MCTruth.h"
55 size_t const mct_index,
56 size_t const parent_index,
57 bool const is_nc_delta_radiative);
59 bool filter(art::Event &
e)
override;
68 art::ServiceHandle<art::TFileService>
tfs;
69 ftree = tfs->make<TTree>(
"NCDeltaRadiativeFilter",
"");
86 art::ValidHandle<std::vector<simb::MCTruth>>
const & ev_mct =
87 e.getValidHandle<std::vector<simb::MCTruth>>(
"generator");
90 <<
"==========================\n";
91 for(simb::MCTruth
const & mct : *ev_mct) {
92 std::cout <<
"----------------------------\n";
93 for(
int i = 0; i < mct.NParticles(); ++i) {
94 simb::MCParticle
const & mcp = mct.GetParticle(i);
95 std::cout << mcp.TrackId() <<
" " << mcp.PdgCode() <<
" " << mcp.Mother() <<
" " << mcp.StatusCode() <<
"\n";
120 size_t const parent_index,
121 bool const is_nc_delta_radiative) {
129 art::ValidHandle<std::vector<simb::MCTruth>>
const & ev_mct =
130 e.getValidHandle<std::vector<simb::MCTruth>>(
"generator");
131 simb::MCNeutrino
const & mcn = ev_mct->at(mct_index).GetNeutrino();
139 if(parent_index != SIZE_MAX) {
141 fparent_pdg = ev_mct->at(mct_index).GetParticle(parent_index).PdgCode();
151 art::ValidHandle<std::vector<simb::MCTruth>>
const & ev_mct =
152 e.getValidHandle<std::vector<simb::MCTruth>>(
"generator");
154 for(
size_t i = 0; i < ev_mct->size(); ++i) {
156 simb::MCTruth
const & mct = ev_mct->at(i);
157 if(mct.GetNeutrino().CCNC() != 1)
continue;
159 std::vector<size_t> exiting_photon_parents;
160 for(
int i = 0; i < mct.NParticles(); ++i) {
161 simb::MCParticle
const & mcp = mct.GetParticle(i);
162 if(mcp.TrackId() != i) {
163 std::cout <<
"ERROR: " << __LINE__ <<
" " << __PRETTY_FUNCTION__ <<
"\nTrackId does not match index\n";
166 if(!(mcp.StatusCode() == 1 && mcp.PdgCode() == 22))
continue;
167 exiting_photon_parents.push_back(mcp.Mother());
170 std::vector<size_t> in_nucleus_photons;
171 for(
size_t const s : exiting_photon_parents) {
172 simb::MCParticle
const & mcp = mct.GetParticle(
s);
174 if(
abs(mcp.Vx())>210 ||
abs(mcp.Vy())>210||mcp.Vz()>510 || mcp.Vz()<-1){
175 std::cout<<
"OUTSIDE TPC x y z ="<<mcp.Vx()<<
" "<<mcp.Vy()<<
" "<<mcp.Vz()<<std::endl;
178 if(
abs(mcp.PdgCode()) == 2114 ||
abs(mcp.PdgCode()) == 2214) {
182 else if(mcp.PdgCode() == 22) {
183 in_nucleus_photons.push_back(mcp.Mother());
187 for(
size_t const s : in_nucleus_photons) {
188 simb::MCParticle
const & mcp = mct.GetParticle(
s);
189 if(
abs(mcp.PdgCode()) == 2114 ||
abs(mcp.PdgCode()) == 2214) {
void cout_stuff(art::Event &e, bool passed)
NCDeltaRadiative(fhicl::ParameterSet const &p)
void FillTree(art::Event &e, size_t const mct_index, size_t const parent_index, bool const is_nc_delta_radiative)
bool filter(art::Event &e) override
int fis_nc_delta_radiative
then echo File list $list not found else cat $list while read file do echo $file sed s
art::ServiceHandle< art::TFileService > tfs
NCDeltaRadiative & operator=(NCDeltaRadiative const &)=delete
BEGIN_PROLOG could also be cout