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

In This Package:

RawEventHeaderCnv Class Reference

#include <RawEventHeaderCnv.h>

Inheritance diagram for RawEventHeaderCnv:

[legend]
Collaboration diagram for RawEventHeaderCnv:
[legend]
List of all members.

Public Types

 INVALID_ADDRESS
 INVALID_OBJECT
 NO_MEMORY
 BAD_STORAGE_TYPE
 NO_SOURCE_OBJECT
 ICONVERSIONSVC_LAST_ERROR
 SUCCESS
 NO_INTERFACE
 VERSMISMATCH
 LAST_ERROR
enum  Status

Public Member Functions

 RawEventHeaderCnv (ISvcLocator *&)
 RawEventHeaderCnv (unsigned char storageType, const CLID &clid, ISvcLocator *svc)
virtual ~RawEventHeaderCnv ()
virtual long repSvcType () const
virtual StatusCode initialize ()
virtual StatusCode finalize ()
void declareObject (const string &fullPath, const CLID &clid, const string &bank, long par=0)
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddr)
virtual StatusCode updateObj (IOpaqueAddress *, DataObject *)
virtual StatusCode createObj (IOpaqueAddress *, DataObject *&)
virtual StatusCode fillRepRefs (IOpaqueAddress *, DataObject *)
virtual StatusCode updateRep (IOpaqueAddress *, DataObject *)
virtual StatusCode updateRepRefs (IOpaqueAddress *, DataObject *)
DayaBay::RawRomconvertRomFee (const RawDataEvent::RomFee *romFee)
DayaBay::RawPmtChannelconvertPmtChannel (const RawDataEvent::PmtChannel &pmtChannel)
DayaBay::RawRomconvertRomLtb (const RawDataEvent::RomLtb *romLtb)
DayaBay::RawLtbFrameUTCconvertLtbFrameUTC (const RawDataEvent::LtbFrameUTC *ltbFrame)
DayaBay::RawLtbFrameUnixconvertLtbFrameUnix (const RawDataEvent::LtbFrameUnix *ltbFrame)
StatusCode unpackEvent (DayaBay::RawEvent *event, DayaBay::RawEventHeader *rawEventHeader)
DayaBay::RawRomunpackLtbModule (DayaBay::RawModule *module)
DayaBay::RawRomunpackFeeModule (DayaBay::RawModule *module)
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
virtual unsigned long addRef ()
virtual unsigned long release ()
virtual StatusCode setDataProvider (IDataProviderSvc *svc)
virtual IDataProviderSvcdataProvider () const
virtual StatusCode setConversionSvc (IConversionSvc *svc)
virtual IConversionSvcconversionSvc () const
virtual StatusCode setAddressCreator (IAddressCreator *creator)
virtual IAddressCreatoraddressCreator () const
virtual const CLIDobjType () const
virtual long i_repSvcType () const
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
StatusCode service (const std::string &name, T *&psvc, bool createIf=false) const
StatusCode service (const std::string &type, const std::string &name, T *&psvc) const

Static Public Member Functions

static const long storageType ()
static const CLIDclassID ()
static const InterfaceIDinterfaceID ()

Public Attributes

 INVALID_ADDRESS
 INVALID_OBJECT
 NO_MEMORY
 BAD_STORAGE_TYPE
 NO_SOURCE_OBJECT
 ICONVERSIONSVC_LAST_ERROR

Protected Member Functions

ISvcLocatorserviceLocator () const
IMessageSvcmsgSvc () const
IMessageSvcmessageService () const
IDataManagerSvcdataManager () const

Private Attributes

MsgStream m_log
IRawDataInputSvcm_inputSvc

Detailed Description

Definition at line 32 of file RawEventHeaderCnv.h.


Constructor & Destructor Documentation

RawEventHeaderCnv::RawEventHeaderCnv ( ISvcLocator *&   ) 

Definition at line 27 of file RawEventHeaderCnv.cc.

00028 : Converter(RAWDATA_StorageType, classID(), svc)
00029   , m_log(msgSvc(), "RawEventHeaderCnv")
00030 {
00031   initialize();
00032 }

RawEventHeaderCnv::RawEventHeaderCnv ( unsigned char  storageType,
const CLID clid,
ISvcLocator svc 
)

Definition at line 20 of file RawEventHeaderCnv.cc.

00021 : Converter(RAWDATA_StorageType, classID(), svc)
00022   , m_log(msgSvc(), "RawEventHeaderCnv")
00023 {
00024   initialize();
00025 }

virtual RawEventHeaderCnv::~RawEventHeaderCnv (  )  [inline, virtual]

Definition at line 39 of file RawEventHeaderCnv.h.

00039 {}


Member Function Documentation

virtual long RawEventHeaderCnv::repSvcType (  )  const [inline, virtual]

Implements Converter.

Definition at line 42 of file RawEventHeaderCnv.h.

00042                                    {
00043       return RAWDATA_StorageType;
00044    }

static const long RawEventHeaderCnv::storageType (  )  [inline, static]

Definition at line 45 of file RawEventHeaderCnv.h.

00045                                    {
00046       return RAWDATA_StorageType;
00047    }

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

Definition at line 49 of file RawEventHeaderCnv.h.

00049                                    {
00050       return DayaBay::CLID_RawEventHeader;
00051    }

StatusCode RawEventHeaderCnv::initialize (  )  [virtual]

Reimplemented from Converter.

Definition at line 34 of file RawEventHeaderCnv.cc.

00035 {
00036   m_log << MSG::DEBUG << "initialize()" << endreq;
00037 
00038   m_log << MSG::DEBUG << "  query the service RawDataInputSvc." << endreq;
00039   IService* svc = 0;
00040   StatusCode sc = serviceLocator()->getService("RawDataInputSvc", svc, true);
00041   if (sc.isFailure()) {
00042     m_log << MSG::ERROR << "RawDataInputSvc could not be retrieved" << endreq;
00043     return sc;
00044   }
00045   svc->addRef();
00046 
00047   sc = svc->queryInterface(IID_IRawDataInputSvc, (void**) & m_inputSvc);
00048   if (sc.isFailure()) {
00049     m_log << MSG::ERROR << "queryInterface(IID_IRawDataInputSvc) failed" << endreq;
00050     return StatusCode::FAILURE;
00051   }
00052 
00053   return StatusCode::SUCCESS;
00054 }

StatusCode RawEventHeaderCnv::finalize (  )  [virtual]

Reimplemented from Converter.

Definition at line 148 of file RawEventHeaderCnv.cc.

00149 {
00150   m_log << MSG::DEBUG << "finalize()" << endreq;
00151   return StatusCode::SUCCESS;
00152 }

void RawEventHeaderCnv::declareObject ( const string &  fullPath,
const CLID clid,
const string &  bank,
long  par = 0 
)

StatusCode RawEventHeaderCnv::createRep ( DataObject pObject,
IOpaqueAddress *&  refpAddr 
) [virtual]

Reimplemented from Converter.

Definition at line 131 of file RawEventHeaderCnv.cc.

00132 {
00133   m_log << MSG::DEBUG << "createRep()" << endreq;
00134 
00135   RawEventHeader* rdth = dynamic_cast<RawEventHeader*>(pObj);
00136   if (!rdth) {
00137     m_log << MSG::ERROR << "Could not downcast Event" << endreq;
00138     return StatusCode::FAILURE;
00139   }
00140 
00141   string nm = pObj->registry()->name();
00142   RawDataAddress* addr = new RawDataAddress(classID(), nm, "");
00143   pAddr = addr;
00144 
00145   return StatusCode::SUCCESS;
00146 }

StatusCode RawEventHeaderCnv::updateObj ( IOpaqueAddress ,
DataObject  
) [virtual]

Reimplemented from Converter.

Definition at line 57 of file RawEventHeaderCnv.cc.

00058 {
00059   m_log << MSG::DEBUG << "updateObj()" << endreq;
00060   return Converter::updateObj(pAddr, pObj);
00061 }

StatusCode RawEventHeaderCnv::createObj ( IOpaqueAddress ,
DataObject *&   
) [virtual]

Reimplemented from Converter.

Definition at line 63 of file RawEventHeaderCnv.cc.

00064 {
00065   m_log << MSG::DEBUG << "createObj()" << endreq;
00066 
00067   RawEventHeader* rawEventHeader = new RawEventHeader();
00068   pObj = rawEventHeader;
00069 
00070   if(m_inputSvc->m_inputSvcVersion==2) {
00071     DayaBay::RawEvent *event = m_inputSvc->currentRawEventClone();
00072     if (event == NULL) {
00073       m_log << MSG::INFO << "The RawEvent returned is not valid. Please declare RawEventHeader in RawDataInputSvc as true." << endreq;
00074       return StatusCode::FAILURE;
00075     }
00076 
00077     unpackEvent(event, rawEventHeader);
00078   }
00079 
00080   else {
00081     RawDataEvent* rawEvt = m_inputSvc->currentEvent();
00082     if (rawEvt == NULL) {
00083       m_log << MSG::INFO << "The RawDataEvent returned is not valid." << endreq;
00084       return StatusCode::FAILURE;
00085     }
00086 
00087     vector<RawRom*> rawRoms;
00089     for (unsigned int i = 0; i < rawEvt->m_modules.size(); i++) {
00090       switch (rawEvt->m_modules[i]->m_type) {
00091         case kRomLtb:
00092           {
00093             RawDataEvent::RomLtb* romLtb = dynamic_cast<RawDataEvent::RomLtb*>(rawEvt->m_modules[i]);
00094             RawRom *rawRomLtb = convertRomLtb(romLtb);
00095             rawRomLtb->setHeader(rawEventHeader);
00096             rawRoms.push_back(rawRomLtb);
00097           }
00098           break;
00099         case kRomFee:
00100           {
00101             RawDataEvent::RomFee* romFee = dynamic_cast<RawDataEvent::RomFee*>(rawEvt->m_modules[i]);
00102             RawRom *rawRomFee = convertRomFee(romFee);
00103             rawRomFee->setHeader(rawEventHeader);
00104             rawRoms.push_back(rawRomFee);
00105           }
00106           break;
00107         default:
00108           break;
00109       }
00110     }
00111 
00113     rawEventHeader->setModules(rawRoms);
00114 
00115     rawEventHeader->setDataBlockNum(rawEvt->m_dataBlockNum);
00116     rawEventHeader->setDataBlockSize(rawEvt->m_dataBlockSize);
00117     rawEventHeader->setEvtSize(rawEvt->m_evtSize);
00118     rawEventHeader->setDetId(rawEvt->m_detId);
00119     rawEventHeader->setSiteId(rawEvt->m_siteId);
00120     rawEventHeader->setPositionId(rawEvt->m_positionId);
00121     rawEventHeader->setRunNum(rawEvt->m_runNum);
00122     rawEventHeader->setEvtNum(rawEvt->m_evtNum);
00123     rawEventHeader->setDataType(rawEvt->m_dataType);
00124     rawEventHeader->setDataTypeSpecific(rawEvt->m_dataTypeSpecific);
00125     rawEventHeader->setDataStatus(rawEvt->m_dataStatus);
00126   }
00127 
00128   return StatusCode::SUCCESS;
00129 }

virtual StatusCode RawEventHeaderCnv::fillRepRefs ( IOpaqueAddress ,
DataObject  
) [inline, virtual]

Reimplemented from Converter.

Definition at line 63 of file RawEventHeaderCnv.h.

00063                                                                                          {
00064       return StatusCode::SUCCESS;
00065    }

virtual StatusCode RawEventHeaderCnv::updateRep ( IOpaqueAddress ,
DataObject  
) [inline, virtual]

Reimplemented from Converter.

Definition at line 66 of file RawEventHeaderCnv.h.

00066                                                                                            {
00067       return StatusCode::SUCCESS;
00068    }

virtual StatusCode RawEventHeaderCnv::updateRepRefs ( IOpaqueAddress ,
DataObject  
) [inline, virtual]

Reimplemented from Converter.

Definition at line 69 of file RawEventHeaderCnv.h.

00069                                                                                                {
00070       return StatusCode::SUCCESS;
00071    }

RawRom * RawEventHeaderCnv::convertRomFee ( const RawDataEvent::RomFee romFee  ) 

Definition at line 154 of file RawEventHeaderCnv.cc.

00155 {
00156   RawRom *rawRom = new RawRomFee();
00157 
00158   RawRomFee *rawRomFee = dynamic_cast<RawRomFee*>(rawRom);
00159   rawRomFee->setSize(romFee->m_size);
00160   rawRomFee->setSlot(romFee->m_slot);
00161   rawRomFee->setType(romFee->m_type);
00162   rawRomFee->setCbltGA(romFee->m_cbltGA);
00163   rawRomFee->setCbltModuleType(romFee->m_cbltModuleType);
00164   rawRomFee->setCbltDataLength(romFee->m_cbltDataLength);
00165 
00166   rawRomFee->setTriggerNum(romFee->m_triggerNum);
00167   rawRomFee->setTriggerType(romFee->m_triggerType);
00168   rawRomFee->setStatus(romFee->m_status);
00169   rawRomFee->setDataLength(romFee->m_dataLength);
00170   rawRomFee->setVersion(romFee->m_version);
00171 
00173   vector<RawPmtChannel*> rawPmtChannels;
00174   for (unsigned int j = 0; j < romFee->m_channels.size(); j++) {
00175     const RawDataEvent::PmtChannel &channel = romFee->m_channels[j];
00176     rawPmtChannels.push_back(convertPmtChannel(channel));
00177   }
00178   rawRomFee->setChannels(rawPmtChannels);
00179 
00180   return rawRom;
00181 }

RawPmtChannel * RawEventHeaderCnv::convertPmtChannel ( const RawDataEvent::PmtChannel pmtChannel  ) 

Definition at line 183 of file RawEventHeaderCnv.cc.

00184 {
00185   RawPmtChannel *rawPmtChannel = new RawPmtChannel();
00186 
00187   rawPmtChannel->setChannel(pmtChannel.m_channel);
00188   rawPmtChannel->setAdc(pmtChannel.m_adc);
00189   rawPmtChannel->setAdcPeakingCycle(pmtChannel.m_adcPeakingCycle);
00190   rawPmtChannel->setAdcRange(pmtChannel.m_adcRange);
00191   rawPmtChannel->setTdc(pmtChannel.m_tdc);
00192   rawPmtChannel->setTdcHitCount(pmtChannel.m_tdcHitCount);
00193   rawPmtChannel->setPedestal(pmtChannel.m_pedestal);
00194 
00195   return rawPmtChannel;
00196 }

RawRom * RawEventHeaderCnv::convertRomLtb ( const RawDataEvent::RomLtb romLtb  ) 

Definition at line 198 of file RawEventHeaderCnv.cc.

00199 {
00200   RawRom *rawRom = new RawRomLtb();
00201 
00202   RawRomLtb *rawRomLtb = dynamic_cast<RawRomLtb*>(rawRom);
00203 
00204   rawRomLtb->setSize(romLtb->m_size);
00205   rawRomLtb->setSlot(romLtb->m_slot);
00206   rawRomLtb->setType(romLtb->m_type);
00207   rawRomLtb->setCbltGA(romLtb->m_cbltGA);
00208   rawRomLtb->setCbltModuleType(romLtb->m_cbltModuleType);
00209   rawRomLtb->setCbltDataLength(romLtb->m_cbltDataLength);
00210 
00212   vector<RawLtbFrame*> rawLtbFrames;
00213   for (unsigned int j = 0; j < romLtb->m_frames.size(); j++) {
00214     RawDataEvent::LtbFrame *frame = romLtb->m_frames[j];
00215     if(frame->m_timestampType && frame->m_GPSValid && frame->m_clockSystemValid) {
00216       RawDataEvent::LtbFrameUTC* ltbFrameUTC = dynamic_cast<RawDataEvent::LtbFrameUTC*>(frame);
00217       rawLtbFrames.push_back(convertLtbFrameUTC(ltbFrameUTC));
00218     } else {
00219       RawDataEvent::LtbFrameUnix* ltbFrameUnix = dynamic_cast<RawDataEvent::LtbFrameUnix*>(frame);
00220       rawLtbFrames.push_back(convertLtbFrameUnix(ltbFrameUnix));
00221     }
00222   }
00223   rawRomLtb->setFrames(rawLtbFrames);
00224 
00225   return rawRom;
00226 }

RawLtbFrameUTC * RawEventHeaderCnv::convertLtbFrameUTC ( const RawDataEvent::LtbFrameUTC ltbFrame  ) 

Definition at line 228 of file RawEventHeaderCnv.cc.

00229 {
00230   RawLtbFrameUTC *rawLtbFrame = new RawLtbFrameUTC();
00231 
00232   rawLtbFrame->setAccStat(ltbFrame->m_accStat);
00233   rawLtbFrame->setGPSValid(ltbFrame->m_GPSValid);
00234   rawLtbFrame->setTimestampType(ltbFrame->m_timestampType);
00235   rawLtbFrame->setClockSystemValid(ltbFrame->m_clockSystemValid);
00236   rawLtbFrame->setIltSn(ltbFrame->m_iltSn);
00237   rawLtbFrame->setRot(ltbFrame->m_rot);
00238   rawLtbFrame->setTriggerSrc(ltbFrame->m_triggerSrc);
00239   rawLtbFrame->setNanoSecondLow(ltbFrame->m_nanoSecondLow);
00240   rawLtbFrame->setNanoSecondHigh(ltbFrame->m_nanoSecondHigh);
00241   rawLtbFrame->setAccumulationLow(ltbFrame->m_accumulationLow);
00242   rawLtbFrame->setAccumulationHigh(ltbFrame->m_accumulationHigh);
00243   rawLtbFrame->setHsum(ltbFrame->m_hsum);
00244   rawLtbFrame->setEsumComp(ltbFrame->m_esumComp);
00245   rawLtbFrame->setEsumADC(ltbFrame->m_esumADC);
00246   rawLtbFrame->setCrossTriggerSrc(ltbFrame->m_crossTriggerSrc);
00247   rawLtbFrame->setFeeBufferStat(ltbFrame->m_feeBufferStat);
00248   rawLtbFrame->setLtbBufferStat(ltbFrame->m_ltbBufferStat);
00249   rawLtbFrame->setDay(ltbFrame->m_day);
00250   rawLtbFrame->setHour(ltbFrame->m_hour);
00251   rawLtbFrame->setMinute(ltbFrame->m_minute);
00252   rawLtbFrame->setSecond(ltbFrame->m_second);
00253   rawLtbFrame->setTimestamp(ltbFrame->timeStamp());
00254 
00255   return rawLtbFrame;
00256 }

RawLtbFrameUnix * RawEventHeaderCnv::convertLtbFrameUnix ( const RawDataEvent::LtbFrameUnix ltbFrame  ) 

Definition at line 258 of file RawEventHeaderCnv.cc.

00259 {
00260   RawLtbFrameUnix *rawLtbFrame = new RawLtbFrameUnix();
00261 
00262   rawLtbFrame->setAccStat(ltbFrame->m_accStat);
00263   rawLtbFrame->setGPSValid(ltbFrame->m_GPSValid);
00264   rawLtbFrame->setTimestampType(ltbFrame->m_timestampType);
00265   rawLtbFrame->setClockSystemValid(ltbFrame->m_clockSystemValid);
00266   rawLtbFrame->setIltSn(ltbFrame->m_iltSn);
00267   rawLtbFrame->setRot(ltbFrame->m_rot);
00268   rawLtbFrame->setTriggerSrc(ltbFrame->m_triggerSrc);
00269   rawLtbFrame->setNanoSecondLow(ltbFrame->m_nanoSecondLow);
00270   rawLtbFrame->setNanoSecondHigh(ltbFrame->m_nanoSecondHigh);
00271   rawLtbFrame->setAccumulationLow(ltbFrame->m_accumulationLow);
00272   rawLtbFrame->setAccumulationHigh(ltbFrame->m_accumulationHigh);
00273   rawLtbFrame->setHsum(ltbFrame->m_hsum);
00274   rawLtbFrame->setEsumComp(ltbFrame->m_esumComp);
00275   rawLtbFrame->setEsumADC(ltbFrame->m_esumADC);
00276   rawLtbFrame->setCrossTriggerSrc(ltbFrame->m_crossTriggerSrc);
00277   rawLtbFrame->setFeeBufferStat(ltbFrame->m_feeBufferStat);
00278   rawLtbFrame->setLtbBufferStat(ltbFrame->m_ltbBufferStat);
00279   rawLtbFrame->setUnixSecLow(ltbFrame->m_unixSecLow);
00280   rawLtbFrame->setUnixSecHigh(ltbFrame->m_unixSecHigh);
00281   rawLtbFrame->setTimestamp(ltbFrame->timeStamp());
00282 
00283   return rawLtbFrame;
00284 }

StatusCode RawEventHeaderCnv::unpackEvent ( DayaBay::RawEvent event,
DayaBay::RawEventHeader rawEventHeader 
)

Definition at line 287 of file RawEventHeaderCnv.cc.

00289 {
00290   m_log << MSG::DEBUG << "unpackEvent" << endreq;
00291 
00292   vector<RawRom*> rawRoms;
00293   // Loop over modules
00294   while( DayaBay::RawModule* module = event->nextModule() ){
00295     StatusCode sc;
00296     if( module->isLocalTriggerModule() ){
00297       m_log << MSG::DEBUG << "LocalTriggerModule" << endreq;
00298       RawRom *rawRomLtb = unpackLtbModule(module);
00299       rawRomLtb->setHeader(rawEventHeader);
00300       rawRoms.push_back(rawRomLtb);
00301     }else if( module->isPmtFeeModule() ){
00302       m_log << MSG::DEBUG << "PmtFeeModule" << endreq;
00303       RawRom *rawRomFee = unpackFeeModule(module);
00304       rawRomFee->setHeader(rawEventHeader);
00305       rawRoms.push_back(rawRomFee);
00306     }else if( module->isFlashAdcModule() ){
00307       //sc = this->unpackFlashAdcModule(module, readout);
00308     }else if( module->isRpcRomModule() ){
00309       //sc = this->unpackRpcRomModule(module, readout);
00310     }else if( module->isRpcRtmModule() ){
00311       //sc = this->unpackRpcRomModule(module, readout);
00312     }else{
00313       m_log << MSG::WARNING << "Cannot unpack unknown module type: " 
00314         << module->moduleType()<< endreq;
00315       sc = StatusCode::FAILURE;
00316     }
00317     if( !sc.isSuccess() ){
00318       // Gracefully continue even if there is trouble reading a module
00319       continue;
00320     }
00321     delete module;
00322   }
00323 
00324   rawEventHeader->setModules(rawRoms);
00325 
00326   return StatusCode::SUCCESS;
00327 }

RawRom * RawEventHeaderCnv::unpackLtbModule ( DayaBay::RawModule module  ) 

Definition at line 330 of file RawEventHeaderCnv.cc.

00331 {
00332   m_log << MSG::DEBUG << "unpackLtbModule" << endreq;
00333 
00334   RawRom *rawRom = new RawRomLtb();
00335   RawRomLtb *rawRomLtb = dynamic_cast<RawRomLtb*>(rawRom);
00336   rawRomLtb->setType(module->moduleType());
00337   rawRomLtb->setSize(module->size());
00338   rawRomLtb->setSlot(module->slot());
00339 
00340   vector<RawLtbFrame*> rawLtbFrames;
00341   while( DayaBay::DataFragment* fragment = module->nextDataFragment() ){
00342     if( fragment->isLocalTriggerData() ){
00343       // Process the trigger data fragment
00344       DayaBay::LocalTriggerData* ltbData = 
00345         dynamic_cast<DayaBay::LocalTriggerData*>(fragment);
00346       if(!ltbData){
00347         m_log << MSG::WARNING << "Bad Local Trigger Data fragment" << endreq;
00348         continue;
00349       }
00350 
00351       if(ltbData->isUnixTime()) {
00352         RawLtbFrameUnix *rawLtbFrame = new RawLtbFrameUnix();
00353         rawLtbFrames.push_back(rawLtbFrame);
00354 
00355         rawLtbFrame->setAccStat(ltbData->accumulationStatus());
00356         rawLtbFrame->setGPSValid(ltbData->gpsValid());
00357         rawLtbFrame->setTimestampType(ltbData->timestampType());
00358         rawLtbFrame->setClockSystemValid(ltbData->clockValid());
00359         rawLtbFrame->setRot(ltbData->readOutType());
00360         rawLtbFrame->setTriggerSrc(ltbData->triggerType());
00361         rawLtbFrame->setNanoSecondLow(ltbData->nanosecondLow());
00362         rawLtbFrame->setNanoSecondHigh(ltbData->nanosecondHigh());
00363         rawLtbFrame->setAccumulationLow(ltbData->accumulationLow());
00364         rawLtbFrame->setAccumulationHigh(ltbData->accumulationHigh());
00365         rawLtbFrame->setHsum(ltbData->hsum());
00366         rawLtbFrame->setEsumComp(ltbData->esumComp());
00367         rawLtbFrame->setEsumADC(ltbData->esum());
00368         rawLtbFrame->setCrossTriggerSrc(ltbData->crossTriggerSource());
00369         rawLtbFrame->setFeeBufferStat(ltbData->feeBufferStatus());
00370         rawLtbFrame->setLtbBufferStat(ltbData->ltbBufferStatus());
00371         rawLtbFrame->setUnixSecLow(ltbData->unixtimeLow());
00372         rawLtbFrame->setUnixSecHigh(ltbData->unixtimeHigh());
00373 
00374         TimeStamp triggerTime(ltbData->unixtime(),ltbData->nanosecond()+ltbData->accumulation());
00375         rawLtbFrame->setTimestamp(triggerTime);
00376 
00377       } // end if unix time
00378 
00379       else if(ltbData->isUtcTime()) {
00380         RawLtbFrameUTC *rawLtbFrame = new RawLtbFrameUTC();
00381         rawLtbFrames.push_back(rawLtbFrame);
00382 
00383         rawLtbFrame->setAccStat(ltbData->accumulationStatus());
00384         rawLtbFrame->setGPSValid(ltbData->gpsValid());
00385         rawLtbFrame->setTimestampType(ltbData->timestampType());
00386         rawLtbFrame->setClockSystemValid(ltbData->clockValid());
00387         rawLtbFrame->setRot(ltbData->readOutType());
00388         rawLtbFrame->setTriggerSrc(ltbData->triggerType());
00389         rawLtbFrame->setNanoSecondLow(ltbData->nanosecondLow());
00390         rawLtbFrame->setNanoSecondHigh(ltbData->nanosecondHigh());
00391         rawLtbFrame->setAccumulationLow(ltbData->accumulationLow());
00392         rawLtbFrame->setAccumulationHigh(ltbData->accumulationHigh());
00393         rawLtbFrame->setHsum(ltbData->hsum());
00394         rawLtbFrame->setEsumComp(ltbData->esumComp());
00395         rawLtbFrame->setEsumADC(ltbData->esum());
00396         rawLtbFrame->setCrossTriggerSrc(ltbData->crossTriggerSource());
00397         rawLtbFrame->setFeeBufferStat(ltbData->feeBufferStatus());
00398         rawLtbFrame->setLtbBufferStat(ltbData->ltbBufferStatus());
00399         rawLtbFrame->setDay(ltbData->days());
00400         rawLtbFrame->setHour(ltbData->hour());
00401         rawLtbFrame->setMinute(ltbData->minute());
00402         rawLtbFrame->setSecond(ltbData->second());
00403       }
00404     }
00405     delete fragment;
00406   }
00407 
00408   rawRomLtb->setFrames(rawLtbFrames);
00409   return rawRom;
00410 }

RawRom * RawEventHeaderCnv::unpackFeeModule ( DayaBay::RawModule module  ) 

Definition at line 413 of file RawEventHeaderCnv.cc.

00414 {
00415   m_log << MSG::DEBUG << "unpackFeeModule" << endreq;
00416 
00417   RawRom *rawRom = new RawRomFee();
00418   RawRomFee *rawRomFee = dynamic_cast<RawRomFee*>(rawRom);
00419   rawRomFee->setType(module->moduleType());
00420   rawRomFee->setSize(module->size());
00421   rawRomFee->setSlot(module->slot());
00422   FeeHeadFragment *headFragment = dynamic_cast<FeeHeadFragment*>(module->headFragment());
00423   rawRomFee->setTriggerNum(headFragment->triggerNumber());
00424   //rawRomFee->setTriggerType(romFee->m_triggerType);
00425   rawRomFee->setStatus(headFragment->status());
00426   //rawRomFee->setDataLength(romFee->m_dataLength);
00427   rawRomFee->setVersion(headFragment->feeDataVersion());
00428 
00429   vector<RawPmtChannel*> rawPmtChannels;
00430   int preChannel = -1;
00431   vector<int> adc,adcRange,adcCycle,tdc,tdcHitCount,pedestal;
00432   RawPmtChannel *rawPmtChannel = 0;
00433   while( DayaBay::DataFragment* fragment = module->nextDataFragment() ){
00434     if( fragment->isFeePeakData() ){
00435       // Process the FEE peak-finding data fragment
00436       DayaBay::FeePeakData* feePeakData = 
00437         dynamic_cast<DayaBay::FeePeakData*>(fragment);
00438       if(!feePeakData){
00439         m_log << MSG::WARNING << "Bad FEE Peak-finding Data fragment" << endreq;
00440         continue;
00441       }
00442 
00443       m_log << MSG::DEBUG << "(Slot,channel) = (" << module->slot()
00444         << "," << feePeakData->channel() << ")" << endreq;
00445       if(feePeakData->channel() != preChannel) {
00446         // Set previous channel
00447         if(preChannel != -1) {
00448           rawPmtChannel->setTdc(tdc);
00449           rawPmtChannel->setTdcHitCount(tdcHitCount);
00450           rawPmtChannel->setAdc(adc);
00451           rawPmtChannel->setAdcRange(adcRange);
00452           rawPmtChannel->setAdcPeakingCycle(adcCycle);
00453           rawPmtChannel->setPedestal(pedestal);
00454         }
00455 
00456         preChannel = feePeakData->channel();
00457         // new channel
00458         rawPmtChannel = new RawPmtChannel();
00459         rawPmtChannels.push_back(rawPmtChannel);
00460         rawPmtChannel->setChannel(feePeakData->channel());
00461         adc.clear();
00462         adcRange.clear();
00463         adcCycle.clear();
00464         tdc.clear();
00465         tdcHitCount.clear();
00466         pedestal.clear();
00467       }
00468 
00469       tdc.push_back( feePeakData->tdc() );
00470       tdcHitCount.push_back( feePeakData->tdcHitCount() );
00471       adc.push_back( feePeakData->adc() );
00472       adcRange.push_back(feePeakData->adcRange());
00473       adcCycle.push_back( feePeakData->peakCycle() );
00474       if( feePeakData->hasAdcPedestal() )
00475         pedestal.push_back( feePeakData->adcPedestal() ); 
00476 
00477     }else{
00478       m_log << MSG::WARNING << "Unknown FEE data fragment type: " << fragment->dataType() 
00479         << endreq;
00480     }
00481     delete fragment;
00482   }
00483 
00484   if(rawPmtChannel) {
00485     rawPmtChannel->setTdc(tdc);
00486     rawPmtChannel->setTdcHitCount(tdcHitCount);
00487     rawPmtChannel->setAdc(adc);
00488     rawPmtChannel->setAdcRange(adcRange);
00489     rawPmtChannel->setAdcPeakingCycle(adcCycle);
00490     rawPmtChannel->setPedestal(pedestal);
00491   }
00492 
00493   rawRomFee->setChannels(rawPmtChannels);
00494   return rawRom;
00495 }


Member Data Documentation

MsgStream RawEventHeaderCnv::m_log [mutable, private]

Definition at line 88 of file RawEventHeaderCnv.h.

IRawDataInputSvc* RawEventHeaderCnv::m_inputSvc [private]

Definition at line 89 of file RawEventHeaderCnv.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 Mon Apr 11 20:27:05 2011 for RawDataIO by doxygen 1.4.7