Jpp - 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 120 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 129 of file JProductRouter.hh.

130  {
131  for (JDetectorIntegration_t::const_iterator product = detector.begin(); product != detector.end(); ++product) {
132  if (product->has()) {
133  for (JPBSSequences::const_iterator i = pbs.begin(); i != pbs.end(); ++i) {
134  if (insert(detector, *product, *i)) {
135  break;
136  }
137  }
138  }
139  }
140  }
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 149 of file JProductRouter.hh.

150  {
151  const_iterator p = this->find(upi);
152 
153  if (p != this->end())
154  return p->second;
155  else
156  return JLocation_t();
157  }
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 168 of file JProductRouter.hh.

171  {
172  using namespace std;
173 
174  if (!pbs.empty()) {
175 
176  JPBSSequence::const_iterator i = pbs.begin();
177 
178  if (product.content.getPBS() == i->getPBS()) {
179 
180  JLocation_t location;
181 
182  for (JUPI_t upi = product.content.getUPI(); ++i != pbs.end(); ) {
183 
184  const JDetectorIntegration_t::range_type range = detector.find(upi);
185 
186  if (distance(range.first, range.second) == 1) {
187 
188  const JProductIntegration_t& ps = detector[range.first->second];
189 
190  if (is_optical_module(ps.container.getPBS()) ||
191  is_base_module (ps.container.getPBS())) { location.position = ps.position; }
192  else if (is_string (ps.container.getPBS())) { location.floor = ps.position; }
193  else if (is_detector (ps.container.getPBS())) { location.string = ps.position; }
194 
195  upi = ps.container.getUPI();
196 
197  } else {
198 
199  break;
200  }
201  }
202 
203  if (i == pbs.end()) {
204 
205  std::map<JUPI_t, JLocation_t>::insert(make_pair(product.content.getUPI(), location));
206 
207  return true;
208  }
209  }
210  }
211 
212  return false;
213  }
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: