1 #ifndef __JDETECTOR__JPMTPARAMETERSMAP__
2 #define __JDETECTOR__JPMTPARAMETERSMAP__
29 namespace JDETECTOR {}
30 namespace JPP {
using namespace JDETECTOR; }
92 public JThrow<JPMTParametersMap>
121 ifstream
in(file_name);
144 JPMTParametersMap_t::const_iterator i = find(
id);
147 parameters = i->second;
151 parameters.
QE *= this->
QE;
270 for (const_iterator i = this->begin(); i != this->end(); ++i) {
272 if (!i->second.is_valid()) {
276 if (i->second.QE * this->QE > 1.0 ||
277 i->second.QE * this->QE < 0.0) {
278 THROW(
JException,
"Invalid PMT QE at " << i->first <<
' ' << i->second.QE * this->QE);
311 for (JPMTParametersMap::const_iterator i = this->begin(); i != this->end(); ++i) {
312 if (i->second.QE > Pmax) {
313 THROW(
JValueOutOfRange,
"Hit probability PMT " << i->first <<
' ' << i->second.QE <<
" > maximum probability given expectation value " << this->mu << endl);
317 for (JPMTParametersMap::iterator i = this->begin(); i != this->end(); ++i) {
319 if (i->second.QE > 0.0)
320 i->second.QE =
getQE(i->second.QE, this->mu);
339 JStringStream
is(in);
348 JProperties demo =
object.defaultPMTParameters.getProperties();
351 properties[
"pmt"] = helper;
352 properties[
"%"] = demo;
353 properties[
"QE"] =
object.QE;
354 properties[
"mu"] =
object.mu;
356 is >>
object.comment;
372 using namespace JLANG;
376 JProperties demo =
object.defaultPMTParameters.getProperties();
379 properties[
"%"] = demo;
381 out <<
object.comment;
464 helper.
object[id].getProperties().read(in);
480 for (JPMTParametersMap::const_iterator i = helper.
object.begin(); i != helper.
object.end(); ++i) {
484 i->second.getProperties(helper.
equation).write(out);
Exception for opening of file.
static void setEquationParameters(const JEquationParameters &equation)
Set equation parameters.
Exception for reading of file.
void setQE(const double QE)
Set global QE.
JPMTParametersMap(const JPMTParameters ¶meters=JPMTParameters())
Constructor.
Auxiliary base class for controling the throwing of exceptions.
double getMu() const
Get expectation value for number of photo-electrons given two-fold (or higher) coincidence rate...
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Utility class to parse parameter values.
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
*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
static equation_type< T > make_equation(const std::string &key, const T &value)
Auxiliary method to create equation type.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
const JEquationParameters & equation
double mu
Expectation value for number of photo-electrons given two-fold (or higher) coincidence rate...
friend std::ostream & operator<<(std::ostream &out, const JPMTParametersMap &object)
Stream output.
void convertHitProbabilityToQE(const double mu)
Convert the hit probabilities to QEs for given expectation value.
std::map< JPMTIdentifier, JPMTParameters > JPMTParametersMap_t
Type definition of map PMT identifier to PMT parameters.
JPMTParametersMapHelper(JPMTParametersMap &__object, const JEquationParameters &__equation)
Constructor.
Utility class to parse parameter values.
JPMTParametersMap & object
Auxiliary class for I/O of PMT parameters map.
JPMTParameters & getDefaultPMTParameters()
Get default PMT parameters.
double getQE() const
Get global QE.
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...
bool is_valid() const
Check validity of PMT parameters.
const JPMTParameters & getDefaultPMTParameters() const
Get default PMT parameters.
Auxiliary class for map of PMT parameters.
JPMTParameters defaultPMTParameters
Default PMT parameters.
double getQE(const JPMTIdentifier &id) const
Get QE of given PMT.
friend std::istream & operator>>(std::istream &in, JPMTParametersMap &object)
Stream input.
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...
static JEquationParameters & getEquationParameters()
Get equation parameters.
bool is_valid() const
Check validity of PMT parameters.
static JStat getFileStatus
Function object for file status.
JLANG::JEquationFacet setequation
Type definition of stream manipulator for equational I/O.
void setDefaultPMTParameters(const JPMTParameters ¶meters)
Set default PMT parameters.
Exception for accessing a value in a collection that is outside of its range.
Data structure for PMT parameters.
Auxiliary base class for storing and loading a single object to and from an ASCII file...
friend std::istream & operator>>(std::istream &in, JPMTParametersMapHelper &helper)
Stream input PMT parameters map helper.
JPMTParametersMap(const char *const file_name)
Constructor.
friend std::ostream & operator<<(std::ostream &out, const JPMTParametersMapHelper &helper)
Stream output PMT parameters map helper.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
double getMaximalHitProbability(const double mu)
Get maximal ratio of hit probabilities for given QE and expectation value of the number of photo-elec...
double QE
relative quantum efficiency
double getHitProbability(const JPMTIdentifier &id) const
Get ratio of hit probabilities of given PMT.
static void Throw(const bool option)
Enable/disable throw option.