/* * SdsStripDigiLoader.cxx * * Created on: Nov 28, 2012 * Author: dklein */ #include "SdsStripDigiLoader.h" #include "FairMQLogger.h" SdsStripDigiLoader::SdsStripDigiLoader() : FairMQSamplerTask("Load PndSdsDigiStrip from rootfile into PndHits::SdsDigiStrip") { } SdsStripDigiLoader::~SdsStripDigiLoader() { } void SdsStripDigiLoader::Exec(Option_t* opt) { Int_t nStripDigis = fInput->GetEntriesFast(); Int_t size = nStripDigis * sizeof(PndPayload::SdsDigiStrip); void* buffer = operator new[](size); PndPayload::SdsDigiStrip* ptr = static_cast(buffer); for (Int_t i = 0; i < nStripDigis; ++i) { PndSdsDigiStrip* stripDigi = (PndSdsDigiStrip*) fInput->At(i); if (stripDigi != NULL) { new (&ptr[i]) PndPayload::SdsDigiStrip(); ptr[i].fChannel = stripDigi->GetChannel(); ptr[i].fDetID = stripDigi->GetDetID(); ptr[i].fSensorID = stripDigi->GetSensorID(); ptr[i].fFE = stripDigi->GetFE(); ptr[i].fCharge = stripDigi->GetCharge(); ptr[i].fTimeStamp = stripDigi->GetTimeStamp(); ptr[i].fTimeStampError = stripDigi->GetTimeStampError(); } else { continue; } } FairMQMessage* event = new FairMQMessage(buffer, size, NULL); fOutput->push_back(event); //std::stringstream logmsg; //logmsg << "loaded " << event->Size() << " bytes (" << nStripDigis // << "entries)."; //FairMQLogger::GetInstance()->Log(FairMQLogger::DEBUG, logmsg.str()); }