/* * SdsStripDigiLoader.cxx * * Created on: Nov 28, 2012 * Author: dklein */ #include "SdsStripDigiLoader.h" #include "Logger.h" namespace Highway { namespace PndSamplerTasks { SdsStripDigiLoader::SdsStripDigiLoader() : SamplerTask( "Load PndSdsDigiStrip from rootfile into PndHits::SdsDigiStrip") { } SdsStripDigiLoader::~SdsStripDigiLoader() { } void SdsStripDigiLoader::Exec(Option_t* opt) { int nStripDigis = fInput->GetEntriesFast(); int size = nStripDigis * sizeof(PndPayload::SdsDigiStrip); void* buffer = operator new[](size); PndPayload::SdsDigiStrip* ptr = static_cast(buffer); for (int 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; } } Message* event = new Message(buffer, size, NULL); fOutput->push_back(event); //std::stringstream logmsg; //logmsg << "loaded " << event->Size() << " bytes (" << nStripDigis // << "entries)."; //Logger::GetInstance()->Log(Logger::DEBUG, logmsg.str()); } } /* namespace PndSamplerTasks */ } /* namespace Highway */