All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
flashmatch::DetectorSpecs Class Reference

#include <FMWKInterface.h>

Public Member Functions

 DetectorSpecs (std::string filename="specs.cfg")
 
 ~DetectorSpecs ()
 
const geoalgo::Point_tPMTPosition (size_t opch)
 PMT XYZ position filler. More...
 
const geoalgo::AABoxActiveVolume () const
 Detector active volume. More...
 
const geoalgo::AABoxActiveVolume (int tpc, int cryo=0) const
 Detector active volume given cryo and tpc. More...
 
size_t NOpDets () const
 

of PMTs

More...
 
double DriftVelocity () const
 Drift velocity. More...
 
float GetVisibility (double x, double y, double z, unsigned int opch) const
 Visibility. More...
 
float GetVisibilityReflected (double x, double y, double z, unsigned int opch) const
 Visibility Reflected. More...
 
const std::vector< std::vector
< float > > & 
GetPhotonLibraryData () const
 Photon Library data access FIXME. More...
 

Static Public Member Functions

static DetectorSpecsGetME (std::string filename="detector_specs.cfg")
 

Private Attributes

std::vector< geoalgo::Point_t_pmt_v
 
geoalgo::AABox _bbox
 
std::unordered_map< std::pair
< int, int >, geoalgo::AABox,
boost::hash< std::pair< int,
int > > > 
_bbox_map
 A bbox map (cryo,tpc) -> bbox. More...
 
double _drift_velocity
 

Static Private Attributes

static DetectorSpecs_me = nullptr
 Voxel definition. More...
 

Detailed Description

Definition at line 38 of file FMWKInterface.h.

Constructor & Destructor Documentation

flashmatch::DetectorSpecs::DetectorSpecs ( std::string  filename = "specs.cfg")

Definition at line 71 of file FMWKInterface.cxx.

71  {
72  ::art::ServiceHandle<geo::Geometry> const geo;
73  auto const clock_data = ::art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
74  auto const det_prop = ::art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob(clock_data);
75 
76  _drift_velocity = det_prop.DriftVelocity();
77  _pmt_v.clear();
78 
79  _pmt_v.resize(geo->NOpDets());
80 
81  for (size_t opdet = 0; opdet < geo->NOpDets(); opdet++) {
82 
83  std::vector<double> pos(3, 0.);
84  geo->OpDetGeoFromOpDet(opdet).GetCenter(&pos[0]);
85 
86  geoalgo::Point_t pmt(pos);
87  _pmt_v[opdet] = pmt;
88  }
89 
90  double global_x_min = 1e9, global_x_max = -1e9;
91  double global_y_min = 1e9, global_y_max = -1e9;
92  double global_z_min = 1e9, global_z_max = -1e9;
93 
94  _bbox_map.reserve(geo->Ncryostats() * geo->NTPC());
95 
96  for (size_t cryo = 0; cryo < geo->Ncryostats(); cryo++) {
97  for (size_t tpc = 0; tpc < geo->NTPC(cryo); tpc++) {
98  const geo::TPCGeo tpc_geo = geo->TPC(tpc, cryo);
99  double x_min = tpc_geo.GetCenter().X() - tpc_geo.HalfWidth();
100  double x_max = tpc_geo.GetCenter().X() + tpc_geo.HalfWidth();
101 
102  double y_min = tpc_geo.GetCenter().Y() - tpc_geo.HalfHeight();
103  double y_max = tpc_geo.GetCenter().Y() + tpc_geo.HalfHeight();
104 
105  double z_min = tpc_geo.GetCenter().Z() - tpc_geo.HalfLength();
106  double z_max = tpc_geo.GetCenter().Z() + tpc_geo.HalfLength();
107 
108  if (x_min < global_x_min) global_x_min = x_min;
109  if (x_max > global_x_max) global_x_max = x_max;
110  if (y_min < global_y_min) global_y_min = y_min;
111  if (y_max > global_y_max) global_y_max = y_max;
112  if (z_min < global_z_min) global_z_min = z_min;
113  if (z_max > global_z_max) global_z_max = z_max;
114 
115  _bbox_map.emplace(std::make_pair(tpc, cryo), geoalgo::AABox(x_min, y_min, z_min, x_max, y_max, z_max));
116  }
117 
118  _bbox = geoalgo::AABox(global_x_min, global_y_min, global_z_min,
119  global_x_max, global_y_max, global_z_max);
120  }
121 
122  // art::ServiceHandle<phot::PhotonVisibilityService const> pvs;
123  }
std::unordered_map< std::pair< int, int >, geoalgo::AABox, boost::hash< std::pair< int, int > > > _bbox_map
A bbox map (cryo,tpc) -&gt; bbox.
Definition: FMWKInterface.h:83
Geometry information for a single TPC.
Definition: TPCGeo.h:38
Representation of a 3D rectangular box which sides are aligned w/ coordinate axis. A representation of an Axis-Aligned-Boundary-Box, a simple &amp; popular representation of 3D boundary box for collision detection. The concept was taken from the reference, Real-Time-Collision-Detection (RTCD), and in particular Ch. 4.2 (page 77): .
double HalfLength() const
Length is associated with z coordinate [cm].
Definition: TPCGeo.h:117
double HalfHeight() const
Height is associated with y coordinate [cm].
Definition: TPCGeo.h:111
std::vector< geoalgo::Point_t > _pmt_v
Definition: FMWKInterface.h:81
double HalfWidth() const
Width is associated with x coordinate [cm].
Definition: TPCGeo.h:107
Point GetCenter() const
Returns the center of the TPC volume in world coordinates [cm].
Definition: TPCGeo.h:779
flashmatch::DetectorSpecs::~DetectorSpecs ( )
inline

Definition at line 42 of file FMWKInterface.h.

42 {}

Member Function Documentation

const geoalgo::AABox& flashmatch::DetectorSpecs::ActiveVolume ( ) const
inline

Detector active volume.

Definition at line 54 of file FMWKInterface.h.

54 { return _bbox; }
const geoalgo::AABox & flashmatch::DetectorSpecs::ActiveVolume ( int  tpc,
int  cryo = 0 
) const

Detector active volume given cryo and tpc.

Definition at line 143 of file FMWKInterface.cxx.

143  {
144  auto iter = _bbox_map.find(std::pair<int,int>(tpc, cryo));
145  if (iter == _bbox_map.end()) {
146  FLASH_CRITICAL() << "Boundary box map doesn't contain cryo " << cryo
147  << " or tpc " << tpc << "!" << std::endl;
148  throw OpT0FinderException();
149  }
150  return iter->second;
151  }
std::unordered_map< std::pair< int, int >, geoalgo::AABox, boost::hash< std::pair< int, int > > > _bbox_map
A bbox map (cryo,tpc) -&gt; bbox.
Definition: FMWKInterface.h:83
#define FLASH_CRITICAL()
Compiler macro for CRITICAL message.
double flashmatch::DetectorSpecs::DriftVelocity ( ) const
inline

Drift velocity.

Definition at line 63 of file FMWKInterface.h.

63 { return _drift_velocity; }
static DetectorSpecs& flashmatch::DetectorSpecs::GetME ( std::string  filename = "detector_specs.cfg")
inlinestatic

Definition at line 44 of file FMWKInterface.h.

45  {
46  if(!_me) _me = new DetectorSpecs(filename);
47  return *_me;
48  }
BEGIN_PROLOG could also be dds filename
DetectorSpecs(std::string filename="specs.cfg")
static DetectorSpecs * _me
Voxel definition.
Definition: FMWKInterface.h:80
const std::vector<std::vector<float > >& flashmatch::DetectorSpecs::GetPhotonLibraryData ( ) const

Photon Library data access FIXME.

float flashmatch::DetectorSpecs::GetVisibility ( double  x,
double  y,
double  z,
unsigned int  opch 
) const

Visibility.

Definition at line 125 of file FMWKInterface.cxx.

125  {
126  // double xyz[3];
127  // xyz[0] = x;
128  // xyz[1] = y;
129  // xyz[2] = z;
130  // return pvs.GetVisibility(xyz, opch, false);
131  return -1;
132  }
float flashmatch::DetectorSpecs::GetVisibilityReflected ( double  x,
double  y,
double  z,
unsigned int  opch 
) const

Visibility Reflected.

Definition at line 134 of file FMWKInterface.cxx.

134  {
135  // double xyz[3];
136  // xyz[0] = x;
137  // xyz[1] = y;
138  // xyz[2] = z;
139  // return pvs.GetVisibility(xyz, opch, true);
140  return -1;
141  }
size_t flashmatch::DetectorSpecs::NOpDets ( ) const
inline

of PMTs

Definition at line 60 of file FMWKInterface.h.

60 { return _pmt_v.size(); }
std::vector< geoalgo::Point_t > _pmt_v
Definition: FMWKInterface.h:81
const geoalgo::Point_t& flashmatch::DetectorSpecs::PMTPosition ( size_t  opch)
inline

PMT XYZ position filler.

Definition at line 51 of file FMWKInterface.h.

51 { return _pmt_v.at(opch); }
std::vector< geoalgo::Point_t > _pmt_v
Definition: FMWKInterface.h:81

Member Data Documentation

geoalgo::AABox flashmatch::DetectorSpecs::_bbox
private

Definition at line 82 of file FMWKInterface.h.

std::unordered_map<std::pair<int, int>, geoalgo::AABox, boost::hash<std::pair<int, int> > > flashmatch::DetectorSpecs::_bbox_map
private

A bbox map (cryo,tpc) -> bbox.

Definition at line 83 of file FMWKInterface.h.

double flashmatch::DetectorSpecs::_drift_velocity
private

Definition at line 84 of file FMWKInterface.h.

DetectorSpecs * flashmatch::DetectorSpecs::_me = nullptr
staticprivate

Voxel definition.

Definition at line 80 of file FMWKInterface.h.

std::vector<geoalgo::Point_t> flashmatch::DetectorSpecs::_pmt_v
private

Definition at line 81 of file FMWKInterface.h.


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