/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
RunDataWriterAlg Class Reference

#include <RunDataWriterAlg.h>

Collaboration diagram for RunDataWriterAlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Private Member Functions

StatusCode writeDataToFile ()
StatusCode writeDataToDatabase ()

Private Attributes

bool m_writeToFile
bool m_writeToDatabase
std::string m_runDataLocation
IDybStorageSvcm_storageSvc
IRunDataSvcm_runDataSvc

Detailed Description

Definition at line 19 of file RunDataWriterAlg.h.


Constructor & Destructor Documentation

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

Definition at line 9 of file RunDataWriterAlg.cc.

  : GaudiAlgorithm(name,pSvcLocator),
    m_storageSvc(0),
    m_runDataSvc(0)
{
  declareProperty("RunDataLocation",
                  m_runDataLocation=DayaBay::RunHeaderLocation::Default,
                  "Location in file where Run Data is to be found.");
  declareProperty("WriteToFile",m_writeToFile=false,
                  "Write the run data to the current output file?");
  declareProperty("WriteToDatabase",m_writeToDatabase=false,
                  "Write the run data to the offline database?");
}
RunDataWriterAlg::~RunDataWriterAlg ( ) [virtual]

Definition at line 24 of file RunDataWriterAlg.cc.

{
}

Member Function Documentation

StatusCode RunDataWriterAlg::initialize ( ) [virtual]

Definition at line 28 of file RunDataWriterAlg.cc.

{
  // Initialize the necessary services
  if( m_writeToFile ){
    StatusCode sc = this->service("DybStorageSvc",m_storageSvc,true);
    if(sc.isFailure()){
      error() << "Failed to get DybStorageSvc" << endreq;
      return sc;
    }
  }
  StatusCode sc = this->service("RunDataSvc",m_runDataSvc,true);
  if(sc.isFailure()){
    error() << "Failed to get RunDataSvc" << endreq;
    return sc;
  }
  return StatusCode::SUCCESS;
}
StatusCode RunDataWriterAlg::execute ( ) [virtual]

Definition at line 46 of file RunDataWriterAlg.cc.

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

Definition at line 51 of file RunDataWriterAlg.cc.

{
  if( m_writeToFile ) m_storageSvc->release();
  m_runDataSvc->release();
  return StatusCode::SUCCESS;
}
StatusCode RunDataWriterAlg::endRun ( ) [virtual]

Definition at line 59 of file RunDataWriterAlg.cc.

{
  // Write the run data to file/database at the end of the run
  StatusCode sc = StatusCode::SUCCESS;
  if( m_writeToFile ) sc = this->writeDataToFile();
  if( !sc.isSuccess() ) return sc;
  if( m_writeToDatabase ) sc = this->writeDataToDatabase();
  return sc;
}
StatusCode RunDataWriterAlg::writeDataToFile ( ) [private]

Definition at line 69 of file RunDataWriterAlg.cc.

                                            {
  // Write Run Data to current output file

  debug() << "Writing RunData" << endreq;
  // Create Run Header
  DayaBay::RunHeader runHeader;
  runHeader.setRunDataList( m_runDataSvc->cachedRunData() );
  // Have to put RunHeader in a registry for DybStorageSvc to work correctly
  DataSvcHelpers::RegistryEntry* regEntry 
    = new DataSvcHelpers::RegistryEntry(m_runDataLocation);
  regEntry->setObject(&runHeader);
  debug() << "Storing RunHeader" << endreq;
  StatusCode sc = m_storageSvc->store(&runHeader, m_runDataLocation);
  debug() << "Stored RunHeader" << endreq;
  if(sc.isFailure()){
    error() << "Failed to store Run Header to output file" << endreq;
  }
  // Clear run data to prevent deleting
  debug() << "Clearing RunData in RunHeader" << endreq;
  std::vector<DayaBay::RunData*> emptyList;
  runHeader.setRunDataList( emptyList );
  debug() << "Cleared RunData in RunHeader" << endreq;
  return sc;
}
StatusCode RunDataWriterAlg::writeDataToDatabase ( ) [private]

Definition at line 94 of file RunDataWriterAlg.cc.

                                                {
  // Write Run Data to offline database
  warning() << "Writing Run Data to offline database is not yet implemented."
            << endreq;
  return StatusCode::SUCCESS;
}

Member Data Documentation

Definition at line 38 of file RunDataWriterAlg.h.

Definition at line 41 of file RunDataWriterAlg.h.

std::string RunDataWriterAlg::m_runDataLocation [private]

Definition at line 44 of file RunDataWriterAlg.h.

Definition at line 47 of file RunDataWriterAlg.h.

Definition at line 49 of file RunDataWriterAlg.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:00:22 for RunDataSvc by doxygen 1.7.4