Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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"
9 #include "JDetector/JDetector.hh"
11 
12 
13 /**
14  * \author mdejong
15  */
16 
17 namespace JDETECTOR {}
18 namespace JPP { using namespace JDETECTOR; }
19 
20 namespace JDETECTOR {
21 
22  using JTOOLS::JHashMap;
23 
24 
25  /**
26  * Auxiliary container for PMT 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
52  * for a given detector using a map of the PMT parameters.
53  */
56  public JHashMap<int, JModuleSignalProcessor>
57  {
58  public:
59  /**
60  * Default constructor.
61  */
63  {}
64 
65 
66  /**
67  * Constructor.
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.
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  * Get PMT signal processor.
98  *
99  * \param pmt PMT identifier
100  * \return PMT signal processor
101  */
103  {
104  return this->get(pmt.getID())[pmt.getPMTAddress()];
105  }
106  };
107 }
108 
109 #endif
JPMTDefaultSimulator()
Default constructor.
General purpose class for hash map of (key, value) pairs.
Definition: JHashMap.hh:53
void put(const size_t pmt, const JPMTAnalogueSignalProcessor &cpu)
Put PMT signal processor in container at given readout channel.
JPMTDefaultSimulator(const JPMTParameters &parameters, const JPMTIdentifier &pmt)
Constructor.
General purpose classes for (multidimensional) hash maps.
Detector data structure.
Definition: JDetector.hh:77
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Data structure for detector geometry and calibration.
Auxiliary container for PMT signal processors in same optical module.
int getID() const
Get identifier.
Definition: JObjectID.hh:54
int getPMTAddress() const
Get PMT identifier (= TDC).
Auxiliary class for map of PMT parameters.
void put(typename JClass< key_type >::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
JPMTDefaultSimulator(const JPMTParametersMap &parameters, const JDetector &detector)
Constructor.
virtual const JPMTSignalProcessorInterface & getPMTSignalProcessor(const JPMTIdentifier &pmt) const
Get PMT signal processor.
PMT analogue signal processor.
Data structure for PMT parameters.