Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
Public Types | Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
JDETECTOR::JDetectorSimulator Class Reference

Detector simulation. More...

#include <JDetectorSimulator.hh>

Inheritance diagram for JDETECTOR::JDetectorSimulator:
JDETECTOR::JPMTRouter JDETECTOR::JK40Simulator JDETECTOR::JPMTSimulator JDETECTOR::JCLBSimulator JLANG::JReference< JClass_t >

Public Types

typedef JDetector::const_iterator const_iterator
 

Public Member Functions

 JDetectorSimulator (const JDetector &detector)
 Constructor. More...
 
bool hasK40Simulator () const
 Check availability of K40 simulator. More...
 
bool hasPMTSimulator () const
 Check availability of PMT simulator. More...
 
bool hasCLBSimulator () const
 Check availability of CLB simulator. More...
 
const JK40SimulatorgetK40Simulator () const
 Get K40 simulator. More...
 
const JPMTSimulatorgetPMTSimulator () const
 Get PMT simulator. More...
 
const JCLBSimulatorgetCLBSimulator () const
 Get CLB simulator. More...
 
void reset (JK40Simulator *k40Simulator)
 Reset K40 simulator. More...
 
void reset (JPMTSimulator *pmtSimulator)
 Reset PMT simulator. More...
 
void reset (JCLBSimulator *clbSimulator)
 Reset CLB simulator. More...
 
virtual void generateHits (const JModule &module, const JTimeRange &period, JModuleData &output) const override
 Generate hits. More...
 
virtual void processHits (const JPMTIdentifier &ID, const JCalibration &calibration, const JStatus &status, const JPMTData< JPMTSignal > &input, JPMTData< JPMTPulse > &output) const override
 Process hits. More...
 
virtual void processData (const JModuleIdentifier &id, const JCLBInput &input, JDAQSuperFrame &output) const override
 Process data. More...
 
virtual void operator() (const JModule &module, JModuleData &input, JDAQSuperFrame &output) const
 Process module data in one step. More...
 
const JPMTRoutergetPMTRouter () const
 Get PMT router. More...
 
const JPMTAddressgetAddress (const JObjectID &id) const
 Get address of PMT. More...
 
const JPMTgetPMT (const JPMTAddress &address) const
 Get PMT. More...
 
const JPMTgetPMT (const JObjectID &id) const
 Get PMT. More...
 
bool hasPMT (const JObjectID &id) const
 Has PMT. More...
 
JPMTIdentifier getIdentifier (const JPMTAddress &address) const
 Get identifier of PMT. More...
 
JPMTIdentifier getIdentifier (const JObjectID &id) const
 Get identifier of PMT. More...
 
const JModulegetModule (const JModuleAddress &address) const
 Get module. More...
 
const JModulegetParentModule (const JObjectID &id) const
 Get parent module. More...
 
int getParentModuleID (const JObjectID &id) const
 Get parent module identifier. More...
 
JPMTChannel getPMTChannel (const JPMTAddress &address) const
 Get PMT channel. More...
 
JPMTChannel getPMTChannel (const JObjectID &id) const
 Get PMT channel. More...
 
JUTMPosition getUTMPosition (const JObjectID &id) const
 Get UTM position of given PMT identifier. More...
 
const JClass_t & getReference () const
 Get reference to object. More...
 
JClass_t & getReference ()
 Get reference to object. More...
 
bool is_valid () const
 Check validity of reference. More...
 
const JClass_t * operator-> () const
 Smart pointer. More...
 
JClass_t * operator-> ()
 Smart pointer. More...
 
const JClass_t & operator* () const
 Dereference operator. More...
 
JClass_t & operator* ()
 Dereference operator. More...
 

Protected Attributes

JLANG::JSinglePointer< JK40Simulatork40Simulator
 
JLANG::JSinglePointer< JPMTSimulatorpmtSimulator
 
JLANG::JSinglePointer< JCLBSimulatorclbSimulator
 
JClass_t & __object
 

Private Types

typedef JReference< const JDetectorJReference_t
 

Private Member Functions

 JDetectorSimulator (const JDetectorSimulator &)
 Make copy constructor inaccesible. More...
 
JDetectorSimulatoroperator= (const JDetectorSimulator &)
 Make assignment operator inaccesible. More...
 

Private Attributes

JCLBInput buffer
 
JTOOLS::JRouter< JPMTAddressrouter
 

Detailed Description

Detector simulation.

This class implements the JK40Simulator, JPMTSimulator and JCLBSimulator interfaces. The implementations of these interfaces should be provided via pointers to corresponding objects.

N.B: This class owns the objects pointed to using class JLANG::JSinglePointer.

Definition at line 33 of file JDetectorSimulator.hh.

Member Typedef Documentation

◆ JReference_t

typedef JReference<const JDetector> JDETECTOR::JPMTRouter::JReference_t
privateinherited

Definition at line 39 of file JPMTRouter.hh.

◆ const_iterator

typedef JDetector::const_iterator JDETECTOR::JPMTRouter::const_iterator
inherited

Definition at line 43 of file JPMTRouter.hh.

Constructor & Destructor Documentation

◆ JDetectorSimulator() [1/2]

JDETECTOR::JDetectorSimulator::JDetectorSimulator ( const JDetectorSimulator )
private

Make copy constructor inaccesible.

◆ JDetectorSimulator() [2/2]

JDETECTOR::JDetectorSimulator::JDetectorSimulator ( const JDetector detector)
inline

Constructor.

Parameters
detectordetector

Definition at line 58 of file JDetectorSimulator.hh.

58  :
60  {}
JPMTRouter(const JDetector &detector)
Constructor.
Definition: JPMTRouter.hh:51
Detector file.
Definition: JHead.hh:227

Member Function Documentation

◆ operator=()

JDetectorSimulator& JDETECTOR::JDetectorSimulator::operator= ( const JDetectorSimulator )
private

Make assignment operator inaccesible.

◆ hasK40Simulator()

bool JDETECTOR::JDetectorSimulator::hasK40Simulator ( ) const
inline

Check availability of K40 simulator.

Returns
true if simulator available; else false

Definition at line 68 of file JDetectorSimulator.hh.

69  {
70  return k40Simulator.get() != NULL;
71  }
JLANG::JSinglePointer< JK40Simulator > k40Simulator

◆ hasPMTSimulator()

bool JDETECTOR::JDetectorSimulator::hasPMTSimulator ( ) const
inline

Check availability of PMT simulator.

Returns
true if simulator available; else false

Definition at line 80 of file JDetectorSimulator.hh.

81  {
82  return pmtSimulator.get() != NULL;
83  }
JLANG::JSinglePointer< JPMTSimulator > pmtSimulator

◆ hasCLBSimulator()

bool JDETECTOR::JDetectorSimulator::hasCLBSimulator ( ) const
inline

Check availability of CLB simulator.

Returns
true if simulator available; else false

Definition at line 91 of file JDetectorSimulator.hh.

92  {
93  return clbSimulator.get() != NULL;
94  }
JLANG::JSinglePointer< JCLBSimulator > clbSimulator

◆ getK40Simulator()

const JK40Simulator& JDETECTOR::JDetectorSimulator::getK40Simulator ( ) const
inline

Get K40 simulator.

Returns
K40 simulator

Definition at line 102 of file JDetectorSimulator.hh.

103  {
104  if (hasK40Simulator())
105  return *k40Simulator;
106  else
107  THROW(JPointerException, "JDetectorSimulator: K40 simulator not avaliable.");
108  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
bool hasK40Simulator() const
Check availability of K40 simulator.
Exception for accessing an invalid pointer.
Definition: JException.hh:126

◆ getPMTSimulator()

const JPMTSimulator& JDETECTOR::JDetectorSimulator::getPMTSimulator ( ) const
inline

Get PMT simulator.

Returns
PMT simulator

Definition at line 116 of file JDetectorSimulator.hh.

117  {
118  if (hasPMTSimulator())
119  return *pmtSimulator;
120  else
121  THROW(JPointerException, "JDetectorSimulator: PMT simulator not avaliable.");
122  }
bool hasPMTSimulator() const
Check availability of PMT simulator.

◆ getCLBSimulator()

const JCLBSimulator& JDETECTOR::JDetectorSimulator::getCLBSimulator ( ) const
inline

Get CLB simulator.

Returns
CLB simulator

Definition at line 130 of file JDetectorSimulator.hh.

131  {
132  if (hasCLBSimulator())
133  return *clbSimulator;
134  else
135  THROW(JPointerException, "JDetectorSimulator: CLB simulator not avaliable.");
136  }
bool hasCLBSimulator() const
Check availability of CLB simulator.

◆ reset() [1/3]

void JDETECTOR::JDetectorSimulator::reset ( JK40Simulator k40Simulator)
inline

Reset K40 simulator.

Parameters
k40SimulatorK40 simulator

Definition at line 144 of file JDetectorSimulator.hh.

145  {
146  this->k40Simulator.reset(k40Simulator);
147  }

◆ reset() [2/3]

void JDETECTOR::JDetectorSimulator::reset ( JPMTSimulator pmtSimulator)
inline

Reset PMT simulator.

Parameters
pmtSimulatorPMT simulator

Definition at line 156 of file JDetectorSimulator.hh.

157  {
158  this->pmtSimulator.reset(pmtSimulator);
159  }

◆ reset() [3/3]

void JDETECTOR::JDetectorSimulator::reset ( JCLBSimulator clbSimulator)
inline

Reset CLB simulator.

Parameters
clbSimulatorCLB simulator

Definition at line 167 of file JDetectorSimulator.hh.

168  {
169  this->clbSimulator.reset(clbSimulator);
170  }

◆ generateHits()

virtual void JDETECTOR::JDetectorSimulator::generateHits ( const JModule module,
const JTimeRange period,
JModuleData output 
) const
inlineoverridevirtual

Generate hits.

Parameters
modulemodule
periodtime window [ns]
outputbackground data

Implements JDETECTOR::JK40Simulator.

Definition at line 180 of file JDetectorSimulator.hh.

183  {
184  getK40Simulator().generateHits(module, period, output);
185  }
const JK40Simulator & getK40Simulator() const
Get K40 simulator.
virtual void generateHits(const JModule &module, const JTimeRange &period, JModuleData &output) const =0
Generate hits.

◆ processHits()

virtual void JDETECTOR::JDetectorSimulator::processHits ( const JPMTIdentifier ID,
const JCalibration calibration,
const JStatus status,
const JPMTData< JPMTSignal > &  input,
JPMTData< JPMTPulse > &  output 
) const
inlineoverridevirtual

Process hits.

Parameters
IDPMT identifier
calibrationPMT calibration
statusPMT status
inputPMT signals
outputPMT hits

Implements JDETECTOR::JPMTSimulator.

Definition at line 197 of file JDetectorSimulator.hh.

202  {
203  getPMTSimulator().processHits(ID, calibration, status, input, output);
204  }
const JPMTSimulator & getPMTSimulator() const
Get PMT simulator.
virtual void processHits(const JPMTIdentifier &id, const JCalibration &calibration, const JStatus &status, const JPMTData< JPMTSignal > &input, JPMTData< JPMTPulse > &output) const =0
Process hits.
Calibration.
Definition: JHead.hh:330

◆ processData()

virtual void JDETECTOR::JDetectorSimulator::processData ( const JModuleIdentifier id,
const JCLBInput input,
JDAQSuperFrame output 
) const
inlineoverridevirtual

Process data.

Parameters
idmodule identifier
inputPMT data
outputCLB data

Implements JDETECTOR::JCLBSimulator.

Definition at line 214 of file JDetectorSimulator.hh.

215  {
216  getCLBSimulator().processData(id, input, output);
217  }
virtual void processData(const JModuleIdentifier &id, const JCLBInput &input, JDAQSuperFrame &output) const =0
Process data.
const JCLBSimulator & getCLBSimulator() const
Get CLB simulator.

◆ operator()()

virtual void JDETECTOR::JDetectorSimulator::operator() ( const JModule module,
JModuleData input,
JDAQSuperFrame output 
) const
inlinevirtual

Process module data in one step.

Parameters
modulemodule
inputPMT signals
outputCLB data

Definition at line 227 of file JDetectorSimulator.hh.

230  {
231  // PMT simulation
232 
233  buffer.reset(input.size());
234 
235  for (unsigned int i = 0; i != input.size(); ++i) {
236 
237  input[i].sort();
238 
239  const JPMT& pmt = module.getPMT(i);
240 
241  processHits(JPMTIdentifier(module.getID(), i),
242  pmt.getCalibration(),
243  pmt.getStatus(),
244  input [i],
245  buffer[i]);
246  }
247 
248  // CLB simulation
249 
250  processData(module, buffer, output);
251  }
const JCalibration & getCalibration() const
Get calibration.
virtual void processData(const JModuleIdentifier &id, const JCLBInput &input, JDAQSuperFrame &output) const override
Process data.
virtual void processHits(const JPMTIdentifier &ID, const JCalibration &calibration, const JStatus &status, const JPMTData< JPMTSignal > &input, JPMTData< JPMTPulse > &output) const override
Process hits.
const JPMT & getPMT(const int index) const
Get PMT.
Definition: JModule.hh:172
Data structure for PMT geometry, calibration and status.
Definition: JPMT.hh:49
int getID() const
Get identifier.
Definition: JObjectID.hh:50
void reset(size_t size)
Reset CLB buffers.
int getStatus() const
Get status.
Definition: JStatus.hh:63

◆ getPMTRouter()

const JPMTRouter& JDETECTOR::JPMTRouter::getPMTRouter ( ) const
inlineinherited

Get PMT router.

Returns
PMT router

Definition at line 68 of file JPMTRouter.hh.

69  {
70  return static_cast<const JPMTRouter&>(*this);
71  }
Router for direct addressing of PMT data in detector data structure.
Definition: JPMTRouter.hh:37

◆ getAddress()

const JPMTAddress& JDETECTOR::JPMTRouter::getAddress ( const JObjectID id) const
inlineinherited

Get address of PMT.

Parameters
idPMT identifier
Returns
address

Definition at line 80 of file JPMTRouter.hh.

81  {
82  return router.get(id.getID());
83  }
JTOOLS::JRouter< JPMTAddress > router
Definition: JPMTRouter.hh:218

◆ getPMT() [1/2]

const JPMT& JDETECTOR::JPMTRouter::getPMT ( const JPMTAddress address) const
inlineinherited

Get PMT.

Parameters
addressPMT address
Returns
PMT

Definition at line 92 of file JPMTRouter.hh.

93  {
94  return getReference().getPMT(address);
95  }
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38

◆ getPMT() [2/2]

const JPMT& JDETECTOR::JPMTRouter::getPMT ( const JObjectID id) const
inlineinherited

Get PMT.

Parameters
idPMT identifier
Returns
PMT

Definition at line 104 of file JPMTRouter.hh.

105  {
106  return getReference().getPMT(this->getAddress(id));
107  }
const JPMTAddress & getAddress(const JObjectID &id) const
Get address of PMT.
Definition: JPMTRouter.hh:80

◆ hasPMT()

bool JDETECTOR::JPMTRouter::hasPMT ( const JObjectID id) const
inlineinherited

Has PMT.

Parameters
idPMT identifier
Returns
true if PMT present; else false

Definition at line 116 of file JPMTRouter.hh.

117  {
118  return router.has(id.getID());
119  }

◆ getIdentifier() [1/2]

JPMTIdentifier JDETECTOR::JPMTRouter::getIdentifier ( const JPMTAddress address) const
inlineinherited

Get identifier of PMT.

Parameters
addressPMT address
Returns
address

Definition at line 128 of file JPMTRouter.hh.

129  {
130  return JPMTIdentifier(getModule(address), address.second);
131  }
int second
index of PMT in module data structure.
Definition: JPMTAddress.hh:100
const JModule & getModule(const JModuleAddress &address) const
Get module.
Definition: JPMTRouter.hh:152

◆ getIdentifier() [2/2]

JPMTIdentifier JDETECTOR::JPMTRouter::getIdentifier ( const JObjectID id) const
inlineinherited

Get identifier of PMT.

Parameters
idPMT identifier
Returns
address

Definition at line 140 of file JPMTRouter.hh.

141  {
142  return getIdentifier(this->getAddress(id));
143  }
JPMTIdentifier getIdentifier(const JPMTAddress &address) const
Get identifier of PMT.
Definition: JPMTRouter.hh:128

◆ getModule()

const JModule& JDETECTOR::JPMTRouter::getModule ( const JModuleAddress address) const
inlineinherited

Get module.

Parameters
addressmodule address
Returns
module

Definition at line 152 of file JPMTRouter.hh.

153  {
154  return getReference().getModule(address);
155  }

◆ getParentModule()

const JModule& JDETECTOR::JPMTRouter::getParentModule ( const JObjectID id) const
inlineinherited

Get parent module.

Parameters
idPMT identifier
Returns
module

Definition at line 164 of file JPMTRouter.hh.

165  {
166  return getModule(this->getAddress(id));
167  }

◆ getParentModuleID()

int JDETECTOR::JPMTRouter::getParentModuleID ( const JObjectID id) const
inlineinherited

Get parent module identifier.

Parameters
idPMT identifier
Returns
module identifier

Definition at line 176 of file JPMTRouter.hh.

177  {
178  return getParentModule(id).getID();
179  }
const JModule & getParentModule(const JObjectID &id) const
Get parent module.
Definition: JPMTRouter.hh:164

◆ getPMTChannel() [1/2]

JPMTChannel JDETECTOR::JPMTRouter::getPMTChannel ( const JPMTAddress address) const
inlineinherited

Get PMT channel.

Parameters
addressPMT address
Returns
PMT channel

Definition at line 188 of file JPMTRouter.hh.

189  {
190  return JPMTChannel(getModule(address).getLocation(), address.second);
191  }
Auxiliary class to uniquely identify PMT readout channel.
Definition: JPMTChannel.hh:35

◆ getPMTChannel() [2/2]

JPMTChannel JDETECTOR::JPMTRouter::getPMTChannel ( const JObjectID id) const
inlineinherited

Get PMT channel.

Parameters
idPMT identifier
Returns
PMT channel

Definition at line 200 of file JPMTRouter.hh.

201  {
202  return getPMTChannel(getAddress(id));
203  }
JPMTChannel getPMTChannel(const JPMTAddress &address) const
Get PMT channel.
Definition: JPMTRouter.hh:188

◆ getUTMPosition()

JUTMPosition JDETECTOR::JPMTRouter::getUTMPosition ( const JObjectID id) const
inlineinherited

Get UTM position of given PMT identifier.

Parameters
idPMT identifier
Returns
UTM position

Definition at line 212 of file JPMTRouter.hh.

213  {
214  return JUTMPosition(getPMT(id).getPosition() + getReference().getPosition());
215  }
const JPMT & getPMT(const JPMTAddress &address) const
Get PMT.
Definition: JPMTRouter.hh:92
JPosition3D getPosition(const JModule &first, const JModule &second)
Get position to go from first to second module.

◆ getReference() [1/2]

template<class JClass_t >
const JClass_t& JLANG::JReference< JClass_t >::getReference ( ) const
inlineinherited

Get reference to object.

Returns
reference to object

Definition at line 38 of file JReference.hh.

39  {
40  return __object;
41  }
JClass_t & __object
Definition: JReference.hh:110

◆ getReference() [2/2]

template<class JClass_t >
JClass_t& JLANG::JReference< JClass_t >::getReference ( )
inlineinherited

Get reference to object.

Returns
reference to object

Definition at line 49 of file JReference.hh.

50  {
51  return __object;
52  }

◆ is_valid()

template<class JClass_t >
bool JLANG::JReference< JClass_t >::is_valid ( ) const
inlineinherited

Check validity of reference.

Returns
true

Definition at line 60 of file JReference.hh.

61  {
62  return true;
63  }

◆ operator->() [1/2]

template<class JClass_t >
const JClass_t* JLANG::JReference< JClass_t >::operator-> ( ) const
inlineinherited

Smart pointer.

Returns
pointer to object

Definition at line 71 of file JReference.hh.

72  {
73  return &__object;
74  }

◆ operator->() [2/2]

template<class JClass_t >
JClass_t* JLANG::JReference< JClass_t >::operator-> ( )
inlineinherited

Smart pointer.

Returns
pointer to object

Definition at line 82 of file JReference.hh.

83  {
84  return &__object;
85  }

◆ operator*() [1/2]

template<class JClass_t >
const JClass_t& JLANG::JReference< JClass_t >::operator* ( ) const
inlineinherited

Dereference operator.

Returns
reference to object

Definition at line 93 of file JReference.hh.

94  {
95  return __object;
96  }

◆ operator*() [2/2]

template<class JClass_t >
JClass_t& JLANG::JReference< JClass_t >::operator* ( )
inlineinherited

Dereference operator.

Returns
reference to object

Definition at line 104 of file JReference.hh.

105  {
106  return __object;
107  }

Member Data Documentation

◆ k40Simulator

JLANG::JSinglePointer<JK40Simulator> JDETECTOR::JDetectorSimulator::k40Simulator
protected

Definition at line 255 of file JDetectorSimulator.hh.

◆ pmtSimulator

JLANG::JSinglePointer<JPMTSimulator> JDETECTOR::JDetectorSimulator::pmtSimulator
protected

Definition at line 256 of file JDetectorSimulator.hh.

◆ clbSimulator

JLANG::JSinglePointer<JCLBSimulator> JDETECTOR::JDetectorSimulator::clbSimulator
protected

Definition at line 257 of file JDetectorSimulator.hh.

◆ buffer

JCLBInput JDETECTOR::JDetectorSimulator::buffer
mutableprivate

Definition at line 260 of file JDetectorSimulator.hh.

◆ router

JTOOLS::JRouter<JPMTAddress> JDETECTOR::JPMTRouter::router
privateinherited

Definition at line 218 of file JPMTRouter.hh.

◆ __object

template<class JClass_t >
JClass_t& JLANG::JReference< JClass_t >::__object
protectedinherited

Definition at line 110 of file JReference.hh.


The documentation for this class was generated from the following file: