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

Exercise DybInputLoadTool. More...

#include <TestInputLoadAlg.h>

Collaboration diagram for TestInputLoadAlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TestInputLoadAlg (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~TestInputLoadAlg ()
virtual StatusCode initialize ()
virtual StatusCode execute ()
virtual StatusCode finalize ()

Private Member Functions

StatusCode get_header (int entry, const std::string &path, bool input_headers)
StatusCode get_frame (int entry, const std::string &path, bool input_headers)

Private Attributes

ToolHandle< IDybInputLoadToolm_loader
ToolHandle< IDybEntryPolicyToolm_policy
std::string m_path
int m_test_type

Detailed Description

Exercise DybInputLoadTool.

Load files into the TES directly using a DybInputLoadTool. This is just for testing

Brett Viren <bviren@lycastus.phy.bnl.gov> Tue Nov 16 12:29:12 2010

Definition at line 28 of file TestInputLoadAlg.h.


Constructor & Destructor Documentation

TestInputLoadAlg::TestInputLoadAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 11 of file TestInputLoadAlg.cc.

    : GaudiAlgorithm(name,pSvcLocator)
{
    declareProperty("Loader", m_loader, "A IDybInputLoadTool");
    declareProperty("Policy", m_policy, "A IDybEntryPolicyTool");
    declareProperty("Path", m_path, "A TES-like path to the HeaderObject to load");
    declareProperty("TestType", m_test_type=0, "Which tests to run [0,1,2,3,4]");
}
TestInputLoadAlg::~TestInputLoadAlg ( ) [virtual]

Definition at line 20 of file TestInputLoadAlg.cc.

{
}

Member Function Documentation

StatusCode TestInputLoadAlg::initialize ( ) [virtual]

Definition at line 24 of file TestInputLoadAlg.cc.

{
    MsgStream log(msgSvc(), "TestInputLoadAlg");

    {
        StatusCode sc = m_loader.retrieve();
        if (sc.isFailure()) {
            log << MSG::ERROR << "Failed to retrieve " << m_loader << endreq;
            return sc;
        }
    }

    {
        StatusCode sc = m_policy.retrieve();
        if (sc.isFailure()) {
            log << MSG::ERROR << "Failed to retrieve " << m_policy << endreq;
            return sc;
        }
    }
    return StatusCode::SUCCESS;
}
StatusCode TestInputLoadAlg::execute ( ) [virtual]

Definition at line 118 of file TestInputLoadAlg.cc.

{
    MsgStream log(msgSvc(), "TestInputLoadAlg");

    int entry = m_policy->next_entry();

    int which = entry%4;
    if (m_test_type) which = m_test_type-1;

    log << MSG::DEBUG << "test " << which << " loading entry " << entry << endreq;
    
    std::string rspath = "/Event/RegistrationSequence";

    switch(which) {
    case 0:
        return this->get_header(entry,m_path,false);
        break;
    case 1:
        return this->get_header(entry,m_path,true);
        break;
    case 2:
        return this->get_frame(entry,rspath,true);
        break;
    case 3:
        return this->get_frame(entry,rspath,true);
        break;
    }

    log << MSG::ERROR << "got unknown test code: " << which+1 << " should be in [0-4]" << endreq;
    return StatusCode::FAILURE;
}
StatusCode TestInputLoadAlg::finalize ( ) [virtual]

Definition at line 150 of file TestInputLoadAlg.cc.

{
    return StatusCode::SUCCESS;
}
StatusCode TestInputLoadAlg::get_header ( int  entry,
const std::string &  path,
bool  input_headers 
) [private]

Definition at line 68 of file TestInputLoadAlg.cc.

{
    MsgStream log(msgSvc(), "TestInputLoadAlg");

    HeaderObject* ho = m_loader->get_header(entry,path,input_headers);
    if (!ho) {
        log << MSG::ERROR << "Failed to get HeaderObject at entry "
            << entry << " and path \"" << path << "\"" << endreq;
        return StatusCode::FAILURE;
    }
    log << MSG::DEBUG << "Found Header object at entry "
        << entry << " and path \"" << path << "\"" << endreq;
    log << MSG::DEBUG << ho->earliest() << endreq;
    std::vector<const HeaderObject*> bucket;
    collect_input_headers(log, ho, bucket);
    
    log << MSG::DEBUG << "Got " << bucket.size() << " HeaderObjects" << endreq;

    for (size_t ind=0; ind<bucket.size(); ++ind) {
        HeaderObject* hop = const_cast<HeaderObject*>(bucket[ind]);
        log << MSG::DEBUG << "Putting HeaderObject at " << hop->defLoc() << endreq;
        this->put(hop,hop->defLoc());
    }

    return StatusCode::SUCCESS;
}
StatusCode TestInputLoadAlg::get_frame ( int  entry,
const std::string &  path,
bool  input_headers 
) [private]

Definition at line 95 of file TestInputLoadAlg.cc.

{
    MsgStream log(msgSvc(), "TestInputLoadAlg");

    IDybInputLoadTool::ExecutionFrame ef = m_loader->get_frame(entry,path,input_headers);
    if (!ef.size()) {
        log << MSG::ERROR << "Failed to get non-empty ExecutionFrame at entry "
            << entry << " and path \"" << path << "\"" << endreq;
        return StatusCode::FAILURE;
    }
    log << MSG::DEBUG << "Found ExecutionFrame object at entry "
        << entry << " and path \"" << path << "\"" << endreq;
    
    log << MSG::DEBUG << "Got " << ef.size() << " HeaderObjects" << endreq;

    for (size_t ind=0; ind < ef.size(); ++ind) {
        log << MSG::DEBUG << ind << " " << ef[ind].first << endreq;
        this->put(ef[ind].second,ef[ind].first);
    }

    return StatusCode::SUCCESS;
}

Member Data Documentation

Definition at line 43 of file TestInputLoadAlg.h.

Definition at line 44 of file TestInputLoadAlg.h.

std::string TestInputLoadAlg::m_path [private]

Definition at line 45 of file TestInputLoadAlg.h.

Definition at line 46 of file TestInputLoadAlg.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 10:15:57 for DybIO by doxygen 1.7.4