Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPMTRunByRunSimulator.hh
Go to the documentation of this file.
1 #ifndef __JTRIGGER__JPMTRUNBYRUNSIMULATOR__
2 #define __JTRIGGER__JPMTRUNBYRUNSIMULATOR__
3 
5 
8 #include "JDetector/JDetector.hh"
9 #include "JDAQ/JHighRateVeto.hh"
12 
13 
14 /**
15  * \author mdejong
16  */
17 
18 namespace JTRIGGER {}
19 namespace JPP { using namespace JTRIGGER; }
20 
21 namespace JTRIGGER {
22 
27 
28 
29  /**
30  * PMT simulation based on run-by-run information.
31  *
32  * This class overwrites the method JPMTDefaultSimulator::getPMTStatus.
33  * The actual PMT status is obtained from summary data.
34  */
37  {
38  public:
39  /**
40  * Constructor.
41  *
42  * \param router summary router
43  * \param parameters PMT parameters
44  * \param detector detector
45  */
48  const JDetector& detector) :
49  JPMTDefaultSimulator(parameters, detector),
50  summary_router(router),
51  QE(parameters.getQE())
52  {}
53 
54 
55  /**
56  * Get PMT status.
57  *
58  * \param id PMT identifier
59  * \param window time range
60  * \param status PMT status
61  * \return status
62  */
63  virtual bool getPMTStatus(const JPMTIdentifier& id, const JTimeRange& window, const JStatus& status) const override
64  {
68 
69  if (summary_router.hasSummaryFrame(id.getModuleID())) {
70 
71  const JDAQSummaryFrame& frame = summary_router.getSummaryFrame(id.getModuleID());
72 
73  const int pmt = id.getPMTAddress();
74 
75  return (getPMTStatus(status) &&
76  getDAQStatus(frame, status) &&
77  window.getUpperLimit() <= getMaximalTime(getRate(frame,pmt) * QE));
78  }
79 
80  return false;
81  }
82 
83 
84  protected:
86  const double QE;
87  };
88 }
89 
90 #endif
JPMTRunByRunSimulator(const JSummaryRouter &router, const JPMTParametersMap &parameters, const JDetector &detector)
Constructor.
Router for fast addressing of summary data in JDAQSummaryslice data structure as a function of the op...
Detector data structure.
Definition: JDetector.hh:89
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
Data structure for detector geometry and calibration.
Detector file.
Definition: JHead.hh:226
double getRate(const JDAQSummaryFrame &frame, const int pmt, const double factor=1.0)
Get corrected rate of PMT.
double getQE(const double R, const double mu)
Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons...
Data storage class for rate measurements of all PMTs in one module.
Auxiliary class for handling status.
Definition: JStatus.hh:37
Auxiliary class for map of PMT parameters.
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
double getMaximalTime(const double R_Hz)
Get maximal time for given rate.
PMT simulation based on run-by-run information.
bool getPMTStatus(const JStatus &status)
Test status of PMT.
virtual bool getPMTStatus(const JPMTIdentifier &id, const JTimeRange &window, const JStatus &status) const override
Get PMT status.
bool hasSummaryFrame(const JDAQModuleIdentifier &module) const
Has summary frame.
bool getDAQStatus(const JDAQFrameStatus &frame, const JStatus &status)
Test status of DAQ.
JTOOLS::JRange< double > JTimeRange
Type definition for time range (unit [s]).