19 #include <TBufferFile.h>
21 #include <TCollection.h>
22 #include <TStreamerInfo.h>
99 , paramType(
"UChar_t")
103 , streamerInfo(nullptr)
104 , streamerInfoSize(0)
109 , paramValue(nullptr)
110 , arraySize(o.arraySize)
111 , paramType(o.paramType)
112 , basicType(o.basicType)
113 , bytesPerValue(o.bytesPerValue)
114 , classVersion(o.classVersion)
115 , streamerInfo(nullptr)
116 , streamerInfoSize(o.streamerInfoSize)
128 , paramValue(nullptr)
129 , arraySize(sizeof(Int_t))
132 , bytesPerValue(sizeof(Int_t))
134 , streamerInfo(nullptr)
135 , streamerInfoSize(0)
144 , paramValue(nullptr)
145 , arraySize(sizeof(Bool_t))
146 , paramType(
"Bool_t")
148 , bytesPerValue(sizeof(Bool_t))
150 , streamerInfo(nullptr)
151 , streamerInfoSize(0)
160 , paramValue(nullptr)
161 , arraySize(sizeof(UInt_t))
162 , paramType(
"UInt_t")
164 , bytesPerValue(sizeof(UInt_t))
166 , streamerInfo(nullptr)
167 , streamerInfoSize(0)
176 , paramValue(nullptr)
177 , arraySize(sizeof(Float_t))
178 , paramType(
"Float_t")
180 , bytesPerValue(sizeof(Float_t))
182 , streamerInfo(nullptr)
183 , streamerInfoSize(0)
192 , paramValue(nullptr)
193 , arraySize(sizeof(Double_t))
194 , paramType(
"Double_t")
196 , bytesPerValue(sizeof(Double_t))
198 , streamerInfo(nullptr)
199 , streamerInfoSize(0)
208 , paramValue(nullptr)
209 , arraySize(sizeof(Int_t) * nValues)
212 , bytesPerValue(sizeof(Int_t))
214 , streamerInfo(nullptr)
215 , streamerInfoSize(0)
224 , paramValue(nullptr)
225 , arraySize(sizeof(UInt_t) * nValues)
226 , paramType(
"UInt_t")
228 , bytesPerValue(sizeof(UInt_t))
230 , streamerInfo(nullptr)
231 , streamerInfoSize(0)
240 , paramValue(nullptr)
241 , arraySize(sizeof(Float_t) * nValues)
242 , paramType(
"Float_t")
244 , bytesPerValue(sizeof(Float_t))
246 , streamerInfo(nullptr)
247 , streamerInfoSize(0)
256 , paramValue(nullptr)
257 , arraySize(sizeof(Double_t) * nValues)
258 , paramType(
"Double_t")
260 , bytesPerValue(sizeof(Double_t))
262 , streamerInfo(nullptr)
263 , streamerInfoSize(0)
272 , paramValue(nullptr)
273 , arraySize(strlen(value))
274 , paramType(
"Text_t")
276 , bytesPerValue(sizeof(Char_t))
278 , streamerInfo(nullptr)
279 , streamerInfoSize(0)
288 , paramValue(nullptr)
289 , arraySize(sizeof(Char_t) * nValues)
290 , paramType(
"Char_t")
292 , bytesPerValue(sizeof(Char_t))
294 , streamerInfo(nullptr)
295 , streamerInfoSize(0)
304 , paramValue(nullptr)
305 , arraySize(sizeof(UChar_t) * nValues)
306 , paramType(
"UChar_t")
308 , bytesPerValue(sizeof(UChar_t))
310 , streamerInfo(nullptr)
311 , streamerInfoSize(0)
337 if (strcmp(t,
"Char_t") == 0) {
340 }
else if (strcmp(t,
"Int_t") == 0) {
343 }
else if (strcmp(t,
"Float_t") == 0) {
346 }
else if (strcmp(t,
"Double_t") == 0) {
349 }
else if (strcmp(t,
"Text_t") == 0) {
419 std::cout << GetName() <<
": ";
421 std::cout <<
"\n Class Type: " <<
paramType.Data() <<
"\n Class Version: " <<
classVersion << std::endl;
422 }
else if (strcmp(
paramType,
"Text_t") == 0) {
424 val.ReplaceAll(
"\n",
"\n ");
425 std::cout <<
paramType <<
"\n " << val.Data() << std::endl;
431 std::cout <<
paramType <<
" array, nValues: " << nParams <<
"\n ";
434 Char_t* val =
reinterpret_cast<Char_t*
>(
paramValue);
436 }
else if (strcmp(
paramType,
"Int_t") == 0) {
437 Int_t* val =
reinterpret_cast<Int_t*
>(
paramValue);
439 }
else if (strcmp(
paramType,
"Float_t") == 0) {
440 Float_t* val =
reinterpret_cast<Float_t*
>(
paramValue);
442 }
else if (strcmp(
paramType,
"Double_t") == 0) {
443 Double_t* val =
reinterpret_cast<Double_t*
>(
paramValue);
455 while (k < nParams) {
460 std::cout << val[k] <<
" ";
468 std::cout << std::endl;
584 TFile* filesave = gFile;
587 const Int_t bufsize = 10000;
589 TBufferFile* buffer =
new TBufferFile(TBuffer::kWrite, bufsize);
591 buffer->SetParent(paramFile);
592 buffer->MapObject(obj);
593 obj->Streamer(*buffer);
594 Int_t len = buffer->Length();
595 Char_t* buf =
new char[len];
596 memcpy(buf, buffer->Buffer(), len);
598 TArrayC* fClassIndex = paramFile->GetClassIndex();
599 if (fClassIndex && fClassIndex->fArray[0] != 0) {
600 TIter next(gROOT->GetListOfStreamerInfo());
603 while ((info = static_cast<TStreamerInfo*>(next()))) {
604 Int_t uid = info->GetNumber();
605 if (fClassIndex->fArray[uid]) {
609 if (list.GetSize() > 0) {
611 fClassIndex->fArray[0] = 2;
613 TBufferFile* infoBuffer =
new TBufferFile(TBuffer::kWrite, bufsize);
615 infoBuffer->MapObject(&list);
616 list.Streamer(*infoBuffer);
617 Int_t infolen = infoBuffer->Length();
618 Char_t* infobuf =
new char[infolen];
619 memcpy(infobuf, infoBuffer->Buffer(), infolen);
626 fClassIndex->fArray[0] = 0;
638 while ((o = static_cast<FairParamObj*>(next())) != 0) {
650 if (o != 0 && strcmp(o->
getParamType(),
"Text_t") == 0) {
652 if (l < length - 1) {
653 memcpy(value, reinterpret_cast<Char_t*>(o->
getParamValue()), l);
657 LOG(error) <<
"char array too small";
661 LOG(error) <<
"Could not find parameter " << name;
675 if (o != 0 && strcmp(o->
getParamType(),
"UChar_t") == 0) {
681 LOG(error) <<
"Different array sizes for parameter " << name;
686 LOG(error) <<
"Could not find parameter " << name;
700 if (o != 0 && strcmp(o->
getParamType(),
"Int_t") == 0) {
707 LOG(error) <<
"Different array sizes for parameter " << name;
712 LOG(error) <<
"Could not find parameter " << name;
726 if (o != 0 && strcmp(o->
getParamType(),
"Bool_t") == 0) {
733 LOG(error) <<
"Different array sizes for parameter " << name;
738 LOG(error) <<
"Could not find parameter " << name;
752 if (o != 0 && strcmp(o->
getParamType(),
"Int_t") == 0) {
759 LOG(error) <<
"Different array sizes for parameter " << name;
764 LOG(error) <<
"Could not find parameter " << name;
778 if (o != 0 && strcmp(o->
getParamType(),
"Float_t") == 0) {
785 LOG(error) <<
"Different array sizes for parameter " << name;
790 LOG(error) <<
"Could not find parameter " << name;
804 if (o != 0 && strcmp(o->
getParamType(),
"Double_t") == 0) {
811 LOG(error) <<
"Different array sizes for parameter " << name;
816 LOG(error) <<
"Could not find parameter " << name;
829 if (o != 0 && strcmp(o->
getParamType(),
"Int_t") == 0) {
832 if (value->GetSize() != n) {
838 LOG(error) <<
"Could not find parameter " << name;
851 if (o != 0 && strcmp(o->
getParamType(),
"Char_t") == 0) {
853 if (value->GetSize() != l) {
859 LOG(error) <<
"Could not find parameter " << name;
872 if (o != 0 && strcmp(o->
getParamType(),
"Float_t") == 0) {
875 if (value->GetSize() != n) {
881 LOG(error) <<
"Could not find parameter " << name;
894 if (o != 0 && strcmp(o->
getParamType(),
"Double_t") == 0) {
897 if (value->GetSize() != n) {
903 LOG(error) <<
"Could not find parameter " << name;
917 if (o != 0 && strcmp(o->
getParamType(), obj->IsA()->GetName()) == 0) {
920 <<
" does not match actual version = " << obj->IsA()->GetClassVersion();
925 TFile* filesave = gFile;
927 TBufferFile* buf = 0;
931 buf =
new TBufferFile(TBuffer::kRead, len);
932 memcpy(buf->Buffer(),
reinterpret_cast<Char_t*
>(o->
getStreamerInfo()), len);
933 buf->SetBufferOffset(0);
935 buf->MapObject(&list);
940 while ((info = static_cast<TStreamerInfo*>(next()))) {
941 if (info->IsA() != TStreamerInfo::Class()) {
942 LOG(warn) <<
"Not a TStreamerInfo object";
951 buf =
new TBufferFile(TBuffer::kRead, len);
952 memcpy(buf->Buffer(),
reinterpret_cast<Char_t*
>(o->
getParamValue()), len);
953 buf->SetBufferOffset(0);
960 LOG(error) <<
"Could not find parameter " << name;
void printData(type *, Int_t)
const char * getParamType()
void addObject(const Text_t *, TObject *)
ClassImp(FairEventBuilder)
Bool_t fillObject(const Text_t *, TObject *)
void setParamValue(UChar_t *, const Int_t)
FairParamObj(const Text_t *name="")
UChar_t * setLength(Int_t l)
UChar_t * getParamValue()
UChar_t * setStreamerInfoSize(Int_t)
Bool_t fill(const Text_t *, Text_t *, const Int_t)
void setParamType(const Text_t *t)
UChar_t * getStreamerInfo()
void setClassVersion(const Int_t v)
Int_t getStreamerInfoSize()
void setStreamerInfo(UChar_t *, const Int_t)