Jpp  17.3.0-rc.2
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 
26 
27 
28  /**
29  * PMT simulation based on run-by-run information.
30  *
31  * This class overwrites the method JPMTDefaultSimulator::getPMTStatus.
32  * The actual PMT status is obtained from summary data.
33  */
36  {
37  public:
38  /**
39  * Constructor.
40  *
41  * \param router summary router
42  * \param parameters PMT parameters
43  * \param detector detector
44  */
47  const JDetector& detector) :
48  JPMTDefaultSimulator(parameters, detector),
49  summary_router(router),
50  QE(parameters.getQE())
51  {}
52 
53 
54  /**
55  * Get PMT status.
56  *
57  * \param id PMT identifier
58  * \param window time range
59  * \param status PMT status
60  * \return status
61  */
62  virtual bool getPMTStatus(const JPMTIdentifier& id, const JTimeRange& window, const JStatus& status) const override
63  {
67 
68  if (summary_router.hasSummaryFrame(id.getModuleID())) {
69 
70  const JDAQSummaryFrame& frame = summary_router.getSummaryFrame(id.getModuleID());
71 
72  const int pmt = id.getPMTAddress();
73 
74  return (getPMTStatus(status) &&
75  getDAQStatus(frame, status) &&
76  window.getUpperLimit() <= getMaximalTime(getRate(frame,pmt) * QE));
77  }
78 
79  return false;
80  }
81 
82 
83  protected:
85  const double QE;
86  };
87 }
88 
89 #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]).