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

In This Package:

Classes | Public Member Functions | Private Attributes
MainAlgorithm Class Reference

algorithm for controlling the whole cycle of Fast MC Production processing. More...

#include <MainAlgorithm.h>

Collaboration diagram for MainAlgorithm:
Collaboration graph
[legend]

List of all members.

Classes

class  Configure

Public Member Functions

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

Private Attributes

IROBufferSvcm_roBSvc
DigitalizeAlgm_digitAlg
int m_execNum
list __all__ = ['MainAlgorithmConf', 'Configure']

Detailed Description

algorithm for controlling the whole cycle of Fast MC Production processing.

Based on GaudiAlgorithm

Zhang YiChun Dec 12 2010 yczhang@ihep.ac.cn

Definition at line 23 of file MainAlgorithm.h.


Constructor & Destructor Documentation

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

Definition at line 10 of file MainAlgorithm.cc.

              :GaudiAlgorithm(name, pSvcLocator)
{
  info()<< "Construct:MainAlgorithm()!"<< endreq;

  m_roBSvc  = 0;
  m_execNum = 0;
}
MainAlgorithm::~MainAlgorithm ( ) [virtual]

Definition at line 114 of file MainAlgorithm.cc.

{
  info()<< "Destructor:~MainAlgorithm()!"<< endreq;
}

Member Function Documentation

StatusCode MainAlgorithm::initialize ( ) [virtual]

Definition at line 19 of file MainAlgorithm.cc.

{
  StatusCode sc = this->GaudiAlgorithm::initialize();
  if(sc.isFailure()) 
  { 
    error()<< "Error when initializing  GaudiAlgorithm"<< endreq;
    return sc;
  }

  //Prepare the sub algorithm--DigitalizeAlg
  Algorithm* subAlg = 0; 
  sc = createSubAlgorithm("DigitalizeAlg", "DigitalizeAlg", subAlg);
  if(sc.isFailure()) 
  {
    error()<< "Error creating Sub-Algorithm: DigitalizeAlg!" << endreq;
    return sc;
  }
  //m_digitAlg = dynamic_cast< DigitalizeAlg* >(subAlg);
  m_digitAlg = (DigitalizeAlg*)subAlg;
  if(!m_digitAlg)
  {
    error()<< "Can not converte Algorithm* to DigitalizeAlg* !"<< endreq;
    return StatusCode::SUCCESS;
  }

  //Initialize the ROBufferSvc
  IService* isvc = 0;
  sc = serviceLocator()->service("ROBufferSvc", isvc, true);
  if(sc.isFailure()) 
  {
    error()<< "Service:ROBufferSvc could not be retrieved"<< endreq;
    return sc;
  }
  isvc->addRef();
  sc = isvc->queryInterface(IROBufferSvc::interfaceID(), (void**)&m_roBSvc);
  if(sc.isFailure()) 
  {
    error()<< "ROBufferSvc does not implement IROBufferSvc."<< endreq;
    return sc;
  }

  info()<< "MainAlgorithm initialize()!"<< endreq;

  return StatusCode::SUCCESS;
}
StatusCode MainAlgorithm::execute ( ) [virtual]

Definition at line 65 of file MainAlgorithm.cc.

{
  //In one execute(), output one ReadoutHeader!
  info()<< "Now into MainAlgorithm "<< m_execNum<< " executation!"<< endreq;

  for( ; ; )
  {
    //If the MixHeader buffer is empty, notice the DigitalizeAlg
    if(0 == m_roBSvc->getMBufferSize())
    {
      info()<< "The MixHeader buffer is empty!"<< endreq;
      //Fill the MixHeader buffer
      StatusCode sc = m_digitAlg->execute();
      if(sc.isFailure())
      {
        error()<< "Error in DigitalizeAlg::execute()!"<< endreq;
        return StatusCode::FAILURE;
      }
      continue;
    }
    //If the MixHeader buffer is not empty, get one ReadoutHeader directly
    else
    {
      ReadoutHeader* roh = 0;
      roh = m_roBSvc->getROHeader();
      if(!roh)
      {
        error()<< "Failed to get one ReadoutHeader!"<< endreq;
        return StatusCode::FAILURE;
      }

      info()<< "Put the ReadoutHeader: "<< roh<< " into TES!"<< endreq;
      this->put(evtSvc(), roh, ReadoutHeaderLocation::Default);
      break;
    }
  }

  m_execNum++;
  info()<< "MainAlgorithm execute() finalized!" << endreq;

  return StatusCode::SUCCESS;
}
StatusCode MainAlgorithm::finalize ( ) [virtual]

Definition at line 108 of file MainAlgorithm.cc.

{
  info()<< "MainAlgorithm finalize()!"<< endreq;
  return StatusCode::SUCCESS;
}

Member Data Documentation

Definition at line 34 of file MainAlgorithm.h.

Definition at line 35 of file MainAlgorithm.h.

int MainAlgorithm::m_execNum [private]

Definition at line 36 of file MainAlgorithm.h.

list MainAlgorithm::__all__ = ['MainAlgorithmConf', 'Configure'] [private]

Definition at line 3 of file __init__.py.


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:17:41 for MainAlgorithm by doxygen 1.7.4