1 #ifndef __JDETECTOR__JMONTECARLODETECTOR__ 
    2 #define __JDETECTOR__JMONTECARLODETECTOR__ 
   91         iterator p = this->begin();
 
   93         for ( ; 
n != 0; --
n, ++p)
 
  203         iterator p = this->begin();
 
  205         for ( ; 
n != 0; --
n, ++p)
 
  240                         const int __pmt_id) :
 
  296       for (
string key, buffer; in >> 
key; ) {
 
  300           OMaddress.push_back(
OM(in));
 
  302         else if (
key == 
"OM_cluster:")
 
  306         else if (
key == 
"OM_position:")
 
  310         else if (
key == 
"string:")
 
  312           DetectorString.push_back(
String(in));
 
  314         else if (
key == 
"OM_cluster_data:")
 
  318         else if (
key == 
"LCM_logic:")
 
  334         const int lcm_id = i->getID();
 
  336         for (LCM_logic::const_iterator 
j = i->begin(); 
j != i->end(); ++
j) {
 
  339           const int pmt_id = 
distance(i->begin(),
j) + 1;
 
  348       sort(OMaddress      .begin(), OMaddress      .end());
 
  349       sort(OMcluster      .begin(), OMcluster      .end());
 
  350       sort(OMposition     .begin(), OMposition     .end());
 
  351       sort(DetectorString .begin(), DetectorString .end());
 
  352       sort(LCMreverselogic.begin(), LCMreverselogic.end());
 
  363       for (OMclusterIterator  = OMcluster.begin(); 
 
  364            OMclusterIterator != OMcluster.end(); 
 
  365            OMclusterIterator++) {
 
  367         StringIterator = 
find(DetectorString.begin(),
 
  368                               DetectorString.end(),
 
  369                               OMclusterIterator->string_id);
 
  371         if (StringIterator != DetectorString.end()) {
 
  373           const JLocation location(StringIterator->getID(), -1);
 
  375           for (addressIterator  = OMclusterIterator->begin(); 
 
  376                addressIterator != OMclusterIterator->end(); 
 
  379             OMIterator = 
find(OMaddress.begin(),
 
  383             if (OMIterator != OMaddress.end()) {
 
  385               OMpositionIterator = 
find(OMposition.begin(),
 
  387                                         OMIterator->address);
 
  389               if (OMpositionIterator != OMposition.end()) {
 
  393                 double ct = cos(StringIterator->twist * 
PI / 180.0);
 
  394                 double st = sin(StringIterator->twist * 
PI / 180.0);
 
  396                 double x  =  ct * OMpositionIterator->x - st * OMpositionIterator->y;
 
  397                 double y  =  st * OMpositionIterator->x + ct * OMpositionIterator->y;
 
  400                                  StringIterator->y + 
y,
 
  401                                  StringIterator->z + OMpositionIterator->z + OMclusterIterator->z);
 
  404                                           StringIterator->twist * 
PI / 180.0 + OMpositionIterator->phi));
 
  406                 int lcm_id  = OMclusterIterator->getID();
 
  407                 int pmt_id  = OMIterator->address;
 
  412                                                                      LCMreverselogic.end(), 
 
  413                                                                      OMIterator->getID());
 
  415                   if (p != LCMreverselogic.end()) {
 
  421                 detector.
put(lcm_id, pmt_id - 1, location, 
JPMT(OMIterator->getID(), 
JAxis3D(pos, dir)));
 
  431       for (OMclusterdataIterator  = OMclusterdata.begin(); 
 
  432            OMclusterdataIterator != OMclusterdata.end(); 
 
  433            OMclusterdataIterator++) {
 
  436                                OMclusterdataIterator->y,
 
  437                                OMclusterdataIterator->z);
 
  440                                              OMclusterdataIterator->phi,
 
  441                                              OMclusterdataIterator->psi));
 
  443         OMclusterIterator = 
find(OMcluster.begin(),
 
  445                                  OMclusterdataIterator->getID());
 
  447         if (OMclusterIterator != OMcluster.end()) {
 
  449           const JLocation location(OMclusterIterator->string_id, -1);
 
  451           for (addressIterator  = OMclusterIterator->begin(); 
 
  452                addressIterator != OMclusterIterator->end(); 
 
  455             OMIterator = 
find(OMaddress.begin(),
 
  459             if (OMIterator != OMaddress.end()) {
 
  461               OMpositionIterator = 
find(OMposition.begin(),
 
  463                                         OMIterator->address);
 
  465               if (OMpositionIterator != OMposition.end()) {
 
  468                                  OMpositionIterator->y,
 
  469                                  OMpositionIterator->z);
 
  472                                           OMpositionIterator->phi));
 
  479                 int lcm_id  = OMclusterIterator->getID();
 
  480                 int pmt_id  = OMIterator->address;
 
  485                                                                      LCMreverselogic.end(), 
 
  486                                                                      OMIterator->getID());
 
  488                   if (p != LCMreverselogic.end()) {
 
  494                 detector.
put(lcm_id, pmt_id - 1, location, 
JPMT(OMIterator->getID(), 
JAxis3D(pos, dir)));
 
  508       for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
 
  510         if (module->getString() != 
string) {
 
  511           string = module->getString();
 
  515         module->setLocation(
JLocation(
string,++floor));
 
  544                    const int        pmtAddress,
 
  548       JDetector::iterator p = std::lower_bound(this->begin(), this->end(), moduleID);
 
  550       if (p == this->end() || p->getID() != moduleID) {
 
  552         JModule module(moduleID, location);
 
  554         module.resize(pmtAddress + 1);
 
  556         module[pmtAddress] = pmt;
 
  560         this->insert(p, module);
 
  568         for (JModule::const_iterator i = p->begin(); i != p->end(); ++i) {
 
  574         if (pmtAddress + 1 > (
int) p->size()) {
 
  575           p->resize(pmtAddress + 1);
 
  583           P.
sub(p->at(pmtAddress).getPosition());
 
  590         p->at(pmtAddress) = pmt;
 
  606     static T 
find(T __begin, T __end, 
const int id) 
 
  608       T i = std::lower_bound(__begin, __end, 
id);
 
  610       if (i != __end && *i != 
id)
 
Data structure for detector geometry and calibration.
 
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
 
Logical location of module.
 
Data structure for a composite optical module.
 
Auxiliary class for LCM logic parameters.
 
LCM_logic(std::istream &in)
Constructor.
 
int lcm_id
LCM identifier.
 
int string_id
string identifier
 
Auxiliary class for LCM logic parameters.
 
int pmt_id
PMT identifier.
 
LCM_reverse_logic()
Default constructor.
 
int lcm_id
LCM identifier.
 
LCM_reverse_logic(const int __id, const int __lcm_id, const int __pmt_id)
Constructor.
 
Auxiliary class for OM cluster data.
 
OM_cluster_data(std::istream &in)
Constructor.
 
Auxiliary class for OM cluster parameters.
 
int string_id
string identifier
 
OM_cluster(std::istream &in)
Constructor.
 
Auxiliary class for OM position.
 
double theta
zenit angle of orientation
 
double phi
azimuth angle of orientation
 
OM_position(std::istream &in)
Constructor.
 
OM(std::istream &in)
Constructor.
 
int serialNumber
PMT serial number.
 
Auxiliary class for string parameters.
 
String(std::istream &in)
Constructor.
 
double tOffset
time offset
 
double twistRate
twist rate
 
Monte Carlo detector (i.e. ".det" file).
 
JMonteCarloDetector(const bool useLogic)
Constructor.
 
void setUseLogic(const bool useLogic)
Set usage of logic.
 
static T find(T __begin, T __end, const int id)
Binary search method.
 
JDetector & put(const int moduleID, const int pmtAddress, const JLocation &location, const JPMT &pmt)
Set PMT.
 
friend std::istream & operator>>(std::istream &in, JMonteCarloDetector &detector)
Read detector from input.
 
JMonteCarloDetector()
Default constructor.
 
static bool compare(const JModule &first, const JModule &second)
Module comparator.
 
Data structure for PMT geometry, calibration and status.
 
Data structure for angles in three dimensions.
 
Data structure for direction in three dimensions.
 
JDirection3D & transform(const JMatrix3D &T)
Transform.
 
Data structure for Euler angles in three dimensions.
 
Data structure for position in three dimensions.
 
void setPosition(const JVector3D &pos)
Set position.
 
const JPosition3D & getPosition() const
Get position.
 
void transform(const JRotation3D &R, const JVector3D &pos)
Transform position.
 
JVector3D & add(const JVector3D &vector)
Add vector.
 
JVector3D & div(const double factor)
Scale vector.
 
JVector3D & sub(const JVector3D &vector)
Subtract vector.
 
JVector3D & mul(const double factor)
Scale vector.
 
Auxiliary class for object identification.
 
int getID() const
Get identifier.
 
file Auxiliary data structures and methods for detector calibration.
 
static const int LED_BEACON_PMT_TYPE
PMT type of LED beacon.
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
 
const JObjectID & getUndefinedObjectID()
Get undefined object identifier.
 
static const double PI
Mathematical constants.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).