1 #ifndef __JDETECTOR__JDETECTOR__
2 #define __JDETECTOR__JDETECTOR__
94 public JMultiEquals<JDetector, JTYPELIST<JDetectorID, JVersion>::typelist>,
172 return setVersion(getLatestDetectorVersion<JDetectorVersion::JVersion_t>());
183 for (iterator module = this->begin(); module != this->end(); ++module) {
184 module->getStatus().set(bit);
196 for (iterator module = this->begin(); module != this->end(); ++module) {
197 module->getStatus().reset(bit);
209 for (iterator module = this->begin(); module != this->end(); ++module) {
210 for (JModule::iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
211 pmt->getStatus().set(bit);
224 for (iterator module = this->begin(); module != this->end(); ++module) {
225 for (JModule::iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
226 pmt->getStatus().reset(bit);
240 for (iterator i = begin(); i != end(); ++i) {
256 for (iterator i = begin(); i != end(); ++i) {
272 return at(address.
first);
284 return at(address.
first);
296 for (JDetector::const_iterator module = this->begin(); module != this->end(); ++module) {
297 if (module->getLocation() == location) {
314 for (JDetector::const_iterator module = this->begin(); module != this->end(); ++module) {
315 if (module->getLocation() == location) {
332 for (JDetector::iterator module = this->begin(); module != this->end(); ++module) {
333 if (module->getLocation() == location) {
386 int number_of_modules;
392 catch(std::exception&) {}
400 in >> number_of_modules;
406 istringstream(buffer) >> number_of_modules;
410 for (
JModule module; number_of_modules != 0 && in >> module; --number_of_modules) {
411 detector.push_back(module);
433 setFormat<JPosition3D> (
JFormat_t( 9, 3, std::ios::fixed | std::ios::showpos));
434 setFormat<JDirection3D> (
JFormat_t( 9, 6, std::ios::fixed | std::ios::showpos));
435 setFormat<JQuaternion3D>(
JFormat_t( 9, 6, std::ios::fixed | std::ios::showpos));
436 setFormat<JCalibration> (
JFormat_t(10, 3, std::ios::fixed | std::ios::showpos));
442 out << static_cast<const JDetectorID&>(detector);
448 out << static_cast<const JDetectorVersion&>(detector) << endl;
449 out << static_cast<const JDetectorHeader&> (detector) << endl;
457 out << detector.size() << endl;
459 for (const_iterator i = detector.begin(); i != detector.end(); ++i) {
499 int number_of_modules;
504 in >> number_of_modules;
507 this->resize(number_of_modules);
509 for (JDetector::iterator out = this->begin(); number_of_modules != 0; --number_of_modules, ++out) {
536 for (JComment::const_iterator i = this->
comment.begin(); i != this->comment.end(); ++i) {
546 const int number_of_modules = this->size();
548 out << static_cast<const JDetectorID&> (*
this);
549 out << static_cast<const JDetectorVersion&>(*
this);
550 out << static_cast<const JDetectorHeader&> (*
this);
551 out << number_of_modules;
553 for (const_iterator module = this->begin(); module != this->end(); ++module) {
616 return start_of_comment;
Data structure for detector version.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Data structure for optical module.
Data structure for PMT geometry and calibration.
STD extensions for binary I/O.
bool setVersion(const JDetectorVersion::JVersion_t &version, const bool force=false)
Set version.
void resetPMTStatus(const int bit)
Reset status of all PMTs.
static const size_t LENGTH_START_OF_COMMENT
Length of start of comment in binary I/O.
const JModule & getModule(const JModuleAddress &address) const
Get module parameters.
start_of_comment_type
Enumeration for different lengths of start of comment in binary I/O.
const JPMT & getPMT(const JPMTAddress &address) const
Get PMT parameters.
void resetModuleStatus(const int bit)
Reset status of all modules.
void setPMTStatus(const int bit)
Set status of all PMTs.
friend std::ostream & operator<<(std::ostream &out, const JDetector &detector)
Write detector to output.
static start_of_comment_type getStartOfComment()
Get option for short start of comment in binary I/O.
JModule & getModule(const JLocation &location)
Get module parameters.
static void setStartOfComment(const start_of_comment_type option)
Set option for short start of comment in binary I/O.
JDetector & operator-=(const JVector3D &pos)
Move detector elements.
virtual JWriter & write(JWriter &out) const override
Write to output.
const JModule & getModule(const JLocation &location) const
Get module parameters.
void setVersion(const JVersion &version)
Set version.
void setModuleStatus(const int bit)
Set status of all modules.
JDetector(const JDetectorID &id, const JVersion &version, const JDetectorHeader &header)
Constructor.
static start_of_comment_type & get_start_of_comment()
Get option for short start of comment in binary I/O.
bool hasModule(const JLocation &location) const
Check availability of module parameters.
void setVersion() const
Set version.
friend std::istream & operator>>(std::istream &in, JDetector &detector)
Read detector from input.
virtual JReader & read(JReader &in) override
Read from input.
JDetector & operator+=(const JVector3D &pos)
Move detector elements.
JDetector()
Default constructor.
JModule & getModule(const JModuleAddress &address)
Get module parameters.
bool setToLatestVersion()
Set to latest version.
JPMT & getPMT(const JPMTAddress &address)
Get PMT parameters.
Logical location of module.
Address of module in detector data structure.
int first
index of module in detector data structure
Data structure for a composite optical module.
static void setVersion(const JVersion &version)
Set detector version.
Address of PMT in detector data structure.
int second
index of PMT in module data structure.
Data structure for PMT geometry, calibration and status.
static void setVersion(const JVersion &version)
Set detector version.
Data structure for vector in three dimensions.
Interface for binary input.
Forward declaration of binary output.
Interface for binary output.
Exception for accessing an index in a collection that is outside of its range.
Auxiliary class for object identification.
JUTMPosition & sub(const JUTMPosition &pos)
Subtract UTM position.
JUTMPosition & add(const JUTMPosition &pos)
Add UTM position.
file Auxiliary data structures and methods for detector calibration.
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
static const JPutDetectorVersion putDetectorVersion(getDetectorVersion)
Function object to map numerical value to detector version.
JLANG::JObjectID JDetectorID
Type definition of detector identifier.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JDetectorVersion()
Default constructor.
JVersion_t
Enumeration of version types.
@ V3
Version with PMT status field and comments.
Auxiliary class for version identifier.
void setVersion(const std::string &version)
Set version.
const std::string & getVersion() const
Get version.
Template definition of auxiliary base class for data structures composed of multiple base classes wit...
Auxiliary class for recursive type list generation.