Jpp
Public Member Functions | List of all members
JDATABASE::JProductRouter Struct Reference

Auxiliary class to map UPI to location in detector. More...

#include <JProductRouter.hh>

Inheritance diagram for JDATABASE::JProductRouter:
std::map< JUPI, JLocation_t >

Public Member Functions

 JProductRouter (const JDetectorIntegration &detector)
 Constructor. More...
 
JLocation_t getLocation (const JUPI &upi) const
 Get location of product with given UPI. More...
 

Detailed Description

Auxiliary class to map UPI to location in detector.

Definition at line 101 of file JProductRouter.hh.

Constructor & Destructor Documentation

◆ JProductRouter()

JDATABASE::JProductRouter::JProductRouter ( const JDetectorIntegration detector)
inline

Constructor.

Parameters
detectordetector integration

Definition at line 109 of file JProductRouter.hh.

110  {
111  using namespace std;
112  using namespace JPP;
113 
114  for (JDetectorIntegration::const_iterator i = detector.begin(); i != detector.end(); ++i) {
115 
116  if (i->has()) {
117 
118  {
119  const JPBS pbs[] = { PBS::DOM, PBS::DETECTION_UNIT, PBS::DETECTOR };
120 
121  const JProductTrace trace(detector, i->content.getUPI(), make_array(pbs));
122 
123  if (trace.size() == getSize(pbs)) {
124 
125  this->insert(make_pair(i->content.getUPI(), JLocation_t(trace[2].position, trace[1].position, trace[0].position)));
126 
127  continue;
128  }
129  }
130 
131  {
132  const JPBS pbs[] = { PBS::BASE, PBS::DETECTION_UNIT, PBS::DETECTOR };
133 
134  const JProductTrace trace(detector, i->content.getUPI(), make_array(pbs));
135 
136  if (trace.size() == getSize(pbs)) {
137 
138  this->insert(make_pair(i->content.getUPI(), JLocation_t(trace[2].position, trace[1].position, trace[0].position)));
139 
140  continue;
141  }
142  }
143 
144  {
146 
147  const JProductTrace trace(detector, i->content.getUPI(), make_array(pbs));
148 
149  if (trace.size() == getSize(pbs)) {
150 
151  this->insert(make_pair(i->content.getUPI(), JLocation_t(trace[2].position, trace[1].position, trace[0].position)));
152 
153  continue;
154  }
155  }
156  }
157  }
158  }

Member Function Documentation

◆ getLocation()

JLocation_t JDATABASE::JProductRouter::getLocation ( const JUPI upi) const
inline

Get location of product with given UPI.

Note that only for products inside a string, a valid location is returned, otherwise, the default location is returned.

Parameters
upiUPI
Returns
location

Definition at line 170 of file JProductRouter.hh.

171  {
173 
174  if (p != this->end())
175  return p->second;
176  else
177  return JLocation_t();
178  }

The documentation for this struct was generated from the following file:
JDATABASE::JDetectorIntegration::end
const_iterator end() const
end of integration data
Definition: JDetectorIntegration.hh:320
JDATABASE::PBS::DETECTION_UNIT
static const JPBS DETECTION_UNIT(3)
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JDATABASE::JDetectorIntegration::begin
const_iterator begin() const
begin of integration data
Definition: JDetectorIntegration.hh:319
JLANG::getSize
size_t getSize(T(&array)[N])
Get size of c-array.
Definition: JLangToolkit.hh:32
JDATABASE::JDetectorIntegration::const_iterator
data_type::const_iterator const_iterator
Definition: JDetectorIntegration.hh:306
JDATABASE::PBS::DOM
static const JPBS DOM(3, 4)
JDATABASE::JLocation_t
Auxiliary data structure for location of product in detector.
Definition: JProductRouter.hh:26
std::map
Definition: JSTDTypes.hh:16
JDATABASE::JProductTrace
Auxiliary class to trace product.
Definition: JDetectorIntegration.hh:617
JDATABASE::JPBS
Product breakdown structure (PBS).
Definition: JPBS.hh:27
JDATABASE::PBS::DETECTOR
static const JPBS DETECTOR(0)
Fixed PBS.
std
Definition: jaanetDictionary.h:36
JDATABASE::PBS::BASE_CONTAINER
static const JPBS BASE_CONTAINER(3, 2, 2)
JLANG::make_array
const std::vector< JValue_t > make_array(const JValue_t(&array)[N])
Method to create array of values.
Definition: JVectorize.hh:27
JDATABASE::PBS::BASE
static const JPBS BASE(3, 2)