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

#include <RunDataCnv.h>

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

List of all members.

Public Member Functions

 RunHeaderCnv (ISvcLocator *svc)
virtual ~RunHeaderCnv ()
StatusCode PerToTran (const PerRunHeader &perobj, DayaBay::RunHeader &tranobj)
 Copy data from TObject based class of type TType to DataObject based class of type DOType.
StatusCode TranToPer (const DayaBay::RunHeader &tranobj, PerRunHeader &perobj)
 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)
PerRunDataconvert (const DayaBay::RunData &runData)
DayaBay::RunDataconvert (const PerRunData &perRunData)
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 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 20 of file RunDataCnv.h.


Constructor & Destructor Documentation

RunHeaderCnv::RunHeaderCnv ( ISvcLocator *  svc)

Definition at line 7 of file RunDataCnv.cc.

  : RootIOTypedCnv<PerRunHeader,RunHeader>("PerRunHeader",
                                           classID(),svc)
{
}
RunHeaderCnv::~RunHeaderCnv ( ) [virtual]

Definition at line 14 of file RunDataCnv.cc.

{
}

Member Function Documentation

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

Definition at line 24 of file RunDataCnv.h.

                               {
    return DayaBay::CLID_RunHeader;
  }
StatusCode RunHeaderCnv::PerToTran ( const PerRunHeader perobj,
DayaBay::RunHeader tranobj 
)

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

Definition at line 18 of file RunDataCnv.cc.

{
  MsgStream log(msgSvc(), "RunHeaderCnv::PerToTran");

  log << MSG::DEBUG << "Converting persistent to transient object" << endreq;

  StatusCode sc = HeaderObjectCnv::toTran(perobj,tranobj);
  if (sc.isFailure()) return sc;
  
  vector<PerRunData*> in_vec = perobj.runDataList;
  vector<PerRunData*>::iterator it;
  
  for(it = in_vec.begin(); it != in_vec.end(); ++it)
  {
    RunData* runData = convert(**it);
    tranobj.runDataList().push_back(runData);
  }
  return StatusCode::SUCCESS;
}                                       
StatusCode RunHeaderCnv::TranToPer ( const DayaBay::RunHeader tranobj,
PerRunHeader perobj 
)

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

Definition at line 39 of file RunDataCnv.cc.

{
  MsgStream log(msgSvc(), "RunHeaderCnv::TranToPer");

  log << MSG::DEBUG << "Converting transient to persistent object" << endreq;

  perobj.clear();
  StatusCode sc = HeaderObjectCnv::toPer(tranobj,perobj);
  if (sc.isFailure()) return sc;
  
  vector<RunData*> in_vec = tranobj.runDataList();
  vector<RunData*>::iterator it;

  for(it=in_vec.begin();it!=in_vec.end();++it){
    perobj.runDataList.push_back( convert(**it) );
  }
  return StatusCode::SUCCESS;
  
}
StatusCode RunHeaderCnv::fillRepRefs ( IOpaqueAddress *  addr,
DataObject *  dobj 
) [virtual]

Reimplemented from RootIOTypedCnv< PerRunHeader, DayaBay::RunHeader >.

Definition at line 61 of file RunDataCnv.cc.

{
    MsgStream log(msgSvc(), "RunHeaderCnv::fillRepRefs");
    RunHeader* rh = dynamic_cast<RunHeader*>(dobj);

    log << MSG::INFO
        << "Got " << rh->inputHeaders().size() << " headers" << endreq;


    StatusCode sc = HeaderObjectCnv::fillPer(m_rioSvc,*rh,*m_perOutObj);
    if (sc.isFailure()) {
        log << MSG::ERROR << "Failed to fill HeaderObject part" << endreq;
        return sc;
    }

    // ... fill RunHeader part...
    return sc;
}
StatusCode RunHeaderCnv::fillObjRefs ( IOpaqueAddress *  addr,
DataObject *  dobj 
) [virtual]

Reimplemented from RootIOTypedCnv< PerRunHeader, DayaBay::RunHeader >.

Definition at line 80 of file RunDataCnv.cc.

{
    MsgStream log(msgSvc(), "RunHeaderCnv::fillObjRefs");
    HeaderObject* hobj = dynamic_cast<HeaderObject*>(dobj);
    StatusCode sc = HeaderObjectCnv::fillTran(m_rioSvc,*m_perInObj,*hobj);
    if (sc.isFailure()) {
        log << MSG::ERROR << "Failed to fill HeaderObject part" << endreq;
        return sc;
    }

    log << MSG::INFO
        << "Got " << hobj->inputHeaders().size() << " headers" << endreq;

    // ... fill RunHeader part...
    return sc;
}
PerRunData * RunHeaderCnv::convert ( const DayaBay::RunData runData)

Definition at line 97 of file RunDataCnv.cc.

                                                              {
  std::vector<PerCalibSource> calibSources;
  int nSources = runData.calibSources().size();
  for(int srcIdx=0; srcIdx<nSources; srcIdx++){
    const CalibSource& source = (runData.calibSources())[srcIdx];
    PerCalibSource perSource(source.id(), source.ledFrequency(),
                             source.adZPosition());
    calibSources.push_back(perSource);
  }
  return (new PerRunData(runData.runNumber(), runData.runType(),
                         runData.detectors(), runData.startTime(), 
                         runData.endTime(), calibSources));
}
RunData * RunHeaderCnv::convert ( const PerRunData perRunData)

Definition at line 111 of file RunDataCnv.cc.

{
  RunData* runData = new RunData();
  runData->setRunNumber(perRunData.runNumber);
  runData->setRunType(perRunData.runType);
  runData->setDetectors(perRunData.detectors);
  runData->setStartTime(perRunData.startTime);
  runData->setEndTime(perRunData.endTime);
  int nSources = perRunData.calibSources.size();
  DayaBay::RunData::CalibSources calibSources;
  for(int srcIdx=0; srcIdx<nSources; srcIdx++){
    const PerCalibSource& perSource = perRunData.calibSources[srcIdx];
    CalibSource source;
    source.setId(perSource.id);
    source.setLedFrequency(perSource.ledFrequency);
    source.setAdZPosition(perSource.adZPosition);
    calibSources.push_back(source);
  }
  runData->setCalibSources(calibSources);
  return runData;
}
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 10:00:15 for PerRunData by doxygen 1.7.4