Jpp  16.0.3
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
JDATABASE::JPMTThreshold Class Reference

Auxiliary class for PMT thresholds. More...

#include <JPMTThreshold.hh>

Inheritance diagram for JDATABASE::JPMTThreshold:
JDATABASE::JPMTRunsetupParams< int > std::map< std::string, int >

Public Member Functions

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

Static Public Member Functions

static std::string getUPI (const JUPI_t &upi)
 Get fallback UPI. More...
 

Detailed Description

Auxiliary class for PMT thresholds.

Definition at line 18 of file JPMTThreshold.hh.

Constructor & Destructor Documentation

JDATABASE::JPMTThreshold::JPMTThreshold ( )
inline

Default constructor.

Definition at line 29 of file JPMTThreshold.hh.

30  {}
JDATABASE::JPMTThreshold::JPMTThreshold ( const int  id,
const int  run 
)
inline

Constructor.

Parameters
iddetector identifier
runrun number

Definition at line 39 of file JPMTThreshold.hh.

40  {
41  configure(id, run);
42  }
void configure(const int id, const int run)
Configure PMT thresholds for given detector and run.

Member Function Documentation

void JDATABASE::JPMTThreshold::configure ( const int  id,
const int  run 
)
inline

Configure PMT thresholds for given detector and run.

Parameters
iddetector identifier
runrun number

Definition at line 51 of file JPMTThreshold.hh.

52  {
53  configure(id, run, PMT_THRESHOLD_t);
54  }
void configure(const int id, const int run)
Configure PMT thresholds for given detector and run.
const char *const PMT_THRESHOLD_t
parameter name of PMT threshold
static std::string JDATABASE::JPMTRunsetupParams< int >::getUPI ( const JUPI_t upi)
inlinestaticinherited

Get fallback UPI.

Parameters
upiUPI
Returns
UPI

Definition at line 57 of file JPMTRunsetupParams.hh.

58  {
59  std::ostringstream os;
60 
61  os << upi.getPBS()
62  << JUPI_t::SEPARATOR
63  << upi.getVariant()
64  << JUPI_t::SEPARATOR
65  << JUPI_t::DOT;
66 
67  return os.str();
68  }
const std::string & getVariant() const
Get variant.
Definition: JUPI_t.hh:108
const JPBS_t & getPBS() const
Get PBS.
Definition: JPBS_t.hh:99
void JDATABASE::JPMTRunsetupParams< int >::configure ( const int  id,
const int  run,
const std::string &  parameter 
)
inlineinherited

Configure PMT run setup parameters for given detector and run.

Parameters
iddetector identifier
runrun number
parameterparameter name

Definition at line 85 of file JPMTRunsetupParams.hh.

86  {
87  using namespace std;
88  using namespace JPP;
89 
90  this->clear();
91 
92  string rs_oid;
93  JAllParams upars;
94 
95  {
96  ResultSet& rs = getResultSet(getTable<JRuns>(), getSelector<JRuns>(id, run));
97 
99 
100  if (rs >> parameters) {
101  rs_oid = parameters.RUNSETUPID;
102  }
103 
104  rs.Close();
105  }
106  {
107  ResultSet& rs = getResultSet(getTable<JAllParams>(), getSelector<JAllParams>(OPTICS_t));
108 
109  for (JAllParams parameters; rs >> parameters; ) {
110  if (parameters.NAME == parameter) {
111  upars = parameters;
112  }
113  }
114 
115  rs.Close();
116  }
117  {
118  ResultSet& rs = getResultSet(getTable<JRunsetupParams>(), getSelector<JRunsetupParams>(getDetector(id), rs_oid));
119 
120  for (JRunsetupParams parameters; rs >> parameters; ) {
121  if (parameters.PAR_OID == upars.OID && parameters.ISINPUT == 'Y') {
122  if (parameters.VALUE != "") {
123  istringstream(parameters.VALUE) >> (*this)[parameters.UPIFILTER];
124  }
125  }
126  }
127 
128  rs.Close();
129  }
130  }
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
Definition: JDBToolkit.hh:365
const char *const OPTICS_t
sub-system of PMT
ResultSet & getResultSet(const std::string &query)
Get result set.
Definition: JDB.hh:432
Template definition for getting table specific selector.
std::string RUNSETUPID
Definition: JRuns.hh:26
result_type JDATABASE::JPMTRunsetupParams< int >::operator() ( const JUPI_t upi) const
inlineinherited

Get PMT parameter value for given UPI of PMT.

Parameters
upiUPI
Returns
PMT parameter value

Definition at line 139 of file JPMTRunsetupParams.hh.

140  {
141  typename JPMTRunsetupParams::const_iterator p = this->find(upi.toString());
142 
143  const bool is_default = (p == this->end());
144 
145  if (is_default) {
146  p = this->find(getUPI(upi));
147  }
148 
149  if (p != this->end())
150  return { is_default, p->second };
151  else
152  THROW(JDatabaseException, "Invalid UPI " << upi);
153  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
static std::string getUPI(const JUPI_t &upi)
Get fallback UPI.
std::string toString() const
Convert UPI.
Definition: JUPI_t.hh:141

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