Jpp  15.0.4
the software that should make you happy
 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 25 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 34 of file JProductRouter.hh.

35  {
36  for (JDetectorIntegration_t::const_iterator product = detector.begin(); product != detector.end(); ++product) {
37  if (product->has()) {
38  for (JPBSSequences::const_iterator i = pbs.begin(); i != pbs.end(); ++i) {
39  if (insert(detector, *product, *i)) {
40  break;
41  }
42  }
43  }
44  }
45  }
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 54 of file JProductRouter.hh.

55  {
56  const_iterator p = this->find(upi);
57 
58  if (p != this->end())
59  return p->second;
60  else
61  return JLocation_t();
62  }
Auxiliary data structure for location of product in detector.
Definition: JLocation_t.hh:24
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 73 of file JProductRouter.hh.

76  {
77  using namespace std;
78 
79  if (!pbs.empty()) {
80 
81  JPBSSequence::const_iterator i = pbs.begin();
82 
83  if (product.content.getPBS() == i->getPBS()) {
84 
85  JLocation_t location;
86 
87  for (JUPI_t upi = product.content.getUPI(); ++i != pbs.end(); ) {
88 
89  const JDetectorIntegration_t::range_type range = detector.find(upi);
90 
91  if (distance(range.first, range.second) == 1) {
92 
93  const JProductIntegration_t& ps = detector[range.first->second];
94 
96  is_base_module (ps.container.getPBS())) { location.position = ps.position; }
97  else if (is_string (ps.container.getPBS())) { location.floor = ps.position; }
98  else if (is_detector (ps.container.getPBS())) { location.string = ps.position; }
99 
100  upi = ps.container.getUPI();
101 
102  } else {
103 
104  break;
105  }
106  }
107 
108  if (i == pbs.end()) {
109 
110  std::map<JUPI_t, JLocation_t>::insert(make_pair(product.content.getUPI(), location));
111 
112  return true;
113  }
114  }
115  }
116 
117  return false;
118  }
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
Definition: JLocation_t.hh:106
Auxiliary data structure for location of product in detector.
Definition: JLocation_t.hh:24
range_type find(const JUPI_t &upi) const
Find range of products with given UPI.
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
int position
position in floor
Definition: JLocation_t.hh:107
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
Definition: JLocation_t.hh:105
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: