/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 | Static Public Member Functions | Private Attributes
EvtStoreQuery Class Reference

#include <EvtStoreQuery.h>

Inheritance diagram for EvtStoreQuery:
Inheritance graph
[legend]
Collaboration diagram for EvtStoreQuery:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 EvtStoreQuery (const std::string &name, ISvcLocator *svc)
 Standard Service Constructor.
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual const DataObject * queryInputAddress (const std::string &location, const unsigned long &entry)
 EvtStoreQuery methods.
virtual StatusCode queryInterface (const InterfaceID &id, void **interface)
 Methods required by ServiceManager.

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Attributes

bool m_useAES
std::string m_evtSvcName
IDataProviderSvc * m_evtSvc
std::string m_archiveSvcName
IDataProviderSvc * m_archiveSvc

Detailed Description

Definition at line 14 of file EvtStoreQuery.h.


Constructor & Destructor Documentation

EvtStoreQuery::EvtStoreQuery ( const std::string &  name,
ISvcLocator *  svc 
)

Standard Service Constructor.

Definition at line 13 of file EvtStoreQuery.cpp.

                                               :
  Service(name,svc),
  m_useAES(true),
  m_evtSvc(0),
  m_archiveSvc(0)
{
  declareProperty("UseAes",m_useAES=true, "Is AES in use?");
  declareProperty("TES",m_evtSvcName="EventDataSvc","Name of TES");
  declareProperty("AES",m_archiveSvcName="EventDataArchiveSvc","Name of AES");
}

Member Function Documentation

StatusCode EvtStoreQuery::initialize ( ) [virtual]

Definition at line 44 of file EvtStoreQuery.cpp.

{
  MsgStream log(msgSvc(), name());

  StatusCode status = service(m_evtSvcName,m_evtSvc);

  log<<MSG::DEBUG<<"m_evtSvc "<<m_evtSvc<<endreq;
  if (status.isFailure()) {
    log<<MSG::ERROR<<"Service [EventDataSvc] not found"<<endreq;
    return status;
  }

  // get archive service
  if(m_useAES) {
    status = service(m_archiveSvcName,m_archiveSvc);

    log<<MSG::DEBUG<<"m_archiveSvc "<<m_archiveSvc<<endreq;
    if (status.isFailure() || m_archiveSvc==0) {
      log<<MSG::ERROR<<"Service [EventDataArchiveSvc] not found"<<endreq;
      return status;
    }    
  }

  return Service::initialize();
}
StatusCode EvtStoreQuery::finalize ( ) [virtual]

Definition at line 70 of file EvtStoreQuery.cpp.

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

  return Service::finalize();
}
const DataObject * EvtStoreQuery::queryInputAddress ( const std::string &  location,
const unsigned long &  entry 
) [virtual]

EvtStoreQuery methods.

Search TES and AES (when used) for a data object at certain location and with required entry number. location: TES or TTree location entry: TTree entry (This implicitly requires a TemporalDataObject)

Return 0 if not found and a pointer if succeed.

Implements IEvtStoreQuery.

Definition at line 79 of file EvtStoreQuery.cpp.

{
  MsgStream log(msgSvc(), name());
  //  log<<MSG::INFO<<"Searching: "<<location<<"\t"<<entry<<endreq;

  DataObject* pObj=0;
  DayaBay::TemporalDataObject* pTdo=0;
  StatusCode sc;

  if(!m_useAES) 
    {
      sc=m_evtSvc->findObject(location,pObj);
      if(sc.isSuccess())
        {
          try{
            pTdo=dynamic_cast<DayaBay::TemporalDataObject*>(pObj);
          } catch(...) {
            //
          }
          if(pTdo!=0) 
            {
              const GenericAddress* ria=pTdo->inputAddress();
              //log<<MSG::INFO<<"ria= "<<ria<<endreq;
              if(ria!=0) 
                {
                  //log<<MSG::INFO<<"Searching: "<<location<<"\t"<<entry<<"\t"<<pObj<<endreq;
                  if(ria->ipar()[0]==entry)
                    {
                      log<<MSG::DEBUG<<"Found: "<<location<<"\t"<<entry<<"\t"<<pObj<<endreq;
                      return pObj;
                    }
                  else 
                    {
                      log<<MSG::DEBUG<<"Reject: "<<location<<"\t"<<entry<<"!="<<ria->ipar()[0]<<"\t"<<pObj
                         <<"[" << pTdo->earliest() << " --> " << pTdo->latest() << "]"
                         <<endreq;
                    }
                }
            }
        }
    }
  else
    {
      log<<MSG::DEBUG<<"AES, searching... "<<m_archiveSvc<<"\t"<<location<<"\t"<<entry<<endreq;
      SmartDataPtr<DybArchiveList>  data_list(m_archiveSvc,location);
      if( data_list!=0 )
        {
          log<<MSG::DEBUG<<"size of list "<<data_list->size();
          // newest data is always at the FRONT of the list
          DybArchiveList::const_iterator finished = data_list->end();
          DybArchiveList::const_iterator iter = data_list->begin();
          for(;iter!=finished;++iter) 
            {
              pObj=(*iter);
              if(pObj!=0) 
                {
                  try{
                    pTdo=dynamic_cast<DayaBay::TemporalDataObject*>(pObj);
                  } catch(...) {
                    //
                  }
                  if(pTdo!=0)
                    {
                      const GenericAddress* ria=pTdo->inputAddress();
                      log<<MSG::DEBUG<<"ria= "<<ria<<endreq;
                      if(ria!=0)
                        {
                          log<<MSG::DEBUG<<"Checking: "<<location<<"\t"<<ria->ipar()[0]<<"\t"<<entry<<"\t"<<pObj<<endreq;
                          if(ria->ipar()[0]==entry)
                            {
                              log<<MSG::DEBUG<<"Found: "<<location<<"\t"<<entry<<"\t"<<pObj<<endreq;
                              return pObj;
                            }
                        }
                    }
                }
            }
        }
    }
  
  return 0;
}
StatusCode EvtStoreQuery::queryInterface ( const InterfaceID &  id,
void **  interface 
) [virtual]

Methods required by ServiceManager.

Definition at line 25 of file EvtStoreQuery.cpp.

{
  MsgStream log(msgSvc(), name());

  if (IEvtStoreQuery::interfaceID().versionMatch(id)) {
    // If good enough match return this object.
    *interface = (IEvtStoreQuery*)this;
    addRef();
    //log<<MSG::ERROR<<"match"<<endreq;
  } else {
    // Interface is not directly available: try out a base class.
    //log<<MSG::ERROR<<"no match"<<endreq;
    return Service::queryInterface(id,interface);
  }

  return StatusCode::SUCCESS;
}

Member Data Documentation

bool EvtStoreQuery::m_useAES [private]

Definition at line 42 of file EvtStoreQuery.h.

std::string EvtStoreQuery::m_evtSvcName [private]

Definition at line 45 of file EvtStoreQuery.h.

IDataProviderSvc* EvtStoreQuery::m_evtSvc [private]

Definition at line 46 of file EvtStoreQuery.h.

std::string EvtStoreQuery::m_archiveSvcName [private]

Definition at line 49 of file EvtStoreQuery.h.

IDataProviderSvc* EvtStoreQuery::m_archiveSvc [private]

Definition at line 50 of file EvtStoreQuery.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:08 for DybEventMgr by doxygen 1.7.4