7 #ifndef FILTER_FILTERPARTICLESACTIVEVOLUME_H
8 #define FILTER_FILTERPARTICLESACTIVEVOLUME_H
11 #include "art/Framework/Core/ModuleMacros.h"
12 #include "art/Framework/Core/EDFilter.h"
15 #include "art/Framework/Principal/Event.h"
16 #include "fhiclcpp/ParameterSet.h"
17 #include "art/Framework/Principal/Handle.h"
18 #include "art/Framework/Services/Registry/ServiceHandle.h"
19 #include "messagefacility/MessageLogger/MessageLogger.h"
20 #include "canvas/Persistency/Common/Ptr.h"
21 #include "canvas/Persistency/Common/PtrVector.h"
22 #include "cetlib_except/exception.h"
23 #include "canvas/Persistency/Common/FindManyP.h"
24 #include "canvas/Persistency/Common/FindOneP.h"
27 #include "nug4/ParticleNavigation/ParticleList.h"
28 #include "nusimdata/SimulationBase/MCTruth.h"
57 virtual void reconfigure(fhicl::ParameterSet
const&) ;
99 art::ServiceHandle<geo::Geometry> geo;
108 fXmax = p.get<
double >(
"Xmax");
109 fYmax = p.get<
double >(
"Ymax");
110 fZmax = p.get<
double >(
"Zmax");
111 fXmin = p.get<
double >(
"Xmin");
112 fYmin = p.get<
double >(
"Ymin");
113 fZmin = p.get<
double >(
"Zmin");
123 filtpart = p.get<
int >(
"filterpart");
131 bool interactionDesired(
false);
133 art::ServiceHandle<geo::Geometry> geom;
140 auto allmclists = evt.getMany< std::vector<simb::MCTruth> >();
150 std::cout << xyzcenter00[0] <<
" " << xyzcenter00[1] <<
" " << xyzcenter00[2] << std::endl;
154 std::cout << xyzcenter01[0] <<
" " << xyzcenter01[1] <<
" " << xyzcenter01[2] << std::endl;
158 std::cout << xyzcenter10[0] <<
" " << xyzcenter10[1] <<
" " << xyzcenter10[2] << std::endl;
162 std::cout << xyzcenter11[0] <<
" " << xyzcenter11[1] <<
" " << xyzcenter11[2] << std::endl;
177 std::cout << h00 <<
" " << w00 <<
" " << l00 << std::endl;
178 std::cout << h01 <<
" " << w01 <<
" " << l01 << std::endl;
179 std::cout << h10 <<
" " << w10 <<
" " << l10 << std::endl;
180 std::cout << h11 <<
" " << w11 <<
" " << l11 << std::endl;
182 for(
size_t mcl = 0; mcl < allmclists.size(); ++mcl){
183 art::Handle< std::vector<simb::MCTruth> > mclistHandle = allmclists[mcl];
184 for(
size_t m = 0;
m < mclistHandle->size(); ++
m){
185 art::Ptr<simb::MCTruth> mct(mclistHandle,
m);
186 for(
int ipart=0;ipart<mct->NParticles();ipart++){
187 int pdg=mct->GetParticle(ipart).PdgCode();
188 double xx=mct->GetParticle(ipart).Vx();
189 double yy=mct->GetParticle(ipart).Vy();
190 double zz=mct->GetParticle(ipart).Vz();
194 if (xx>(xyzcenter00[0]-w00) && xx<(xyzcenter00[0]+w00) && yy>(xyzcenter00[1]-h00) && yy<(xyzcenter00[1]+h00) && zz>(xyzcenter00[2]-l00/2) && zz<(xyzcenter00[2]+l00/2))
196 interactionDesired =
true;
198 if (xx>(xyzcenter01[0]-w01) && xx<(xyzcenter01[0]+w01) && yy>(xyzcenter01[1]-h01) && yy<(xyzcenter01[1]+h01) && zz>(xyzcenter01[2]-l01/2) && zz<(xyzcenter01[2]+l01/2))
200 interactionDesired =
true;
202 if (xx>(xyzcenter10[0]-w10) && xx<(xyzcenter10[0]+w10) && yy>(xyzcenter10[1]-h10) && yy<(xyzcenter10[1]+h10) && zz>(xyzcenter10[2]-l10/2) && zz<(xyzcenter10[2]+l10/2))
204 interactionDesired =
true;
206 if (xx>(xyzcenter11[0]-w11) && xx<(xyzcenter11[0]+w11) && yy>(xyzcenter11[1]-h11) && yy<(xyzcenter11[1]+h11) && zz>(xyzcenter11[2]-l11/2) && zz<(xyzcenter11[2]+l11/2))
208 interactionDesired =
true;
215 interactionDesired =
true;
228 return interactionDesired;
234 namespace simfilter {
236 DEFINE_ART_MODULE(FilterParticlesActiveVolume)
240 #endif // FILTER_FILTERNEUTRINOSACTIVEVOLUME_H
FilterParticlesActiveVolume(fhicl::ParameterSet const &pset)
Point GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Geometry information for a single TPC.
virtual void reconfigure(fhicl::ParameterSet const &)
bool filter(art::Event &)
Geometry information for a single cryostat.
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
double ActiveHalfWidth() const
Half width (associated with x coordinate) of active TPC volume [cm].
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
virtual ~FilterParticlesActiveVolume()
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc'th TPC in the cryostat.
Tools and modules for checking out the basics of the Monte Carlo.
art framework interface to geometry description
BEGIN_PROLOG could also be cout