All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
NCRadiativeResonant Class Reference
Inheritance diagram for NCRadiativeResonant:

Public Member Functions

 NCRadiativeResonant (fhicl::ParameterSet const &p)
 
 NCRadiativeResonant (NCRadiativeResonant const &)=delete
 
 NCRadiativeResonant (NCRadiativeResonant &&)=delete
 
NCRadiativeResonantoperator= (NCRadiativeResonant const &)=delete
 
NCRadiativeResonantoperator= (NCRadiativeResonant &&)=delete
 
void cout_stuff (art::Event &e, bool passed)
 
void FillTree (art::Event &e, size_t const mct_index, size_t const parent_index, bool const is_nc_delta_radiative)
 
void Reset ()
 
bool filter (art::Event &e) override
 

Private Attributes

TTree * ftree
 
int frun
 
int fsubrun
 
int fevent
 
int fnu_pdg
 
int fccnc
 
int fmode
 
int finteraction_type
 
int fis_nc_delta_radiative
 
int fparent_status_code
 
int fparent_pdg
 

Detailed Description

Definition at line 34 of file NCRadiativeResonant_module.cc.

Constructor & Destructor Documentation

NCRadiativeResonant::NCRadiativeResonant ( fhicl::ParameterSet const &  p)
explicit

Definition at line 68 of file NCRadiativeResonant_module.cc.

68  :
69  art::EDFilter(p),
70  ftree(nullptr) {
71 
72  art::ServiceHandle<art::TFileService> tfs;
73  ftree = tfs->make<TTree>("NCRadiativeResonantFilter", "");
74 
75  ftree->Branch("run", &frun, "run/I");
76  ftree->Branch("subrun", &fsubrun, "subrun/I");
77  ftree->Branch("event", &fevent, "event/I");
78  ftree->Branch("nu_pdg", &fnu_pdg, "nu_pdg/I");
79  ftree->Branch("ccnc", &fccnc, "ccnc/I");
80  ftree->Branch("mode", &fmode, "mode/I");
81  ftree->Branch("is_nc_delta_radiative", &fis_nc_delta_radiative, "is_nc_delta_radiative/I");
82  ftree->Branch("parent_status_code", &fparent_status_code, "parent_status_code/I");
83  ftree->Branch("parent_pdg", &fparent_pdg, "parent_pdg/I");
84 
85 }
pdgs p
Definition: selectors.fcl:22
art::ServiceHandle< art::TFileService > tfs
NCRadiativeResonant::NCRadiativeResonant ( NCRadiativeResonant const &  )
delete
NCRadiativeResonant::NCRadiativeResonant ( NCRadiativeResonant &&  )
delete

Member Function Documentation

void NCRadiativeResonant::cout_stuff ( art::Event &  e,
bool  passed = false 
)

Definition at line 89 of file NCRadiativeResonant_module.cc.

89  {
90 
91  art::ValidHandle<std::vector<simb::MCTruth>> const & ev_mct =
92  e.getValidHandle<std::vector<simb::MCTruth>>("generator");
93 
94  std::cout << passed << "\n"
95  << "===========Summary of Truth info===============\n";
96  for(simb::MCTruth const & mct : *ev_mct) {
97  std::cout<<std::setw(9)<<"track ID ";
98  std::cout<<std::setw(12)<<"Pdgcode ";
99  std::cout<<std::setw(11)<<"mother ID ";
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);
104  std::cout<<std::setw(9)<< mcp.TrackId();
105  std::cout<<std::setw(12)<< mcp.PdgCode();
106  std::cout<<std::setw(11)<< mcp.Mother();
107  std::cout<<std::setw(11)<< mcp.StatusCode() << "\n";
108  }
109  }
110 
111 }
do i e
BEGIN_PROLOG could also be cout
void NCRadiativeResonant::FillTree ( art::Event &  e,
size_t const  mct_index,
size_t const  parent_index,
bool const  is_nc_delta_radiative 
)

Definition at line 130 of file NCRadiativeResonant_module.cc.

133  {
134 
135  Reset();
136 
137  frun = e.id().run();
138  fsubrun = e.id().subRun();
139  fevent = e.id().event();
140 
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();
144 
145  fnu_pdg = mcn.Nu().PdgCode();
146  fccnc = mcn.CCNC();
147  fmode = mcn.Mode();
148  finteraction_type = mcn.InteractionType();
149 
150  fis_nc_delta_radiative = is_nc_delta_radiative;
151 
152  if(parent_index != SIZE_MAX) {
153  fparent_status_code = ev_mct->at(mct_index).GetParticle(parent_index).StatusCode();
154  fparent_pdg = ev_mct->at(mct_index).GetParticle(parent_index).PdgCode();
155  }
156 
157  ftree->Fill();
158 
159 }
do i e
bool NCRadiativeResonant::filter ( art::Event &  e)
override

Definition at line 163 of file NCRadiativeResonant_module.cc.

163  {
164 
165  art::ValidHandle<std::vector<simb::MCTruth>> const & ev_mct =
166  e.getValidHandle<std::vector<simb::MCTruth>>("generator");
167 
168 
169  //looking for resonant photons...
170  // - Particles from NC interaction
171  // - Particles contian photons with StatusCode 1
172  // - the parent of a photon is not delta0 & delta+ ---> pass
173  // - if the parent of a photon is a photon
174  // - the grandparent of a photon is not delta0 & delta+ ---> pass
175  for(size_t ith = 0; ith < ev_mct->size(); ++ith) {//loop through MCTruth
176 
177  simb::MCTruth const & mct = ev_mct->at(ith);
178 // std::cout<<"Looking at the "<<ith<<"th mctruth particle."<<std::endl;
179  if(mct.GetNeutrino().CCNC() != 1) continue;//only look at nc particles;
180 
181  std::vector<size_t> exiting_photon_parents;
182  for(int jth = 0; jth < mct.NParticles(); ++jth) {//loop through MCParticles
183  simb::MCParticle const & mcp = mct.GetParticle(jth);
184 
185  //CHEKC hardcode, TPC filter:
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;
188  exit(0);
189  }
190 
191  if(mcp.TrackId() != jth) {
192  std::cout << "ERROR: " << __LINE__ << " " << __PRETTY_FUNCTION__ << "\nTrackId does not match index\n";
193  exit(1);
194  }
195  if(!(mcp.StatusCode() == 1 && mcp.PdgCode() == 22)) continue;//next, if this is not a photon with StatusCode 1
196  exiting_photon_parents.push_back(mcp.Mother());//collect photon's parents
197  }
198 
199  //looking for delta radiative decay, i.e. mother is a delta with statuscode 3 & daughter is a photon. We don't need exiting deltas.
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);
203  //2114 delta0; 2214 delta+
204  if(abs(mcp.PdgCode()) != 2114 && abs(mcp.PdgCode()) != 2214 ) {//Want mcp as any particles but not delta0+
205 // if(ftree){
206 // FillTree(e, ith, mcp.Mother(), true);
207 // }
208  cout_stuff(e,true);
209  std::cout<<"\nYES a resonant evt: "<<mcp.PdgCode()<<std::endl;
210  return true;
211  }else if(mcp.PdgCode() == 22) {//collect photons;
212  in_nucleus_photons.push_back(mcp.Mother());
213  }
214  }
215 
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) {
219 // if(ftree) FillTree(e, ith, s, true);
220  cout_stuff(e,true);
221  std::cout<<"\nYES a resonant evt with 2 photons: "<<mcp.PdgCode()<<std::endl;
222  return true;
223  }
224  }
225 
226  }
227 
228 // if(ftree) FillTree(e, 0, SIZE_MAX, false);
229  return false;
230 
231 }
T abs(T value)
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
Definition: file_to_url.sh:60
do i e
BEGIN_PROLOG could also be cout
NCRadiativeResonant& NCRadiativeResonant::operator= ( NCRadiativeResonant const &  )
delete
NCRadiativeResonant& NCRadiativeResonant::operator= ( NCRadiativeResonant &&  )
delete
void NCRadiativeResonant::Reset ( )

Member Data Documentation

int NCRadiativeResonant::fccnc
private

Definition at line 42 of file NCRadiativeResonant_module.cc.

int NCRadiativeResonant::fevent
private

Definition at line 40 of file NCRadiativeResonant_module.cc.

int NCRadiativeResonant::finteraction_type
private

Definition at line 44 of file NCRadiativeResonant_module.cc.

int NCRadiativeResonant::fis_nc_delta_radiative
private

Definition at line 45 of file NCRadiativeResonant_module.cc.

int NCRadiativeResonant::fmode
private

Definition at line 43 of file NCRadiativeResonant_module.cc.

int NCRadiativeResonant::fnu_pdg
private

Definition at line 41 of file NCRadiativeResonant_module.cc.

int NCRadiativeResonant::fparent_pdg
private

Definition at line 47 of file NCRadiativeResonant_module.cc.

int NCRadiativeResonant::fparent_status_code
private

Definition at line 46 of file NCRadiativeResonant_module.cc.

int NCRadiativeResonant::frun
private

Definition at line 38 of file NCRadiativeResonant_module.cc.

int NCRadiativeResonant::fsubrun
private

Definition at line 39 of file NCRadiativeResonant_module.cc.

TTree* NCRadiativeResonant::ftree
private

Definition at line 36 of file NCRadiativeResonant_module.cc.


The documentation for this class was generated from the following file: