Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
JPMTDefaultSimulatorInterface.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JPMTDEFAULTSIMULATORINTERFACE__
2 #define __JDETECTOR__JPMTDEFAULTSIMULATORINTERFACE__
3 
5 
8 
9 
10 /**
11  * \author mdejong
12  */
13 
14 namespace JDETECTOR {}
15 namespace JPP { using namespace JDETECTOR; }
16 
17 namespace JDETECTOR {
18 
19  /**
20  * Default PMT simulation interface.
21  *
22  * This class implements the JPMTSimulator interface by transferring
23  * the PMT simulation to the PMT signal processor interface.
24  */
26  public JPMTSimulator
27  {
28  public:
29  /**
30  * Process hits.
31  *
32  * \param id PMT identifier
33  * \param calibration PMT calibration
34  * \param status PMT status
35  * \param input PMT signals
36  * \param output PMT hits
37  */
38  virtual void processHits(const JPMTIdentifier& id,
39  const JCalibration& calibration,
40  const JStatus& status,
41  const JPMTData<JPMTSignal>& input,
42  JPMTData<JPMTPulse>& output) const override
43  {
44  if (getPMTStatus(id, getTimeRange(input), status)) {
45 
46  if (hasPMTSignalProcessor(id)) {
47 
49 
50  cpu(calibration, input, output);
51  }
52  }
53  }
54 
55 
56  /**
57  * Get PMT status.
58  *
59  * \param id PMT identifier
60  * \param window time range
61  * \param status PMT status
62  * \return status
63  */
64  virtual bool getPMTStatus(const JPMTIdentifier& id, const JTimeRange& window, const JStatus& status) const
65  {
66  return !status.has(PMT_DISABLE);
67  }
68 
69 
70  /**
71  * Has PMT signal processor.
72  *
73  * \param pmt PMT identifier
74  * \return true if this has PMT signal processor; else false
75  */
76  virtual const bool hasPMTSignalProcessor(const JPMTIdentifier& pmt) const
77  {
78  return true;
79  }
80 
81 
82  /**
83  * Get PMT signal processor.
84  *
85  * \param pmt PMT identifier
86  * \return PMT signal processor
87  */
89  {
90  static const JPMTSignalProcessorInterface cpu;
91 
92  return cpu;
93  }
94  };
95 }
96 
97 #endif
Data structure for time calibration.
Template data structure for PMT I/O.
virtual const JPMTSignalProcessorInterface & getPMTSignalProcessor(const JPMTIdentifier &pmt) const
Get PMT signal processor.
virtual void processHits(const JPMTIdentifier &id, const JCalibration &calibration, const JStatus &status, const JPMTData< JPMTSignal > &input, JPMTData< JPMTPulse > &output) const override
Process hits.
virtual const bool hasPMTSignalProcessor(const JPMTIdentifier &pmt) const
Has PMT signal processor.
virtual bool getPMTStatus(const JPMTIdentifier &id, const JTimeRange &window, const JStatus &status) const
Get PMT status.
Interface for PMT simulation.
JTimeRange getTimeRange(const Evt &event)
Get time range (i.e. time between earliest and latest hit) of Monte Carlo event.
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).
static const int PMT_DISABLE
KM3NeT Data Definitions v3.4.0-8-ge14cb17 https://git.km3net.de/common/km3net-dataformat.
Definition: pmt_status.hh:12
Auxiliary class for handling status.
Definition: JStatus.hh:39
bool has(const int bit) const
Test PMT status.
Definition: JStatus.hh:120