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

Default PMT simulation. More...

#include <JPMTDefaultSimulator.hh>

Inheritance diagram for 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 > JDETECTOR::JPMTRunByRunSimulator

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

 JPMTDefaultSimulator ()
 Default constructor. More...
 
 JPMTDefaultSimulator (const JPMTParametersMap &parameters, const JDetector &detector)
 Constructor. More...
 
 JPMTDefaultSimulator (const JPMTParameters &parameters, const JPMTIdentifier &pmt)
 Constructor. 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 bool getPMTstatus (const JPMTIdentifier &id) const
 Get PMT status. 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

JComparator compare
 Function object for comparison. More...
 
JRouter< int > router
 

Private Member Functions

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

Detailed Description

Default PMT simulation.

This class implements the JPMTDefaultSimulatorInterface interface for a given detector using a map of the PMT parameters.

Definition at line 54 of file JPMTDefaultSimulator.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

◆ JPMTDefaultSimulator() [1/3]

JDETECTOR::JPMTDefaultSimulator::JPMTDefaultSimulator ( )
inline

Default constructor.

Definition at line 62 of file JPMTDefaultSimulator.hh.

63  {}

◆ JPMTDefaultSimulator() [2/3]

JDETECTOR::JPMTDefaultSimulator::JPMTDefaultSimulator ( const JPMTParametersMap parameters,
const JDetector detector 
)
inline

Constructor.

Parameters
parametersPMT parameters
detectordetector

Definition at line 72 of file JPMTDefaultSimulator.hh.

74  {
75  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
76  for (size_t pmt = 0; pmt != module->size(); ++pmt) {
77  this->get(module->getID()).put(pmt, JPMTAnalogueSignalProcessor(parameters.getPMTParameters(JPMTIdentifier(module->getID(), pmt))));
78  }
79  }
80  }

◆ JPMTDefaultSimulator() [3/3]

JDETECTOR::JPMTDefaultSimulator::JPMTDefaultSimulator ( const JPMTParameters parameters,
const JPMTIdentifier pmt 
)
inline

Constructor.

Parameters
parametersPMT parameters
pmtPMT identifier

Definition at line 89 of file JPMTDefaultSimulator.hh.

91  {
92  this->get(pmt.getID()).put(pmt.getPMTAddress(), JPMTAnalogueSignalProcessor(parameters));
93  }

Member Function Documentation

◆ getPMTSignalProcessor()

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

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  }

◆ getPMTstatus()

virtual bool JDETECTOR::JPMTDefaultSimulatorInterface::getPMTstatus ( const JPMTIdentifier id) const
inlinevirtualinherited

Get PMT status.

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

Parameters
idPMT identifier
Returns
true

Reimplemented in JDETECTOR::JPMTRunByRunSimulator.

Definition at line 57 of file JPMTDefaultSimulatorInterface.hh.

58  {
59  return true;
60  }

◆ 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

◆ 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
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
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
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::put
void put(typename JClass< key_type > ::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
Definition: JMappableCollection.hh:76
JTOOLS::JMappableCollection::get
virtual mapped_type & get(typename JClass< key_type >::argument_type key)=0
Get mapped value.
JDETECTOR::JPMTDefaultSimulatorInterface::getPMTSignalProcessor
virtual const JPMTSignalProcessorInterface & getPMTSignalProcessor(const JPMTIdentifier &pmt) const
Get PMT signal processor.
Definition: JPMTDefaultSimulatorInterface.hh:69
JLANG::JObjectID::getID
int getID() const
Get identifier.
Definition: JObjectID.hh:55
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
JDETECTOR::JPMTIdentifier::getPMTAddress
int getPMTAddress() const
Get PMT identifier (= TDC).
Definition: JPMTIdentifier.hh:73
JDETECTOR::JPMTSignalProcessorInterface
PMT signal processor interface.
Definition: JPMTSignalProcessorInterface.hh:69
JDETECTOR::JPMTParametersMap::getPMTParameters
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Definition: JPMTParametersMap.hh:139
JTOOLS::JHashMap::pair_type
std::pair< const_iterator, bool > pair_type
Definition: JHashMap.hh:71
JDETECTOR::JPMTIdentifier
PMT identifier.
Definition: JPMTIdentifier.hh:30
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
JDETECTOR::JPMTAnalogueSignalProcessor
PMT analogue signal processor.
Definition: JPMTAnalogueSignalProcessor.hh:46