/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 Attributes
TESDemoOutput Class Reference

#include <TESDemoOutput.h>

Collaboration diagram for TESDemoOutput:
Collaboration graph
[legend]

List of all members.

Public Member Functions

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

Private Attributes

StringProperty m_regSeqPath
StringProperty m_readoutPath
IDybStorageSvcp_storageSvc
IArchiveTrimSvcp_trimSvc
std::deque
< DayaBay::RegistrationSequence * > 
m_regSeqs

Detailed Description

Definition at line 15 of file TESDemoOutput.h.


Constructor & Destructor Documentation

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

Definition at line 11 of file TESDemoOutput.cpp.

                                                         :
  GaudiAlgorithm(name,
                 pSvcLocator),
  p_storageSvc(0),
  p_trimSvc(0)
{
  declareProperty("RegSeqPath",
                  m_regSeqPath="/Event/RegistrationSequence",
                  "Path, in the TES, where the RegistrationSequnce object is kept");
  declareProperty("ReadoutPath",
                  m_readoutPath="/Event/TESDemo/Readout",
                  "Path from which to retrieve the Readouts");
}

Member Function Documentation

StatusCode TESDemoOutput::initialize ( )

Definition at line 26 of file TESDemoOutput.cpp.

                                     {
  
   info() << "in initialize" 
          << endreq;
   info() << m_regSeqPath 
          << endreq;
   
   StatusCode status = service("DybStorageSvc",
                               p_storageSvc);
   if (status.isFailure()) {
     return Error("Service [DybStorageSvc] not found",
                  status);
   }

   status = service("ArchiveTrimSvc",
                    p_trimSvc);
   if (status.isFailure()) {
     warning() << "Service [ArchiveTrimSvc] not found, will run output"
               << "at the end of each loop"
               << endreq;
     p_trimSvc = 0;
   }

   return StatusCode::SUCCESS;

}
StatusCode TESDemoOutput::execute ( )

Definition at line 53 of file TESDemoOutput.cpp.

                                  {

  SmartDataPtr<RegistrationSequence>  regSeq(eventSvc(),
                                             m_regSeqPath.value());
  if (0 == regSeq) {
    return Error("Failed to retrieve RegistrationSequence from Event Store");
  }

  regSeq->addRef();
  m_regSeqs.push_back(regSeq.ptr());

  TimeStamp now;
  if (0 != p_trimSvc) {
    SmartDataPtr<const TESDemoReadout>  readout(eventSvc(),
                                                m_readoutPath.value());
    if (0 == readout) {
      return Error("Failed to retrieve readout from Event Store");
    }
    now = readout->timeStamp();
  }

  bool done = false;
  std::deque<RegistrationSequence*>::iterator entry = m_regSeqs.begin();
  while (!done &&
         m_regSeqs.end() != entry) {
    RegistrationSequence* element = *(entry);
    if (0 == p_trimSvc ||
        (now - TimeStamp(p_trimSvc->window(m_regSeqPath.value()))) > element->latest()) {
      p_storageSvc->store(*element);
      element->release();
      entry = m_regSeqs.erase(entry);
    } else {
      done = true;
    }
  }
  
  return StatusCode::SUCCESS;
}
StatusCode TESDemoOutput::finalize ( )

Definition at line 92 of file TESDemoOutput.cpp.

                                   {

  info() << "in finalize"
         << endreq;

  if (0 != p_storageSvc) {
    p_storageSvc->release();
  }

  return StatusCode::SUCCESS;

}

Member Data Documentation

StringProperty TESDemoOutput::m_regSeqPath [private]

Definition at line 28 of file TESDemoOutput.h.

StringProperty TESDemoOutput::m_readoutPath [private]

Definition at line 29 of file TESDemoOutput.h.

Definition at line 31 of file TESDemoOutput.h.

Definition at line 32 of file TESDemoOutput.h.

Definition at line 33 of file TESDemoOutput.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:09:00 for TESDemo by doxygen 1.7.4