Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | Protected Attributes | 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
JPMTSignalProcessorInterface
getPMTSignalProcessor (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
 

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

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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  {}
JPMTDefaultSimulator()
Default constructor.
JRouter< int > router
Definition: JHashMap.hh:375

Member Function Documentation

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  }
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  }
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  }
double getRate(const int tdc, const double factor=1.0) const
Get count rate.
Data storage class for rate measurements of all PMTs in one module.
const JDAQSummaryFrame & getSummaryFrame(const JDAQModuleIdentifier &module) const
Get summary frame.
bool testHighRateVeto() const
Test high-rate veto status.
bool hasSummaryFrame(const JDAQModuleIdentifier &module) const
Has summary frame.
bool testFIFOStatus() const
Test FIFO status.
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  }
int getID() const
Get identifier.
Definition: JObjectID.hh:54
int getPMTAddress() const
Get PMT identifier (= TDC).
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  }
virtual bool getPMTstatus(const JPMTIdentifier &id) const
Get PMT status.
virtual const JPMTSignalProcessorInterface & getPMTSignalProcessor(const JPMTIdentifier &pmt) const
Get PMT signal processor.
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  }
JRouter< int > router
Definition: JHashMap.hh:375
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:366
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  }
JValue_t mapped_type
Definition: JHashMap.hh:60
JRouter< int > router
Definition: JHashMap.hh:375
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:366
std::pair< JKey_t, JValue_t > value_type
Definition: JHashMap.hh:61
pair_type insert(const value_type &element)
Insert element.
Definition: JHashMap.hh:196
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  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:633
JRouter< int > router
Definition: JHashMap.hh:375
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:366
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  }
JRouter< int > router
Definition: JHashMap.hh:375
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:366
JComparator compare
Function object for comparison.
Definition: JHashMap.hh:373
std::pair< const_iterator, bool > pair_type
Definition: JHashMap.hh:71
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  }
JRouter< int > router
Definition: JHashMap.hh:375
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:366
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  }
JRouter< int > router
Definition: JHashMap.hh:375
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:366
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  }
JRouter< int > router
Definition: JHashMap.hh:375
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
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:366
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  }
JRouter< int > router
Definition: JHashMap.hh:375
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:366
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  }
JComparator compare
Function object for comparison.
Definition: JHashMap.hh:373
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  }
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

const JSummaryRouter& JDETECTOR::JPMTRunByRunSimulator::summary_router
protected

Definition at line 100 of file JPMTRunByRunSimulator.hh.

JPMTRateRange JDETECTOR::JPMTRunByRunSimulator::range
protected

[Hz]

Definition at line 101 of file JPMTRunByRunSimulator.hh.

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.

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.

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: