| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Stage Namespace Reference


Namespaces

namespace  __init__
namespace  Configure
namespace  FastMuon
namespace  FullChain
namespace  gun
namespace  IBD
namespace  K40
namespace  Muon
namespace  Test
namespace  Th
namespace  U

Functions

 Stage (const std::string &type, const std::string &name, const IInterface *parent)
FFTimeStamp currentTime () const
StatusCode nextElement (IStageData *&pIStgData, bool erase)
StatusCode pushElement (IStageData *pIStgData)
StatusCode initialize ()
StatusCode finalize ()
 ~Stage ()

Function Documentation

Stage::Stage ( const std::string &  type,
const std::string &  name,
const IInterface parent 
)

Definition at line 15 of file Stage.cc.

00018   : GaudiTool( type, name, parent ) 
00019   , m_SeqName("")
00020 {
00021     // declare my special interface
00022     declareInterface<IStage>(this);
00023 
00024     declareProperty( "Sequencer", m_SeqName, "Sequencer's Name");
00025 }

FFTimeStamp Stage::currentTime (  )  const

Definition at line 28 of file Stage.cc.

00030 {
00031     MsgStream log(msgSvc(), name());
00032     log << MSG::DEBUG << "currentTime() is: " << m_CurrentTime << endreq;
00033     return m_CurrentTime;
00034 }

StatusCode Stage::nextElement ( IStageData *&  pIStgData,
bool  erase 
)

Definition at line 37 of file Stage.cc.

00040 {
00041     debug() << " -- == nextElement() is called == -- " << endreq;
00042 
00043     std::vector<Algorithm*>::iterator pVec;
00044 
00045     if(m_read_erase==true) {
00047         m_sequencer->resetExecuted();
00048         StatusCode sc = m_sequencer->execute();
00049         if (sc.isFailure()) {
00050             error() << "Sequence failed" << endreq;
00051             return sc;
00052         }
00053         debug() << "every processor retured" << endreq;
00054     } else {
00058     }
00059 
00064     IStageDataList::iterator ppData;
00065 
00066     debug() << "current number of elements: "<< m_DataList.size() <<endreq;
00067     if(m_DataList.size()<=0) {
00068         fatal()<<"NO data available! Where is data? Check processors!"<<endreq;
00069         return StatusCode::FAILURE;
00070     }
00071 
00072     ppData=m_DataList.begin();
00073     m_CurrentTime=ppData->first;
00074     debug() << "Smallest time found T_min = "<< m_CurrentTime << endreq;
00075 
00077     pIStgData=ppData->second;
00078   
00079     if(erase) {
00080         m_DataList.erase(ppData);
00081     } 
00082 
00084     m_read_erase=erase;
00085 
00086     debug() << " -- == nextElement() call finished == --" << endreq;
00087     return StatusCode::SUCCESS;
00088 }

StatusCode Stage::pushElement ( IStageData pIStgData  ) 

Definition at line 90 of file Stage.cc.

00091 {
00093     MsgStream log(msgSvc(), name());
00094     StatusCode sc;
00095   
00096     m_DataList.insert(IStageDataList::value_type(pIStgData->time(),pIStgData));
00097   
00098     return sc;
00099 }

StatusCode Stage::initialize (  ) 

Definition at line 102 of file Stage.cc.

00104 {
00105     // Make use of svc<>
00106     IMessageSvc* msg = svc<IMessageSvc>("MessageSvc");
00107     MsgStream log(msg, name());
00108     log << MSG::DEBUG << "intializing ......" << endreq;
00109 
00110     if ("" == m_SeqName) {
00111         log << MSG::ERROR << "No seqencer given to stage " << name() << endreq;
00112         return StatusCode::FAILURE;
00113     }
00114 
00115     { // inspired by Algorithm::createSubAlgorithm and
00116       // GaudiSequencer::decodeNames()
00117 
00118         SmartIF<IAlgManager> am(IID_IAlgManager,serviceLocator());
00119 
00120         IAlgorithm *tmp = 0;
00121 
00122         StatusCode sc = am->getAlgorithm(m_SeqName, tmp);
00123         if (sc.isFailure()) {
00124             log << MSG::DEBUG
00125                 << "Failed to get GaudiSequencer named " << m_SeqName 
00126                 << ". Will try to create..." << endreq;
00127 
00128             sc = am->createAlgorithm ("GaudiSequencer", m_SeqName, tmp);
00129             if( sc.isFailure() ) {
00130                 log << MSG::ERROR
00131                     << "Failed to create GaudiSequencer named "
00132                     << m_SeqName << endreq;
00133                 return StatusCode::FAILURE;
00134             }
00135         }
00136 
00137         try{
00138             m_sequencer = dynamic_cast<Algorithm*>(tmp);
00139         } 
00140         catch(...) {
00141             log << MSG::ERROR
00142                 << "GaudiSequencer named " << m_SeqName << " not an Algorithm?!?" 
00143                 << endreq;
00144             return StatusCode::FAILURE;
00145         }
00146         if (!m_sequencer) {
00147             log << MSG::ERROR
00148                 << "GaudiSequencer not an algorithm??"
00149                 << endreq;
00150             return StatusCode::FAILURE;
00151         }
00152 
00153         log << MSG::INFO
00154             << "Got algorithm " << m_sequencer->name() 
00155             << " setting properties on it"
00156             << endreq;
00157 
00158         IJobOptionsSvc* jos = svc<IJobOptionsSvc>("JobOptionsSvc");
00159         jos->setMyProperties(m_SeqName,m_sequencer);
00160         jos->release();
00161     }
00162 
00163     // Let init flow down to subalgs
00164     StatusCode sc = m_sequencer->initialize();
00165     if (sc.isFailure()) {
00166         log << MSG::ERROR
00167             << "GaudiSequencer::initialize() failed" << endreq;
00168         return sc;
00169     }
00170     log << MSG::DEBUG
00171         << "Got GaudiSequencer/" << m_sequencer->name() << endreq;
00172 
00173     // Although initialized to 0, however, no special meaning
00174     m_CurrentTime=0;
00175 
00176     m_DataList.clear();
00177 
00180     m_read_erase=true;
00181 
00182     return StatusCode::SUCCESS;
00183 }

StatusCode Stage::finalize (  ) 

Definition at line 185 of file Stage.cc.

00187 {
00188     MsgStream log(msgSvc(), name());
00189     log << MSG::DEBUG << "finalizing ......" << endreq;
00190 
00191     // Let finalize flow down to subalgs
00192     return m_sequencer->finalize();
00193 }

Stage::~Stage (  ) 

Definition at line 196 of file Stage.cc.

00198 { 
00199     MsgStream log(msgSvc(), name());
00200     log << MSG::DEBUG << "destructing ......" << endreq;
00201 }

| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:36:11 2011 for Stage by doxygen 1.4.7