1 #ifndef __JDB__JDETECTORINTEGRATION_T__
2 #define __JDB__JDETECTORINTEGRATION_T__
23 #include "dbclient/KM3NeTDBClient.h"
53 return out <<
"(" <<
object.getLowerLimit() <<
"," <<
object.getUpperLimit() <<
")";
133 in >>
object.operation
155 out <<
object.operation <<
' '
156 <<
object.container <<
' '
157 <<
object.content <<
' '
158 <<
object.position <<
' '
159 <<
object.start_date <<
' '
193 typedef std::pair<map_type::const_iterator,
219 void configure(
const std::string& detid,
const bool option =
false)
228 for (
size_t index = 0; index != this->size(); ++index) {
245 for (
iterator product = this->begin(); product != this->end(); ++product) {
246 if (product->operation == detid) {
258 for (
size_t index = 0; index != this->size(); ++index) {
282 if (upi.
getPBS() >= pbs) {
286 switch (
distance(range.first, range.second)) {
326 for (map_type::const_iterator i = range.first; i != range.second; ++i) {
328 out << upi <<
" -> ";
330 print(out, (*
this)[i->second]);
333 range = down.equal_range(upi);
336 out <<
"<- " << (*this)[i->second] << endl;
357 for (map_type::const_iterator i = range.first; i != range.second; ++i) {
358 print(out, (*
this)[i->second]);
361 if (
distance(range.first, range.second) != 1) {
407 ifstream in(file_name);
409 in.ignore(numeric_limits<streamsize>::max(),
'\n');
411 for (
string buffer;
getline(in, buffer); ) {
413 istringstream is(buffer);
422 is >> buffer; istringstream(
trim(buffer)) >> parameters.
CITY;
423 is >> buffer; istringstream(
trim(buffer)) >> parameters.
LOCATIONID;
424 is >> buffer; istringstream(
trim(buffer)) >> parameters.
LOGIN;
425 is >> buffer; istringstream(
trim(buffer)) >> parameters.
USERID;
426 is >> buffer; istringstream(
trim(buffer)) >> parameters.
STARTD;
427 is >> buffer; istringstream(
trim(buffer)) >> parameters.
ENDD;
429 is >> buffer; istringstream(
trim(buffer)) >> parameters.
POSITION;
434 this->up .insert(make_pair(product.
content .
getUPI(), this->size()));
435 this->down.insert(make_pair(product.
container.
getUPI(), this->size()));
437 this->push_back(product);
457 object.up .insert(make_pair(product.content .getUPI(),
object.size()));
458 object.down.insert(make_pair(product.container.getUPI(),
object.size()));
460 object.push_back(product);
476 for (const_iterator i =
object.begin(); i !=
object.end(); ++i) {
477 out << *i << std::endl;
494 return up.equal_range(upi);
511 while (q != up.end() && (*
this)[q->second].content.getPBS() <= pbs) {
529 return down.equal_range(upi);
563 range = out.equal_range(product.
container);
580 range = down.equal_range(product.
content);
587 if (zmap.count(
object.position) == 0 || compare((*
this)[zmap[
object.
position]],
object)) {
588 zmap[
object.position] = i->second;
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Auxiliary class to define a range between two values.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Auxiliary class to specify white space character(s) in currect locale.
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
static const JPBS_t DETECTOR(0)
PBS of detector
Auxiliary classes and methods for database I/O.
std::ostream & operator<<(std::ostream &out, const JPeriod_t &object)
Write period to output stream.
JTOOLS::JRange< JDate_t > JPeriod_t
Type definition of period.
std::ostream & separator(std::ostream &out)
Print separator.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
std::string trim(const std::string &buffer)
Trim string.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::multimap< JUPI_t, int > map_type
map_type out
link UPI to disintegrated data
range_type get(const JUPI_t &upi) const
Get components of product with given UPI.
void load(const char *const file_name, const std::string &separator=";")
Load detector integration from CSV formatted input file.
JDetectorIntegration_t()
Default constructor.
void configure(JProductIntegration_t &product, const JPeriod_t &period)
Configure detector integration for given detector identifier.
friend std::istream & operator>>(std::istream &in, JDetectorIntegration_t &object)
Read detector integration from input stream.
friend std::ostream & operator<<(std::ostream &out, const JDetectorIntegration_t &object)
Write detector integration to output stream.
map_type::const_iterator range_iterator
map_type down
down link UPI to integration data
void print(std::ostream &out, const JUPI_t &upi) const
Print product trace.
void configure(const std::string &detid, const bool option=false)
Configure detector integration for given detector identifier.
std::pair< map_type::const_iterator, map_type::const_iterator > range_type
map_type::const_iterator range_const_iterator
void print(std::ostream &out, const JProductIntegration_t &product) const
Print product trace.
static bool compare(const JProductIntegration_t &first, const JProductIntegration_t &second)
Compare two product integrations.
static const char *const getName()
Table name.
range_type find(const JPBS_t &pbs) const
Find range of products with given PBS.
range_type find(const JUPI_t &upi) const
Find range of products with given UPI.
const JProductIntegration_t & trace(const JUPI_t &upi, const JPBS_t &pbs=PBS::DETECTOR) const
Trace product up to given integration level.
friend bool operator>>(ResultSet &rs, JDetectorIntegration_t &detector)
Read detector integration from result set.
map_type up
up link UPI to integration data
Product breakdown structure (PBS).
const JPBS_t & getPBS() const
Get PBS.
Auxiliary class for product integration data.
void unset()
Unset product status.
JDateAndTime_t start_date
JProductIntegration_t(const JProductIntegration &input)
Constructor.
void set()
Set product status.
friend std::ostream & operator<<(std::ostream &out, const JProductIntegration_t &object)
Write product integration to output stream.
friend std::istream & operator>>(std::istream &in, JProductIntegration_t &object)
Read product integration from input stream.
JProductIntegration_t()
Default constructor.
bool is_set() const
Check product status.
static const char *const getName()
Table name.
Universal product identifier (UPI).
const JUPI_t & getUPI() const
Get UPI.