Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JPMTDefaultSimulator.hh
Go to the documentation of this file.
1#ifndef __JDETECTOR__JPMTDEFAULTSIMULATOR__
2#define __JDETECTOR__JPMTDEFAULTSIMULATOR__
3
4#include <vector>
5
6#include "JTools/JHashMap.hh"
11
12
13/**
14 * \author mdejong
15 */
16
17namespace JDETECTOR {}
18namespace JPP { using namespace JDETECTOR; }
19
20namespace JDETECTOR {
21
22 using JTOOLS::JHashMap;
23
24
25 /**
26 * Auxiliary container for PMT analogue signal processors in same optical module.
27 */
29 public std::vector<JPMTAnalogueSignalProcessor>
30 {
31 /**
32 * Put PMT signal processor in container at given readout channel.
33 *
34 * \param pmt PMT readout channel
35 * \param cpu PMT signal processor
36 */
37 void put(const size_t pmt, const JPMTAnalogueSignalProcessor& cpu)
38 {
39 if (this->size() <= pmt) {
40 this->resize(pmt + 1);
41 }
42
43 (*this)[pmt] = cpu;
44 }
45 };
46
47
48 /**
49 * Default PMT simulation.
50 *
51 * This class implements the JPMTDefaultSimulatorInterface interface for a given detector
52 * using the JPMTAnalogueSignalProcessor with corresponding PMT parameters.
53 */
56 public JHashMap<int, JModuleAnalogueSignalProcessor>
57 {
58 public:
59 /**
60 * Default constructor.
61 */
64
65
66 /**
67 * Constructor for complete detector.
68 *
69 * \param parameters PMT parameters
70 * \param detector detector
71 */
73 const JDetector& detector)
74 {
75 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
76 for (size_t pmt = 0; pmt != module->size(); ++pmt) {
77 this->get(module->getID()).put(pmt, JPMTAnalogueSignalProcessor(parameters.getPMTParameters(JPMTIdentifier(module->getID(), pmt))));
78 }
79 }
80 }
81
82
83 /**
84 * Constructor for single PMT.
85 *
86 * \param parameters PMT parameters
87 * \param pmt PMT identifier
88 */
90 const JPMTIdentifier& pmt)
91 {
92 this->get(pmt.getID()).put(pmt.getPMTAddress(), JPMTAnalogueSignalProcessor(parameters));
93 }
94
95
96 /**
97 * Has PMT signal processor.
98 *
99 * \param pmt PMT identifier
100 * \return true if this has PMT signal processor; else false
101 */
102 virtual const bool hasPMTSignalProcessor(const JPMTIdentifier& pmt) const override
103 {
104 return this->has(pmt.getID());
105 }
106
107
108 /**
109 * Get PMT signal processor.
110 *
111 * \param pmt PMT identifier
112 * \return PMT signal processor
113 */
114 virtual const JPMTSignalProcessorInterface& getPMTSignalProcessor(const JPMTIdentifier& pmt) const override
115 {
116 return this->get(pmt.getID())[pmt.getPMTAddress()];
117 }
118 };
119}
120
121#endif
Data structure for detector geometry and calibration.
General purpose class for hash map of unique elements.
PMT analogue signal processor.
Detector data structure.
Definition JDetector.hh:96
JPMTDefaultSimulator(const JPMTParameters &parameters, const JPMTIdentifier &pmt)
Constructor for single PMT.
virtual const bool hasPMTSignalProcessor(const JPMTIdentifier &pmt) const override
Has PMT signal processor.
JPMTDefaultSimulator(const JPMTParametersMap &parameters, const JDetector &detector)
Constructor for complete detector.
virtual const JPMTSignalProcessorInterface & getPMTSignalProcessor(const JPMTIdentifier &pmt) const override
Get PMT signal processor.
JPMTDefaultSimulator()
Default constructor.
int getPMTAddress() const
Get PMT address (= TDC).
Auxiliary class for map of PMT parameters.
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Data structure for PMT parameters.
int getID() const
Get identifier.
Definition JObjectID.hh:50
file Auxiliary data structures and methods for detector calibration.
Definition JAnchor.hh:12
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary container for PMT analogue signal processors in same optical module.
void put(const size_t pmt, const JPMTAnalogueSignalProcessor &cpu)
Put PMT signal processor in container at given readout channel.
General purpose class for hash map of unique keys.
Definition JHashMap.hh:75
virtual mapped_type & get(typename JClass< key_type >::argument_type key) override
Get mapped value.
Definition JHashMap.hh:146