Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JDETECTOR::JPMTThresholdCalibration_t Struct Reference

Data structure for PMT threshold calibration. More...

#include <JDetectorCalibration.hh>

Inheritance diagram for JDETECTOR::JPMTThresholdCalibration_t:
JDATABASE::JUPI_t JDATABASE::JPBS_t std::vector< int >

Public Member Functions

 JPMTThresholdCalibration_t ()
 Default constructor.
 
 JPMTThresholdCalibration_t (const JUPI_t &upi, const std::string &result, const double threshold, const std::vector< int > &runNumbers=std::vector< int >(0))
 Constructor.
 
const JUPI_tgetUPI () const
 Get UPI.
 
const std::string & getVariant () const
 Get variant.
 
int getVersion () const
 Get version.
 
int getNumber () const
 Get serial number.
 
std::string toString () const
 Convert UPI.
 
 ClassDefNV (JUPI_t, 1)
 
 ClassDefNV (JPBS_t, 1)
 
const JPBS_tgetPBS () const
 Get PBS.
 
bool is_valid () const
 Check validity.
 

Public Attributes

std::string result
 
double threshold
 
std::vector< int > runNumberList
 

Static Public Attributes

static const char SEPARATOR = '/'
 Separator between PBS, variant and version.
 
static const int DEFAULT_VERSION = -1
 Default version.
 
static const int DEFAULT_NUMBER = -1
 Default number.
 
static const char DOT = '.'
 Separator between PBS values.
 

Protected Attributes

std::string variant
 
int version
 
int number
 

Friends

void to_json (json &js, const JPMTThresholdCalibration_t &object)
 Convert PMT threshold calibration to JSon.
 
void from_json (const json &js, JPMTThresholdCalibration_t &object)
 Convert JSon to PMT threshold calibration.
 

Detailed Description

Data structure for PMT threshold calibration.

Definition at line 416 of file JDetectorCalibration.hh.

Constructor & Destructor Documentation

◆ JPMTThresholdCalibration_t() [1/2]

JDETECTOR::JPMTThresholdCalibration_t::JPMTThresholdCalibration_t ( )
inline

Default constructor.

Definition at line 422 of file JDetectorCalibration.hh.

423 {}

◆ JPMTThresholdCalibration_t() [2/2]

JDETECTOR::JPMTThresholdCalibration_t::JPMTThresholdCalibration_t ( const JUPI_t & upi,
const std::string & result,
const double threshold,
const std::vector< int > & runNumbers = std::vector<int>(0) )
inline

Constructor.

Parameters
upiUPI
resultresult
thresholdthreshold
runNumbersrun numbers

Definition at line 434 of file JDetectorCalibration.hh.

Member Function Documentation

◆ getUPI()

const JUPI_t & JDATABASE::JUPI_t::getUPI ( ) const
inlineinherited

Get UPI.

Returns
UPI

Definition at line 100 of file JUPI_t.hh.

101 {
102 return static_cast<const JUPI_t&>(*this);
103 }

◆ getVariant()

const std::string & JDATABASE::JUPI_t::getVariant ( ) const
inlineinherited

Get variant.

Returns
variant

Definition at line 111 of file JUPI_t.hh.

112 {
113 return variant;
114 }
std::string variant
Definition JUPI_t.hh:279

◆ getVersion()

int JDATABASE::JUPI_t::getVersion ( ) const
inlineinherited

Get version.

Returns
version

Definition at line 122 of file JUPI_t.hh.

123 {
124 return version;
125 }

◆ getNumber()

int JDATABASE::JUPI_t::getNumber ( ) const
inlineinherited

Get serial number.

Returns
serial number

Definition at line 133 of file JUPI_t.hh.

134 {
135 return number;
136 }

◆ toString()

std::string JDATABASE::JUPI_t::toString ( ) const
inlineinherited

Convert UPI.

Returns
UPI

Definition at line 144 of file JUPI_t.hh.

145 {
146 std::ostringstream os;
147
148 os << *this;
149
150 return os.str();
151 }

◆ ClassDefNV() [1/2]

JDATABASE::JUPI_t::ClassDefNV ( JUPI_t ,
1  )
inherited

◆ ClassDefNV() [2/2]

JDATABASE::JPBS_t::ClassDefNV ( JPBS_t ,
1  )
inherited

◆ getPBS()

const JPBS_t & JDATABASE::JPBS_t::getPBS ( ) const
inlineinherited

Get PBS.

Returns
PBS

Definition at line 101 of file JPBS_t.hh.

102 {
103 return static_cast<const JPBS_t&>(*this);
104 }
JPBS_t()
Default constructor.
Definition JPBS_t.hh:39

◆ is_valid()

bool JDATABASE::JPBS_t::is_valid ( ) const
inlineinherited

Check validity.

Returns
true if valid; else false

Definition at line 112 of file JPBS_t.hh.

113 {
114 return !this->empty();
115 }

Friends And Related Symbol Documentation

◆ to_json

void to_json ( json & js,
const JPMTThresholdCalibration_t & object )
friend

Convert PMT threshold calibration to JSon.

Parameters
jsjson
objectPMT threshold calibration

Definition at line 451 of file JDetectorCalibration.hh.

452 {
453 std::ostringstream os;
454
455 os << object.getUPI();
456
457 js[UPI_t] = os.str();
458 js[Test_t + Result_t] = object.result;
460 { Unit_t, Unitless_t },
461 { Values_t, get_string_array(object.threshold) } };
462 js[Test_t + Parameters_t][2] = json{ { Name_t, RunNumber_t },
463 { Unit_t, Unitless_t },
464 { Values_t, object.runNumberList } };
465 }
nlohmann::json json
std::vector< std::string > get_string_array(T value)
Cast single value to array of strings, conform the DB-format.
static const std::string Name_t
static const std::string RunNumber_t
static const std::string Parameters_t
static const std::string Unit_t
static const std::string Unitless_t
static const std::string Result_t
static const std::string PMTThreshold_t
static const std::string Values_t
static const std::string Test_t
static const std::string UPI_t

◆ from_json

void from_json ( const json & js,
JPMTThresholdCalibration_t & object )
friend

Convert JSon to PMT threshold calibration.

Parameters
jsjson
objectPMT threshold calibration

Definition at line 474 of file JDetectorCalibration.hh.

475 {
476 using namespace std;
477
478 stringstream is(js.at(UPI_t).get<string>());
479
480 is >> static_cast<JUPI_t&>(object);
481
482 object.result = js.at(Test_t + Result_t).get<string>();
483 object.threshold = retrieve_value(js.at(Test_t + Parameters_t)[0].at(Values_t).get<vector<string>>());
484 object.runNumberList = js.at(Test_t + Parameters_t)[2].at(Values_t).get<vector<int>>();
485 }
double retrieve_value(std::vector< std::string > string_value_array)
Retrieve value from json array of strings.

Member Data Documentation

◆ result

std::string JDETECTOR::JPMTThresholdCalibration_t::result

Definition at line 487 of file JDetectorCalibration.hh.

◆ threshold

double JDETECTOR::JPMTThresholdCalibration_t::threshold

Definition at line 488 of file JDetectorCalibration.hh.

◆ runNumberList

std::vector<int> JDETECTOR::JPMTThresholdCalibration_t::runNumberList

Definition at line 489 of file JDetectorCalibration.hh.

◆ SEPARATOR

const char JDATABASE::JUPI_t::SEPARATOR = '/'
staticinherited

Separator between PBS, variant and version.

Definition at line 36 of file JUPI_t.hh.

◆ DEFAULT_VERSION

const int JDATABASE::JUPI_t::DEFAULT_VERSION = -1
staticinherited

Default version.

Definition at line 38 of file JUPI_t.hh.

◆ DEFAULT_NUMBER

const int JDATABASE::JUPI_t::DEFAULT_NUMBER = -1
staticinherited

Default number.

Definition at line 39 of file JUPI_t.hh.

◆ variant

std::string JDATABASE::JUPI_t::variant
protectedinherited

Definition at line 279 of file JUPI_t.hh.

◆ version

int JDATABASE::JUPI_t::version
protectedinherited

Definition at line 280 of file JUPI_t.hh.

◆ number

int JDATABASE::JUPI_t::number
protectedinherited

Definition at line 281 of file JUPI_t.hh.

◆ DOT

const char JDATABASE::JPBS_t::DOT = '.'
staticinherited

Separator between PBS values.

Definition at line 33 of file JPBS_t.hh.


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