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

Auxiliary class for PMT thresholds. More...

#include <JPMTThreshold.hh>

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

Classes

struct  threshold_type
 Type definition of PMT threshold. More...
 

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...
 
threshold_type operator() (const JUPI_t &upi) const
 Get PMT threshold for given UPI of PMT. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const JPMTThreshold &object)
 Write PMT thresholds to output stream. More...
 

Detailed Description

Auxiliary class for PMT thresholds.

Definition at line 34 of file JPMTThreshold.hh.

Constructor & Destructor Documentation

JDATABASE::JPMTThreshold::JPMTThreshold ( )
inline

Default constructor.

Definition at line 50 of file JPMTThreshold.hh.

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

Constructor.

Parameters
iddetector identifier
runrun number

Definition at line 60 of file JPMTThreshold.hh.

61  {
62  configure(id, run);
63  }
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 72 of file JPMTThreshold.hh.

73  {
74  using namespace std;
75  using namespace JPP;
76 
77  this->clear();
78 
79  string rs_oid;
80  JAllParams upars;
81 
82  {
83  ResultSet& rs = getResultSet(getTable<JRuns>(), getSelector<JRuns>(id, run));
84 
86 
87  if (rs >> parameters) {
88  rs_oid = parameters.RUNSETUPID;
89  }
90 
91  rs.Close();
92  }
93  {
94  ResultSet& rs = getResultSet(getTable<JAllParams>(), getSelector<JAllParams>(OPTICS_t));
95 
96  for (JAllParams parameters; rs >> parameters; ) {
97  if (parameters.NAME == PMT_THRESHOLD_t) {
98  upars = parameters;
99  }
100  }
101 
102  rs.Close();
103  }
104  {
105  ResultSet& rs = getResultSet(getTable<JRunsetupParams>(), getSelector<JRunsetupParams>(getDetector(id), rs_oid));
106 
107  for (JRunsetupParams parameters; rs >> parameters; ) {
108  if (parameters.PAR_OID == upars.OID && parameters.ISINPUT == 'Y') {
109  if (parameters.VALUE != "") {
110  istringstream(parameters.VALUE) >> (*this)[parameters.UPIFILTER];
111  }
112  }
113  }
114 
115  rs.Close();
116  }
117  }
*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
const char *const PMT_THRESHOLD_t
name of PMT threshold
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
Definition: JDBToolkit.cc:5
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
threshold_type JDATABASE::JPMTThreshold::operator() ( const JUPI_t upi) const
inline

Get PMT threshold for given UPI of PMT.

Parameters
upiUPI
Returns
PMT threshold

Definition at line 126 of file JPMTThreshold.hh.

127  {
128  const_iterator p = this->find(upi.toString());
129 
130  const bool is_default = (p == this->end());
131 
132  if (is_default) {
133 
134  std::ostringstream os;
135 
136  os << upi.getPBS()
138  << upi.getVariant()
140  << JUPI_t::DOT;
141 
142  p = this->find(os.str());
143  }
144 
145  if (p != this->end())
146  return { is_default, p->second };
147  else
148  THROW(JDatabaseException, "Invalid UPI " << upi);
149  }
const std::string & getVariant() const
Get variant.
Definition: JUPI_t.hh:108
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
static const char SEPARATOR
Separator between PBS, variant and version.
Definition: JUPI_t.hh:35
const JPBS_t & getPBS() const
Get PBS.
Definition: JPBS_t.hh:99
std::string toString() const
Convert UPI.
Definition: JUPI_t.hh:141
static const char DOT
Separator between PBS values.
Definition: JPBS_t.hh:31

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const JPMTThreshold object 
)
friend

Write PMT thresholds to output stream.

Parameters
outoutput stream
objectPMT thresholds
Returns
output stream

Definition at line 159 of file JPMTThreshold.hh.

160  {
161  using namespace std;
162 
163  for (JPMTThreshold::const_iterator i = object.begin(); i != object.end(); ++i) {
164  out << left << setw(32) << i->first << ' ' << right << setw(3) << i->second << endl;
165  }
166 
167  return out;
168  }

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