10 #ifndef LARCOREALG_COREUTILS_PARTICLEFILTERS_H 11 #define LARCOREALG_COREUTILS_PARTICLEFILTERS_H 16 #include "TGeoMatrix.h" 17 #include "TGeoVolume.h" 18 #include "TLorentzVector.h" 53 VolumeInfo_t(TGeoVolume
const* new_vol, TGeoCombiTrans
const* new_trans)
54 : vol(new_vol), trans(new_trans)
57 TGeoVolume
const*
vol;
83 if (volumeInfo.empty())
return true;
85 for (
auto const& info : volumeInfo) {
87 info.trans->MasterToLocal(pos.data(), local);
89 if (info.vol->Contains(local))
return true;
96 return mustKeep(
Point_t{{pos.X(), pos.Y(), pos.Z()}});
101 return mustKeep(
Point_t{{pos.X(), pos.Y(), pos.Z()}});
111 #endif // LARCOREALG_COREUTILS_PARTICLEFILTERS_H bool mustKeep(Point_t const &pos) const
Returns whether a track along the specified point must be kept.
Namespace for general, non-LArSoft-specific utilities.
std::vector< VolumeInfo_t > volumeInfo
all good volumes
std::array< double, 3 > Point_t
std::vector< VolumeInfo_t > AllVolumeInfo_t
TGeoVolume const * vol
ROOT volume.
PositionInVolumeFilter(std::vector< VolumeInfo_t > &&volumes)
Constructors: read the volumes from the specified list.
bool mustKeep(TLorentzVector const &pos) const
TGeoCombiTrans const * trans
volume transformation (has both ways)
bool mustKeep(TVector3 const &pos) const
VolumeInfo_t(TGeoVolume const *new_vol, TGeoCombiTrans const *new_trans)
PositionInVolumeFilter(std::vector< VolumeInfo_t > const &volumes)
Constructors: read the volumes from the specified list.
Use to keep particles with at least part of trajectory in a volume.