Jpp
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
JDETECTOR::JPMTDefaultSimulator::getPMTSignalProcessor
virtual const JPMTSignalProcessorInterface & getPMTSignalProcessor(const JPMTIdentifier &pmt) const
Get PMT signal processor.
Definition: JPMTDefaultSimulator.hh:102
JPMTParametersMap.hh
JPMTAnalogueSignalProcessor.hh
JHashMap.hh
JDETECTOR::JPMTDefaultSimulator::JPMTDefaultSimulator
JPMTDefaultSimulator(const JPMTParametersMap &parameters, const JDetector &detector)
Constructor.
Definition: JPMTDefaultSimulator.hh:72
std::vector
Definition: JSTDTypes.hh:12
JTOOLS::JHashMap
General purpose class for hash map of (key, value) pairs.
Definition: JHashMap.hh:53
JTOOLS::JMappableCollection::put
void put(typename JClass< key_type > ::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
Definition: JMappableCollection.hh:76
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JDETECTOR::JModuleSignalProcessor::put
void put(const size_t pmt, const JPMTAnalogueSignalProcessor &cpu)
Put PMT signal processor in container at given readout channel.
Definition: JPMTDefaultSimulator.hh:37
JLANG::JObjectID::getID
int getID() const
Get identifier.
Definition: JObjectID.hh:55
JDETECTOR::JPMTDefaultSimulator::JPMTDefaultSimulator
JPMTDefaultSimulator()
Default constructor.
Definition: JPMTDefaultSimulator.hh:62
JDETECTOR::JModuleSignalProcessor
Auxiliary container for PMT signal processors in same optical module.
Definition: JPMTDefaultSimulator.hh:28
JDETECTOR::JPMTParametersMap
Auxiliary class for map of PMT parameters.
Definition: JPMTParametersMap.hh:88
JTOOLS::JHashMap::get
virtual mapped_type & get(typename JClass< key_type >::argument_type key)
Get mapped value.
Definition: JHashMap.hh:159
JDETECTOR::JPMTIdentifier::getPMTAddress
int getPMTAddress() const
Get PMT identifier (= TDC).
Definition: JPMTIdentifier.hh:73
JDETECTOR::JPMTSignalProcessorInterface
PMT signal processor interface.
Definition: JPMTSignalProcessorInterface.hh:69
JDETECTOR::JPMTParametersMap::getPMTParameters
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Definition: JPMTParametersMap.hh:139
JDETECTOR::JPMTDefaultSimulator::JPMTDefaultSimulator
JPMTDefaultSimulator(const JPMTParameters &parameters, const JPMTIdentifier &pmt)
Constructor.
Definition: JPMTDefaultSimulator.hh:89
JDETECTOR::JPMTDefaultSimulator
Default PMT simulation.
Definition: JPMTDefaultSimulator.hh:54
JDETECTOR::JPMTIdentifier
PMT identifier.
Definition: JPMTIdentifier.hh:30
JDETECTOR::JDetector
Detector data structure.
Definition: JDetector.hh:80
JDETECTOR::JPMTDefaultSimulatorInterface
Default PMT simulation interface.
Definition: JPMTDefaultSimulatorInterface.hh:24
JPMTDefaultSimulatorInterface.hh
JDetector.hh
JDETECTOR::JPMTParameters
Data structure for PMT parameters.
Definition: JPMTParameters.hh:29
JDETECTOR
Auxiliary classes and methods for detector calibration.
Definition: JAnchor.hh:12
JDETECTOR::JPMTAnalogueSignalProcessor
PMT analogue signal processor.
Definition: JPMTAnalogueSignalProcessor.hh:46