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

#include <ReadoutEventCnv.h>

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

List of all members.

Public Member Functions

 ReadoutHeaderCnv (ISvcLocator *svc)
virtual ~ReadoutHeaderCnv ()
StatusCode PerToTran (const PerReadoutHeader &perobj, DayaBay::ReadoutHeader &tranobj)
 Copy data from TObject based class of type TType to DataObject based class of type DOType.
StatusCode TranToPer (const DayaBay::ReadoutHeader &tranobj, PerReadoutHeader &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)
PerReadoutconvert (const DayaBay::Readout &roRo)
PerReadoutPmtCrateconvert (const DayaBay::ReadoutPmtCrate &roPmtCrate)
PerReadoutPmtChannelconvert (const DayaBay::ReadoutPmtChannel &roPmtChannel)
PerReadoutTriggerDataPkgconvert (const DayaBay::ReadoutTriggerDataPkg &roPmtTDP)
PerReadoutTriggerDataFrameconvert (const DayaBay::ReadoutTriggerDataFrame &roPmtTDF)
PerReadoutTriggerDataFrameconvert (const DayaBay::ReadoutRpcTriggerDataFrame &roPmtTDF)
PerReadoutRpcCrateconvert (const DayaBay::ReadoutRpcCrate &roRpcCrate)
PerReadoutFecBoardconvert (const DayaBay::ReadoutFecBoard &roFecBoard)
DayaBay::Readoutconvert (const PerReadout &perRo)
DayaBay::ReadoutPmtCrateconvert (const PerReadoutPmtCrate &perRoPcr)
DayaBay::ReadoutPmtChannel convert (const PerReadoutPmtChannel &perRoPch)
DayaBay::ReadoutTriggerDataPkgconvert (const PerReadoutTriggerDataPkg &perRoPmtTDP)
DayaBay::ReadoutTriggerDataFrameconvert (const PerReadoutTriggerDataFrame &perToPmtTDF)
DayaBay::ReadoutTriggerDataFrameconvert (const PerReadoutRpcTriggerDataFrame &perRpcFrame)
DayaBay::ReadoutRpcCrateconvert (const PerReadoutRpcCrate &perRoRcr)
DayaBay::ReadoutFecBoard convert (const PerReadoutFecBoard &perRoFecBrd)
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 ()

Public Attributes

bool m_writefadc

Protected Attributes

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

Private Member Functions

StatusCode TranToPer (const DayaBay::DaqCrate &tranobj, PerReadoutHeader &perobj)
DayaBay::DaqCratetoDaqCrate (const PerReadout &perRo)

Private Attributes

DybDaq::DaqBuffer::OutputBufferListm_buffers
 List of output buffers used to collect FileBuffer to be output.

Detailed Description

Definition at line 40 of file ReadoutEventCnv.h.


Constructor & Destructor Documentation

ReadoutHeaderCnv::ReadoutHeaderCnv ( ISvcLocator *  svc)

Definition at line 22 of file ReadoutEventCnv.cc.

      : RootIOTypedCnv<PerReadoutHeader,ReadoutHeader>("PerReadoutHeader",
                                                       classID(),svc),
            m_buffers(new DaqBuffer::OutputBufferList())
{
    m_writefadc = true;
}
ReadoutHeaderCnv::~ReadoutHeaderCnv ( ) [virtual]

Definition at line 31 of file ReadoutEventCnv.cc.

{
  delete m_buffers;
}

Member Function Documentation

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

Definition at line 44 of file ReadoutEventCnv.h.

                               {
    return DayaBay::CLID_ReadoutHeader;
  }
StatusCode ReadoutHeaderCnv::PerToTran ( const PerReadoutHeader perobj,
DayaBay::ReadoutHeader tranobj 
)

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

Definition at line 36 of file ReadoutEventCnv.cc.

{
  MsgStream log(msgSvc(), "ReadoutHeaderCnv::PerToTran");
  StatusCode sc = HeaderObjectCnv::toTran(perobj,tranobj);
  if (sc.isFailure()) return sc;

  delete tranobj.readout();
  if(perobj.readout){
    DayaBay::Readout* readout = convert( *(perobj.readout) );
    if (0 != readout) {
      readout->setHeader( &tranobj );
      tranobj.setReadout( readout );
    }
    if (!((perobj.readout)->rawEvent).empty()) {
      tranobj.setDaqCrate( toDaqCrate(*(perobj.readout)) );
    }
  }else{
    // Header has no readout
    tranobj.setReadout(0);
  }

  return StatusCode::SUCCESS;
}
StatusCode ReadoutHeaderCnv::TranToPer ( const DayaBay::ReadoutHeader tranobj,
PerReadoutHeader perobj 
)

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

Definition at line 78 of file ReadoutEventCnv.cc.

{
  MsgStream log(msgSvc(), "ReadoutHeaderCnv::TranToPer");
  StatusCode sc = HeaderObjectCnv::toPer(tranobj,perobj);
  if (sc.isFailure()) return sc;

  delete perobj.readout;
  const Readout* readout = tranobj.readout();
  const DayaBay::DaqCrate* daqCrate = tranobj.daqCrate();
  if (0 == daqCrate) {
    perobj.readout = 0;
  } else {
    perobj.readout = new PerReadout();
    return TranToPer(*daqCrate,
                     perobj);
  }

  return StatusCode::SUCCESS;
}
StatusCode ReadoutHeaderCnv::fillRepRefs ( IOpaqueAddress *  addr,
DataObject *  dobj 
) [virtual]

Reimplemented from RootIOTypedCnv< PerReadoutHeader, DayaBay::ReadoutHeader >.

Definition at line 120 of file ReadoutEventCnv.cc.

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

    log << MSG::DEBUG
        << "Saving links to " << rh->inputHeaders().size()
        << " input 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 ReadoutHeader part...
    return sc;
}
StatusCode ReadoutHeaderCnv::fillObjRefs ( IOpaqueAddress *  addr,
DataObject *  dobj 
) [virtual]

Reimplemented from RootIOTypedCnv< PerReadoutHeader, DayaBay::ReadoutHeader >.

Definition at line 139 of file ReadoutEventCnv.cc.

{
    MsgStream log(msgSvc(), "ReadoutHeaderCnv::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::DEBUG
        << "Restored links to " << hobj->inputHeaders().size()
        << " input headers" << endreq;

    // ... fill ReadoutHeader part...
    return sc;
}
PerReadout * ReadoutHeaderCnv::convert ( const DayaBay::Readout roRo)

Definition at line 157 of file ReadoutEventCnv.cc.

{
  Detector det(roRo.detector());
  if(det.detectorId() == DetectorId::kUnknown){
      return 0;
  }else if( det.detectorId() != DetectorId::kRPC ){
      return convert( static_cast<const ReadoutPmtCrate&>(roRo) );
  }else{
    return convert( static_cast<const ReadoutRpcCrate&>(roRo) );
  }
  return 0;
}
PerReadoutPmtCrate * ReadoutHeaderCnv::convert ( const DayaBay::ReadoutPmtCrate roPmtCrate)

Definition at line 170 of file ReadoutEventCnv.cc.

{
  MsgStream log(msgSvc(), "ReadoutHeaderCnv::convert(ReadoutPmtCrate&)");
  PerReadoutPmtCrate *perRoPcr = new PerReadoutPmtCrate();
  perRoPcr->detector = (roPmtCrate.detector()).siteDetPackedData();
  perRoPcr->triggerType = roPmtCrate.triggerType();
  perRoPcr->triggerNumber = roPmtCrate.triggerNumber();

  perRoPcr->triggerTimeSec = roPmtCrate.triggerTime().GetSec(); /* FIXME */
  perRoPcr->triggerTimeNanoSec = roPmtCrate.triggerTime().GetNanoSec();
  ReadoutPmtCrate::PmtChannelReadouts chReadouts = roPmtCrate.channelReadout();
  ReadoutPmtCrate::PmtChannelReadouts::iterator it;

  std::vector<PerReadoutPmtChannel*> out_vec;

  for(it=chReadouts.begin();it!=chReadouts.end();++it)
  {
    PerReadoutPmtChannel* perRoPch = convert( it->second );
    perRoPch->channelId = (it->first).fullPackedData();
    out_vec.push_back(perRoPch);
  }
  perRoPcr->perChannelReadouts = out_vec;
  if(roPmtCrate.triggerDataPkg()){
      perRoPcr->perTriggerDataPkg = convert (*(roPmtCrate.triggerDataPkg()));
  }else{
      log << MSG::WARNING << "TriggerDataPackage Not Found" << endreq;
  }

  // now do fadc data
  if(m_writefadc)
  {
      const map<FadcChannelId, DigitalSignal>& in_fadcReadouts = roPmtCrate.fadcReadout();
      map<FadcChannelId, DigitalSignal>::const_iterator fadc_it, done=in_fadcReadouts.end();
      for( fadc_it = in_fadcReadouts.begin() ; fadc_it != done ; ++fadc_it ){
        (perRoPcr->perFadcReadouts)[(fadc_it->first).fullPackedData()] = fadc_it->second ;
      }
  }

  //perRoPcr->fadcReadouts = chan;

  return perRoPcr;
}
PerReadoutPmtChannel * ReadoutHeaderCnv::convert ( const DayaBay::ReadoutPmtChannel roPmtChannel)

Definition at line 213 of file ReadoutEventCnv.cc.

{
  PerReadoutPmtChannel* perRoPch = new PerReadoutPmtChannel();

  perRoPch->mode = roPmtChannel.mode();
  perRoPch->adc   = roPmtChannel.adc();
  perRoPch->adcRange= roPmtChannel.adcRange();
  perRoPch->adcCycle= roPmtChannel.adcCycle();
  perRoPch->pedestal= roPmtChannel.pedestal();
  perRoPch->tdc   = roPmtChannel.tdc();
  perRoPch->tdcHitCount = roPmtChannel.tdcHitCount();
  perRoPch->waveAdcCycle= roPmtChannel.waveAdcCycle();
  perRoPch->waveAdcHigh = roPmtChannel.waveAdcHigh();
  perRoPch->waveAdcLow = roPmtChannel.waveAdcLow();
  return perRoPch;
}
PerReadoutTriggerDataPkg * ReadoutHeaderCnv::convert ( const DayaBay::ReadoutTriggerDataPkg roPmtTDP)

Definition at line 230 of file ReadoutEventCnv.cc.

{

    PerReadoutTriggerDataPkg* perRoTDP= new PerReadoutTriggerDataPkg((roPmtTDP.detector()).siteDetPackedData(),
                                                                      roPmtTDP.trigNumber(),
                                                                      roPmtTDP.numSubTriggers(),
                                                                      roPmtTDP.boardStatus(),
                                                                      roPmtTDP.localSN());

    //PerReadoutTriggerDataPkg* perRoTDP= new PerReadoutTriggerDataPkg();
    //perRoTDP->detector=(roPmtTDP.detector()).siteDetPackedData();
    //perRoTDP->trigNumber=roPmtTDP.trigNumber();
    //perRoTDP->numSubTriggers=roPmtTDP.numSubTriggers();
    //perRoTDP->boardStatus=roPmtTDP.boardStatus();
    //perRoTDP->localSN=roPmtTDP.localSN();
    if (!roPmtTDP.detector().isRPC()) { // convert PMT frames
        std::vector<DayaBay::ReadoutTriggerDataFrame*>::const_iterator it;
        for(it=roPmtTDP.frames().begin();it!=roPmtTDP.frames().end();++it){
            (perRoTDP->frames).push_back(convert(**it));
        }

        return perRoTDP;
    }
    // Do RPC conversion

    std::vector<DayaBay::ReadoutTriggerDataFrame*>::const_iterator it, done = roPmtTDP.frames().end();
    for(it=roPmtTDP.frames().begin();it!=done;++it){
        (perRoTDP->frames).push_back( convert(*((*it)->asRpcFrame())) );
    }

    return perRoTDP;
}
PerReadoutTriggerDataFrame * ReadoutHeaderCnv::convert ( const DayaBay::ReadoutTriggerDataFrame roPmtTDF)

Definition at line 264 of file ReadoutEventCnv.cc.

{
    PerReadoutTriggerDataFrame *perRoTDF = new PerReadoutTriggerDataFrame(roPmtTDF.seqNumber(),
                                                                        roPmtTDF.readoutType(),
                                                                      roPmtTDF.triggerType(),
                                                                      roPmtTDF.triggerTime(),
                                                                      roPmtTDF.cycle(),
                                                                      roPmtTDF.nhit(),
                                                                      roPmtTDF.esumAdc(),
                                                                      roPmtTDF.esumComp(),
                                                                      roPmtTDF.crossSource());

    return perRoTDF;
}
PerReadoutTriggerDataFrame * ReadoutHeaderCnv::convert ( const DayaBay::ReadoutRpcTriggerDataFrame roPmtTDF)

Definition at line 279 of file ReadoutEventCnv.cc.

{
    PerReadoutRpcTriggerDataFrame *perRoTDF = new PerReadoutRpcTriggerDataFrame();
    const ReadoutRpcTriggerDataFrame *rpcFrame = roPmtTDF.asRpcFrame();
    perRoTDF->seqNumber = rpcFrame->seqNumber();
    perRoTDF->readoutType = rpcFrame->readoutType();
    perRoTDF->triggerType = rpcFrame->triggerType();
    perRoTDF->triggerTimeSec = rpcFrame->triggerTime().GetSec();
    perRoTDF->triggerTimeNanoSec = rpcFrame->triggerTime().GetNanoSec();
    perRoTDF->cycle = rpcFrame->cycle();
    perRoTDF->crossSource = rpcFrame->crossSource();

    // now, do the RPC specific part, i.e. fill the input and output triggers
    std::map<FecChannelId,Trigger::TriggerType_t>::const_iterator it, done;

    done = rpcFrame->inTriggers().end();
    for (it = rpcFrame->inTriggers().begin(); it != done; it++) {
        perRoTDF->inTriggers[it->first.fullPackedData()] = it->second;
    }
    done = rpcFrame->outTriggers().end();
    for (it = rpcFrame->outTriggers().begin(); it != done; it++) {
        perRoTDF->outTriggers[it->first.fullPackedData()] = it->second;
    }

    return perRoTDF;
}
PerReadoutRpcCrate * ReadoutHeaderCnv::convert ( const DayaBay::ReadoutRpcCrate roRpcCrate)

Definition at line 306 of file ReadoutEventCnv.cc.

{
    MsgStream log(msgSvc(), "ReadoutHeaderCnv::convert(ReadoutRpcCrate&)");
    PerReadoutRpcCrate *perRoRcr = new PerReadoutRpcCrate();
    perRoRcr->detector = (roRpcCrate.detector()).siteDetPackedData();
    perRoRcr->triggerType = roRpcCrate.triggerType();
    perRoRcr->triggerNumber = roRpcCrate.triggerNumber();

    perRoRcr->triggerTimeSec = roRpcCrate.triggerTime().GetSec();
    perRoRcr->triggerTimeNanoSec = roRpcCrate.triggerTime().GetNanoSec();

    const ReadoutRpcCrate::FecReadouts& fecRos = roRpcCrate.fecReadouts();
    ReadoutRpcCrate::FecReadouts::const_iterator it, done = fecRos.end();
    PerReadoutRpcCrate::PerFecReadouts& out_vec = perRoRcr->perFecReadouts;
    if (out_vec.size() > 0)
        out_vec.clear();

    for(it=fecRos.begin();it!=done;++it) {
        PerReadoutFecBoard* perRoFBrd = convert( it->second );
        out_vec.push_back(perRoFBrd);
    }

    if(roRpcCrate.triggerDataPkg()){
        perRoRcr->perTriggerDataPkg = convert (*(roRpcCrate.triggerDataPkg()));
    }else{
        log << MSG::WARNING << "TriggerDataPackage Not Found" << endreq;
    }

    return perRoRcr;
}
PerReadoutFecBoard * ReadoutHeaderCnv::convert ( const DayaBay::ReadoutFecBoard roFecBoard)

Definition at line 337 of file ReadoutEventCnv.cc.

{
    PerReadoutFecBoard* perRoBrd = new PerReadoutFecBoard();

    perRoBrd->hitMap = roFecBoard.hitMap();
    perRoBrd->boardId = roFecBoard.boardId().fullPackedData();
    perRoBrd->flag3of4 = roFecBoard.flag3of4();
    perRoBrd->flag2of4 = roFecBoard.flag2of4();

    return perRoBrd;
}
Readout * ReadoutHeaderCnv::convert ( const PerReadout perRo)

Definition at line 349 of file ReadoutEventCnv.cc.

{
  Detector det(perRo.detector);
  if(det.detectorId() == DetectorId::kUnknown){
      return 0;
  }else if( det.detectorId() != DetectorId::kRPC ){
      return convert( static_cast<const PerReadoutPmtCrate&>(perRo) );
  }else{
      return convert( static_cast<const PerReadoutRpcCrate&>(perRo) );
  }
  return 0;
}
ReadoutPmtCrate * ReadoutHeaderCnv::convert ( const PerReadoutPmtCrate perRoPcr)

Definition at line 362 of file ReadoutEventCnv.cc.

{
  ReadoutPmtCrate *out_crate = new ReadoutPmtCrate();
  Detector det(perRoPcr.detector);
  out_crate->setDetector(det);
  out_crate->setTriggerType( Trigger::TriggerType_t(perRoPcr.triggerType) );
  out_crate->setTriggerNumber( perRoPcr.triggerNumber );

  timespec value = {perRoPcr.triggerTimeSec,perRoPcr.triggerTimeNanoSec};
  TimeStamp tstamp(value);
  out_crate->setTriggerTime(tstamp);

  ReadoutPmtCrate::PmtChannelReadouts out_channels;

  PerReadoutPmtCrate::PerPmtChannelReadouts in_channels = perRoPcr.perChannelReadouts;
  PerReadoutPmtCrate::PerPmtChannelReadouts::const_iterator it;

  for(it=in_channels.begin(); it!=in_channels.end(); ++it){
    ReadoutPmtChannel out_channel = convert(**it);
    out_channel.setReadout(out_crate);
    out_channels[out_channel.channelId()]=out_channel;
  }

  out_crate->setChannelReadout(out_channels);
  //Add protection so old version data without TriggerDataPkg can also be read
  if(perRoPcr.perTriggerDataPkg) {
    ReadoutTriggerDataPkg* rotdf = convert( *(perRoPcr.perTriggerDataPkg) );
    rotdf->setReadout(out_crate);
    out_crate->setTriggerDataPkg(rotdf);
  }

  ReadoutPmtCrate::FadcReadouts& out_fadcReadouts = out_crate->fadcReadout();

  PerReadoutPmtCrate::PerFadcReadouts in_fadcReadouts;
  PerReadoutPmtCrate::PerFadcReadouts::const_iterator fadc_it;

  //if(perRoPcr.perFadcReadouts.size()>0){
  //ReadoutPmtCrate::FadcReadouts::iterator fadc_it;
  for(fadc_it=in_fadcReadouts.begin();fadc_it!=in_fadcReadouts.end();++fadc_it){
      out_fadcReadouts[DayaBay::FadcChannelId(fadc_it->first)]=fadc_it->second;
  }
  //}

  return out_crate;
}
ReadoutPmtChannel ReadoutHeaderCnv::convert ( const PerReadoutPmtChannel perRoPch)

Definition at line 408 of file ReadoutEventCnv.cc.

{
  ReadoutPmtChannel out_ch;
  FeeChannelId id(perRoPch.channelId);
  out_ch.setChannelId(id);
  out_ch.setMode(perRoPch.mode);
  out_ch.setAdc(perRoPch.adc);
  out_ch.setAdcRange(perRoPch.adcRange);
  out_ch.setAdcCycle(perRoPch.adcCycle);
  out_ch.setPedestal(perRoPch.pedestal);
  out_ch.setTdc(perRoPch.tdc);
  out_ch.setTdcHitCount(perRoPch.tdcHitCount);
  out_ch.setWaveAdcCycle(perRoPch.waveAdcCycle);
  out_ch.setWaveAdcHigh(perRoPch.waveAdcHigh);
  out_ch.setWaveAdcLow(perRoPch.waveAdcLow);
  return out_ch;
}
ReadoutTriggerDataPkg * ReadoutHeaderCnv::convert ( const PerReadoutTriggerDataPkg perRoPmtTDP)

Definition at line 426 of file ReadoutEventCnv.cc.

{
  ReadoutTriggerDataPkg* roTDP = new ReadoutTriggerDataPkg();
  Detector det(perRoPmtTDP.detector);
  roTDP->setDetector(det);
  roTDP->setTrigNumber(perRoPmtTDP.trigNumber);
  roTDP->setBoardStatus(perRoPmtTDP.boardStatus);
  roTDP->setLocalSN(perRoPmtTDP.localSN);
  if (!det.isRPC()) { // do PMT trigger conversion
      std::vector<PerReadoutTriggerDataFrame*>::const_iterator it;
      for(it=perRoPmtTDP.frames.begin();it!=perRoPmtTDP.frames.end();++it)
      {
        ReadoutTriggerDataFrame* rotdf=convert(**it);
        rotdf->setPackage(roTDP);
        roTDP->addFrame(rotdf);
      }
      return roTDP;
  }
    // deal with RPC detector
    std::vector<PerReadoutTriggerDataFrame*>::const_iterator it, done = perRoPmtTDP.frames.end();
    for(it=perRoPmtTDP.frames.begin();it!=perRoPmtTDP.frames.end();++it) {
        ReadoutTriggerDataFrame* rpcframe=convert(*(dynamic_cast<const PerReadoutRpcTriggerDataFrame*>(*it)));
        rpcframe->setPackage(roTDP);
        roTDP->addFrame(rpcframe);
    }
    return roTDP;
}
ReadoutTriggerDataFrame * ReadoutHeaderCnv::convert ( const PerReadoutTriggerDataFrame perToPmtTDF)

Definition at line 454 of file ReadoutEventCnv.cc.

{
  ReadoutTriggerDataFrame *rotdf = new ReadoutTriggerDataFrame();
  rotdf->setSeqNumber(perToPmtTDF.seqNumber);
  rotdf->setReadoutType(perToPmtTDF.readoutType);
  rotdf->setTriggerType(Trigger::TriggerType_t(perToPmtTDF.triggerType));
  rotdf->setTriggerTime(perToPmtTDF.triggerTime);
  rotdf->setCycle(perToPmtTDF.cycle);
  rotdf->setNhit(perToPmtTDF.nhit);
  rotdf->setEsumAdc(perToPmtTDF.esumAdc);
  rotdf->setEsumComp(perToPmtTDF.esumComp);
  rotdf->setCrossSource(perToPmtTDF.crossSource);
  return rotdf;
}
ReadoutTriggerDataFrame * ReadoutHeaderCnv::convert ( const PerReadoutRpcTriggerDataFrame perRpcFrame)

Definition at line 469 of file ReadoutEventCnv.cc.

{
  ReadoutRpcTriggerDataFrame *rotdf = new ReadoutRpcTriggerDataFrame();
  rotdf->setSeqNumber(perRpcFrame.seqNumber);
  rotdf->setReadoutType(perRpcFrame.readoutType);
  rotdf->setTriggerType(Trigger::TriggerType_t(perRpcFrame.triggerType));
  timespec tt = {perRpcFrame.triggerTimeSec,perRpcFrame.triggerTimeNanoSec};
  rotdf->setTriggerTime( TimeStamp(tt) );
  rotdf->setCycle(perRpcFrame.cycle);
  rotdf->setCrossSource(perRpcFrame.crossSource);

  // now, do the RPC specific part, i.e. fill the input and output triggers
  std::map<DayaBay::FecChannelId,DayaBay::Trigger::TriggerType_t> trigmap;

  std::map<PerReadoutRpcTriggerDataFrame::FecChannelId_type,PerReadoutRpcTriggerDataFrame::TriggerType_type>
    ::const_iterator it, done;
  done = perRpcFrame.inTriggers.end();
  for (it = perRpcFrame.inTriggers.begin(); it != done; it++) {
    trigmap[FecChannelId(it->first)] = Trigger::TriggerType_t(it->second);
  }
  rotdf->setInTriggers(trigmap);
  trigmap.clear();

  done = perRpcFrame.outTriggers.end();
  for (it = perRpcFrame.outTriggers.begin(); it != done; it++) {
    trigmap[FecChannelId(it->first)] = Trigger::TriggerType_t(it->second);
  }
  rotdf->setOutTriggers(trigmap);

  return rotdf;
}
ReadoutRpcCrate * ReadoutHeaderCnv::convert ( const PerReadoutRpcCrate perRoRcr)

Definition at line 501 of file ReadoutEventCnv.cc.

{
    ReadoutRpcCrate *out_crate = new ReadoutRpcCrate();
    Detector det(perRoRcr.detector);
    out_crate->setDetector(det);
    out_crate->setTriggerType( Trigger::TriggerType_t(perRoRcr.triggerType) );
    out_crate->setTriggerNumber( perRoRcr.triggerNumber );

    timespec value = {perRoRcr.triggerTimeSec,perRoRcr.triggerTimeNanoSec};
    TimeStamp tstamp(value);
    out_crate->setTriggerTime(tstamp);

    ReadoutRpcCrate::FecReadouts out_brds;

    const PerReadoutRpcCrate::PerFecReadouts& in_brds = perRoRcr.perFecReadouts;
    PerReadoutRpcCrate::PerFecReadouts::const_iterator it, done = in_brds.end();

    for(it=in_brds.begin(); it!=done; ++it) {
        ReadoutFecBoard out_brd = convert(**it);
        out_brd.setReadout(out_crate);
        out_brds[out_brd.boardId()] = out_brd;
    }

    out_crate->setFecReadouts(out_brds);
    //Add protection so old version data without TriggerDataPkg can also be read
    if(perRoRcr.perTriggerDataPkg) {
        ReadoutTriggerDataPkg* rotdf = convert( *(perRoRcr.perTriggerDataPkg) );
        rotdf->setReadout(out_crate);
        out_crate->setTriggerDataPkg(rotdf);
    }

    return out_crate;
}
ReadoutFecBoard ReadoutHeaderCnv::convert ( const PerReadoutFecBoard perRoFecBrd)

Definition at line 535 of file ReadoutEventCnv.cc.

{
    ReadoutFecBoard out_ch;
    FecChannelId id(perRoFecBrd.boardId);
    out_ch.setBoardId(id);
    out_ch.setHitMap(perRoFecBrd.hitMap);
    out_ch.setFlag3of4(perRoFecBrd.flag3of4);
    out_ch.setFlag2of4(perRoFecBrd.flag2of4);
    return out_ch;
}
StatusCode ReadoutHeaderCnv::TranToPer ( const DayaBay::DaqCrate tranobj,
PerReadoutHeader perobj 
) [private]

Definition at line 99 of file ReadoutEventCnv.cc.

                                                                 {
  const DybDaq::EventReadout& eventReadout = tranobj.eventReadout();
  std::vector<unsigned int>& daqBytes = perobj.readout->rawEvent;
  daqBytes.resize(eventReadout.bufferSize() * ByteBuffer::BYTES_IN_INT);
  unsigned int index = 0;
  eventReadout.gather(*m_buffers);
  DaqBuffer::OutputBufferList::const_iterator buffer;
  for (buffer = m_buffers->begin();
       buffer != m_buffers->end();
       ++buffer) {
    unsigned int capacity = (*buffer).second;
    memcpy(&(daqBytes[index]),
           (*buffer).first,
           capacity);
    index += (capacity / ByteBuffer::BYTES_IN_INT);
  }
  m_buffers->clear();
  return StatusCode::SUCCESS;
}
DayaBay::DaqCrate * ReadoutHeaderCnv::toDaqCrate ( const PerReadout perRo) [private]

Definition at line 61 of file ReadoutEventCnv.cc.

{
    const std::vector<unsigned int>& rawData = perRo.rawEvent;
    unsigned int capacity = rawData.size() * ByteBuffer::BYTES_IN_INT;
    char* buffer = new char[capacity];
    memcpy(buffer, &(rawData[0]), capacity);

    ByteBuffer* byteBuffer = new ByteBuffer(buffer, capacity);
    EventReadout* eventReadout =  new EventReadout(*byteBuffer);
    byteBuffer->release();

    if (eventReadout->header().detector() == DetectorId::kRPC) {
        return new DaqRpcCrate(eventReadout);
    }
    return new DaqPmtCrate(eventReadout);
}
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

Definition at line 82 of file ReadoutEventCnv.h.

List of output buffers used to collect FileBuffer to be output.

Definition at line 94 of file ReadoutEventCnv.h.

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:05:05 for PerReadoutEvent by doxygen 1.7.4