/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 | Protected Attributes | Private Member Functions | Private Attributes
PmtId2PosSvc Class Reference

#include <PmtId2PosSvc.h>

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

List of all members.

Public Member Functions

 PmtId2PosSvc (const std::string &name)
virtual ~PmtId2PosSvc ()
bool initialize ()
bool finalize ()
const TVector3 & hitPosition (PhyEvent *evt, int index)
const std::vector< TVector3 > hitPositions (PhyEvent *evt)
const std::string & name ()
bool setOption (const std::string &option, Type &var)

Protected Attributes

std::string m_name

Private Member Functions

void init (PhyEvent *evt)

Private Attributes

bool m_notReady
TVector3 m_hits [2][9][32][2]
std::string m_ifile

Detailed Description

Definition at line 9 of file PmtId2PosSvc.h.


Constructor & Destructor Documentation

PmtId2PosSvc::PmtId2PosSvc ( const std::string &  name)

Definition at line 9 of file PmtId2PosSvc.cc.

    : SvcBase(name),
      m_notReady(true)
{
    setOption("DataFile", m_ifile);
}
PmtId2PosSvc::~PmtId2PosSvc ( ) [virtual]

Definition at line 16 of file PmtId2PosSvc.cc.

{
}

Member Function Documentation

bool PmtId2PosSvc::initialize ( ) [virtual]

Implements SvcBase.

Definition at line 20 of file PmtId2PosSvc.cc.

{
    return true;
}
bool PmtId2PosSvc::finalize ( ) [virtual]

Implements SvcBase.

Definition at line 25 of file PmtId2PosSvc.cc.

{
    return true;
}
const TVector3 & PmtId2PosSvc::hitPosition ( PhyEvent evt,
int  index 
)

Definition at line 30 of file PmtId2PosSvc.cc.

{
    if ( m_notReady ) init(evt);

    CalibReadout* calib = evt->get<CalibReadout>("Event/CalibReadout/CalibReadoutHeader");

    return m_hits[evt->m_det-5][calib->wallNumber[index]-1][calib->wallSpot[index]-1][calib->inwardFacing[index]];
}
const std::vector< TVector3 > PmtId2PosSvc::hitPositions ( PhyEvent evt)

Definition at line 39 of file PmtId2PosSvc.cc.

{
    if ( m_notReady ) init(evt);

    std::vector<TVector3> vHits;
    CalibReadout* calib = evt->get<CalibReadout>("Event/CalibReadout/CalibReadoutHeader");

    for ( int i = 0; i < calib->nHitsPool; ++i ) {
        vHits.push_back(m_hits[evt->m_det-5][calib->wallNumber[i]-1][calib->wallSpot[i]-1][calib->inwardFacing[i]]);
    }

    return vHits;
}
void PmtId2PosSvc::init ( PhyEvent evt) [private]

Definition at line 53 of file PmtId2PosSvc.cc.

{
    std::ifstream fs(m_ifile.c_str());

    /*
     * det:          5, 6
     * wallNumber:   1 - 9
     * wallSpot:     1 - 24, 1 - 32
     * inwardFacing: 0, 1
     */
    unsigned int index, det, wallNumber, wallSpot, inwardFacing;
    double x, y, z;

    if ( evt->m_site == 4 ) {  // far site
        char tmp[200];
        for ( int i = 0; i < 295; ++i ) fs.getline(tmp, 200);

        for ( int i = 0; i < 384; ++i ) {
            fs >> index >> det >> wallNumber >> wallSpot >> inwardFacing >> x >> y >> z;
            m_hits[det-5][wallNumber-1][wallSpot-1][inwardFacing].SetXYZ(x, y, z);
        }
    }
    else {  // near sites
        char tmp[200];
        for ( int i = 0; i < 3; ++i ) fs.getline(tmp, 200);

        for ( int i = 0; i < 288; ++i ) {
            fs >> index >> det >> wallNumber >> wallSpot >> inwardFacing >> x >> y >> z;
            m_hits[det-5][wallNumber-1][wallSpot-1][inwardFacing].SetXYZ(x, y, z);
        }
    }

    m_notReady = false;
}

Member Data Documentation

bool PmtId2PosSvc::m_notReady [private]

Definition at line 27 of file PmtId2PosSvc.h.

TVector3 PmtId2PosSvc::m_hits[2][9][32][2] [private]

Definition at line 29 of file PmtId2PosSvc.h.

std::string PmtId2PosSvc::m_ifile [private]

Definition at line 30 of file PmtId2PosSvc.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:50:26 for PmtId2PosSvc by doxygen 1.7.4