Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPMTRunByRunSimulator.hh
Go to the documentation of this file.
1 #ifndef __JDETECTOR__JPMTRUNBYRUNSIMULATOR__
2 #define __JDETECTOR__JPMTRUNBYRUNSIMULATOR__
3 
7 #include "JDetector/JDetector.hh"
10 
11 
12 /**
13  * \author mdejong
14  */
15 
16 namespace JDETECTOR {}
17 namespace JPP { using namespace JDETECTOR; }
18 
19 namespace JDETECTOR {
20 
22 
23 
24  /**
25  * PMT simulation based on run-by-run information.
26  *
27  * This class overwrites the method JPMTDefaultSimulator::getPMTstatus.
28  * The actual PMT status is determined from summary data.
29  * The frequency range corresponds to the acceptable range of singles rates.
30  * Outside this range, the PMT is considered default.
31  */
34  {
35  public:
36  /**
37  * Constructor.
38  *
39  * \param router summary router
40  * \param parameters PMT parameters
41  * \param detector detector
42  * \param range_Hz PMT rate range [Hz]
43  */
45  const JPMTParametersMap& parameters,
46  const JDetector& detector,
47  const JPMTRateRange& range_Hz) :
48  JPMTDefaultSimulator(parameters, detector),
49  summary_router(router),
50  range(range_Hz)
51  {}
52 
53 
54  /**
55  * Get PMT rate range.
56  *
57  * \return PMT rate range [Hz]
58  */
60  {
61  return range;
62  }
63 
64 
65  /**
66  * Set PMT rate range.
67  *
68  * \param range_Hz PMT rate range [Hz]
69  */
70  void setPMTRateRange(const JPMTRateRange& range_Hz)
71  {
72  this->range = range_Hz;
73  }
74 
75 
76  /**
77  * Get PMT status.
78  *
79  * If PMT status is false, the method JPMTDefaultSimulatorInterface::processHits does not produce any hits.
80  *
81  * \param id PMT identifier
82  * \return PMT status
83  */
84  virtual bool getPMTstatus(const JPMTIdentifier& id) const
85  {
86  if (summary_router.hasSummaryFrame(id.getModuleID())) {
87 
88  const KM3NETDAQ::JDAQSummaryFrame& frame = summary_router.getSummaryFrame(id.getModuleID());
89 
90  return (!frame.testHighRateVeto(id.getPMTAddress()) &&
91  !frame.testFIFOStatus (id.getPMTAddress()) &&
92  range(frame.getRate(id.getPMTAddress())));
93  }
94 
95  return false;
96  }
97 
98 
99  protected:
101  JPMTRateRange range; //!< [Hz]
102  };
103 }
104 
105 #endif
PMT simulation based on run-by-run information.
Data structure for range of PMT rates.
double getRate(const int tdc, const double factor=1.0) const
Get count rate.
Router for fast addressing of summary data in JDAQSummaryslice data structure as a function of the op...
Detector data structure.
Definition: JDetector.hh:77
JPMTRunByRunSimulator(const JSummaryRouter &router, const JPMTParametersMap &parameters, const JDetector &detector, const JPMTRateRange &range_Hz)
Constructor.
Data structure for detector geometry and calibration.
JRouter< int > router
Definition: JHashMap.hh:375
virtual bool getPMTstatus(const JPMTIdentifier &id) const
Get PMT status.
void setPMTRateRange(const JPMTRateRange &range_Hz)
Set PMT rate range.
Data storage class for rate measurements of all PMTs in one module.
Auxiliary class for map of PMT parameters.
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
bool testHighRateVeto() const
Test high-rate veto status.
const JPMTRateRange & getPMTRateRange() const
Get PMT rate range.
bool hasSummaryFrame(const JDAQModuleIdentifier &module) const
Has summary frame.
bool testFIFOStatus() const
Test FIFO status.