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

#include <HeaderObjectCnv.h>

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

List of all members.

Public Member Functions

 HeaderObjectCnv (ISvcLocator *svc)
virtual ~HeaderObjectCnv ()
void clear ()
StatusCode PerToTran (const PerHeaderObject &tobj, DayaBay::HeaderObject &dobj)
 Copy data from TObject based class of type TType to DataObject based class of type DOType.
StatusCode TranToPer (const DayaBay::HeaderObject &dobj, PerHeaderObject &tobj)
 Copy data from DataObject based class of type DOType to TObject based class of type TType.
StatusCode fillRepRefs (IOpaqueAddress *addr, DataObject *dobj)
StatusCode fillObjRefs (IOpaqueAddress *addr, DataObject *dobj)
PerType & getPerInputObject ()
PerType & getPerOutputObject ()
const RootIOBaseObjectgetBaseInputObject ()
const RootIOBaseObjectgetBaseOutputObject ()
virtual StatusCode PerToTran (const PerType &pobj, TranType &tobj)=0
virtual StatusCode TranToPer (const TranType &tobj, PerType &pobj)=0
virtual StatusCode TranObjectToPerObject (DataObject &dat, const RootOutputAddress &)
virtual StatusCode PerObjectToTranObject (DataObject *&dat)
virtual RootInputStreammakeInputStream (const RootInputAddress &ria)
virtual RootOutputStreammakeOutputStream (const RootOutputAddress &ria)
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
int commit (const RootOutputAddress &roa)
RootIOBaseCnvotherConverter (int clID)

Static Public Member Functions

static const CLID & classID ()
static StatusCode toTran (const PerHeaderObject &tobj, DayaBay::HeaderObject &dobj)
 Static method to do conversion.
static StatusCode toPer (const DayaBay::HeaderObject &dobj, PerHeaderObject &tobj)
static StatusCode fillTran (IRootIOSvc *rioSvc, const PerHeaderObject &tobj, DayaBay::HeaderObject &dobj)
 Static method to fill in HeaderObject references.
static StatusCode fillPer (IRootIOSvc *rioSvc, const DayaBay::HeaderObject &ho, PerHeaderObject &tho)
static unsigned char storageType ()
static const InterfaceID & interfaceID ()

Protected Attributes

std::string m_perclassName
PerType * m_perInObj
PerType * m_perOutObj
IRootIOSvcm_rioSvc
IConversionSvc * m_cnvSvc
RootInputStreamm_ris

Detailed Description

Definition at line 10 of file HeaderObjectCnv.h.


Constructor & Destructor Documentation

HeaderObjectCnv::HeaderObjectCnv ( ISvcLocator *  svc)

Definition at line 18 of file HeaderObjectCnv.cc.

    : RootIOTypedCnv<PerHeaderObject,HeaderObject>("PerHeaderObject",classID(),svc)
{
}
HeaderObjectCnv::~HeaderObjectCnv ( ) [virtual]

Definition at line 23 of file HeaderObjectCnv.cc.

{
}

Member Function Documentation

static const CLID& HeaderObjectCnv::classID ( ) [inline, static]

Definition at line 14 of file HeaderObjectCnv.h.

                                 {
        return DayaBay::CLID_HeaderObject;
    }
void HeaderObjectCnv::clear ( )

Definition at line 27 of file HeaderObjectCnv.cc.

{
    PerHeaderObject* objs[3] = {
        &getPerInputObject(),
        &getPerOutputObject(),
        0
    };
    const char* label[] = { "input", "output", 0 };
    for (int ind=0; objs[ind]; ++ind) {
        PerHeaderObject& tho = *objs[ind];
        tho.context = Context();
        tho.context.SetTimeStamp(TimeStamp(0.0)); // default is sets to "now"
        tho.execNumber = -1;
        tho.jobId = DayaBay::JobId();
        tho.randomState.clear();

        MsgStream log(msgSvc(), "HeaderObjectCnv::clear");
        log << MSG::VERBOSE
            << "clearing " << tho.inputHeaders.size() << " input headers from "
            << label[ind] << " PerHeaderObject"
            << endreq;
        tho.inputHeaders.clear();
    }
}
StatusCode HeaderObjectCnv::toTran ( const PerHeaderObject tobj,
DayaBay::HeaderObject dobj 
) [static]

Static method to do conversion.

This should be called by other converters that are converting a subclass of HeaderObject.

Definition at line 53 of file HeaderObjectCnv.cc.

{
    StatusCode sc = TemporalDataObjectCnv::toTran(perobj,tranobj);
    if (sc.isFailure()) return sc;

    // do header copy
    tranobj.setContext(perobj.context);
    tranobj.setExecNumber(perobj.execNumber);
    tranobj.setJobId(perobj.jobId);
    tranobj.setRandomState(perobj.randomState);
    tranobj.setInputHeaders(vector<const DayaBay::IHeader*>());
    return StatusCode::SUCCESS;
}
StatusCode HeaderObjectCnv::toPer ( const DayaBay::HeaderObject dobj,
PerHeaderObject tobj 
) [static]

Definition at line 68 of file HeaderObjectCnv.cc.

{
    StatusCode sc = TemporalDataObjectCnv::toPer(tranobj,perobj);
    if (sc.isFailure()) return sc;

    // do header copy

    perobj.context = tranobj.context();
    perobj.execNumber = tranobj.execNumber();
    perobj.jobId = tranobj.jobId();
    perobj.randomState = tranobj.randomState();
    perobj.inputHeaders.clear();
    return StatusCode::SUCCESS;
}
StatusCode HeaderObjectCnv::fillTran ( IRootIOSvc rioSvc,
const PerHeaderObject tobj,
DayaBay::HeaderObject dobj 
) [static]

Static method to fill in HeaderObject references.

This should be called by other converters that are converting a subclass of HeaderObject.

Definition at line 133 of file HeaderObjectCnv.cc.

{
    GaudiMsgStreams log("HeaderObjectCnv::fillTran");

    static IEvtStoreQuery* s_evtStoreQuery=0;
    // get a service pointer in a static function
    if (s_evtStoreQuery==0) {
        ServiceHandle<IEvtStoreQuery> msgh("EvtStoreQuery","HeaderObjectCnv");
        s_evtStoreQuery = msgh.operator->();
    }

    // Get current RegistrationSequence
    string rs_path = RegistrationSequence::defaultLocation();
    DataObject *rs_tranobj = 0;
    StatusCode sc = rioSvc->dataSvc()->retrieveObject(rs_path,rs_tranobj);
    if (sc.isFailure()) {
        return sc;
    }
    RegistrationSequence* rsobj = dynamic_cast<RegistrationSequence*>(rs_tranobj);
    if (!rsobj)return StatusCode::FAILURE;

    vector<const DayaBay::IHeader*> inputs;

    size_t siz = tho.inputHeaders.size();
    for (size_t ind=0; ind < siz; ++ind) {
        const PerRef& pref = tho.inputHeaders[ind];

        log.debug()
            << s_evtStoreQuery << "\t" << pref.path() << "\t" << pref.entry() 
            << endreq;
        const DataObject* pOBJ = s_evtStoreQuery->queryInputAddress(pref.path(),pref.entry());

        if(pOBJ!=0) {
            const IHeader* ihead = dynamic_cast<const IHeader*>(pOBJ);
            inputs.push_back(ihead);
        } 
        else {
            static int headerWarningCount = 0;
            if( headerWarningCount < 10 ){
              log.warning()
                <<"An inputHeader " << pref.path() << ", " << pref.entry() << " not found."
                << " Consider using a longer AES window."
                << endreq;
              headerWarningCount++;
              if(headerWarningCount==10){
                log.warning()
                  <<" (Further missing inputHeader messages suppressed.)" 
                  << endreq;
              }
            }
        }
    }
    ho.setInputHeaders(inputs);
    return StatusCode::SUCCESS;
}
StatusCode HeaderObjectCnv::fillPer ( IRootIOSvc rioSvc,
const DayaBay::HeaderObject ho,
PerHeaderObject tho 
) [static]

Definition at line 85 of file HeaderObjectCnv.cc.

{
    GaudiMsgStreams log("HeaderObjectCnv::fillPer");

    tho.inputHeaders.clear();
    size_t siz = ho.inputHeaders().size();
    if( siz <= 0 ) return StatusCode::SUCCESS;

    for (size_t ind = 0; ind<siz; ++ind) {
        const IHeader* ihead = ho.inputHeaders()[ind];
        const HeaderObject* other_ho = 
            dynamic_cast<const HeaderObject*>(ihead);

        const GenericAddress* gad=other_ho->outputAddress();
        if(!gad) {
            static map<string,int> errorMap;
            string other_ho_name = other_ho->name();
            if (!errorMap[other_ho_name]) {
                log.warning()
                    << MSG::WARNING
                    << "Failed to get output address for " << ho.name()
                    << " (#" << ho.execNumber() << ")"
                    << " input header: " << other_ho_name
                    << " (#" << other_ho->execNumber() << ")"
                    << "\n(any further warnings will be suppressed)." << endreq;
            }
            errorMap[other_ho_name] = 1;
            continue; // skip this one
        }

        const RootOutputAddress*  roa=dynamic_cast<const RootOutputAddress*>(gad);
        tho.inputHeaders.push_back(PerRef(roa->entry(),roa->tespath()));
    }
    return StatusCode::SUCCESS;
}
StatusCode HeaderObjectCnv::PerToTran ( const PerHeaderObject tobj,
DayaBay::HeaderObject dobj 
)

Copy data from TObject based class of type TType to DataObject based class of type DOType.

Definition at line 200 of file HeaderObjectCnv.cc.

{
    return HeaderObjectCnv::toTran(perobj,tranobj);
}
StatusCode HeaderObjectCnv::TranToPer ( const DayaBay::HeaderObject dobj,
PerHeaderObject tobj 
)

Copy data from DataObject based class of type DOType to TObject based class of type TType.

Definition at line 206 of file HeaderObjectCnv.cc.

{
    return HeaderObjectCnv::toPer(tranobj,perobj);
}
StatusCode HeaderObjectCnv::fillRepRefs ( IOpaqueAddress *  addr,
DataObject *  dobj 
) [virtual]

Reimplemented from RootIOTypedCnv< PerHeaderObject, DayaBay::HeaderObject >.

Definition at line 125 of file HeaderObjectCnv.cc.

{
    HeaderObject* ho = dynamic_cast<HeaderObject*>(tranobj);
    PerHeaderObject& tho = getPerOutputObject();
    return HeaderObjectCnv::fillPer(m_rioSvc, *ho, tho);
}
StatusCode HeaderObjectCnv::fillObjRefs ( IOpaqueAddress *  addr,
DataObject *  dobj 
) [virtual]

Reimplemented from RootIOTypedCnv< PerHeaderObject, DayaBay::HeaderObject >.

Definition at line 191 of file HeaderObjectCnv.cc.

{
    PerHeaderObject& tho = getPerInputObject();
    HeaderObject* ho = dynamic_cast<HeaderObject*>(tranobj);
    return HeaderObjectCnv::fillTran(m_rioSvc, tho, *ho);
}
PerType & RootIOTypedCnv< class, class >::getPerInputObject ( ) [inherited]
PerType & RootIOTypedCnv< class, class >::getPerOutputObject ( ) [inherited]
const RootIOBaseObject * RootIOTypedCnv< class, class >::getBaseInputObject ( ) [virtual, inherited]

Implements RootIOBaseCnv.

const RootIOBaseObject * RootIOTypedCnv< class, class >::getBaseOutputObject ( ) [virtual, inherited]

Implements RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::PerToTran ( const PerType &  pobj,
TranType &  tobj 
) [pure virtual, inherited]
virtual StatusCode RootIOTypedCnv< class, class >::TranToPer ( const TranType &  tobj,
PerType &  pobj 
) [pure virtual, inherited]
virtual StatusCode RootIOTypedCnv< class, class >::TranObjectToPerObject ( DataObject &  dat,
const RootOutputAddress  
) [virtual, inherited]

Implements RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::PerObjectToTranObject ( DataObject *&  dat) [virtual, inherited]

Implements RootIOBaseCnv.

virtual RootInputStream * RootIOTypedCnv< class, class >::makeInputStream ( const RootInputAddress ria) [virtual, inherited]

Implements RootIOBaseCnv.

virtual RootOutputStream * RootIOTypedCnv< class, class >::makeOutputStream ( const RootOutputAddress ria) [virtual, inherited]

Implements RootIOBaseCnv.

virtual long RootIOTypedCnv< class, class >::repSvcType ( ) const [virtual, inherited]

Reimplemented from RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::initialize ( ) [virtual, inherited]

Reimplemented from RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::finalize ( ) [virtual, inherited]

Reimplemented from RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::createObj ( IOpaqueAddress *  addr,
DataObject *&  dat 
) [virtual, inherited]

Reimplemented from RootIOBaseCnv.

virtual StatusCode RootIOTypedCnv< class, class >::createRep ( DataObject *  pObject,
IOpaqueAddress *&  refpAddress 
) [virtual, inherited]

Reimplemented from RootIOBaseCnv.

int RootIOTypedCnv< class, class >::commit ( const RootOutputAddress roa) [inherited]

Reimplemented from RootIOBaseCnv.

RootIOBaseCnv * RootIOTypedCnv< class, class >::otherConverter ( int  clID) [inherited]

Reimplemented from RootIOBaseCnv.

static unsigned char RootIOTypedCnv< class, class >::storageType ( ) [static, inherited]

Reimplemented from RootIOBaseCnv.

static const InterfaceID & RootIOTypedCnv< class, class >::interfaceID ( ) [static, inherited]

Reimplemented from RootIOBaseCnv.


Member Data Documentation

std::string RootIOTypedCnv< class, class >::m_perclassName [protected, inherited]
PerType * RootIOTypedCnv< class, class >::m_perInObj [protected, inherited]
PerType * RootIOTypedCnv< class, class >::m_perOutObj [protected, inherited]
IRootIOSvc * RootIOTypedCnv< class, class >::m_rioSvc [protected, inherited]

Reimplemented from RootIOBaseCnv.

IConversionSvc * RootIOTypedCnv< class, class >::m_cnvSvc [protected, inherited]

Reimplemented from RootIOBaseCnv.

RootInputStream * RootIOTypedCnv< class, class >::m_ris [protected, inherited]

Reimplemented from RootIOBaseCnv.


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 09:58:27 for PerBaseEvent by doxygen 1.7.4