Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Typedefs | Functions | Variables
JDETECTOR Namespace Reference

Auxiliary classes and methods for detector calibration and simulation. More...

Classes

class  JAnchor
 Data structure for anchor position on sea bed. More...
 
class  JCalibration
 Data structure for PMT calibration. More...
 
struct  JCalibrator
 Auxiliary class to apply (de-)calibration to template hit. More...
 
struct  JCalibrator< T, true >
 Template specialisation of JCalibrator for primitive data types. More...
 
struct  JCalibrator< JHit_t, false >
 Template specialisation of JCalibrator for non-primitive data types. More...
 
class  JTransferFunction1D
 Auxiliary class for a non-linear transfer function of TDC inside FPGA. More...
 
class  JCLBDefaultSimulator
 Default CLB simulation. More...
 
class  JCLBDefaultSimulatorInterface
 Default CLB simulation. More...
 
class  JCLBSimulator
 Interface for CLB simulation. More...
 
class  JCompass
 Data structure for comapss in three dimensions. More...
 
class  JCompassMatrix
 Compass matrix. More...
 
class  JDAQHitRouter
 Simple wrapper around JModuleRouter class for direct addressing of PMT data in detector data structure for DAQ hits. More...
 
class  JDetector
 Detector data structure. More...
 
class  JDetectorAddressMap
 Lookup table for PMT addresses in detector. More...
 
struct  JPPM_DU_t
 Type definitions for different detectors.PPM_DU. More...
 
struct  JKM3NeT_t
 KM3NeT. More...
 
struct  JMonteCarlo_t
 Monte Carlo .detx file. More...
 
struct  JObsolete_t
 obsolete detector More...
 
class  JTemplateDetectorAddressMap
 Template lookup table for PMT addresses in detector. More...
 
class  JTemplateDetectorAddressMap< JObsolete_t >
 Template specialisation of JTemplateDetectorAddressMap for obsolete detector. More...
 
class  JTemplateDetectorAddressMap< JPPM_DU_t >
 Template specialisation of JTemplateDetectorAddressMap for PPM_DU detector. More...
 
class  JTemplateDetectorAddressMap< JKM3NeT_t >
 Template specialisation of JTemplateDetectorAddressMap for KM3NeT detector. More...
 
class  JTemplateDetectorAddressMap< JMonteCarlo_t >
 Template specialisation of JTemplateDetectorAddressMap for Monte Carlo detector. More...
 
struct  JDetectorAddressMap_t
 Auxiliary class to extract detector address map from detector identifier. More...
 
struct  JDetectorAddressMap_t< JTypeList< JHead_t, JTail_t > >
 
struct  JDetectorAddressMap_t< JTypeList< JHead_t, JNullType > >
 
class  JDetectorHeader
 Data structure for detector header. More...
 
class  JDetectorParameters
 Data structure for parameters for detector geometry. More...
 
class  JDetectorParametersHelper
 Auxiliary class for I/O of JDetectorParameters data structure. More...
 
class  JDetectorSimulator
 Detector simulation. More...
 
class  JDetectorSubset_t
 Detector subset without binary search functionality. More...
 
class  JDetectorSubset
 Detector subset with binary search functionality. More...
 
struct  JDetectorVersion
 Detector version. More...
 
struct  JGetDetectorVersion
 Auxiliary class to map detector variant to detector version. More...
 
struct  JPutDetectorVersion
 Auxiliary class to map detector version to detector variant. More...
 
class  JK40DefaultSimulator
 Default implementation of the simulation of K40 background. More...
 
class  JK40DefaultSimulatorInterface
 Default K40 simulator interface. More...
 
struct  JK40Rates
 Auxiliary class for K40 rates. More...
 
class  JK40RunByRunSimulator
 K40 simulation based on run-by-run information. More...
 
class  JK40Simulator
 Interface for simulation of K40 background. More...
 
class  JModule
 Data structure for a composite optical module. More...
 
class  JModuleAddress
 Address of module in detector data structure. More...
 
struct  JPMTAddressTranslator
 Data structure to translate PMT physical to readout address. More...
 
class  JModuleAddressMap
 Lookup table for PMT addresses in optical module. More...
 
struct  JModuleComparator3Z_t
 Module comparator according its z-position. More...
 
struct  JModuleComparator3D_t
 Module comparator according its distance to origin. More...
 
class  JModuleGeometry
 Module geometry. More...
 
struct  JUTCDistance
 Auxiliary class for distance beteen UTC times. More...
 
class  JModuleLocation
 Logical location of module. More...
 
struct  JModuleAttributes
 Data structure for module address and module attributes. More...
 
struct  JMaximalDistance
 Auxiliary class to match modules according maximal distance. More...
 
class  JModuleMapper
 Mapper for directly addressing of associated modules in the detector data structure. More...
 
class  JModuleRouter
 Router for direct addressing of module data in detector data structure. More...
 
class  JMonteCarloDetector
 Monte Carlo detector (i.e. More...
 
class  JPMT
 Data structure for PMT geometry and calibration. More...
 
struct  JGetPMTStatusBit
 Auxiliary class to map key to PMT status bit. More...
 
struct  JPutPMTStatusBit
 Auxiliary class to map PMT status bit to key. More...
 
class  JPMTAddress
 Address of PMT in detector data structure. More...
 
struct  JPMTAnalogueSignalProcessor
 PMT analogue signal processor. More...
 
class  JPMTChannel
 Auxiliary class to uniquely identify PMT readout channel. More...
 
struct  JModuleSignalProcessor
 Auxiliary container for PMT signal processors in same optical module. More...
 
class  JPMTDefaultSimulator
 Default PMT simulation. More...
 
class  JPMTDefaultSimulatorInterface
 Default PMT simulation interface. More...
 
class  JPMTIdentifier
 PMT identifier. More...
 
class  JPMTParameters
 Data structure for PMT parameters. More...
 
class  JPMTParametersMap
 Auxiliary class for map of PMT parameters. More...
 
class  JPMTPhysicalAddress
 Data structure for PMT physical address. More...
 
struct  JPMTRateRange
 Data structure for range of PMT rates. More...
 
class  JPMTReadoutAddress
 Data structure for PMT readout address. More...
 
class  JPMTRouter
 Router for direct addressing of PMT data in detector data structure. More...
 
class  JPMTRunByRunSimulator
 PMT simulation based on run-by-run information. More...
 
class  JPMTSignalProcessorInterface
 PMT signal processor interface. More...
 
struct  JPhotoElectron
 Data structure for single photo-electron. More...
 
struct  JPMTSignal
 Data structure for PMT analogue signal. More...
 
struct  JPMTPulse
 Data structure for PMT digital pulse. More...
 
class  JPMTData
 Template data structure for PMT I/O. More...
 
class  JModuleData
 Data structure for PMT data corresponding to a detector module. More...
 
class  JPMTSimulator
 Interface for PMT simulation. More...
 
class  JTransitionTimeGenerator
 Auxiliary class to generate PMT transition times based on measurements by Oleg Kalekin et al. More...
 
class  JTransitionTimeProbability
 Probability distibution of the PMT transition times based on measurements by Oleg Kalekin et al. More...
 
class  JTransitionTimeProbability2D
 Auxiliary class to generate twofold PMT transition times. More...
 

Typedefs

typedef JPMTData< JPMTPulseJPMTOutput
 Type definition of PMT base output. More...
 
typedef std::vector< JPMTOutputJCLBInput
 Type definition of CLB input. More...
 
typedef JTYPELIST< JPPM_DU_t,
JKM3NeT_t, JMonteCarlo_t >
::typelist 
JDetectorTypes_t
 Type list of detector types. More...
 
typedef double JRateL0_t
 Type definition of singles rate [Hz]. More...
 
typedef std::vector< double > JRateL1_t
 Type definition of count rate as a function of multiplicty [Hz] The multiples rate start counting at two-fold coincidences. More...
 
typedef size_t multiplicity_type
 Type definition of multiplicity. More...
 
typedef JLANG::JComparator
< double(JVector3D::*)() const > 
JModuleComparator
 Type definition of a module comparator using 3D position information. More...
 
typedef JLANG::JObjectID JModuleIdentifier
 
typedef std::map
< JPMTIdentifier,
JPMTParameters
JPMTParametersMap_t
 Type definition of map PMT identifier to PMT parameters. More...
 

Functions

bool operator< (const JAnchor &first, const JAnchor &second)
 Sort anchors in ascending distance from (0,0). More...
 
template<class T >
double getTime (const T &t1, const JCalibration &cal)
 Get calibrated time. More...
 
template<class T >
double putTime (const T &t1, const JCalibration &cal)
 Get de-calibrated time. More...
 
template<class T >
double getToT (const T &tot, const JCalibration &cal)
 Get calibrated time-over-threshold of hit. More...
 
template<class T >
double putToT (const T &tot, const JCalibration &cal)
 Get de-calibrated time-over-threshold of hit. More...
 
void reset (JCLBInput &data, size_t size)
 Reset CLB buffers. More...
 
bool hasDetector (JType< JPPM_DU_t > type, const int id)
 Check validity of detector identifier. More...
 
bool hasDetector (JType< JKM3NeT_t > type, const int id)
 
bool hasDetector (JType< JMonteCarlo_t > type, const int id)
 
template<class JDetector_t >
JDetectorAddressMapgetDetectorAddressMap ()
 Get detector address map. More...
 
template<class JDetector_t >
JModuleAddressMapgetModuleAddressMap (int id)
 Get module address map. More...
 
template<class JDetector_t >
const JPMTAddressTranslatorgetPMTAddressTranslator (int id, int tdc)
 Get PMT address translator for given module identifier and TDC channel. More...
 
template<class JDetector_t >
int getPMTLogicalIndex (int id, int tdc)
 Get PMT logical index for given module identifier and TDC channel. More...
 
JDetectorAddressMapgetDetectorAddressMap (const int id)
 Get detector address map. More...
 
bool hasDetectorAddressMap (const int id)
 Check if detector address map is available. More...
 
JDetectorHeader getARCADetectorHeader ()
 Get detector header for ARCA. More...
 
JDetectorHeader getORCADetectorHeader ()
 Get detector header for ORCA. More...
 
double getMaximalDistance (const JDetector &detector)
 Get maximal distance between modules in detector. More...
 
double GetXrotationG4 (const JVersor3D dir)
 Get rotation over X axis in Geant4 coordinate system. More...
 
double GetYrotationG4 (const JVersor3D dir)
 Get rotation over Y axis in Geant4 coordinate system. More...
 
void read_gdml (std::istream &, const JDetector &)
 
void write_gdml (std::ostream &out, const JDetector &detector)
 Writes KM3Sim GDML input file from detector. More...
 
double getMaximalTime (const JDetector &detector)
 Get maximal time between modules in detector following causality. More...
 
double getMaximalTime (const JDetector &detector, const double roadWidth_m)
 Get maximal time between modules in detector following causality. More...
 
JTimeRange getTimeRange (const JTimeRange &timeRange, const JModule &module)
 Get de-calibrated time range. More...
 
int getNumberOfPMTs (const JModule &module)
 Get number of PMTs. More...
 
int getNumberOfPMTs (const JDetector &detector)
 Get number of PMTs. More...
 
int getNumberOfStrings (const JDetector &detector)
 Get number of strings. More...
 
std::set< int > getStringIDs (const JDetector &detector)
 Get list of strings IDs. More...
 
int getNumberOfFloors (const JDetector &detector)
 Get number of floors. More...
 
int getNumberOfModules (const JDetector &detector)
 Get number of modules. More...
 
void load (const JString &file_name, JDetector &detector)
 Load detector from input file. More...
 
void store (const JString &file_name, const JDetector &detector)
 Store detector to output file. More...
 
const JModulegetModule (const JModuleAddressMap &memo, const int id, const JModuleLocation &location=JModuleLocation())
 Get module according module address map. More...
 
const JModulegetModule (const int id, const JModuleLocation &location=JModuleLocation())
 Get module corresponding to Antares storey. More...
 
std::string getModuleLabel (const JModuleLocation &location)
 Get module label (DU-floor) for JMonitor applications. More...
 
std::vector< std::string > getDetectorVersions (const JType< std::string > &type)
 Get detector versions. More...
 
std::vector
< JDetectorVersion::JVersion_t
getDetectorVersions (const JType< JDetectorVersion::JVersion_t > &type)
 Get detector versions. More...
 
template<class T >
std::vector< T > getDetectorVersions ()
 Get detector versions. More...
 
template<class JAttributes_t >
void setAttributes (const JModule &first, const JModule &second, JAttributes_t &attributes)
 Template method to set module attributes. More...
 
template<>
void setAttributes< JNullType > (const JModule &first, const JModule &second, JNullType &attributes)
 Template specialisation to set no attributes for the default empty object. More...
 
std::vector< std::string > getPMTStatusBits (const JType< std::string > &type)
 Get PMT status bits. More...
 
std::vector
< JPMT::JPMTStatusBits_t
getPMTStatusBits (const JType< JPMT::JPMTStatusBits_t > &type)
 Get PMT status bits. More...
 
template<class T >
std::vector< T > getPMTStatusBits ()
 Get PMT status bits. More...
 
bool operator< (const JPMTIdentifier &first, const JPMTIdentifier &second)
 Less than operator for PMT identifiers. More...
 
bool operator== (const JPMTIdentifier &first, const JPMTIdentifier &second)
 Equal operator for PMT identifiers. More...
 
double getSurvivalProbability (const JPMTParameters &parameters)
 Probability that a one photo-electron hit survives the simulation of the PMT assuming QE = 1. More...
 
double getHitProbability (const double QE, const double mu)
 Get ratio of hit probabilities for given QE and expectation value of the number of photo-electrons. More...
 
double getMaximalHitProbability (const double mu)
 Get maximal ratio of hit probabilities for given QE and expectation value of the number of photo-electrons. More...
 
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. More...
 
bool operator< (const JPhotoElectron &first, const JPhotoElectron &second)
 Less than operator for photo-elecrons. More...
 
bool operator< (const JPMTSignal &first, const JPMTSignal &second)
 Less than operator for PMT signals. More...
 
bool operator< (const JPMTPulse &first, const JPMTPulse &second)
 Less than operator for PMT pulses. More...
 
JTimeRange getTimeRange (const JModuleData &input)
 Get time range (i.e. More...
 

Variables

static const char *const GENDET_DETECTOR_FILE_FORMAT = ".det"
 File name extensions. More...
 
static const char *const BINARY_DETECTOR_FILE_FORMAT = ".dat"
 JIO binary file format. More...
 
static const char *const KM3NET_DETECTOR_FILE_FORMAT = ".detx"
 KM3NeT standard ASCII format. More...
 
static const char *const ZIPPED_DETECTOR_FILE_FORMAT = ".gz"
 zipped KM3NeT standard ASCII format More...
 
static const char *const GDML_DETECTOR_FILE_FORMAT = ".xml"
 KM3Sim input format. More...
 
static const JGetDetectorVersion getDetectorVersion
 Function object to map detector variant to detector version. More...
 
static const JPutDetectorVersion putDetectorVersion (getDetectorVersion)
 Function object to map detector version to detector variant. More...
 
static const int LED_BEACON_PMT_TYPE = 2
 PMT type of LED beacon. More...
 
static const JGetPMTStatusBit getPMTStatusBit
 Function object to map key to PMT status bit. More...
 
static const JPutPMTStatusBit putPMTStatusBit (getPMTStatusBit)
 Function object to map PMT status bit to key. More...
 
const double TIME_OVER_THRESHOLD_NS = 26.4
 Specification for time-over-threshold corresponding to a one photo-electron pulse. More...
 
static const
JTransitionTimeGenerator 
getTransitionTime
 Function object to generate transition time. More...
 
static const
JTransitionTimeProbability 
getTransitionTimeProbability
 Function object of transition time prabability. More...
 
static const
JTransitionTimeProbability2D 
getTransitionTimeProbability2D
 Function object of twofold transition time prabability. More...
 

Detailed Description

Auxiliary classes and methods for detector calibration and simulation.

Author
mdejong

Typedef Documentation

Type definition of PMT base output.

Definition at line 26 of file JCLBSimulator.hh.

Type definition of CLB input.

Definition at line 32 of file JCLBSimulator.hh.

Type list of detector types.

Definition at line 42 of file JDetectorAddressMapToolkit.hh.

typedef double JDETECTOR::JRateL0_t

Type definition of singles rate [Hz].

Definition at line 21 of file JK40Rates.hh.

Type definition of count rate as a function of multiplicty [Hz] The multiples rate start counting at two-fold coincidences.

Definition at line 27 of file JK40Rates.hh.

Type definition of multiplicity.

Definition at line 33 of file JK40Rates.hh.

typedef JLANG::JComparator<double (JVector3D::*)() const> JDETECTOR::JModuleComparator

Type definition of a module comparator using 3D position information.

Definition at line 22 of file JModuleComparator.hh.

Definition at line 16 of file JModuleIdentifier.hh.

Type definition of map PMT identifier to PMT parameters.

Definition at line 47 of file JPMTParametersMap.hh.

Function Documentation

bool JDETECTOR::operator< ( const JAnchor first,
const JAnchor second 
)
inline

Sort anchors in ascending distance from (0,0).

Parameters
firstfirst anchor
secondsecond anchor
Returns
true if first anchor closer to (0,0); else false

Definition at line 99 of file JAnchor.hh.

100  {
101  return first.getLengthSquared() < second.getLengthSquared();
102  }
double getLengthSquared() const
Get length squared.
Definition: JVector2D.hh:184
template<class T >
double JDETECTOR::getTime ( const T &  t1,
const JCalibration cal 
)
inline

Get calibrated time.

Parameters
t1time [ns]
calcalibration
Returns
time [ns]

Definition at line 196 of file JDetector/JCalibration.hh.

197  {
198  return JCalibrator<T>::getTime(t1, cal);
199  }
double getTime(const Hit &hit)
Get true time of hit.
template<class T >
double JDETECTOR::putTime ( const T &  t1,
const JCalibration cal 
)
inline

Get de-calibrated time.

Parameters
t1time [ns]
calcalibration
Returns
time [ns]

Definition at line 210 of file JDetector/JCalibration.hh.

211  {
212  return JCalibrator<T>::putTime(t1, cal);
213  }
double putTime(const T &t1, const JCalibration &cal)
Get de-calibrated time.
template<class T >
double JDETECTOR::getToT ( const T &  tot,
const JCalibration cal 
)
inline

Get calibrated time-over-threshold of hit.

Parameters
tottime-over-threshold [ns]
calcalibration
Returns
time-over-threshold [ns]

Definition at line 224 of file JDetector/JCalibration.hh.

225  {
226  return JCalibrator<T>::getToT(tot, cal);
227  }
double getToT(const T &tot, const JCalibration &cal)
Get calibrated time-over-threshold of hit.
template<class T >
double JDETECTOR::putToT ( const T &  tot,
const JCalibration cal 
)
inline

Get de-calibrated time-over-threshold of hit.

Parameters
tottime-over-threshold [ns]
calcalibration
Returns
time-over-threshold [ns]

Definition at line 238 of file JDetector/JCalibration.hh.

239  {
240  return JCalibrator<T>::putToT(tot, cal);
241  }
double putToT(const T &tot, const JCalibration &cal)
Get de-calibrated time-over-threshold of hit.
void JDETECTOR::reset ( JCLBInput data,
size_t  size 
)
inline

Reset CLB buffers.

Parameters
dataCLB input data
sizenumber of buffers

Definition at line 41 of file JCLBSimulator.hh.

42  {
43  data.resize(size);
44 
45  for (JCLBInput::iterator i = data.begin(); i != data.end(); ++i) {
46  i->clear();
47  }
48  }
bool JDETECTOR::hasDetector ( JType< JPPM_DU_t type,
const int  id 
)

Check validity of detector identifier.

Parameters
typedetector type
iddetector identifier
Returns
true if valid match; else false

Definition at line 52 of file JDetectorAddressMapToolkit.hh.

52 { return id == 1; }
bool JDETECTOR::hasDetector ( JType< JKM3NeT_t type,
const int  id 
)

Definition at line 53 of file JDetectorAddressMapToolkit.hh.

53 { return id >= 2 && id <= 100000; }
bool JDETECTOR::hasDetector ( JType< JMonteCarlo_t type,
const int  id 
)

Definition at line 54 of file JDetectorAddressMapToolkit.hh.

54 { return id >= -100000 && id <= -2; }
template<class JDetector_t >
JDetectorAddressMap& JDETECTOR::getDetectorAddressMap ( )
inline

Get detector address map.

Returns
detector address map

Definition at line 363 of file JDetectorAddressMapToolkit.hh.

364  {
366 
367  return demo;
368  }
Template lookup table for PMT addresses in detector.
template<class JDetector_t >
JModuleAddressMap& JDETECTOR::getModuleAddressMap ( int  id)
inline

Get module address map.

Parameters
idmodule identifier
Returns
module address map

Definition at line 378 of file JDetectorAddressMapToolkit.hh.

379  {
380  return getDetectorAddressMap<JDetector_t>().get(id);
381  }
template<class JDetector_t >
const JPMTAddressTranslator& JDETECTOR::getPMTAddressTranslator ( int  id,
int  tdc 
)
inline

Get PMT address translator for given module identifier and TDC channel.

Parameters
idmodule identifier
tdcTDC
Returns
PMT address translator

Definition at line 392 of file JDetectorAddressMapToolkit.hh.

393  {
394  return getModuleAddressMap<JDetector_t>(id).getAddressTranslator(tdc);
395  }
template<class JDetector_t >
int JDETECTOR::getPMTLogicalIndex ( int  id,
int  tdc 
)
inline

Get PMT logical index for given module identifier and TDC channel.

Parameters
idmodule identifier
tdcTDC
Returns
PMT logical index

Definition at line 406 of file JDetectorAddressMapToolkit.hh.

407  {
408  return getModuleAddressMap<JDetector_t>(id).getIndex(tdc);
409  }
int getIndex()
Get index for user I/O manipulation.
Definition: JPrint.hh:26
JDetectorAddressMap& JDETECTOR::getDetectorAddressMap ( const int  id)
inline

Get detector address map.

Parameters
iddetector identifier
Returns
detector address map

Definition at line 487 of file JDetectorAddressMapToolkit.hh.

488  {
490  }
T get(const JHead &head)
Get object from header.
bool JDETECTOR::hasDetectorAddressMap ( const int  id)
inline

Check if detector address map is available.

Parameters
iddetector identifier
Returns
true if detector address map available; else false

Definition at line 499 of file JDetectorAddressMapToolkit.hh.

500  {
502  }
Auxiliary class to extract detector address map from detector identifier.
JDetectorHeader JDETECTOR::getARCADetectorHeader ( )
inline

Get detector header for ARCA.

Returns
detector header

Definition at line 223 of file JDetectorHeader.hh.

224  {
225  return JDetectorHeader(JUTCTimeRange(0.0, 999999999999.9),
226  JUTMGrid ("UTM", "WGS84", "33N"),
227  JUTMPosition (587600, 4016800, -3450));
228  }
Data structure for detector header.
JDetectorHeader JDETECTOR::getORCADetectorHeader ( )
inline

Get detector header for ORCA.

Returns
detector header

Definition at line 235 of file JDetectorHeader.hh.

236  {
237  return JDetectorHeader(JUTCTimeRange(0.0, 999999999999.9),
238  JUTMGrid ("UTM", "WGS84", "32N"),
239  JUTMPosition (256500, 4743000, -2425));
240  }
Data structure for detector header.
double JDETECTOR::getMaximalDistance ( const JDetector detector)
inline

Get maximal distance between modules in detector.

Parameters
detectordetector
Returns
maximal distance [m]

Definition at line 73 of file JDetectorToolkit.hh.

74  {
75  double dmax = 0.0;
76 
77  for (JDetector::const_iterator i = detector.begin(); i != detector.end(); ++i) {
78  for (JDetector::const_iterator j = detector.begin(); j != i; ++j) {
79  if (i->getDistance(*j) > dmax) {
80  dmax = i->getDistance(*j);
81  }
82  }
83  }
84 
85  return dmax;
86  }
double JDETECTOR::GetXrotationG4 ( const JVersor3D  dir)
inline

Get rotation over X axis in Geant4 coordinate system.

Parameters
dirdirection
Returns
X-rotation [deg]

Definition at line 95 of file JDetectorToolkit.hh.

96  {
97  const double phi = atan2(dir.getDY(), dir.getDZ())*(180.0/PI);
98 
99  if (phi < 0.0){
100  return phi + 360.0;
101  }
102  else{
103  return phi;
104  }
105  }
static const double PI
Constants.
Definition: JConstants.hh:20
double JDETECTOR::GetYrotationG4 ( const JVersor3D  dir)
inline

Get rotation over Y axis in Geant4 coordinate system.

Parameters
dirdirection
Returns
Y-rotation [deg]

Definition at line 114 of file JDetectorToolkit.hh.

115  {
116  return asin(-dir.getDX())*(180.0/PI);
117  }
static const double PI
Constants.
Definition: JConstants.hh:20
void JDETECTOR::read_gdml ( std::istream &  ,
const JDetector  
)
inline

Definition at line 120 of file JDetectorToolkit.hh.

121  {}
void JDETECTOR::write_gdml ( std::ostream &  out,
const JDetector detector 
)
inline

Writes KM3Sim GDML input file from detector.

Parameters
outoutput stream
detectordetector

Definition at line 130 of file JDetectorToolkit.hh.

131  {
132  const JCylinder3D cylinder(detector.begin(), detector.end());
133 
134  // Detector height is bascially just a distance between the highest and the lowest DOM
135  //double Detector_Height = cylinder.getZmax() - cylinder.getZmin();
136  // Distance from the center of the lowest DOM to the seabed
137  //double Seabed_Distance = cylinder.getZmin();
138 
139  // To translate Z coordinate from detx format which corresponds to the distance from the seabed one has to perform a following calculation
140  // Dom_Z_GDML = Dom_Z_Detx - Distance to the seabed from the lowest DOM - Detector_height/2
141 
142  //double DistanceOfSeabedFromLowestOM = Seabed_Distance;
143  // For now, the size of the WorldBox is fixed to 2200 meters
144  const double WorldBoxHeight = 2200.;
145  // Below formula comes directly from the note by Apostolos
146  //double Crust_Z_size = WorldBoxHeight/2-Detector_Height/2-DistanceOfSeabedFromLowestOM; Formula for obsolete coordinate covention, where Z_seabed != 0
147  const double Crust_Z_size = WorldBoxHeight/2;
148  //double Crust_Z_position = -WorldBoxHeight/4-Detector_Height/4-DistanceOfSeabedFromLowestOM/2; Formula for obsolete coordinate covention, where Z_seabed != 0
149  const double Crust_Z_position= -WorldBoxHeight/4;
150 
151 
152  out<<"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<gdml xmlns:gdml=\"http://cern.ch/2001/Schemas/GDML\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"/afs/cern.ch/sw/geant4/releases/share/geant4.9.5/source/persistency/gdml/schema/gdml.xsd\">\n\n\n";
153  out<<"<define>\n";
154  out<<"<rotation name=\"identity\"/>\n<position name=\"zero\"/>\n";
155 
156  int PMTs_NO = 0;
157  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
158 
159  const JFIT::JEstimator<JPoint3D> center(module->begin(), module->end());
160 
161  //out<<"<position name=\"PosString"<<module->getString()<<"_Dom"<<module->getID()<<"\" unit=\"m\" x=\""<<module->getX()<<"\" y=\""<<module->getY()<<"\" z=\""<<module->getZ() - Seabed_Distance-Detector_Height/2<<"\"/>\n"; Formula for obsolete coordinate covention, where Z_seabed != 0
162  out<<"<position name=\"PosString"<<module->getString()<<"_Dom"<<module->getID()<<"\" unit=\"m\" x=\""<<module->getX()<<"\" y=\""<<module->getY()<<"\" z=\""<<module->getZ()<<"\"/>\n";
163 
164  for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
165  //JVector3D vec;
166  //static_cast<JVector3D> (vec) = module->sub(*pmt);
167 
168  const JVector3D vec = static_cast<JVector3D>(*pmt).sub(center);
169  out<<"<position name=\"CathodPosition"<<pmt->getID()<<"_"<<module->getID()<<"\" unit=\"m\" x=\""<<vec.getX()<<"\" y=\""<<vec.getY()<<"\" z=\""<<vec.getZ()<<"\"/>\n";
170  out<<"<rotation name=\"CathodRotation"<<pmt->getID()<<"_"<<module->getID()<<"\" unit=\"deg\" x=\""<<GetXrotationG4(*pmt)<<"\" y=\""<<GetYrotationG4(*pmt)<<"\" z=\"0.000000\"/>\n";
171  out<<"<constant name=\"CathodID_"<<PMTs_NO<<"\" value=\""<<pmt->getID()<<"\"/>\n";
172  PMTs_NO++;
173  }
174 
175  }
176 
177  out<<"<position name=\"OMShift\" unit=\"m\" x=\"0\" y=\"0\" z=\"0.0392\"/>\n";
178  out<<"\n\n\n";
179  out<<"<!-- end of DU position definitions -->\n<position name=\"CrustPosition\" unit=\"m\" x=\"0\" y=\"0\" z=\""<<Crust_Z_position<<"\"/>\n";
180 
181  out<<"</define>\n";
182  out<<"<materials>\n";
183  out<<"</materials>\n";
184  out<<"<solids>\n";
185  out<<" <box name=\"WorldBox\" lunit=\"m\" x=\"2200\" y=\"2200\" z=\"2200\"/>\n";
186  out<<" <box name=\"CrustBox\" lunit=\"m\" x=\"2200\" y=\"2200\" z=\""<<Crust_Z_size<<"\"/>\n";
187  out<<" <box name=\"StoreyBox\" lunit=\"m\" x=\"0.6\" y=\"0.6\" z=\"0.6\"/>\n";
188  out<<" <sphere name=\"OMSphere\" lunit=\"cm\" aunit=\"deg\" rmin=\"0.0\" rmax=\"21.6\" startphi=\"0.0\" deltaphi=\"360.0\" starttheta=\"0.0\" deltatheta=\"180.0\"/>\n";
189  out<<" <tube name=\"CathodTube\" lunit=\"cm\" aunit=\"deg\" rmin=\"0.0\" rmax=\"4.7462\" z=\"0.5\" startphi=\"0.0\" deltaphi=\"360.0\"/>\n";
190  out<<"</solids>\n\n\n";
191 
192  out<<"<structure>\n";
193  out<<" <volume name=\"CathodVolume\">\n";
194  out<<" <materialref ref=\"Cathod\"/>\n";
195  out<<" <solidref ref=\"CathodTube\"/>\n";
196  out<<" </volume>\n";
197 
198  out<<"<!-- OMVolume(s) construction -->\n";
199 
200  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
201 
202  out<<" <volume name=\"OMVolume"<<module->getID()<<"\">\n";
203  out<<" <materialref ref=\"Water\"/>\n";
204  out<<" <solidref ref=\"OMSphere\"/>\n";
205 
206  for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
207  out<<" <physvol>\n";
208  out<<" <volumeref ref=\"CathodVolume\"/>\n";
209  out<<" <positionref ref=\"CathodPosition"<<pmt->getID()<<"_"<<module->getID()<<"\"/>\n";
210  out<<" <rotationref ref=\"CathodRotation"<<pmt->getID()<<"_"<<module->getID()<<"\"/>\n";
211  out<<" </physvol>\n";
212  }
213 
214  out<<" </volume>\n";
215  }
216 
217  out<<"<!-- StoreyVolume(s) construction -->\n";
218 
219  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
220  out<<" <volume name=\"StoreyVolume"<<module->getID()<<"\">\n";
221  out<<" <materialref ref=\"Water\"/>\n";
222  out<<" <solidref ref=\"StoreyBox\"/>\n";
223  out<<" <physvol>\n";
224  out<<" <volumeref ref=\"OMVolume"<<module->getID()<<"\"/>\n";
225  out<<" <positionref ref=\"OMShift\"/>\n";
226  //out<<" <positionref ref=\"zero\"/>\n";
227  out<<" <rotationref ref=\"identity\"/>\n";
228  out<<" </physvol>\n";
229  out<<" </volume>\n";
230  }
231 
232  out<<"<!-- Crust Volume construction-->\n";
233  out<<"<volume name=\"CrustVolume\">\n";
234  out<<" <materialref ref=\"Crust\"/>\n";
235  out<<" <solidref ref=\"CrustBox\"/>\n";
236  out<<"</volume>\n";
237 
238  out<<"<!-- World Volume construction-->\n";
239  out<<"<volume name=\"WorldVolume\">\n";
240  out<<" <materialref ref=\"Water\"/>\n";
241  out<<" <solidref ref=\"WorldBox\"/>\n";
242 
243  out<<" <physvol>\n";
244  out<<" <volumeref ref=\"CrustVolume\"/>\n";
245  out<<" <positionref ref=\"CrustPosition\"/>\n";
246  out<<" <rotationref ref=\"identity\"/>\n";
247  out<<" </physvol>\n";
248 
249  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
250  out<<" <physvol>\n";
251  out<<" <volumeref ref=\"StoreyVolume"<<module->getID()<<"\"/>\n";
252  out<<" <positionref ref=\"PosString"<< module->getString() <<"_Dom"<< module->getID() <<"\"/>\n";
253  //out<<" <rotation x="{}" y="{}" z="0.0"/>\n'.format(Dom_Phi[i], Dom_Theta[i]))
254  out<<" <rotationref ref=\"identity\"/>\n";
255  out<<" </physvol>\n";
256  }
257 
258  out<<"</volume>\n";
259 
260  out<<"</structure>\n";
261  out<<"<setup name=\"Default\" version=\"1.0\">\n";
262  out<<"<world ref=\"WorldVolume\"/>\n";
263  out<<"</setup>\n";
264  out<<"</gdml>\n";
265  }
double GetYrotationG4(const JVersor3D dir)
Get rotation over Y axis in Geant4 coordinate system.
double getX() const
Get x position.
Definition: JVector3D.hh:92
Linear fit of crossing point (position) between axes (objects with position and direction).
double GetXrotationG4(const JVersor3D dir)
Get rotation over X axis in Geant4 coordinate system.
double JDETECTOR::getMaximalTime ( const JDetector detector)
inline

Get maximal time between modules in detector following causality.

Parameters
detectordetector
Returns
maximal time [ns]

Definition at line 274 of file JDetectorToolkit.hh.

275  {
277  }
double getIndexOfRefraction()
Get average index of refraction of water.
Definition: JConstants.hh:111
const double getInverseSpeedOfLight()
Get inverse speed of light.
Definition: JConstants.hh:100
double getMaximalDistance(const JDetector &detector)
Get maximal distance between modules in detector.
double JDETECTOR::getMaximalTime ( const JDetector detector,
const double  roadWidth_m 
)
inline

Get maximal time between modules in detector following causality.

The road width corresponds to the maximal distance traveled by the light.

Parameters
detectordetector
roadWidth_mroad width [m]
Returns
maximal time [ns]

Definition at line 288 of file JDetectorToolkit.hh.

289  {
290  const double Dmax_m = getMaximalDistance(detector);
291 
292  return (sqrt((Dmax_m + roadWidth_m*getSinThetaC()) *
293  (Dmax_m - roadWidth_m*getSinThetaC())) +
294  roadWidth_m * getSinThetaC() * getTanThetaC()) * getInverseSpeedOfLight();
295  }
double getSinThetaC()
Get average sine of Cherenkov angle of water.
Definition: JConstants.hh:144
const double getInverseSpeedOfLight()
Get inverse speed of light.
Definition: JConstants.hh:100
double getMaximalDistance(const JDetector &detector)
Get maximal distance between modules in detector.
double getTanThetaC()
Get average tangent of Cherenkov angle of water.
Definition: JConstants.hh:122
JTimeRange JDETECTOR::getTimeRange ( const JTimeRange &  timeRange,
const JModule module 
)
inline

Get de-calibrated time range.

The de-calibrated time range is corrected for minimal and maximal time offset of PMTs in given module.

Parameters
timeRangetime range [ns]
modulemodule
Returns
time range [ns]

Definition at line 307 of file JDetectorToolkit.hh.

308  {
309  if (!module.empty()) {
310 
311  JTimeRange time_range(JTimeRange::DEFAULT_RANGE);
312 
313  for (JModule::const_iterator pmt = module.begin(); pmt != module.end(); ++pmt) {
314 
315  const JCalibration& calibration = pmt->getCalibration();
316 
317  time_range.include(putTime(timeRange.getLowerLimit(), calibration));
318  time_range.include(putTime(timeRange.getUpperLimit(), calibration));
319  }
320 
321  return time_range;
322 
323  } else {
324 
325  return timeRange;
326  }
327  }
const JCalibration & getCalibration() const
Get calibration.
Data structure for PMT calibration.
JRange< double > JTimeRange
Type definition for time range.
double putTime(const T &t1, const JCalibration &cal)
Get de-calibrated time.
int JDETECTOR::getNumberOfPMTs ( const JModule module)
inline

Get number of PMTs.

Parameters
modulemodule
Returns
number of PMTs

Definition at line 336 of file JDetectorToolkit.hh.

337  {
338  return module.size();
339  }
int JDETECTOR::getNumberOfPMTs ( const JDetector detector)
inline

Get number of PMTs.

Parameters
detectordetector
Returns
number of PMTs

Definition at line 348 of file JDetectorToolkit.hh.

349  {
350  int number_of_pmts = 0;
351 
352  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
353  number_of_pmts += getNumberOfPMTs(*module);
354  }
355 
356  return number_of_pmts;
357  }
int getNumberOfPMTs(const JModule &module)
Get number of PMTs.
int JDETECTOR::getNumberOfStrings ( const JDetector detector)
inline

Get number of strings.

Parameters
detectordetector
Returns
number of strings

Definition at line 366 of file JDetectorToolkit.hh.

367  {
368  std::set<int> buffer;
369 
370  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
371  buffer.insert(module->getString());
372  }
373 
374  return buffer.size();
375  }
std::set<int> JDETECTOR::getStringIDs ( const JDetector detector)
inline

Get list of strings IDs.

Parameters
detectordetector
Returns
list of string IDs

Definition at line 384 of file JDetectorToolkit.hh.

385  {
386  std::set<int> buffer;
387 
388  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
389  buffer.insert(module->getString());
390  }
391 
392  return buffer;
393  }
int JDETECTOR::getNumberOfFloors ( const JDetector detector)
inline

Get number of floors.

Parameters
detectordetector
Returns
number of floors

Definition at line 402 of file JDetectorToolkit.hh.

403  {
404  std::set<int> buffer;
405 
406  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
407  buffer.insert(module->getFloor());
408  }
409 
410  return buffer.size();
411  }
int JDETECTOR::getNumberOfModules ( const JDetector detector)
inline

Get number of modules.

Parameters
detectordetector
Returns
number of modules

Definition at line 420 of file JDetectorToolkit.hh.

421  {
422  std::set<int> buffer;
423 
424  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
425  buffer.insert(module->getID());
426  }
427 
428  return buffer.size();
429  }
void JDETECTOR::load ( const JString &  file_name,
JDetector detector 
)
inline

Load detector from input file.

Supported file formats:

Parameters
file_namefile name
detectordetector

Definition at line 444 of file JDetectorToolkit.hh.

445  {
446  using namespace std;
447  using namespace JIO;
448 
449  if (file_name.endsWith(GENDET_DETECTOR_FILE_FORMAT)) {
450 
451  JMonteCarloDetector buffer(true);
452 
453  ifstream in(file_name.c_str());
454 
455  if (!in) {
456  THROW(JFileOpenException, "File not opened: " << file_name);
457  }
458 
459  in >> buffer;
460 
461  in.close();
462 
463  detector.swap(buffer);
464 
465  } else if (file_name.endsWith(BINARY_DETECTOR_FILE_FORMAT)) {
466 
467  JFileStreamReader in(file_name.c_str());
468 
469  if (!in) {
470  THROW(JFileOpenException, "File not opened: " << file_name);
471  }
472 
473  detector.read(in);
474 
475  in.close();
476 
477  } else if (file_name.endsWith(KM3NET_DETECTOR_FILE_FORMAT)) {
478 
479  ifstream in(file_name.c_str());
480 
481  if (!in) {
482  THROW(JFileOpenException, "File not opened: " << file_name);
483  }
484 
485  in >> detector;
486 
487  in.close();
488 
489  } else if (file_name.endsWith(ZIPPED_DETECTOR_FILE_FORMAT)) {
490 
491  igzstream in(file_name.c_str());
492 
493  if (!in) {
494  THROW(JFileOpenException, "File not opened: " << file_name);
495  }
496 
497  in >> detector;
498 
499  in.close();
500 
501  } else {
502 
503  THROW(JProtocolException, "Protocol not defined: " << file_name);
504  }
505  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:633
virtual JReader & read(JReader &in)
Read from input.
Definition: JDetector.hh:367
Monte Carlo detector (i.e.
static const char *const KM3NET_DETECTOR_FILE_FORMAT
KM3NeT standard ASCII format.
static const char *const ZIPPED_DETECTOR_FILE_FORMAT
zipped KM3NeT standard ASCII format
static const char *const GENDET_DETECTOR_FILE_FORMAT
File name extensions.
static const char *const BINARY_DETECTOR_FILE_FORMAT
JIO binary file format.
Binary buffered file input.
void JDETECTOR::store ( const JString &  file_name,
const JDetector detector 
)
inline

Store detector to output file.

Supported file formats:

Parameters
file_namefile name
detectordetector

Definition at line 520 of file JDetectorToolkit.hh.

521  {
522  using namespace std;
523  using namespace JIO;
524 
525  if (file_name.endsWith(BINARY_DETECTOR_FILE_FORMAT)) {
526 
527  JFileStreamWriter out(file_name.c_str());
528 
529  detector.write(out);
530 
531  out.close();
532 
533  } else if (file_name.endsWith(KM3NET_DETECTOR_FILE_FORMAT)) {
534 
535  std::ofstream out(file_name.c_str());
536 
537  out << detector;
538 
539  out.close();
540 
541  } else if (file_name.endsWith(ZIPPED_DETECTOR_FILE_FORMAT)) {
542 
543  ogzstream out(file_name.c_str());
544 
545  out << detector;
546 
547  out.close();
548 
549  } else if (file_name.endsWith(GDML_DETECTOR_FILE_FORMAT)) {
550 
551  std::ofstream out(file_name.c_str());
552 
553  write_gdml(out, detector);
554 
555  out.close();
556 
557  } else {
558 
559  throw JProtocolException("Protocol not defined.");
560  }
561  }
virtual JWriter & write(JWriter &out) const
Write to output.
Definition: JDetector.hh:397
void close()
Definition: gzstream.h:185
static const char *const KM3NET_DETECTOR_FILE_FORMAT
KM3NeT standard ASCII format.
static const char *const ZIPPED_DETECTOR_FILE_FORMAT
zipped KM3NeT standard ASCII format
static const char *const BINARY_DETECTOR_FILE_FORMAT
JIO binary file format.
Binary buffered file output.
static const char *const GDML_DETECTOR_FILE_FORMAT
KM3Sim input format.
void write_gdml(std::ostream &out, const JDetector &detector)
Writes KM3Sim GDML input file from detector.
const JModule& JDETECTOR::getModule ( const JModuleAddressMap memo,
const int  id,
const JModuleLocation location = JModuleLocation() 
)
inline

Get module according module address map.

Parameters
memomodule address map
idmodule identifier
locationmodule location
Returns
module

Definition at line 572 of file JDetectorToolkit.hh.

575  {
576  static JModule module;
577 
578 
579  module.setID(id);
580 
581  module.setLocation(location);
582 
583  module.resize(memo.size());
584 
585  if (memo.has( 0)) { module[memo[ 0].tdc] = JPMT( 1, JAxis3D(JVector3D(+0.000, +0.000, -0.200), JVersor3D(+0.000, +0.000, -1.000))); }
586 
587  if (memo.has( 1)) { module[memo[ 1].tdc] = JPMT( 2, JAxis3D(JVector3D(+0.000, +0.105, -0.170), JVersor3D(+0.000, +0.527, -0.850))); }
588  if (memo.has( 2)) { module[memo[ 2].tdc] = JPMT( 3, JAxis3D(JVector3D(+0.091, +0.053, -0.170), JVersor3D(+0.456, +0.263, -0.850))); }
589  if (memo.has( 3)) { module[memo[ 3].tdc] = JPMT( 4, JAxis3D(JVector3D(+0.091, -0.053, -0.170), JVersor3D(+0.456, -0.263, -0.850))); }
590  if (memo.has( 4)) { module[memo[ 4].tdc] = JPMT( 5, JAxis3D(JVector3D(+0.000, -0.105, -0.170), JVersor3D(+0.000, -0.527, -0.850))); }
591  if (memo.has( 5)) { module[memo[ 5].tdc] = JPMT( 6, JAxis3D(JVector3D(-0.091, -0.053, -0.170), JVersor3D(-0.456, -0.263, -0.850))); }
592  if (memo.has( 6)) { module[memo[ 6].tdc] = JPMT( 7, JAxis3D(JVector3D(-0.091, +0.053, -0.170), JVersor3D(-0.456, +0.263, -0.850))); }
593 
594  if (memo.has( 7)) { module[memo[ 7].tdc] = JPMT( 8, JAxis3D(JVector3D(+0.083, +0.144, -0.111), JVersor3D(+0.416, +0.720, -0.555))); }
595  if (memo.has( 8)) { module[memo[ 8].tdc] = JPMT( 9, JAxis3D(JVector3D(+0.166, +0.000, -0.111), JVersor3D(+0.832, +0.000, -0.555))); }
596  if (memo.has( 9)) { module[memo[ 9].tdc] = JPMT(10, JAxis3D(JVector3D(+0.083, -0.144, -0.111), JVersor3D(+0.416, -0.720, -0.555))); }
597  if (memo.has(10)) { module[memo[10].tdc] = JPMT(11, JAxis3D(JVector3D(-0.083, -0.144, -0.111), JVersor3D(-0.416, -0.720, -0.555))); }
598  if (memo.has(11)) { module[memo[11].tdc] = JPMT(12, JAxis3D(JVector3D(-0.166, +0.000, -0.111), JVersor3D(-0.832, +0.000, -0.555))); }
599  if (memo.has(12)) { module[memo[12].tdc] = JPMT(13, JAxis3D(JVector3D(-0.083, +0.144, -0.111), JVersor3D(-0.416, +0.720, -0.555))); }
600 
601  if (memo.has(13)) { module[memo[13].tdc] = JPMT(14, JAxis3D(JVector3D(+0.000, +0.191, -0.059), JVersor3D(+0.000, +0.955, -0.295))); }
602  if (memo.has(14)) { module[memo[14].tdc] = JPMT(15, JAxis3D(JVector3D(+0.165, +0.096, -0.059), JVersor3D(+0.827, +0.478, -0.295))); }
603  if (memo.has(15)) { module[memo[15].tdc] = JPMT(16, JAxis3D(JVector3D(+0.165, -0.096, -0.059), JVersor3D(+0.827, -0.478, -0.295))); }
604  if (memo.has(16)) { module[memo[16].tdc] = JPMT(17, JAxis3D(JVector3D(+0.000, -0.191, -0.059), JVersor3D(+0.000, -0.955, -0.295))); }
605  if (memo.has(17)) { module[memo[17].tdc] = JPMT(18, JAxis3D(JVector3D(-0.165, -0.096, -0.059), JVersor3D(-0.827, -0.478, -0.295))); }
606  if (memo.has(18)) { module[memo[18].tdc] = JPMT(19, JAxis3D(JVector3D(-0.165, +0.096, -0.059), JVersor3D(-0.827, +0.478, -0.295))); }
607 
608  if (memo.has(19)) { module[memo[19].tdc] = JPMT(20, JAxis3D(JVector3D(+0.096, +0.165, +0.059), JVersor3D(+0.478, +0.827, +0.295))); }
609  if (memo.has(20)) { module[memo[20].tdc] = JPMT(21, JAxis3D(JVector3D(+0.191, +0.000, +0.059), JVersor3D(+0.955, +0.000, +0.295))); }
610  if (memo.has(21)) { module[memo[21].tdc] = JPMT(22, JAxis3D(JVector3D(+0.096, -0.165, +0.059), JVersor3D(+0.478, -0.827, +0.295))); }
611  if (memo.has(22)) { module[memo[22].tdc] = JPMT(23, JAxis3D(JVector3D(-0.096, -0.165, +0.059), JVersor3D(-0.478, -0.827, +0.295))); }
612  if (memo.has(23)) { module[memo[23].tdc] = JPMT(24, JAxis3D(JVector3D(-0.191, +0.000, +0.059), JVersor3D(-0.955, +0.000, +0.295))); }
613  if (memo.has(24)) { module[memo[24].tdc] = JPMT(25, JAxis3D(JVector3D(-0.096, +0.165, +0.059), JVersor3D(-0.478, +0.827, +0.295))); }
614 
615  if (memo.has(25)) { module[memo[25].tdc] = JPMT(26, JAxis3D(JVector3D(+0.000, +0.166, +0.111), JVersor3D(+0.000, +0.832, +0.555))); }
616  if (memo.has(26)) { module[memo[26].tdc] = JPMT(27, JAxis3D(JVector3D(+0.144, +0.083, +0.111), JVersor3D(+0.720, +0.416, +0.555))); }
617  if (memo.has(27)) { module[memo[27].tdc] = JPMT(28, JAxis3D(JVector3D(+0.144, -0.083, +0.111), JVersor3D(+0.720, -0.416, +0.555))); }
618  if (memo.has(28)) { module[memo[28].tdc] = JPMT(29, JAxis3D(JVector3D(+0.000, -0.166, +0.111), JVersor3D(+0.000, -0.832, +0.555))); }
619  if (memo.has(29)) { module[memo[29].tdc] = JPMT(30, JAxis3D(JVector3D(-0.144, -0.083, +0.111), JVersor3D(-0.720, -0.416, +0.555))); }
620  if (memo.has(30)) { module[memo[30].tdc] = JPMT(31, JAxis3D(JVector3D(-0.144, +0.083, +0.111), JVersor3D(-0.720, +0.416, +0.555))); }
621 
622  return module;
623  }
Data structure for a composite optical module.
Definition: JModule.hh:47
void setLocation(const JModuleLocation &location)
Set location.
Data structure for PMT geometry and calibration.
Definition: JPMT.hh:52
void setID(const int id)
Set identifier.
Definition: JObjectID.hh:65
bool has(const int index) const
Test whether index is available.
const JModule& JDETECTOR::getModule ( const int  id,
const JModuleLocation location = JModuleLocation() 
)
inline

Get module corresponding to Antares storey.

Parameters
idmodule identifier
locationmodule location
Returns
module

Definition at line 633 of file JDetectorToolkit.hh.

635  {
636  using JTOOLS::PI;
637 
638  static JModule module;
639 
640  module.setID(id);
641 
642  module.setLocation(location);
643 
644  if (module.empty()) {
645 
646  module.resize(3);
647 
648  const double R = 0.5; // [m]
649 
650  const double st = sin(0.75*PI);
651  const double ct = cos(0.75*PI);
652 
653  for (int i = 0; i != 3; ++i) {
654 
655  const double phi = (2.0*PI*i) / 3.0;
656  const double cp = cos(phi);
657  const double sp = sin(phi);
658 
659  module[i] = JPMT(i, JAxis3D(JVector3D(R*st*cp, R*st*sp, R*ct), JVersor3D(st*cp, st*sp, ct)));
660  }
661  }
662 
663  return module;
664  }
Data structure for a composite optical module.
Definition: JModule.hh:47
static const double PI
Constants.
Definition: JConstants.hh:20
void setLocation(const JModuleLocation &location)
Set location.
Data structure for PMT geometry and calibration.
Definition: JPMT.hh:52
void setID(const int id)
Set identifier.
Definition: JObjectID.hh:65
std::string JDETECTOR::getModuleLabel ( const JModuleLocation location)
inline

Get module label (DU-floor) for JMonitor applications.

Parameters
locationmodule location

Definition at line 672 of file JDetectorToolkit.hh.

672  {
673  using namespace std;
674  ostringstream os;
675  os << "DU" << setfill('0') << setw(3) << location.getString();
676  os << "F" << setfill('0') << setw(2) << location.getFloor();
677  return os.str();
678  }
int getFloor() const
Get floor number.
int getString() const
Get string number.
std::vector<std::string> JDETECTOR::getDetectorVersions ( const JType< std::string > &  type)
inline

Get detector versions.

Note that the order of the versions is descending.

Parameters
typetype
Returns
versions

Definition at line 190 of file JDetectorVersion.hh.

191  {
193 
194  for (JPutDetectorVersion::const_reverse_iterator i = putDetectorVersion.rbegin(); i != putDetectorVersion.rend(); ++i) {
195  buffer.push_back(i->second);
196  }
197 
198  return buffer;
199  }
static const JPutDetectorVersion putDetectorVersion(getDetectorVersion)
Function object to map detector version to detector variant.
std::vector<JDetectorVersion::JVersion_t> JDETECTOR::getDetectorVersions ( const JType< JDetectorVersion::JVersion_t > &  type)
inline

Get detector versions.

Note that the order of the versions is descending.

Parameters
typetype
Returns
versions

Definition at line 210 of file JDetectorVersion.hh.

211  {
213 
214  for (JPutDetectorVersion::const_reverse_iterator i = putDetectorVersion.rbegin(); i != putDetectorVersion.rend(); ++i) {
215  buffer.push_back(i->first);
216  }
217 
218  return buffer;
219  }
static const JPutDetectorVersion putDetectorVersion(getDetectorVersion)
Function object to map detector version to detector variant.
template<class T >
std::vector<T> JDETECTOR::getDetectorVersions ( )
inline

Get detector versions.

Returns
versions

Definition at line 228 of file JDetectorVersion.hh.

229  {
230  return getDetectorVersions(JType<T>());
231  }
std::vector< std::string > getDetectorVersions(const JType< std::string > &type)
Get detector versions.
template<class JAttributes_t >
void JDETECTOR::setAttributes ( const JModule first,
const JModule second,
JAttributes_t &  attributes 
)

Template method to set module attributes.

This method should be overloaded for each type of module attributes.

Parameters
firstfirst module
secondsecond module
attributesmodule attributes
template<>
void JDETECTOR::setAttributes< JNullType > ( const JModule first,
const JModule second,
JNullType &  attributes 
)

Template specialisation to set no attributes for the default empty object.

Parameters
firstfirst module
secondsecond module
attributesmodule attributes

Definition at line 48 of file JModuleMapper.hh.

51  {}
std::vector<std::string> JDETECTOR::getPMTStatusBits ( const JType< std::string > &  type)
inline

Get PMT status bits.

Parameters
typetype
Returns
status bits

Definition at line 380 of file JPMT.hh.

381  {
383 
384  for (JPutPMTStatusBit::const_iterator i = putPMTStatusBit.begin(); i != putPMTStatusBit.end(); ++i) {
385  buffer.push_back(i->second);
386  }
387 
388  return buffer;
389  }
static const JPutPMTStatusBit putPMTStatusBit(getPMTStatusBit)
Function object to map PMT status bit to key.
std::vector<JPMT::JPMTStatusBits_t> JDETECTOR::getPMTStatusBits ( const JType< JPMT::JPMTStatusBits_t > &  type)
inline

Get PMT status bits.

Parameters
typetype
Returns
status bits

Definition at line 398 of file JPMT.hh.

399  {
401 
402  for (JPutPMTStatusBit::const_iterator i = putPMTStatusBit.begin(); i != putPMTStatusBit.end(); ++i) {
403  buffer.push_back(i->first);
404  }
405 
406  return buffer;
407  }
static const JPutPMTStatusBit putPMTStatusBit(getPMTStatusBit)
Function object to map PMT status bit to key.
template<class T >
std::vector<T> JDETECTOR::getPMTStatusBits ( )
inline

Get PMT status bits.

Returns
status bits

Definition at line 416 of file JPMT.hh.

417  {
418  return getPMTStatusBits(JType<T>());
419  }
std::vector< std::string > getPMTStatusBits(const JType< std::string > &type)
Get PMT status bits.
Definition: JPMT.hh:380
bool JDETECTOR::operator< ( const JPMTIdentifier first,
const JPMTIdentifier second 
)
inline

Less than operator for PMT identifiers.

Parameters
firstPMT identifier
secondPMT identifier
Returns
true if first PMT lower than second PMT; else false

Definition at line 153 of file JPMTIdentifier.hh.

154  {
155  if (first.getModuleID() == second.getModuleID())
156  return first.getPMTAddress() < second.getPMTAddress();
157  else
158  return first.getModuleID() < second.getModuleID();
159  }
int getModuleID() const
Get module identifier.
int getPMTAddress() const
Get PMT identifier (= TDC).
bool JDETECTOR::operator== ( const JPMTIdentifier first,
const JPMTIdentifier second 
)
inline

Equal operator for PMT identifiers.

Parameters
firstPMT identifier
secondPMT identifier
Returns
true if first PMT equal second PMT; else false

Definition at line 169 of file JPMTIdentifier.hh.

170  {
171  return (first.getModuleID() == second.getModuleID() &&
172  first.getPMTAddress() == second.getPMTAddress());
173  }
int getModuleID() const
Get module identifier.
int getPMTAddress() const
Get PMT identifier (= TDC).
double JDETECTOR::getSurvivalProbability ( const JPMTParameters parameters)
inline

Probability that a one photo-electron hit survives the simulation of the PMT assuming QE = 1.

Parameters
parametersPMT parameters
Returns
probability

Definition at line 32 of file JPMTParametersToolkit.hh.

33  {
34  JPMTParameters data = parameters;
35  const int NPE = 1;
36 
37  data.QE = 1.0;
38 
40  }
virtual double getSurvivalProbability(const int NPE) const
Probability that a hit survives the simulation of the PMT.
Data structure for PMT parameters.
double QE
relative quantum efficiency
double JDETECTOR::getHitProbability ( const double  QE,
const double  mu 
)
inline

Get ratio of hit probabilities for given QE and expectation value of the number of photo-electrons.


The ratio corresponds to the hit probability with given QE divided by that with QE = 1.
The expectation value is defined for a two-fold (or higher) coincidence.

Parameters
QEQE
muexpectation value
Returns
ratio

Definition at line 52 of file JPMTParametersToolkit.hh.

53  {
54  if (mu > 0.0)
55  return (1.0 - exp(-QE*mu)) / (1.0 - exp(-mu));
56  else
57  return QE;
58  }
double JDETECTOR::getMaximalHitProbability ( const double  mu)
inline

Get maximal ratio of hit probabilities for given QE and expectation value of the number of photo-electrons.


The ratio corresponds to the hit probability with infinite QE divided by that with QE = 1.
The expectation value is defined for a two-fold (or higher) coincidence.

Parameters
muexpectation value
Returns
ratio

Definition at line 69 of file JPMTParametersToolkit.hh.

70  {
71  using namespace std;
72 
73  if (mu > 0.0)
74  return 1.0 / (1.0 - exp(-mu));
75  else
76  return numeric_limits<double>::max();
77  }
double JDETECTOR::getQE ( const double  R,
const double  mu 
)
inline

Get QE for given ratio of hit probabilities and expectation value of the number of photo-electrons.


The ratio corresponds to the hit probability with given QE divided by that with QE = 1.
The expectation value is defined for a two-fold (or higher) coincidence.

Parameters
Rratio
muexpectation value
Returns
QE

Definition at line 89 of file JPMTParametersToolkit.hh.

90  {
91  if (R < getMaximalHitProbability(mu)) {
92 
93  if (mu > 0.0)
94  return -log(1.0 - R*(1.0 - exp(-mu))) / mu;
95  else
96  return R;
97 
98  } else {
99 
100  THROW(JValueOutOfRange, "Inconsistent arguments at method getQE(" << R << "," << mu <<")");
101  }
102  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:633
double getMaximalHitProbability(const double mu)
Get maximal ratio of hit probabilities for given QE and expectation value of the number of photo-elec...
bool JDETECTOR::operator< ( const JPhotoElectron first,
const JPhotoElectron second 
)
inline

Less than operator for photo-elecrons.

Parameters
firstfirst photo-electron
secondsecond photo-electron
Returns
true if first photo-electron earlier than second; else false

Definition at line 67 of file JPMTSimulator.hh.

68  {
69  return first.t_ns < second.t_ns;
70  }
bool JDETECTOR::operator< ( const JPMTSignal first,
const JPMTSignal second 
)
inline

Less than operator for PMT signals.

Parameters
firstfirst PMT signal
secondsecond PMT signal
Returns
true if first PMT signal earlier than second; else false

Definition at line 111 of file JPMTSimulator.hh.

112  {
113  return first.t_ns < second.t_ns;
114  }
double t_ns
time [ns]
bool JDETECTOR::operator< ( const JPMTPulse first,
const JPMTPulse second 
)
inline

Less than operator for PMT pulses.

Parameters
firstfirst PMT pulse
secondsecond PMT pulse
Returns
true if first PMT pulse earlier than second; else false

Definition at line 155 of file JPMTSimulator.hh.

156  {
157  return first.t_ns < second.t_ns;
158  }
double t_ns
time [ns]
JTimeRange JDETECTOR::getTimeRange ( const JModuleData input)
inline

Get time range (i.e.

earlist and latest hit time) of module data.

Parameters
inputmodule data
Returns
time range

Definition at line 282 of file JPMTSimulator.hh.

283  {
284  JTimeRange timeRange(JTimeRange::DEFAULT_RANGE);
285 
286  for (JModuleData::const_iterator frame = input.begin(); frame != input.end(); ++frame) {
287  for (JModuleData::value_type::const_iterator hit = frame->begin(); hit != frame->end(); ++hit) {
288  timeRange.include(hit->t_ns);
289  }
290  }
291 
292  return timeRange;
293  }
JRange< double > JTimeRange
Type definition for time range.

Variable Documentation

const char* const JDETECTOR::GENDET_DETECTOR_FILE_FORMAT = ".det"
static

File name extensions.

file format used by gendet

Definition at line 60 of file JDetectorToolkit.hh.

const char* const JDETECTOR::BINARY_DETECTOR_FILE_FORMAT = ".dat"
static

JIO binary file format.

Definition at line 61 of file JDetectorToolkit.hh.

const char* const JDETECTOR::KM3NET_DETECTOR_FILE_FORMAT = ".detx"
static

KM3NeT standard ASCII format.

Definition at line 62 of file JDetectorToolkit.hh.

const char* const JDETECTOR::ZIPPED_DETECTOR_FILE_FORMAT = ".gz"
static

zipped KM3NeT standard ASCII format

Definition at line 63 of file JDetectorToolkit.hh.

const char* const JDETECTOR::GDML_DETECTOR_FILE_FORMAT = ".xml"
static

KM3Sim input format.

Definition at line 64 of file JDetectorToolkit.hh.

const JGetDetectorVersion JDETECTOR::getDetectorVersion
static

Function object to map detector variant to detector version.

Definition at line 173 of file JDetectorVersion.hh.

const JPutDetectorVersion JDETECTOR::putDetectorVersion(getDetectorVersion)
static

Function object to map detector version to detector variant.

const int JDETECTOR::LED_BEACON_PMT_TYPE = 2
static

PMT type of LED beacon.

Definition at line 37 of file JMonteCarloDetector.hh.

const JGetPMTStatusBit JDETECTOR::getPMTStatusBit
static

Function object to map key to PMT status bit.

Definition at line 365 of file JPMT.hh.

const JPutPMTStatusBit JDETECTOR::putPMTStatusBit(getPMTStatusBit)
static

Function object to map PMT status bit to key.

const double JDETECTOR::TIME_OVER_THRESHOLD_NS = 26.4

Specification for time-over-threshold corresponding to a one photo-electron pulse.

Definition at line 26 of file JPMTAnalogueSignalProcessor.hh.

const JTransitionTimeGenerator JDETECTOR::getTransitionTime
static

Function object to generate transition time.

Definition at line 1071 of file JPMTTransitTimeGenerator.hh.

const JTransitionTimeProbability JDETECTOR::getTransitionTimeProbability
static

Function object of transition time prabability.

Definition at line 1046 of file JPMTTransitTimeProbability.hh.

const JTransitionTimeProbability2D JDETECTOR::getTransitionTimeProbability2D
static

Function object of twofold transition time prabability.

Definition at line 1096 of file JPMTTransitTimeProbability.hh.