38 template<
class JAddress_t>
60 if (this->action ==
"set") {
64 }
else if (this->action ==
"add") {
68 }
else if (this->action ==
"sub") {
72 }
else if (this->action ==
"mul") {
76 }
else if (this->action ==
"div") {
85 catch(
const std::exception& error) {
86 cerr << error.what() << endl;
101 friend inline std::istream&
operator>>(std::istream&
in, JModifier& modifier)
103 return in >> modifier.address
117 friend inline std::ostream&
operator<<(std::ostream& out,
const JModifier& modifier)
119 return out << modifier.address <<
' '
120 << modifier.action <<
' '
121 << modifier.key <<
' '
152 int main(
int argc,
char **argv)
157 typedef JModifier<JPMTPhysicalAddress> JModifier_t;
170 JParser<> zap(
"Auxiliary program to edit PMT parameters map.");
172 zap[
'a'] =
make_field(detectorFile,
"detector file.") =
"";
173 zap[
'D'] =
make_field(detectorID,
"detector identifier (in absence of detector file).") = 0;
182 catch(
const exception &error) {
183 FATAL(error.what() << endl);
187 if (detectorFile !=
"") {
194 load(detectorFile, detector);
200 if (detectorID == 0) {
202 detectorID = detector.
getID();
204 }
else if (detectorID != detector.
getID()) {
206 FATAL(
"Inconsistent detector identifier " << detectorID <<
" != " << detector.
getID() << endl);
210 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
212 for (
unsigned int pmt = 0;
pmt != module->size(); ++
pmt) {
216 if (parameters.find(
id) == parameters.end()) {
218 NOTICE(
"Setting default parameters for PMT " <<
id << endl);
220 parameters[id] = parameters.getDefaultPMTParameters();
226 if (!modifier.empty()) {
229 FATAL(
"Invalid detector identifier " << detectorID << endl);
234 for (JPMTParametersMap::iterator ps = parameters.begin(); ps != parameters.end(); ++ps) {
240 if (i->address == address || i->address == WILDCARD) {
242 NOTICE(
"Modifying parameters for PMT " << ps->first << endl);
244 if (!i->apply(ps->second)) {
245 ERROR(
"No valid action: " << *i << endl);
257 for (JPMTParametersMap::iterator i = parameters.begin(); i != parameters.end(); ++i) {
262 cpu.
getNPE(T_ns.getUpperLimit(), NPE),
266 cpu.
getNPE(T_ns.getUpperLimit(), NPE),
274 parameters.comment.add(
JMeta(argc, argv));
278 out << parameters << endl;
Utility class to parse command line options.
double getIntegralOfChargeProbability(const double xmin, const double xmax, const int NPE) const
Get integral of probability.
bool hasDetectorAddressMap(const int id)
Check if detector address map is available.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
*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
Lookup table for PMT addresses in detector.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
JProperties getProperties(const JEquationParameters &equation=JPMTParameters::getEquationParameters())
Get properties of this class.
Data structure for detector geometry and calibration.
const JModuleAddressMap & get(const int id) const
Get module address map.
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
const T & getValue(const std::string &key) const
Get value.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getID() const
Get identifier.
Auxiliary class for map of PMT parameters.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map.
General purpose messaging.
JRange< Double_t > JRange_t
PMT analogue signal processor.
virtual double getNPE(const double tot_ns, const double eps=1.0e-3) const
Get number of photo-electrons.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
Auxiliary class to define a range between two values.
Utility class to parse command line options.
PMT analogue signal processor.
Data structure for PMT physical address.
Data structure for PMT parameters.
int main(int argc, char *argv[])