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

Public Member Functions

 FilterParticlesActiveVolume (fhicl::ParameterSet const &pset)
 
virtual ~FilterParticlesActiveVolume ()
 
bool filter (art::Event &)
 
virtual void reconfigure (fhicl::ParameterSet const &)
 
virtual void beginJob ()
 

Private Attributes

double fXmax
 
double fXmin
 
double fZmax
 
double fZmin
 
double fYmax
 
double fYmin
 
int finActive
 
int filtpart
 

Detailed Description

Definition at line 48 of file FilterParticlesActiveVolume_module.cc.

Constructor & Destructor Documentation

simfilter::FilterParticlesActiveVolume::FilterParticlesActiveVolume ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 85 of file FilterParticlesActiveVolume_module.cc.

85  : EDFilter{pset}
86  {
87  this->reconfigure(pset);
88  }
virtual void reconfigure(fhicl::ParameterSet const &)
simfilter::FilterParticlesActiveVolume::~FilterParticlesActiveVolume ( )
virtual

Definition at line 92 of file FilterParticlesActiveVolume_module.cc.

93  {
94  }

Member Function Documentation

void simfilter::FilterParticlesActiveVolume::beginJob ( )
virtual

Definition at line 97 of file FilterParticlesActiveVolume_module.cc.

98  {
99  art::ServiceHandle<geo::Geometry> geo;
100 
101  }
bool simfilter::FilterParticlesActiveVolume::filter ( art::Event &  evt)

Definition at line 129 of file FilterParticlesActiveVolume_module.cc.

130  {
131  bool interactionDesired(false);
132  //get the list of particles from this event
133  art::ServiceHandle<geo::Geometry> geom;
134 
135 
136  // * MC truth information
137 
138  //std::vector< art::Handle< std::vector<simb::MCTruth> > > allmclists;
139  //evt.getManyByType(allmclists);
140  auto allmclists = evt.getMany< std::vector<simb::MCTruth> >();
141 
142 
143  std::cout << fXmin << " " << fXmax << " " << fYmin << " " <<fYmax << " " << fZmin << " " << fZmax << std::endl;
144 
145  geo::CryostatGeo const& cryo0 = geom->Cryostat(0);
146  geo::CryostatGeo const& cryo1 = geom->Cryostat(1);
147 
148  geo::TPCGeo const& tpc00 = cryo0.TPC(0);
149  TVector3 xyzcenter00 = tpc00.GetActiveVolumeCenter();
150  std::cout << xyzcenter00[0] << " " << xyzcenter00[1] << " " << xyzcenter00[2] << std::endl;
151 
152  geo::TPCGeo const& tpc01 = cryo0.TPC(1);
153  TVector3 xyzcenter01 = tpc01.GetActiveVolumeCenter();
154  std::cout << xyzcenter01[0] << " " << xyzcenter01[1] << " " << xyzcenter01[2] << std::endl;
155 
156  geo::TPCGeo const& tpc10 = cryo1.TPC(0);
157  TVector3 xyzcenter10 = tpc10.GetActiveVolumeCenter();
158  std::cout << xyzcenter10[0] << " " << xyzcenter10[1] << " " << xyzcenter10[2] << std::endl;
159 
160  geo::TPCGeo const& tpc11 = cryo1.TPC(1);
161  TVector3 xyzcenter11 = tpc11.GetActiveVolumeCenter();
162  std::cout << xyzcenter11[0] << " " << xyzcenter11[1] << " " << xyzcenter11[2] << std::endl;
163 
164  double h00=tpc00.ActiveHalfHeight();
165  double h01=tpc01.ActiveHalfHeight();
166  double h10=tpc10.ActiveHalfHeight();
167  double h11=tpc11.ActiveHalfHeight();
168  double w00=tpc00.ActiveHalfWidth();
169  double w01=tpc01.ActiveHalfWidth();
170  double w10=tpc10.ActiveHalfWidth();
171  double w11=tpc11.ActiveHalfWidth();
172  double l00=tpc00.ActiveLength();
173  double l01=tpc01.ActiveLength();
174  double l10=tpc10.ActiveLength();
175  double l11=tpc11.ActiveLength();
176 
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;
181 
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();
191 
192  if (finActive==1 && pdg==filtpart)
193  {
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))
195  {
196  interactionDesired = true;
197  }
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))
199  {
200  interactionDesired = true;
201  }
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))
203  {
204  interactionDesired = true;
205  }
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))
207  {
208  interactionDesired = true;
209  }
210 
211  if (finActive==0 && pdg==filtpart)
212  {
213  if (xx>fXmin && xx<fXmax && yy>fYmin && yy<fYmax && zz>fZmin && zz<fZmax)
214  {
215  interactionDesired = true;
216  }
217  }
218 
219  }
220  // std::cout << "FilterNoDirtParticles: i is " << i << std::endl ;
221  // Now walk through trajectory and see if it enters the TPC
222  // trajectory loop
223  // end Genie particle
224  }
225  }
226  }// loop on MCPHandle
227 
228  return interactionDesired;
229 
230  } // end FilterNoDirtParticles()function
Point GetActiveVolumeCenter() const
Returns the center of the TPC active volume in world coordinates [cm].
Definition: TPCGeo.h:288
var pdg
Definition: selectors.fcl:14
double ActiveHalfHeight() const
Half height (associated with y coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:99
Geometry information for a single TPC.
Definition: TPCGeo.h:38
Geometry information for a single cryostat.
Definition: CryostatGeo.h:43
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].
Definition: TPCGeo.h:95
double ActiveLength() const
Length (associated with z coordinate) of active TPC volume [cm].
Definition: TPCGeo.h:103
const TPCGeo & TPC(unsigned int itpc) const
Return the itpc&#39;th TPC in the cryostat.
Definition: CryostatGeo.cxx:93
TCEvent evt
Definition: DataStructs.cxx:8
BEGIN_PROLOG could also be cout
void simfilter::FilterParticlesActiveVolume::reconfigure ( fhicl::ParameterSet const &  p)
virtual

Definition at line 104 of file FilterParticlesActiveVolume_module.cc.

105  {
106  finActive = p.get< int >("inActive");
107  if (finActive==0) {
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");
114  }
115  if (finActive==1) {
116  fXmax=-999;
117  fYmax=-999;
118  fZmax=-999;
119  fXmin=-999;
120  fYmin=-999;
121  fZmin=-999;
122  }
123  filtpart = p.get< int >("filterpart");
124 
125  return;
126  }
pdgs p
Definition: selectors.fcl:22

Member Data Documentation

int simfilter::FilterParticlesActiveVolume::filtpart
private

Definition at line 76 of file FilterParticlesActiveVolume_module.cc.

int simfilter::FilterParticlesActiveVolume::finActive
private

Definition at line 75 of file FilterParticlesActiveVolume_module.cc.

double simfilter::FilterParticlesActiveVolume::fXmax
private

Definition at line 69 of file FilterParticlesActiveVolume_module.cc.

double simfilter::FilterParticlesActiveVolume::fXmin
private

Definition at line 70 of file FilterParticlesActiveVolume_module.cc.

double simfilter::FilterParticlesActiveVolume::fYmax
private

Definition at line 73 of file FilterParticlesActiveVolume_module.cc.

double simfilter::FilterParticlesActiveVolume::fYmin
private

Definition at line 74 of file FilterParticlesActiveVolume_module.cc.

double simfilter::FilterParticlesActiveVolume::fZmax
private

Definition at line 71 of file FilterParticlesActiveVolume_module.cc.

double simfilter::FilterParticlesActiveVolume::fZmin
private

Definition at line 72 of file FilterParticlesActiveVolume_module.cc.


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