FairRoot/PandaRoot
PndMQSdsHitLoader.cxx
Go to the documentation of this file.
1 /*
2  * File: PndMQSdsHitLoader.tpl
3  * @since 2014-02-08
4  * @author: A. Rybalchenko, N. Winckler
5  *
6  */
7 
8 #include "PndMQSdsHitLoader.h"
9 
10 // Default implementation of PndMQSdsHitLoader::Exec() with Boost transport data format
11 void PndMQSdsHitLoader::Exec(Option_t*)
12 {
13  // Default implementation of the base template Exec function using boost
14  // the condition check if the input class has a function member with name
15  // void serialize(boost::archive::binary_oarchive & ar, const unsigned int version) and if the payload are of boost type
16 
18  {
19  ostringstream buffer;
20  boost::archive::binary_oarchive OutputArchive(buffer);
21  for (Int_t i = 0; i < fInput->GetEntriesFast(); ++i)
22  {
23  PndSdsHit* digi = static_cast<PndSdsHit*>(fInput->At(i));
24  if (!digi)
25  {
26  continue;
27  }
28  fDigiVector.push_back(*digi);
29  }
30 
31  OutputArchive << fDigiVector;
32  int size = buffer.str().length();
33  fOutput = fTransportFactory->CreateMessage(size);
34  memcpy(fOutput->GetData(), buffer.str().c_str(), size);
35 
36  // delete the vector content
37  if (fDigiVector.size() > 0)
38  {
39  fDigiVector.clear();
40  }
41  }
42  else
43  {
44  LOG(ERROR) << "Boost Serialization not available";
45  }
46 }
TClonesArray * digi
Int_t i
Definition: run_full.C:25
vector< PndSdsHit > fDigiVector
virtual void Exec(Option_t *opt)