1 #ifndef __JDETECTOR__JPMTPARAMETERSMAP__
2 #define __JDETECTOR__JPMTPARAMETERSMAP__
92 public JThrow<JPMTParametersMap>
121 ifstream in(file_name);
144 JPMTParametersMap_t::const_iterator i = find(
id);
147 parameters = i->second;
152 parameters.
QE *= this->
QE;
271 for (const_iterator i = this->begin(); i != this->end(); ++i) {
273 if (!i->second.is_valid()) {
277 if (i->second.QE * this->QE > 1.0 ||
278 i->second.QE * this->QE < 0.0) {
279 THROW(
JException,
"Invalid PMT QE at " << i->first <<
' ' << i->second.QE * this->QE);
312 for (JPMTParametersMap::const_iterator i = this->begin(); i != this->end(); ++i) {
313 if (i->second.QE > Pmax) {
314 THROW(
JValueOutOfRange,
"Hit probability PMT " << i->first <<
' ' << i->second.QE <<
" > maximum probability given expectation value " << this->mu << endl);
318 for (JPMTParametersMap::iterator i = this->begin(); i != this->end(); ++i) {
320 if (i->second.QE > 0.0)
321 i->second.QE =
getQE(i->second.QE, this->mu);
339 JPMTParametersMap_t::iterator i = find(
id);
370 JProperties demo =
object.defaultPMTParameters.getProperties();
373 properties[
"pmt"] = helper;
374 properties[
"%"] = demo;
375 properties[
"QE"] =
object.QE;
376 properties[
"mu"] =
object.mu;
378 is >>
object.comment;
394 using namespace JLANG;
398 JProperties demo =
object.defaultPMTParameters.getProperties();
401 properties[
"%"] = demo;
486 helper.
object[id].getProperties().read(in);
502 for (JPMTParametersMap::const_iterator i = helper.
object.begin(); i != helper.
object.end(); ++i) {
506 i->second.getProperties(helper.
equation).write(out);
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Utility class to parse parameter values.
Auxiliary class for I/O of PMT parameters map.
JPMTParametersMap & object
JPMTParametersMapHelper(JPMTParametersMap &__object, const JEquationParameters &__equation)
Constructor.
friend std::istream & operator>>(std::istream &in, JPMTParametersMapHelper &helper)
Stream input PMT parameters map helper.
friend std::ostream & operator<<(std::ostream &out, const JPMTParametersMapHelper &helper)
Stream output PMT parameters map helper.
const JEquationParameters & equation
Auxiliary class for map of PMT parameters.
void setQE(const double QE)
Set global QE.
friend std::istream & operator>>(std::istream &in, JPMTParametersMap &object)
Stream input.
static void setEquationParameters(const JEquationParameters &equation)
Set equation parameters.
JPMTParametersMap(const char *const file_name)
Constructor.
double getMu() const
Get expectation value for number of photo-electrons given two-fold (or higher) coincidence rate.
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
static JEquationParameters & getEquationParameters()
Get equation parameters.
const JPMTParameters & getDefaultPMTParameters() const
Get default PMT parameters.
void convertHitProbabilityToQE(const double mu)
Convert the hit probabilities to QEs for given expectation value.
JPMTParameters & getDefaultPMTParameters()
Get default PMT parameters.
void setDefaultPMTParameters(const JPMTParameters ¶meters)
Set default PMT parameters.
double mu
Expectation value for number of photo-electrons given two-fold (or higher) coincidence rate.
JPMTParameters defaultPMTParameters
Default PMT parameters.
double getQE() const
Get global QE.
double getQE(const JPMTIdentifier &id) const
Get QE of given PMT.
double getHitProbability(const JPMTIdentifier &id) const
Get ratio of hit probabilities of given PMT.
JPMTParametersMap(const JPMTParameters ¶meters=JPMTParameters())
Constructor.
bool is_valid() const
Check validity of PMT parameters.
friend std::ostream & operator<<(std::ostream &out, const JPMTParametersMap &object)
Stream output.
JPMTParameters & operator[](const JPMTIdentifier &id)
Access parameters corresponding to given PMT identifier.
Data structure for PMT parameters.
bool is_valid() const
Check validity of PMT parameters.
double QE
relative quantum efficiency
Utility class to parse parameter values.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
static equation_type< T > make_equation(const std::string &key, const T &value)
Auxiliary method to create equation type.
Exception for opening of file.
Exception for reading of file.
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
void load()
Load data from file with name corresponding to current contents.
Auxiliary base class for controling the throwing of exceptions.
static void Throw(const bool option)
Enable/disable throw option.
Exception for accessing a value in a collection that is outside of its range.
file Auxiliary data structures and methods for detector calibration.
double getMaximalHitProbability(const double mu)
Get maximal ratio of hit probabilities for given QE and expectation value of the number of photo-elec...
std::map< JPMTIdentifier, JPMTParameters > JPMTParametersMap_t
Type definition of map PMT identifier to PMT parameters.
double getHitProbability(const double QE, const double mu)
Get ratio of hit probabilities for given QE and expectation value of the number of photo-electrons.
double getQE(const double R, const double mu)
Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons.
Auxiliary classes and methods for language specific functionality.
JLANG::JEquationFacet setequation
Type definition of stream manipulator for equational I/O.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static JStat getFileStatus
Function object for file status.
Auxiliary base class for storing and loading a single object to and from an ASCII file,...