Public Member Functions | Protected Attributes | Private Types | List of all members
gar::geo::seg::AuxDetChannelMapAlg Class Referenceabstract

#include <AuxDetChannelMapAlg.h>

Public Member Functions

virtual ~AuxDetChannelMapAlg ()=default
 
virtual void Initialize (AuxDetGeometryData_t &geodata)=0
 
virtual void Uninitialize ()=0
 
virtual size_t NearestAuxDet (const double *point, std::vector< geo::AuxDetGeo * > const &auxDets) const
 
virtual size_t NearestSensitiveAuxDet (const double *point, std::vector< geo::AuxDetGeo * > const &auxDets, size_t &ad) const
 
virtual size_t ChannelToAuxDet (std::vector< geo::AuxDetGeo * > const &auxDets, std::string const &detName, uint32_t const &channel) const
 
virtual std::pair< size_t, size_t > ChannelToSensitiveAuxDet (std::vector< geo::AuxDetGeo * > const &auxDets, std::string const &detName, uint32_t const &channel) const
 
virtual uint32_t PositionToAuxDetChannel (double const worldLoc[3], std::vector< geo::AuxDetGeo * > const &auxDets, size_t &ad, size_t &sv) const =0
 
virtual const TVector3 AuxDetChannelToPosition (uint32_t const &channel, std::string const &auxDetName, std::vector< geo::AuxDetGeo * > const &auxDets) const =0
 

Protected Attributes

std::map< size_t, std::stringfADGeoToName
 map the AuxDetGeo index to the name More...
 
std::map< std::string, size_t > fNameToADGeo
 map the names to the AuxDetGeo index More...
 
std::map< size_t, std::vector< chanAndSV > > fADGeoToChannelAndSV
 

Private Types

typedef std::pair< uint32_t, size_t > chanAndSV
 

Detailed Description

Definition at line 37 of file AuxDetChannelMapAlg.h.

Member Typedef Documentation

typedef std::pair<uint32_t, size_t> gar::geo::seg::AuxDetChannelMapAlg::chanAndSV
private

Definition at line 39 of file AuxDetChannelMapAlg.h.

Constructor & Destructor Documentation

virtual gar::geo::seg::AuxDetChannelMapAlg::~AuxDetChannelMapAlg ( )
virtualdefault

Member Function Documentation

virtual const TVector3 gar::geo::seg::AuxDetChannelMapAlg::AuxDetChannelToPosition ( uint32_t const &  channel,
std::string const &  auxDetName,
std::vector< geo::AuxDetGeo * > const &  auxDets 
) const
pure virtual
size_t gar::geo::seg::AuxDetChannelMapAlg::ChannelToAuxDet ( std::vector< geo::AuxDetGeo * > const &  auxDets,
std::string const &  detName,
uint32_t const &  channel 
) const
virtual

Definition at line 89 of file AuxDetChannelMapAlg.cxx.

92  {
93  // loop over the map of AuxDet names to Geo object numbers to determine which auxdet
94  // we have. If no name in the map matches the provided string, throw an exception
95  for(auto itr : fADGeoToName)
96  if( itr.second.compare(detName) == 0 ) return itr.first;
97 
98  throw cet::exception("Geometry") << "No AuxDetGeo matching name: " << detName;
99 
101  }
static int max(int a, int b)
std::map< size_t, std::string > fADGeoToName
map the AuxDetGeo index to the name
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::pair< size_t, size_t > gar::geo::seg::AuxDetChannelMapAlg::ChannelToSensitiveAuxDet ( std::vector< geo::AuxDetGeo * > const &  auxDets,
std::string const &  detName,
uint32_t const &  channel 
) const
virtual

Definition at line 106 of file AuxDetChannelMapAlg.cxx.

109  {
110  size_t adGeoIdx = this->ChannelToAuxDet(auxDets, detName, channel);
111 
112  // look for the index of the sensitive volume for the given channel
113  if( fADGeoToChannelAndSV.count(adGeoIdx) > 0 ){
114 
115  auto itr = fADGeoToChannelAndSV.find(adGeoIdx);
116 
117  // get the vector of channels to AuxDetSensitiveGeo index
118  if( channel < itr->second.size() )
119  return std::make_pair(adGeoIdx, itr->second[channel].second);
120 
121  throw cet::exception("Geometry")
122  << "Given AuxDetSensitive channel, "
123  << channel
124  << ", cannot be found in vector associated to AuxDetGeo index: "
125  << adGeoIdx
126  << ". Vector has size "
127  << itr->second.size();
128  }
129 
130  throw cet::exception("Geometry")
131  << "Given AuxDetGeo with index "
132  << adGeoIdx
133  << " does not correspond to any vector of sensitive volumes";
134 
135  return std::make_pair(adGeoIdx, std::numeric_limits<unsigned int>::max());
136  }
virtual size_t ChannelToAuxDet(std::vector< geo::AuxDetGeo * > const &auxDets, std::string const &detName, uint32_t const &channel) const
uint8_t channel
Definition: CRTFragment.hh:201
static int max(int a, int b)
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
std::map< size_t, std::vector< chanAndSV > > fADGeoToChannelAndSV
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual void gar::geo::seg::AuxDetChannelMapAlg::Initialize ( AuxDetGeometryData_t geodata)
pure virtual
size_t gar::geo::seg::AuxDetChannelMapAlg::NearestAuxDet ( const double *  point,
std::vector< geo::AuxDetGeo * > const &  auxDets 
) const
virtual

Definition at line 17 of file AuxDetChannelMapAlg.cxx.

19  {
20  double HalfCenterWidth = 0.;
21  double localPoint[3] = {0.};
22 
23  for(size_t a = 0; a < auxDets.size(); ++a) {
24 
25  auxDets[a]->WorldToLocal(point, localPoint);
26 
27  HalfCenterWidth = 0.5 * (auxDets[a]->HalfWidth1() + auxDets[a]->HalfWidth2());
28 
29  if(localPoint[2] >= - auxDets[a]->Length()/2 &&
30  localPoint[2] <= auxDets[a]->Length()/2 &&
31  localPoint[1] >= - auxDets[a]->HalfHeight() &&
32  localPoint[1] <= auxDets[a]->HalfHeight() &&
33  // if AuxDet a is a box, then HalfSmallWidth = HalfWidth
34  localPoint[0] >= - HalfCenterWidth + localPoint[2]*(HalfCenterWidth - auxDets[a]->HalfWidth2())/(0.5 * auxDets[a]->Length()) &&
35  localPoint[0] <= HalfCenterWidth - localPoint[2]*(HalfCenterWidth - auxDets[a]->HalfWidth2())/(0.5 * auxDets[a]->Length())
36  ) return a;
37 
38  }// for loop over AudDet a
39 
40  // throw an exception because we couldn't find the sensitive volume
41  throw cet::exception("ChannelMapLArIAT") << "Can't find AuxDet for position ("
42  << point[0] << ","
43  << point[1] << ","
44  << point[2] << ")\n";
45 
47 
48  }
float Length(const PFPStruct &pfp)
Definition: PFPUtils.cxx:3303
const double a
static int max(int a, int b)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
size_t gar::geo::seg::AuxDetChannelMapAlg::NearestSensitiveAuxDet ( const double *  point,
std::vector< geo::AuxDetGeo * > const &  auxDets,
size_t &  ad 
) const
virtual

Definition at line 51 of file AuxDetChannelMapAlg.cxx.

54  {
55  double HalfCenterWidth = 0.;
56  double localPoint[3] = {0.};
57 
58  ad = this->NearestAuxDet(point, auxDets);
59 
60  geo::AuxDetGeo* adg = auxDets[ad];
61 
62  for(size_t a = 0; a < adg->NSensitiveVolume(); ++a) {
63 
64  geo::AuxDetSensitiveGeo const& adsg = adg->SensitiveVolume(a);
65  adsg.WorldToLocal(point, localPoint);
66 
67  HalfCenterWidth = 0.5 * (adsg.HalfWidth1() + adsg.HalfWidth2());
68 
69  if(localPoint[2] >= - adsg.Length()/2 &&
70  localPoint[2] <= adsg.Length()/2 &&
71  localPoint[1] >= - adsg.HalfHeight() &&
72  localPoint[1] <= adsg.HalfHeight() &&
73  // if AuxDet a is a box, then HalfSmallWidth = HalfWidth
74  localPoint[0] >= - HalfCenterWidth + localPoint[2]*(HalfCenterWidth - adsg.HalfWidth2())/(0.5 * adsg.Length()) &&
75  localPoint[0] <= HalfCenterWidth - localPoint[2]*(HalfCenterWidth - adsg.HalfWidth2())/(0.5 * adsg.Length())
76  ) return a;
77  }// for loop over AuxDetSensitive a
78 
79  // throw an exception because we couldn't find the sensitive volume
80  throw cet::exception("Geometry") << "Can't find AuxDetSensitive for position ("
81  << point[0] << ","
82  << point[1] << ","
83  << point[2] << ")\n";
84 
86  }
virtual size_t NearestAuxDet(const double *point, std::vector< geo::AuxDetGeo * > const &auxDets) const
AuxDetSensitiveGeo const & SensitiveVolume(size_t sv) const
Definition: AuxDetGeo.h:171
const double a
size_t NSensitiveVolume() const
Definition: AuxDetGeo.h:172
static int max(int a, int b)
void WorldToLocal(const double *world, double *auxdet) const
Transform point from world frame to local auxiliary detector frame.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
virtual uint32_t gar::geo::seg::AuxDetChannelMapAlg::PositionToAuxDetChannel ( double const  worldLoc[3],
std::vector< geo::AuxDetGeo * > const &  auxDets,
size_t &  ad,
size_t &  sv 
) const
pure virtual
virtual void gar::geo::seg::AuxDetChannelMapAlg::Uninitialize ( )
pure virtual

Member Data Documentation

std::map<size_t, std::vector<chanAndSV> > gar::geo::seg::AuxDetChannelMapAlg::fADGeoToChannelAndSV
protected

map the AuxDetGeo index to a vector of pairs corresponding to the channel and AuxDetSensitiveGeo index

Definition at line 78 of file AuxDetChannelMapAlg.h.

std::map<size_t, std::string> gar::geo::seg::AuxDetChannelMapAlg::fADGeoToName
protected

map the AuxDetGeo index to the name

Definition at line 76 of file AuxDetChannelMapAlg.h.

std::map<std::string, size_t> gar::geo::seg::AuxDetChannelMapAlg::fNameToADGeo
protected

map the names to the AuxDetGeo index

Definition at line 77 of file AuxDetChannelMapAlg.h.


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