Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
genie::geometry::GeomVolSelectorFiducial Class Reference

GENIE Interface for user-defined volume selector functors Trim path segments based on the intersection with a cylinder, box or sphere as well as everything the Basic selector can do. More...

#include <GeomVolSelectorFiducial.h>

Inheritance diagram for genie::geometry::GeomVolSelectorFiducial:
genie::geometry::GeomVolSelectorBasic genie::geometry::GeomVolSelectorI genie::geometry::GeomVolSelectorRockBox

Public Member Functions

 GeomVolSelectorFiducial ()
 
virtual ~GeomVolSelectorFiducial ()
 
void TrimSegment (PathSegment &segment) const
 
void BeginPSList (const PathSegmentList *untrimmed) const
 
void EndPSList () const
 
void SetReverseFiducial (Bool_t reverse=true)
 
void AdoptFidShape (FidShape *shape)
 
void MakeSphere (Double_t x0, Double_t y0, Double_t z0, Double_t radius)
 
void MakeXCylinder (Double_t y0, Double_t z0, Double_t radius, Double_t xmin, Double_t xmax)
 
void MakeYCylinder (Double_t x0, Double_t z0, Double_t radius, Double_t ymin, Double_t ymax)
 
void MakeZCylinder (Double_t x0, Double_t y0, Double_t radius, Double_t zmin, Double_t zmax)
 
void MakeCylinder (Double_t *base, Double_t *axis, Double_t radius, Double_t *cap1, Double_t *cap2)
 
void MakeBox (Double_t *xyzmin, Double_t *xyzmax)
 
void MakeZPolygon (Int_t n, Double_t x0, Double_t y0, Double_t inradius, Double_t phi0deg, Double_t zmin, Double_t zmax)
 
virtual void ConvertShapeMaster2Top (const ROOTGeomAnalyzer *rgeom)
 
- Public Member Functions inherited from genie::geometry::GeomVolSelectorBasic
 GeomVolSelectorBasic ()
 
virtual ~GeomVolSelectorBasic ()
 
void SetVolumeSelection (string volstr)
 
void SetMediumSelection (string medstr)
 
void SetMaterialSelection (string matstr)
 
void SetPathSelection (string pathstr)
 
- Public Member Functions inherited from genie::geometry::GeomVolSelectorI
virtual ~GeomVolSelectorI ()
 
virtual PathSegmentListGenerateTrimmedList (const PathSegmentList *untrimmed) const
 
void SetCurrentRay (const TLorentzVector &x4, const TLorentzVector &p4)
 configure for individual neutrino ray More...
 
void SetSI2Local (double scale)
 set scale factor for SI to "raydist" units of PathSegmentList More...
 
void SetRemoveEntries (bool rmset)
 
bool GetRemoveEntries ()
 
void SetNeedPath ()
 
bool GetNeedPath () const
 allow toggle on only More...
 
std::string GetName () const
 

Static Protected Member Functions

static Bool_t NewStepPairs (Bool_t selectReverse, Double_t raydist, Double_t slo, Double_t shi, const RayIntercept &intercept, Bool_t &split, StepRange &step1, StepRange &step2)
 

Protected Attributes

Bool_t fSelectReverse
 
FidShapefShape
 select for "outside" fiducial? More...
 
const PathSegmentListfCurrPathSegmentList
 shape More...
 
RayIntercept fIntercept
 
- Protected Attributes inherited from genie::geometry::GeomVolSelectorBasic
vector< stringfRequiredVol
 
vector< stringfRequiredMed
 
vector< stringfRequiredMat
 
vector< stringfRequiredPath
 
vector< stringfForbiddenVol
 
vector< stringfForbiddenMed
 
vector< stringfForbiddenMat
 
vector< stringfForbiddenPath
 
- Protected Attributes inherited from genie::geometry::GeomVolSelectorI
TLorentzVector fX4
 current neutrino ray's start position (global) More...
 
TLorentzVector fP4
 current neutrino ray's momentum (global) More...
 
double fScale
 SI->raydist scale factor. More...
 
bool fRemoveEntries
 whether selector should remove entries or set hi=lo More...
 
bool fNeedPath
 selector needs PathSegment "path" string More...
 
std::string fName
 volume selector name More...
 

Additional Inherited Members

- Protected Member Functions inherited from genie::geometry::GeomVolSelectorBasic
void ParseSelection (const string &str, vector< string > &required, vector< string > &forbidden)
 
bool RejectString (const string &str, const vector< string > &required, const vector< string > &forbidden) const
 
- Protected Member Functions inherited from genie::geometry::GeomVolSelectorI
 GeomVolSelectorI ()
 
 GeomVolSelectorI (std::string name)
 

Detailed Description

GENIE Interface for user-defined volume selector functors Trim path segments based on the intersection with a cylinder, box or sphere as well as everything the Basic selector can do.

Assumes that the fiducial volume is defined in the same coords and units as the PathSegmentList ("top vol") and that the ray always starts outside the defined volume. (If not user should cap the fid volume just down from the flux window or use the SetUpstreamZ() in the flux driver to push the ray back to make it so).

Author
Robert Hatcher rhatc.nosp@m.her@.nosp@m.fnal..nosp@m.gov FNAL

July 14, 2010

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 43 of file GeomVolSelectorFiducial.h.

Constructor & Destructor Documentation

GeomVolSelectorFiducial::GeomVolSelectorFiducial ( )

Definition at line 22 of file GeomVolSelectorFiducial.cxx.

25 {
26  fName = "Fiducial";
27 }
std::string fName
volume selector name
FidShape * fShape
select for "outside" fiducial?
const PathSegmentList * fCurrPathSegmentList
shape
GeomVolSelectorFiducial::~GeomVolSelectorFiducial ( )
virtual

Definition at line 30 of file GeomVolSelectorFiducial.cxx.

31 {
32  if ( fShape ) delete fShape;
33  fShape = 0;
34  fCurrPathSegmentList = 0; // was reference only
35 }
FidShape * fShape
select for "outside" fiducial?
const PathSegmentList * fCurrPathSegmentList
shape

Member Function Documentation

void GeomVolSelectorFiducial::AdoptFidShape ( FidShape shape)

Definition at line 177 of file GeomVolSelectorFiducial.cxx.

178 {
179  if ( fShape ) delete fShape;
180  fShape = shape;
181 }
FidShape * fShape
select for "outside" fiducial?
void GeomVolSelectorFiducial::BeginPSList ( const PathSegmentList untrimmed) const
virtual

Every derived version must also respond to a signal that starts a new path segment list processing and ends it. In general they can simply ignore the signal. If the derived class needs to cache something, make it mutable

Reimplemented from genie::geometry::GeomVolSelectorBasic.

Reimplemented in genie::geometry::GeomVolSelectorRockBox.

Definition at line 150 of file GeomVolSelectorFiducial.cxx.

151 {
152  // A new neutrino ray has been set, calculate the entrance/exit distances.
153 
154  GeomVolSelectorBasic::BeginPSList(untrimmed); // initialize base class in case it is needed
155 
156  fCurrPathSegmentList = untrimmed;
157 
158  if ( ! fShape ) {
159  LOG("GeomVolSel", pFATAL) << "no shape defined";
161  } else {
164  }
165 
166 }
const TVector3 & GetStartPos() const
#define pFATAL
Definition: Messenger.h:56
const TVector3 & GetDirection() const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
virtual RayIntercept Intercept(const TVector3 &start, const TVector3 &dir) const =0
FidShape * fShape
select for "outside" fiducial?
void BeginPSList(const PathSegmentList *untrimmed) const
const PathSegmentList * fCurrPathSegmentList
shape
void GeomVolSelectorFiducial::ConvertShapeMaster2Top ( const ROOTGeomAnalyzer rgeom)
virtual

Reimplemented in genie::geometry::GeomVolSelectorRockBox.

Definition at line 183 of file GeomVolSelectorFiducial.cxx.

184 {
185  if ( fShape ) fShape->ConvertMaster2Top(rgeom);
186 }
virtual void ConvertMaster2Top(const ROOTGeomAnalyzer *rgeom)=0
FidShape * fShape
select for "outside" fiducial?
void GeomVolSelectorFiducial::EndPSList ( ) const
virtual

Reimplemented from genie::geometry::GeomVolSelectorBasic.

Reimplemented in genie::geometry::GeomVolSelectorRockBox.

Definition at line 169 of file GeomVolSelectorFiducial.cxx.

170 {
171  // Completed current path segment list processsing
174 }
const PathSegmentList * fCurrPathSegmentList
shape
void GeomVolSelectorFiducial::MakeBox ( Double_t *  xyzmin,
Double_t *  xyzmax 
)

Definition at line 239 of file GeomVolSelectorFiducial.cxx.

240 {
241  // This sets parameters for a box
242 
243  double boxXYZmin[3], boxXYZmax[3];
244  for ( int j = 0; j < 3; ++j ) {
245  boxXYZmin[j] = TMath::Min(xyzmin[j],xyzmax[j]);
246  boxXYZmax[j] = TMath::Max(xyzmin[j],xyzmax[j]);
247  }
248 
249  FidPolyhedron* poly = new FidPolyhedron();
250  // careful about sign of "d" vs. direction normal
251  PlaneParam pln0(-1,0,0, boxXYZmin[0]); poly->push_back(pln0);
252  PlaneParam pln1(0,-1,0, boxXYZmin[1]); poly->push_back(pln1);
253  PlaneParam pln2(0,0,-1, boxXYZmin[2]); poly->push_back(pln2);
254  PlaneParam pln3(+1,0,0,-boxXYZmax[0]); poly->push_back(pln3);
255  PlaneParam pln4(0,+1,0,-boxXYZmax[1]); poly->push_back(pln4);
256  PlaneParam pln5(0,0,+1,-boxXYZmax[2]); poly->push_back(pln5);
257 
258  AdoptFidShape(poly);
259 }
void push_back(const PlaneParam &pln)
Definition: FidShape.h:140
void GeomVolSelectorFiducial::MakeCylinder ( Double_t *  base,
Double_t *  axis,
Double_t  radius,
Double_t *  cap1,
Double_t *  cap2 
)

Definition at line 230 of file GeomVolSelectorFiducial.cxx.

232 {
233  // This sets parameters for a cylinder
234  AdoptFidShape(new FidCylinder(TVector3(base),TVector3(axis),radius,
235  PlaneParam(cap1),PlaneParam(cap2)));
236 }
void GeomVolSelectorFiducial::MakeSphere ( Double_t  x0,
Double_t  y0,
Double_t  z0,
Double_t  radius 
)

Definition at line 188 of file GeomVolSelectorFiducial.cxx.

189 {
190  AdoptFidShape(new FidSphere(TVector3(x0,y0,z0),radius));
191 }
void GeomVolSelectorFiducial::MakeXCylinder ( Double_t  y0,
Double_t  z0,
Double_t  radius,
Double_t  xmin,
Double_t  xmax 
)

Definition at line 194 of file GeomVolSelectorFiducial.cxx.

196 {
197  // This sets parameters for a cylinder parallel to the x-axis
198  Double_t base[] = { 0, y0, z0 };
199  Double_t axis[] = { 1, 0, 0 };
200  Double_t cap1[] = { -1, 0, 0, xmin };
201  Double_t cap2[] = { +1, 0, 0, -xmax }; // note sign change
202  this->MakeCylinder(base,axis,radius,cap1,cap2);
203 }
void MakeCylinder(Double_t *base, Double_t *axis, Double_t radius, Double_t *cap1, Double_t *cap2)
void GeomVolSelectorFiducial::MakeYCylinder ( Double_t  x0,
Double_t  z0,
Double_t  radius,
Double_t  ymin,
Double_t  ymax 
)

Definition at line 206 of file GeomVolSelectorFiducial.cxx.

208 {
209  // This sets parameters for a cylinder parallel to the y-axis
210  Double_t base[] = { x0, 0, z0 };
211  Double_t axis[] = { 0, 1, 0 };
212  Double_t cap1[] = { 0, -1, 0, ymin };
213  Double_t cap2[] = { 0, +1, 0, -ymax }; // note sign change
214  this->MakeCylinder(base,axis,radius,cap1,cap2);
215 }
void MakeCylinder(Double_t *base, Double_t *axis, Double_t radius, Double_t *cap1, Double_t *cap2)
void GeomVolSelectorFiducial::MakeZCylinder ( Double_t  x0,
Double_t  y0,
Double_t  radius,
Double_t  zmin,
Double_t  zmax 
)

Definition at line 218 of file GeomVolSelectorFiducial.cxx.

220 {
221  // This sets parameters for a cylinder parallel to the z-axis
222  Double_t base[] = { x0, y0, 0 };
223  Double_t axis[] = { 0, 0, 1 };
224  Double_t cap1[] = { 0, 0, -1, zmin };
225  Double_t cap2[] = { 0, 0, +1, -zmax }; // note sign change
226  this->MakeCylinder(base,axis,radius,cap1,cap2);
227 }
void MakeCylinder(Double_t *base, Double_t *axis, Double_t radius, Double_t *cap1, Double_t *cap2)
void GeomVolSelectorFiducial::MakeZPolygon ( Int_t  n,
Double_t  x0,
Double_t  y0,
Double_t  inradius,
Double_t  phi0deg,
Double_t  zmin,
Double_t  zmax 
)

Definition at line 262 of file GeomVolSelectorFiducial.cxx.

264 {
265  // phi=0 will put flat face towards +x
266  // inscribed radius
267 
268  FidPolyhedron* poly = new FidPolyhedron();
269 
270  Double_t dphir = TMath::TwoPi()/n;
271  Double_t phi0r = phi0deg * TMath::DegToRad();
272  for ( int iface = 0; iface < n; ++iface ) {
273  Double_t dx = TMath::Cos(dphir*iface + phi0r);
274  Double_t dy = TMath::Sin(dphir*iface + phi0r);
275  PlaneParam face(dx,dy,0,-inradius-dx*x0-dy*y0); poly->push_back(face);
276  }
277  PlaneParam plnz1(0,0,-1, zmin); poly->push_back(plnz1);
278  PlaneParam plnz2(0,0,+1,-zmax); poly->push_back(plnz2);
279 
280  AdoptFidShape(poly);
281 }
std::void_t< T > n
void push_back(const PlaneParam &pln)
Definition: FidShape.h:140
Bool_t GeomVolSelectorFiducial::NewStepPairs ( Bool_t  selectReverse,
Double_t  raydist,
Double_t  slo,
Double_t  shi,
const RayIntercept intercept,
Bool_t &  split,
StepRange step1,
StepRange step2 
)
staticprotected

Definition at line 87 of file GeomVolSelectorFiducial.cxx.

92 {
93  // modifying a step based on a range
94  // there seem to be six possible cases:
95  // step: |===| {slo,shi}
96  //
97  // range: in out
98  // # # normal reverse
99  // 0 |===| # # {0,0} {slo,shi}
100  // 1 |==#==| # {in,shi} {slo,in}
101  // 2 |==#========#==| {in,out} {slo,in}+{out,shi}
102  // 3 # |==| # {slo,shi} {0,0}
103  // 4 # |==#==| {slo,out} {out,shi}
104  // 5 # # |====| {0,0} {slo,shi}
105  // # #
106  //
107  bool ismodified = true;
108  step1 = StepRange(slo,shi);
109  split = false;
110  // dist in/out are relative to the ray origin
111  Double_t sdistin = intercept.fDistIn - raydist;
112  Double_t sdistout = intercept.fDistOut - raydist;
113  // do remaining calculations relative to steps within this segment
114  if ( slo < sdistin ) {
115  if ( shi < sdistin ) {
116  // case 0
117  if ( selectReverse ) { ismodified = false; }
118  else { step1 = StepRange(0,0); }
119  } else if ( shi < sdistout ) {
120  // case 1
121  if ( selectReverse ) { step1.second = sdistin; }
122  else { step1.first = sdistin; }
123  } else {
124  // case 2
125  if ( selectReverse ) { split = true;
126  step1 = StepRange(slo,sdistin);
127  step2 = StepRange(sdistout,shi); }
128  else { step1 = StepRange(sdistin,sdistout); }
129  }
130  } else if ( slo < sdistout ) {
131  if ( shi < sdistout ) {
132  // case 3
133  if ( selectReverse ) { step1 = StepRange(0,0); }
134  else { ismodified = false; }
135  } else {
136  // case 4
137  if ( selectReverse ) { step1.first = sdistout; }
138  else { step1.second = sdistout; }
139  }
140  } else {
141  // case 5
142  if ( selectReverse ) { ismodified = false; }
143  else { step1 = StepRange(0,0); }
144  }
145 
146  return ismodified;
147 }
std::pair< Double_t, Double_t > StepRange
Double_t fDistOut
distance along ray to enter fid volume
Definition: FidShape.h:51
void split(std::string const &s, char c, OutIter dest)
Definition: split.h:35
void genie::geometry::GeomVolSelectorFiducial::SetReverseFiducial ( Bool_t  reverse = true)
inline

Definition at line 57 of file GeomVolSelectorFiducial.h.

static unsigned int reverse(QString &chars, unsigned char *level, unsigned int a, unsigned int b)
Definition: qstring.cpp:11649
void GeomVolSelectorFiducial::TrimSegment ( PathSegment segment) const
virtual

This is the method every derived version must implement To reject a segment outright: segment.fStepRangeSet.clear()

so a miss means blindly accept all segments

Reimplemented from genie::geometry::GeomVolSelectorBasic.

Reimplemented in genie::geometry::GeomVolSelectorRockBox.

Definition at line 38 of file GeomVolSelectorFiducial.cxx.

39 {
40  // First trim the segment based on the ray vs. cylinder or box
41  // Then trim futher according to the Basic parameters
42 
43  if ( ! fIntercept.fIsHit ) {
44  // simple case when ray doesn't intersect the fiducial volume at all
45  if ( fSelectReverse ) {
46  // fiducial is reversed (ie. only want regions outside)
47  /// so a miss means blindly accept all segments
48  } else {
49  // want in fiducial, ray misses => reject all segments
50  ps.fStepRangeSet.clear(); //
51  }
52  } else {
53  // ray hit fiducial volume, some segments steps need rejection, some need splitting...
54  // check the steps in this segment
55  Double_t dist = ps.fRayDist;
56  StepRangeSet::iterator srs_itr = ps.fStepRangeSet.begin();
57  StepRangeSet::iterator srs_end = ps.fStepRangeSet.end();
58  StepRangeSet modifiedStepRangeSet;
59  Bool_t ismod = false;
60 
61  // loop over steps within this segement
62  for ( ; srs_itr != srs_end; ++srs_itr ) {
63  Double_t slo = srs_itr->first;
64  Double_t shi = srs_itr->second;
65  Bool_t split = false;
66  StepRange step1, step2;
67  // determine new trimmed or split steps
68  ismod |= NewStepPairs(fSelectReverse,dist,slo,shi,
69  fIntercept,split,step1,step2);
70  // build up new step list
71  bool nonzerostep = ( step1.first != step1.second );
72  if ( nonzerostep || ! fRemoveEntries ) {
73  modifiedStepRangeSet.push_back(step1);
74  if (split) {
75  modifiedStepRangeSet.push_back(step2);
76  }
77  }
78  } // loop over step range set elements
79  if ( ismod ) ps.fStepRangeSet = modifiedStepRangeSet;
80 
81  } // fIsHit
82 
84 }
intermediate_table::iterator iterator
std::vector< StepRange > StepRangeSet
Bool_t fIsHit
distance along ray to exit fid volume
Definition: FidShape.h:52
bool fRemoveEntries
whether selector should remove entries or set hi=lo
std::pair< Double_t, Double_t > StepRange
static constexpr double ps
Definition: Units.h:99
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
void TrimSegment(PathSegment &segment) const
static Bool_t NewStepPairs(Bool_t selectReverse, Double_t raydist, Double_t slo, Double_t shi, const RayIntercept &intercept, Bool_t &split, StepRange &step1, StepRange &step2)
void split(std::string const &s, char c, OutIter dest)
Definition: split.h:35

Member Data Documentation

const PathSegmentList* genie::geometry::GeomVolSelectorFiducial::fCurrPathSegmentList
mutableprotected

shape

Definition at line 90 of file GeomVolSelectorFiducial.h.

RayIntercept genie::geometry::GeomVolSelectorFiducial::fIntercept
mutableprotected

Definition at line 91 of file GeomVolSelectorFiducial.h.

Bool_t genie::geometry::GeomVolSelectorFiducial::fSelectReverse
protected

Definition at line 85 of file GeomVolSelectorFiducial.h.

FidShape* genie::geometry::GeomVolSelectorFiducial::fShape
protected

select for "outside" fiducial?

Definition at line 87 of file GeomVolSelectorFiducial.h.


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