Jpp
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | List of all members
JDETECTOR::JPMTRunByRunSimulator Class Reference

PMT simulation based on run-by-run information. More...

#include <JPMTRunByRunSimulator.hh>

Inheritance diagram for JDETECTOR::JPMTRunByRunSimulator:
JDETECTOR::JPMTDefaultSimulator JDETECTOR::JPMTDefaultSimulatorInterface JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t > JDETECTOR::JPMTSimulator std::vector< std::pair< JKey_t, JValue_t > > JTOOLS::JMappableCollection< JKey_t, JValue_t >

Public Types

typedef JKey_t key_type
 
typedef JValue_t mapped_type
 
typedef std::pair< JKey_t, JValue_t > value_type
 
typedef JEvaluator_t evaluator_type
 
typedef std::vector< value_typecontainer_type
 
typedef container_type::const_iterator const_iterator
 
typedef container_type::const_reverse_iterator const_reverse_iterator
 
typedef container_type::iterator iterator
 
typedef container_type::reverse_iterator reverse_iterator
 
typedef std::pair< const_iterator, bool > pair_type
 

Public Member Functions

 JPMTRunByRunSimulator (const JSummaryRouter &router, const JPMTParametersMap &parameters, const JDetector &detector, const JPMTRateRange &range_Hz)
 Constructor. More...
 
const JPMTRateRangegetPMTRateRange () const
 Get PMT rate range. More...
 
void setPMTRateRange (const JPMTRateRange &range_Hz)
 Set PMT rate range. More...
 
virtual bool getPMTstatus (const JPMTIdentifier &id) const
 Get PMT status. More...
 
virtual const JPMTSignalProcessorInterfacegetPMTSignalProcessor (const JPMTIdentifier &pmt) const
 Get PMT signal processor. More...
 
virtual void processHits (const JPMTIdentifier &id, const JCalibration &calibration, const JPMTData< JPMTSignal > &input, JPMTData< JPMTPulse > &output) const
 Process hits. More...
 
virtual void clear ()
 Clear. More...
 
virtual mapped_typeget (typename JClass< key_type >::argument_type key)
 Get mapped value. More...
 
const mapped_typeget (typename JClass< key_type >::argument_type key) const
 Get mapped value. More...
 
pair_type insert (const value_type &element)
 Insert element. More...
 
void erase (iterator pos)
 Erase element at given position. More...
 
void erase (iterator __begin, iterator __end)
 Erase elements in given range. More...
 
bool erase (typename JClass< key_type >::argument_type key) const
 Erase element. More...
 
bool has (typename JClass< key_type >::argument_type key) const
 Test whether key is present. More...
 
const JComparatorgetComparator () const
 Get comparator. More...
 
mapped_typeoperator[] (typename JClass< key_type >::argument_type key)
 Get mapped value. More...
 
void put (typename JClass< key_type > ::argument_type key, typename JClass< mapped_type >::argument_type value)
 Put pair-wise element (key,value) into collection. More...
 

Public Attributes

JEvaluator_t getValue
 Function object for evaluation of key. More...
 

Protected Attributes

const JSummaryRoutersummary_router
 
JPMTRateRange range
 [Hz] More...
 
JComparator compare
 Function object for comparison. More...
 
JRouter< int > router
 

Private Member Functions

void resize ()
 
void push_back ()
 
void pop_back ()
 

Detailed Description

PMT simulation based on run-by-run information.

This class overwrites the method JPMTDefaultSimulator::getPMTstatus. The actual PMT status is determined from summary data. The frequency range corresponds to the acceptable range of singles rates. Outside this range, the PMT is considered default.

Definition at line 32 of file JPMTRunByRunSimulator.hh.

Member Typedef Documentation

◆ key_type

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef JKey_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::key_type
inherited

Definition at line 59 of file JHashMap.hh.

◆ mapped_type

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef JValue_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::mapped_type
inherited

Definition at line 60 of file JHashMap.hh.

◆ value_type

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef std::pair<JKey_t, JValue_t> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::value_type
inherited

Definition at line 61 of file JHashMap.hh.

◆ evaluator_type

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef JEvaluator_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::evaluator_type
inherited

Definition at line 62 of file JHashMap.hh.

◆ container_type

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef std::vector<value_type> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::container_type
inherited

Definition at line 64 of file JHashMap.hh.

◆ const_iterator

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef container_type::const_iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::const_iterator
inherited

Definition at line 66 of file JHashMap.hh.

◆ const_reverse_iterator

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef container_type::const_reverse_iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::const_reverse_iterator
inherited

Definition at line 67 of file JHashMap.hh.

◆ iterator

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef container_type::iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::iterator
inherited

Definition at line 68 of file JHashMap.hh.

◆ reverse_iterator

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef container_type::reverse_iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::reverse_iterator
inherited

Definition at line 69 of file JHashMap.hh.

◆ pair_type

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef std::pair<const_iterator, bool> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::pair_type
inherited

Definition at line 71 of file JHashMap.hh.

Constructor & Destructor Documentation

◆ JPMTRunByRunSimulator()

JDETECTOR::JPMTRunByRunSimulator::JPMTRunByRunSimulator ( const JSummaryRouter router,
const JPMTParametersMap parameters,
const JDetector detector,
const JPMTRateRange range_Hz 
)
inline

Constructor.

Parameters
routersummary router
parametersPMT parameters
detectordetector
range_HzPMT rate range [Hz]

Definition at line 44 of file JPMTRunByRunSimulator.hh.

47  :
48  JPMTDefaultSimulator(parameters, detector),
50  range(range_Hz)
51  {}

Member Function Documentation

◆ getPMTRateRange()

const JPMTRateRange& JDETECTOR::JPMTRunByRunSimulator::getPMTRateRange ( ) const
inline

Get PMT rate range.

Returns
PMT rate range [Hz]

Definition at line 59 of file JPMTRunByRunSimulator.hh.

60  {
61  return range;
62  }

◆ setPMTRateRange()

void JDETECTOR::JPMTRunByRunSimulator::setPMTRateRange ( const JPMTRateRange range_Hz)
inline

Set PMT rate range.

Parameters
range_HzPMT rate range [Hz]

Definition at line 70 of file JPMTRunByRunSimulator.hh.

71  {
72  this->range = range_Hz;
73  }

◆ getPMTstatus()

virtual bool JDETECTOR::JPMTRunByRunSimulator::getPMTstatus ( const JPMTIdentifier id) const
inlinevirtual

Get PMT status.

If PMT status is false, the method JPMTDefaultSimulatorInterface::processHits does not produce any hits.

Parameters
idPMT identifier
Returns
PMT status

Reimplemented from JDETECTOR::JPMTDefaultSimulatorInterface.

Definition at line 84 of file JPMTRunByRunSimulator.hh.

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  }

◆ getPMTSignalProcessor()

virtual const JPMTSignalProcessorInterface& JDETECTOR::JPMTDefaultSimulator::getPMTSignalProcessor ( const JPMTIdentifier pmt) const
inlinevirtualinherited

Get PMT signal processor.

Parameters
pmtPMT identifier
Returns
PMT signal processor

Reimplemented from JDETECTOR::JPMTDefaultSimulatorInterface.

Definition at line 102 of file JPMTDefaultSimulator.hh.

103  {
104  return this->get(pmt.getID())[pmt.getPMTAddress()];
105  }

◆ processHits()

virtual void JDETECTOR::JPMTDefaultSimulatorInterface::processHits ( const JPMTIdentifier id,
const JCalibration calibration,
const JPMTData< JPMTSignal > &  input,
JPMTData< JPMTPulse > &  output 
) const
inlinevirtualinherited

Process hits.

Parameters
idPMT identifier
calibrationPMT calibration
inputPMT signals
outputPMT hits

Implements JDETECTOR::JPMTSimulator.

Definition at line 36 of file JPMTDefaultSimulatorInterface.hh.

40  {
41  if (getPMTstatus(id)) {
42 
44 
45  cpu(calibration, input, output);
46  }
47  }

◆ clear()

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
virtual void JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::clear ( )
inlinevirtualinherited

Clear.

Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.

Definition at line 141 of file JHashMap.hh.

142  {
143  // reset internal router
144 
145  for (iterator i = this->begin(); i != this->end(); ++i) {
146  router.put(this->getValue(i->first), router.getDefaultAddress());
147  }
148 
149  container_type::clear();
150  }

◆ get() [1/2]

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
virtual mapped_type& JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::get ( typename JClass< key_type >::argument_type  key)
inlinevirtualinherited

Get mapped value.

Parameters
keykey
Returns
mapped value

Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.

Definition at line 159 of file JHashMap.hh.

160  {
161  const int ival = this->getValue(key);
162 
163  if (!router.has(ival)) {
164  insert(value_type(key, mapped_type()));
165  }
166 
167  return container_type::operator[](router.get(ival)).second;
168  }

◆ get() [2/2]

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
const mapped_type& JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::get ( typename JClass< key_type >::argument_type  key) const
inlineinherited

Get mapped value.

This method will throw an exception if given key is not present following the prerequisite of constness.

Parameters
keykey
Returns
mapped value

Definition at line 179 of file JHashMap.hh.

180  {
181  const int ival = this->getValue(key);
182 
183  if (router.has(ival))
184  return container_type::operator[](router.get(ival)).second;
185  else
186  THROW(JIndexOutOfRange, "JHasMap::get(): invalid key.");
187  }

◆ insert()

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
pair_type JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::insert ( const value_type element)
inlineinherited

Insert element.

Parameters
elementelement
Returns
(position, status), where status is true if inserted; else false

Definition at line 196 of file JHashMap.hh.

197  {
198  using namespace std;
199 
200  const int ival = this->getValue(element.first);
201 
202  if (!router.has(ival)) {
203 
204  iterator i = container_type::insert(lower_bound(this->begin(), this->end(), element.first, compare), element);
205 
206  router.put(ival, distance(this->begin(), i));
207 
208  for (iterator __i = i; ++__i != this->end(); ) {
209  router.put(this->getValue(__i->first), distance(this->begin(), __i));
210  }
211 
212  return pair_type(i, true);
213 
214  } else {
215 
216  return pair_type(this->end(), false);
217  }
218  }

◆ erase() [1/3]

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
void JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::erase ( iterator  pos)
inlineinherited

Erase element at given position.

Parameters
posvalid position

Definition at line 226 of file JHashMap.hh.

227  {
228  this->router.put(this->getValue(*pos), this->router.getDefaultAddress());
229 
230  iterator i = pos;
231 
232  container_type::erase(i++);
233 
234  for ( ; i != this->end(); ++i) {
235  this->router.put(this->getValue(*i), distance(this->begin(), i));
236  }
237  }

◆ erase() [2/3]

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
void JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::erase ( iterator  __begin,
iterator  __end 
)
inlineinherited

Erase elements in given range.

Parameters
__beginbegin position (included)
__endend position (excluded)

Definition at line 246 of file JHashMap.hh.

247  {
248  iterator i = __begin;
249 
250  while (i != __end) {
251 
252  this->router.put(this->getValue(*i), this->router.getDefaultAddress());
253 
254  container_type::erase(i++);
255  }
256 
257  for ( ; i != this->end(); ++i) {
258  this->router.put(this->getValue(*i), distance(this->begin(), i));
259  }
260  }

◆ erase() [3/3]

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
bool JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::erase ( typename JClass< key_type >::argument_type  key) const
inlineinherited

Erase element.

Parameters
keykey
Returns
true if element with given key has been erased; else false

Definition at line 269 of file JHashMap.hh.

270  {
271  const int ival = this->getValue(key);
272 
273  if (router.has(ival)) {
274 
275  iterator pos = this->begin();
276 
277  std::advance(pos, this->router.get(ival));
278 
279  iterator i = container_type::erase(pos);
280 
281  for ( ; i != this->end(); ++i) {
282  this->router.put(this->getValue(*i), distance(this->begin(), i));
283  }
284 
285  return true;
286  }
287 
288  return false;
289  }

◆ has()

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
bool JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::has ( typename JClass< key_type >::argument_type  key) const
inlineinherited

Test whether key is present.

Parameters
keykey
Returns
true if present; else false

Definition at line 298 of file JHashMap.hh.

299  {
300  return router.has(this->getValue(key));
301  }

◆ getComparator()

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
const JComparator& JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::getComparator ( ) const
inlineinherited

Get comparator.

Returns
comparator

Definition at line 309 of file JHashMap.hh.

310  {
311  return compare;
312  }

◆ resize()

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
void JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::resize ( )
privateinherited

◆ push_back()

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
void JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::push_back ( )
privateinherited

◆ pop_back()

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
void JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::pop_back ( )
privateinherited

◆ operator[]()

template<class JKey_t, class JValue_t>
mapped_type& JTOOLS::JMappableCollection< JKey_t, JValue_t >::operator[] ( typename JClass< key_type >::argument_type  key)
inlineinherited

Get mapped value.

Parameters
keykey
Returns
value

Definition at line 64 of file JMappableCollection.hh.

65  {
66  return get(key);
67  }

◆ put()

template<class JKey_t, class JValue_t>
void JTOOLS::JMappableCollection< JKey_t, JValue_t >::put ( typename JClass< key_type > ::argument_type  key,
typename JClass< mapped_type >::argument_type  value 
)
inlineinherited

Put pair-wise element (key,value) into collection.

Parameters
keykey
valuevalue

Definition at line 76 of file JMappableCollection.hh.

78  {
79  get(key) = value;
80  }

Member Data Documentation

◆ summary_router

const JSummaryRouter& JDETECTOR::JPMTRunByRunSimulator::summary_router
protected

Definition at line 100 of file JPMTRunByRunSimulator.hh.

◆ range

JPMTRateRange JDETECTOR::JPMTRunByRunSimulator::range
protected

[Hz]

Definition at line 101 of file JPMTRunByRunSimulator.hh.

◆ getValue

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
JEvaluator_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::getValue
inherited

Function object for evaluation of key.

Definition at line 366 of file JHashMap.hh.

◆ compare

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
JComparator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::compare
protectedinherited

Function object for comparison.

Definition at line 373 of file JHashMap.hh.

◆ router

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
JRouter<int> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::router
protectedinherited

Definition at line 375 of file JHashMap.hh.


The documentation for this class was generated from the following file:
std::iterator
Definition: JSTDTypes.hh:18
KM3NETDAQ::JDAQFrameStatus::testHighRateVeto
bool testHighRateVeto() const
Test high-rate veto status.
Definition: JDAQFrameStatus.hh:202
JDETECTOR::JPMTRunByRunSimulator::range
JPMTRateRange range
[Hz]
Definition: JPMTRunByRunSimulator.hh:101
JROOT::advance
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Definition: JCounter.hh:35
JDETECTOR::JPMTRunByRunSimulator::summary_router
const JSummaryRouter & summary_router
Definition: JPMTRunByRunSimulator.hh:100
JTOOLS::JHashMap::value_type
std::pair< JKey_t, JValue_t > value_type
Definition: JHashMap.hh:61
JTOOLS::JHashMap::compare
JComparator compare
Function object for comparison.
Definition: JHashMap.hh:373
JTRIGGER::JSummaryRouter::getSummaryFrame
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
Definition: JSummaryRouter.hh:90
JTRIGGER::JSummaryRouter::hasSummaryFrame
bool hasSummaryFrame(const JDAQModuleIdentifier &module) const
Has summary frame.
Definition: JSummaryRouter.hh:102
distance
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Definition: PhysicsEvent.hh:434
JTOOLS::JMappableCollection::get
virtual mapped_type & get(typename JClass< key_type >::argument_type key)=0
Get mapped value.
KM3NETDAQ::JDAQSummaryFrame::getRate
double getRate(const int tdc, const double factor=1.0) const
Get count rate.
Definition: JDAQSummaryFrame.hh:453
JDETECTOR::JPMTDefaultSimulatorInterface::getPMTSignalProcessor
virtual const JPMTSignalProcessorInterface & getPMTSignalProcessor(const JPMTIdentifier &pmt) const
Get PMT signal processor.
Definition: JPMTDefaultSimulatorInterface.hh:69
KM3NETDAQ::JDAQSummaryFrame
Data storage class for rate measurements of all PMTs in one module.
Definition: JDAQSummaryFrame.hh:320
JLANG::JObjectID::getID
int getID() const
Get identifier.
Definition: JObjectID.hh:55
JDETECTOR::JPMTDefaultSimulator::JPMTDefaultSimulator
JPMTDefaultSimulator()
Default constructor.
Definition: JPMTDefaultSimulator.hh:62
JTOOLS::JHashMap::insert
pair_type insert(const value_type &element)
Insert element.
Definition: JHashMap.hh:196
THROW
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:669
JTOOLS::JHashMap::get
virtual mapped_type & get(typename JClass< key_type >::argument_type key)
Get mapped value.
Definition: JHashMap.hh:159
KM3NETDAQ::JDAQFrameStatus::testFIFOStatus
bool testFIFOStatus() const
Test FIFO status.
Definition: JDAQFrameStatus.hh:246
JDETECTOR::JPMTIdentifier::getPMTAddress
int getPMTAddress() const
Get PMT identifier (= TDC).
Definition: JPMTIdentifier.hh:73
JDETECTOR::JPMTSignalProcessorInterface
PMT signal processor interface.
Definition: JPMTSignalProcessorInterface.hh:69
JTOOLS::JHashMap::pair_type
std::pair< const_iterator, bool > pair_type
Definition: JHashMap.hh:71
std
Definition: jaanetDictionary.h:36
JTOOLS::JHashMap::router
JRouter< int > router
Definition: JHashMap.hh:375
JTOOLS::JHashMap::mapped_type
JValue_t mapped_type
Definition: JHashMap.hh:60
JDETECTOR::JPMTDefaultSimulatorInterface::getPMTstatus
virtual bool getPMTstatus(const JPMTIdentifier &id) const
Get PMT status.
Definition: JPMTDefaultSimulatorInterface.hh:57
JTOOLS::JHashMap::getValue
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:366