Jpp 19.3.0
the software that should make you happy
Loading...
Searching...
No Matches
JDATABASE::JPMTRunsetupParams< JValue_t > Class Template Reference

Auxiliary class for PMT run setup parameters. More...

#include <JPMTRunsetupParams.hh>

Inheritance diagram for JDATABASE::JPMTRunsetupParams< JValue_t >:
std::map< std::string, JPMTValue< JValue_t > >

Classes

struct  result_type
 Type definition of PMT parameter value. More...
 

Public Member Functions

 JPMTRunsetupParams ()
 Default constructor.
 
void configure (const int id, const int run, const std::string &parameter)
 Configure PMT run setup parameters for given detector and run.
 
result_type operator() (const JUPI_t &upi) const
 Get PMT parameter value for given UPI of PMT.
 

Friends

std::ostream & operator<< (std::ostream &out, const JPMTRunsetupParams &object)
 Write PMT run setup parameters to output stream.
 

Detailed Description

template<class JValue_t>
class JDATABASE::JPMTRunsetupParams< JValue_t >

Auxiliary class for PMT run setup parameters.

This class provides for an implementation of the fallback method based on the UPI of a PMT and the value of JRunsetupParams::ORDER.

Definition at line 57 of file JPMTRunsetupParams.hh.

Constructor & Destructor Documentation

◆ JPMTRunsetupParams()

template<class JValue_t >
JDATABASE::JPMTRunsetupParams< JValue_t >::JPMTRunsetupParams ( )
inline

Default constructor.

Definition at line 87 of file JPMTRunsetupParams.hh.

88 {}

Member Function Documentation

◆ configure()

template<class JValue_t >
void JDATABASE::JPMTRunsetupParams< JValue_t >::configure ( const int id,
const int run,
const std::string & parameter )
inline

Configure PMT run setup parameters for given detector and run.

Parameters
iddetector identifier
runrun number
parameterparameter name

Definition at line 98 of file JPMTRunsetupParams.hh.

99 {
100 using namespace std;
101 using namespace JPP;
102
103 this->clear();
104
105 string rs_oid;
106 JAllParams upars;
107
108 {
109 ResultSet& rs = getResultSet(getTable<JRuns>(), getSelector<JRuns>(id, run));
110
111 JRuns parameters;
112
113 if (rs >> parameters) {
114 rs_oid = parameters.RUNSETUPID;
115 }
116
117 rs.Close();
118 }
119 {
121
122 for (JAllParams parameters; rs >> parameters; ) {
123 if (parameters.NAME == parameter) {
124 upars = parameters;
125 }
126 }
127
128 rs.Close();
129 }
130 {
132
133 for (JRunsetupParams parameters; rs >> parameters; ) {
134 if (parameters.PAR_OID == upars.OID && parameters.ISINPUT == 'Y') {
135 if (parameters.VALUE != "") {
136
137 JPMTValue<JValue_t>& value = (*this)[parameters.UPIFILTER];
138
139 if (parameters.ORDER > value.first) {
140
141 value.first = parameters.ORDER;
142
143 istringstream(parameters.VALUE) >> value.second;
144 }
145 }
146 }
147 }
148
149 rs.Close();
150 }
151 }
const char *const OPTICS_t
sub-system of PMT
ResultSet & getResultSet(const std::string &query)
Get result set.
Definition JDB.hh:438
const char * getTable()
Get table name.
Definition JDB.hh:373
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for fallback order of PMT data.
std::string RUNSETUPID
Definition JRuns.hh:26
Template definition for getting table specific selector.

◆ operator()()

template<class JValue_t >
result_type JDATABASE::JPMTRunsetupParams< JValue_t >::operator() ( const JUPI_t & upi) const
inline

Get PMT parameter value for given UPI of PMT.

Parameters
upiUPI
Returns
PMT parameter value

Definition at line 160 of file JPMTRunsetupParams.hh.

161 {
162 typename JPMTRunsetupParams::const_iterator p = this->find(upi.toString()), p0 = p, p1 = p;
163
164 // fallbacks
165
166 const JUPI_t buffer[] = {
167 JUPI_t(upi.getPBS(), upi.getVariant(), JUPI_t::DEFAULT_VERSION, 0),
168 JUPI_t(upi.getPBS(), upi.getVariant(), JUPI_t::DEFAULT_VERSION, JUPI_t::DEFAULT_NUMBER),
169 JUPI_t(upi.getPBS(), "", JUPI_t::DEFAULT_VERSION, 0),
170 JUPI_t(upi.getPBS(), "", JUPI_t::DEFAULT_VERSION, JUPI_t::DEFAULT_NUMBER)
171 };
172
173 for (const JUPI_t& i : buffer) {
174 if ((p = this->find(i.toString())) != this->end()) {
175 if (p1 == this->end() || p->first > p1->first) {
176 p1 = p;
177 }
178 }
179 }
180
181 if (p1 != this->end()) {
182 return { p0 != p1, p1->second.second };
183 }
184
185 THROW(JDatabaseException, "Invalid UPI " << upi);
186 }
TPaveText * p1
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
static const int DEFAULT_VERSION
Default version.
Definition JUPI_t.hh:39
static const int DEFAULT_NUMBER
Default number.
Definition JUPI_t.hh:40

Friends And Related Symbol Documentation

◆ operator<<

template<class JValue_t >
std::ostream & operator<< ( std::ostream & out,
const JPMTRunsetupParams< JValue_t > & object )
friend

Write PMT run setup parameters to output stream.

Parameters
outoutput stream
objectPMT run setup parameters
Returns
output stream

Definition at line 196 of file JPMTRunsetupParams.hh.

197 {
198 using namespace std;
199
200 for (typename JPMTRunsetupParams::const_iterator i = object.begin(); i != object.end(); ++i) {
201 out << left << setw(32) << i->first << ' ' << right << i->second.second << endl;
202 }
203
204 return out;
205 }

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