/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
PmtGeomInfoSvc Class Reference

#include <PmtGeomInfoSvc.h>

Inheritance diagram for PmtGeomInfoSvc:
Inheritance graph
[legend]
Collaboration diagram for PmtGeomInfoSvc:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PmtGeomInfoSvc (const std::string &name, ISvcLocator *svc)
 ~PmtGeomInfoSvc ()
virtual StatusCode initialize ()
virtual StatusCode reinitialize ()
virtual StatusCode finalize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
IPmtGeomInfoget (std::string structure_path)
 IPmtGeomInfoSvc interface.
IPmtGeomInfoget (IDetectorElement *pmtde)
 Look up by DetectorElement.
IPmtGeomInfoget (unsigned int pmtid)
 Look up by fully qualified PMT id (see Conventions/Detectors.h)

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Types

typedef std::map< unsigned int,
IPmtGeomInfo * > 
MapByInt
typedef std::map< std::string,
IPmtGeomInfo * > 
MapByString
typedef std::map
< IDetectorElement
*, IPmtGeomInfo * > 
MapByDE

Private Member Functions

IPmtGeomInfoadd (unsigned int pmtid, const std::string &path, IDetectorElement *de)
IPmtGeomInfofind (unsigned int pmtid, IDetectorElement *de)
IDetectorElement * findParent (unsigned int pmtid, IDetectorElement *currentDE)

Private Attributes

std::vector< std::string > m_StreamItems
 Property: StreamItems.
std::vector< IDetectorElement * > m_topDEs
std::string m_SiteIdUserParameter
 Property: SiteIdUserParameter.
std::string m_DetectorIdUserParameter
 Property: DetectorIdUserParameter.
std::string m_PmtIdUserParameter
 Property: PmtIdUserParameter.
bool m_enableSabGeometry
 Property: EnableSabGeometry.
MapByInt m_byId
MapByString m_byPath
MapByDE m_byDE
IDataProviderSvc * m_detSvc
IDetectorElement * m_detector

Detailed Description

Definition at line 28 of file PmtGeomInfoSvc.h.


Member Typedef Documentation

typedef std::map<unsigned int,IPmtGeomInfo*> PmtGeomInfoSvc::MapByInt [private]

Definition at line 87 of file PmtGeomInfoSvc.h.

typedef std::map<std::string,IPmtGeomInfo*> PmtGeomInfoSvc::MapByString [private]

Definition at line 89 of file PmtGeomInfoSvc.h.

typedef std::map<IDetectorElement*,IPmtGeomInfo*> PmtGeomInfoSvc::MapByDE [private]

Definition at line 91 of file PmtGeomInfoSvc.h.


Constructor & Destructor Documentation

PmtGeomInfoSvc::PmtGeomInfoSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Definition at line 16 of file PmtGeomInfoSvc.cc.

    : Service(name,svc)
    , m_detSvc(0)
    , m_detector(0)
{
    declareProperty("SiteIdUserParameter",m_SiteIdUserParameter="SiteID",
                    "Name of the user parameter attached to Site detector "
                    "elements that gives the packed Site ID number.");
    declareProperty("DetectorIdUserParameter", 
                    m_DetectorIdUserParameter="DetectorID",
                    "Name of the user parameter attached to Detector "
                    "detector elements that gives the fully qualified "
                    "packed Detector ID.");
    declareProperty("PmtIdUserParameter",m_PmtIdUserParameter="PmtID",
                    "Name of the user parameter attached to PMT detector "
                    "elements that gives the fully qualified packed PMT ID");
    std::vector<std::string> defaultStreamItems;
    defaultStreamItems.push_back("/dd/Structure/DayaBay");
    declareProperty("StreamItems",m_StreamItems=defaultStreamItems,
                    "List of top level Detector Elements.");
    declareProperty("EnableSabGeometry",m_enableSabGeometry=true,
                    "Workaround to allow for non-existent SAB geometry");
}
PmtGeomInfoSvc::~PmtGeomInfoSvc ( )

Definition at line 40 of file PmtGeomInfoSvc.cc.

{
}

Member Function Documentation

virtual StatusCode PmtGeomInfoSvc::initialize ( ) [virtual]
virtual StatusCode PmtGeomInfoSvc::reinitialize ( ) [virtual]
virtual StatusCode PmtGeomInfoSvc::finalize ( ) [virtual]
virtual StatusCode PmtGeomInfoSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
) [virtual]
IPmtGeomInfo * PmtGeomInfoSvc::get ( std::string  structure_path) [virtual]

IPmtGeomInfoSvc interface.

Look up by TDS path of detector element.

Look up by TDS path of detector element

Implements IPmtGeomInfoSvc.

Definition at line 98 of file PmtGeomInfoSvc.cc.

{
    //nomsg MsgStream msg(msgSvc(),name());
    //nomsg msg << MSG::DEBUG << "PmtGeomInfoSvc::get(path "<<structure_path<<")" << endreq;

    IPmtGeomInfo* pmtinfo = m_byPath[structure_path];
    if (pmtinfo) return pmtinfo;

    SmartDataPtr<IDetectorElement> obj(m_detSvc,structure_path);
    if (!obj) return 0;

    unsigned int pmtid = obj->params()->param<int>(m_PmtIdUserParameter);
    if (!pmtid) return 0;
    
    return this->add(pmtid,structure_path,obj);
}
IPmtGeomInfo * PmtGeomInfoSvc::get ( IDetectorElement *  pmtde) [virtual]

Look up by DetectorElement.

Implements IPmtGeomInfoSvc.

Definition at line 116 of file PmtGeomInfoSvc.cc.

{
    //nomsg MsgStream msg(msgSvc(),name());
    //nomsg msg << MSG::DEBUG << "PmtGeomInfoSvc::get(IDetectorElement "<<pmtde->name()<<")" << endreq;

    IPmtGeomInfo* pmtinfo = m_byDE[pmtde];
    if (pmtinfo) return pmtinfo;

    unsigned int pmtid = pmtde->params()->param<int>(m_PmtIdUserParameter);
    if (!pmtid) return 0;

    return this->add(pmtid,"",pmtde);
}
IPmtGeomInfo * PmtGeomInfoSvc::get ( unsigned int  pmtid) [virtual]

Look up by fully qualified PMT id (see Conventions/Detectors.h)

Implements IPmtGeomInfoSvc.

Definition at line 131 of file PmtGeomInfoSvc.cc.

{
    //nomsg MsgStream msg(msgSvc(),name());
    //nomsg msg << MSG::DEBUG << "PmtGeomInfoSvc::get(int "<<(void*)pmtid<<")" << endreq;
    

    /*
      algorithm: 

      * add site/detector values into high level detector elements in
      XML.

      * add isCompatible() method to Detectors.h, Returns true if bits
      * match, but not including fully zero'd bytes.

      * Search down /dd/Structure, check each DetectorElement for a
      * PmtID user parameter.  Failing that look for a DetectorID
      * parameter and if found check if value isCompatible() and
      * abandon branch if it isn't. Quit if DetectorElements are
      * exhausted or if one is found that matches the PMTID.

     */

    if(m_enableSabGeometry){
      // If site is SAB, use DYB near site instead.
      DayaBay::DetectorSensor sensor(pmtid);
      if(sensor.site() == Site::kSAB){
        static bool beenWarned = false;
        if(!beenWarned){
          //nomsg msg << MSG::WARNING << "Using Near site PMT positions for SAB"              << endreq;
          beenWarned = true;
        }
        DayaBay::DetectorSensor tempSensor(sensor.sensorId(),
                                           Site::kDayaBay,
                                           sensor.detectorId());
        pmtid = tempSensor.fullPackedData();
      }
    }

    // Have we seen you before?
    IPmtGeomInfo* pmtinfo = m_byId[pmtid];
    if (pmtinfo) {
        //nomsg msg << MSG::DEBUG << "Found "<< (void*)pmtid << ", seen before"<<endreq;
        return pmtinfo;
    }

    // Let's first do a quick check in the last detector we saw
    if (m_detector) {
        //nomsg msg << MSG::DEBUG << "Looking for "<< (void*)pmtid             << " in "<< m_detector->name() << endreq;
        pmtinfo = this->find(pmtid,m_detector);
        if (pmtinfo) {
            //nomsg msg << MSG::DEBUG << "Found "<< (void*)pmtid                << " after quick check"<<endreq;
            return pmtinfo;
        }
        m_detector = 0;
    }

    // No luck, do a full search starting from top level DEs
    for (size_t ind=0; ind<m_topDEs.size(); ++ind) {
        //nomsg msg << MSG::DEBUG << "Looking for "<< (void*)pmtid             << " in "<< m_topDEs[ind]->name() << endreq;
        pmtinfo = this->find(pmtid,m_topDEs[ind]);
        if (pmtinfo) {
            //nomsg msg << MSG::DEBUG << "Found "<< (void*)pmtid                << " after full search"<<endreq;
            return pmtinfo;
        }
    }
    //nomsg msg << MSG::DEBUG << "Failed to find PMT ID "<< (void*)pmtid << endreq;
    return 0;
}
IPmtGeomInfo* PmtGeomInfoSvc::add ( unsigned int  pmtid,
const std::string &  path,
IDetectorElement *  de 
) [private]
IPmtGeomInfo* PmtGeomInfoSvc::find ( unsigned int  pmtid,
IDetectorElement *  de 
) [private]
IDetectorElement* PmtGeomInfoSvc::findParent ( unsigned int  pmtid,
IDetectorElement *  currentDE 
) [private]
const InterfaceID & IPmtGeomInfoSvc::interfaceID ( ) [static, inherited]

Definition at line 3 of file IPmtGeomInfoSvc.cc.

                                                {

  static const InterfaceID m_IID("IPmtGeomInfoSvc", 1, 0);

  return m_IID;
}

Member Data Documentation

std::vector<std::string> PmtGeomInfoSvc::m_StreamItems [private]

Property: StreamItems.

List of top level Detector Elements. For simulation this should likely match GiGa's property of the same name.

Definition at line 57 of file PmtGeomInfoSvc.h.

std::vector<IDetectorElement*> PmtGeomInfoSvc::m_topDEs [private]

Definition at line 58 of file PmtGeomInfoSvc.h.

Property: SiteIdUserParameter.

Name of the user parameter attached to Site detector elements that gives the packed Site ID number. Default is "SiteID"

Definition at line 63 of file PmtGeomInfoSvc.h.

Property: DetectorIdUserParameter.

Name of the user parameter attached to Detector detector elements that gives the fully qualified packed Detector ID. Default is "DetectorID"

Definition at line 67 of file PmtGeomInfoSvc.h.

std::string PmtGeomInfoSvc::m_PmtIdUserParameter [private]

Property: PmtIdUserParameter.

Name of the user parameter attached to PMT detector elements that gives the fully qualified packed PMT ID. Default is "PmtID"

Definition at line 71 of file PmtGeomInfoSvc.h.

Property: EnableSabGeometry.

If true, use DYB near site PMT positions for processing SAB data. Default is "True"

Definition at line 75 of file PmtGeomInfoSvc.h.

Definition at line 88 of file PmtGeomInfoSvc.h.

Definition at line 90 of file PmtGeomInfoSvc.h.

Definition at line 92 of file PmtGeomInfoSvc.h.

IDataProviderSvc* PmtGeomInfoSvc::m_detSvc [private]

Definition at line 94 of file PmtGeomInfoSvc.h.

IDetectorElement* PmtGeomInfoSvc::m_detector [private]

Definition at line 97 of file PmtGeomInfoSvc.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:56:27 for DetHelpers by doxygen 1.7.4