Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private 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_t, JLocation_t >

Public Member Functions

 JProductRouter (const JDetectorIntegration_t &detector, const JPBSSequences &pbs)
 Constructor. More...
 
JLocation_t getLocation (const JUPI_t &upi) const
 Get location of product with given UPI. More...
 

Private Member Functions

bool insert (const JDetectorIntegration_t &detector, const JProductIntegration_t &product, const JPBSSequence &pbs)
 Insert product. More...
 

Detailed Description

Auxiliary class to map UPI to location in detector.

Definition at line 119 of file JProductRouter.hh.

Constructor & Destructor Documentation

JDATABASE::JProductRouter::JProductRouter ( const JDetectorIntegration_t detector,
const JPBSSequences pbs 
)
inline

Constructor.

Parameters
detectordetector integration
pbsPBS sequences

Definition at line 128 of file JProductRouter.hh.

129  {
130  for (JDetectorIntegration_t::const_iterator product = detector.begin(); product != detector.end(); ++product) {
131  if (product->has()) {
132  for (JPBSSequences::const_iterator i = pbs.begin(); i != pbs.end(); ++i) {
133  if (insert(detector, *product, *i)) {
134  break;
135  }
136  }
137  }
138  }
139  }
bool insert(const JDetectorIntegration_t &detector, const JProductIntegration_t &product, const JPBSSequence &pbs)
Insert product.

Member Function Documentation

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

Get location of product with given UPI.

Parameters
upiUPI
Returns
location

Definition at line 148 of file JProductRouter.hh.

149  {
150  const_iterator p = this->find(upi);
151 
152  if (p != this->end())
153  return p->second;
154  else
155  return JLocation_t();
156  }
Auxiliary data structure for location of product in detector.
bool JDATABASE::JProductRouter::insert ( const JDetectorIntegration_t detector,
const JProductIntegration_t product,
const JPBSSequence pbs 
)
inlineprivate

Insert product.

Parameters
detectordetector integration
productproduct
pbsPBS sequence
Returns
true if inserted; else false

Definition at line 167 of file JProductRouter.hh.

170  {
171  using namespace std;
172 
173  if (!pbs.empty()) {
174 
175  JPBSSequence::const_iterator i = pbs.begin();
176 
177  if (product.content.getPBS() == i->getPBS()) {
178 
179  JLocation_t location;
180 
181  for (JUPI_t upi = product.content.getUPI(); ++i != pbs.end(); ) {
182 
183  const JDetectorIntegration_t::range_type range = detector.find(upi);
184 
185  if (distance(range.first, range.second) == 1) {
186 
187  const JProductIntegration_t& ps = detector[range.first->second];
188 
189  if (is_optical_module(ps.container.getPBS()) ||
190  is_base_module (ps.container.getPBS())) { location.position = ps.position; }
191  else if (is_string (ps.container.getPBS())) { location.floor = ps.position; }
192  else if (is_detector (ps.container.getPBS())) { location.string = ps.position; }
193 
194  upi = ps.container.getUPI();
195 
196  } else {
197 
198  break;
199  }
200  }
201 
202  if (i == pbs.end()) {
203 
204  std::map<JUPI_t, JLocation_t>::insert(make_pair(product.content.getUPI(), location));
205 
206  return true;
207  }
208  }
209  }
210 
211  return false;
212  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Universal product identifier (UPI).
Definition: JUPI_t.hh:29
const JPBS_t & getPBS() const
Get PBS.
Definition: JPBS_t.hh:99
const JUPI_t & getUPI() const
Get UPI.
Definition: JUPI_t.hh:97
int floor
position in string
Auxiliary data structure for location of product in detector.
range_type find(const JUPI_t &upi) const
Find range of products with given UPI.
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi mv $WORKDIR/fit.root $MODULE_ROOT typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
Definition: module-Z:fit.sh:84
int position
position in floor
bool is_string(const JPBS_t &pbs)
Test if given PBS corresponds to a string.
Definition: JPBS_t.hh:265
bool is_base_module(const JPBS_t &pbs)
Test if given PBS corresponds to a base module.
Definition: JPBS_t.hh:289
int string
position in detector
bool is_detector(const JPBS_t &pbs)
Test if given PBS corresponds to a detector.
Definition: JPBS_t.hh:253
bool is_optical_module(const JPBS_t &pbs)
Test if given PBS corresponds to a optical module.
Definition: JPBS_t.hh:277
Auxiliary class for product integration data.

The documentation for this struct was generated from the following file: