Skip to content
Snippets Groups Projects
Commit b86aa5d9 authored by Administrator's avatar Administrator
Browse files

Add custom streamer for CbmPsdDigi (#1814)

The entry for the CbmPsdDigi in the file DataLinkdef.h was wrong, such that
for the CbmPsdDigi a streamer was generated which does not support automatic
schema evolution. To overcome the problem a custom streamer with explicit
schema evolution was added. This streamer allows to read also CbmPsdDigi
Version 3 data from existing files. Refs #1814
parent 85cbecb1
No related branches found
No related tags found
No related merge requests found
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
#pragma link C++ class CbmTofTracklet + ; #pragma link C++ class CbmTofTracklet + ;
#pragma link C++ class CbmTofTrackletParam + ; #pragma link C++ class CbmTofTrackletParam + ;
#pragma link C++ class CbmPsdDigi; #pragma link C++ class CbmPsdDigi-;
#pragma link C++ class CbmPsdHit; #pragma link C++ class CbmPsdHit;
#pragma link C++ class CbmPsdPoint + ; #pragma link C++ class CbmPsdPoint + ;
#pragma link C++ class CbmPsdAddress; #pragma link C++ class CbmPsdAddress;
......
...@@ -7,11 +7,12 @@ ...@@ -7,11 +7,12 @@
#include "CbmPsdDigi.h" #include "CbmPsdDigi.h"
#include <TBuffer.h> // for TBuffer
#include <TClass.h> // for CbmPsdDigi::IsA()
#include <TString.h> // for Form, TString #include <TString.h> // for Form, TString
#include <string> // for basic_string #include <string> // for basic_string
// --- Default constructor // --- Default constructor
CbmPsdDigi::CbmPsdDigi() {} CbmPsdDigi::CbmPsdDigi() {}
...@@ -82,5 +83,64 @@ std::string CbmPsdDigi::ToString() const { ...@@ -82,5 +83,64 @@ std::string CbmPsdDigi::ToString() const {
return string.Data(); return string.Data();
} }
// --- Custom Streamer
void CbmPsdDigi::Streamer(TBuffer& R__b) {
// Stream an object of class CbmPsdDigi.
UInt_t R__s, R__c;
if (R__b.IsReading()) {
Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
if (R__v) {}
// LOG(info) << "Reading CbmPsdDigi version " << R__v;
if (3 == R__v) {
R__b >> fdEdep;
R__b >> fdTime;
R__b >> fuAddress;
R__b.CheckByteCount(R__s, R__c, CbmPsdDigi::IsA());
} else if (4 == R__v) {
R__b >> ffFitHarmonic1;
R__b >> ffFitHarmonic2;
R__b >> ffFitR2;
R__b >> ffFitEdep;
R__b >> fdEdep;
R__b >> fdTime;
R__b >> fuAddress;
R__b >> fuAmpl;
R__b >> fuZL;
R__b >> fdEdepWfm;
R__b.CheckByteCount(R__s, R__c, CbmPsdDigi::IsA());
}
} else {
// The function WriteVersion does not return the version number
// but the position where ti write the next data
// to get the class version use TClass->GetClassVersion()
R__c = R__b.WriteVersion(CbmPsdDigi::IsA(), kTRUE);
Version_t version = CbmPsdDigi::IsA()->GetClassVersion();
// We don't intent to write data in old format
/*
if ( 3 == version ) {
R__b << fdEdep;
R__b << fdTime;
R__b << fuAddress;
R__b.SetByteCount(R__c, kTRUE);
} else if ( 4 == version ) {
*/
if (4 == version) {
R__b << ffFitHarmonic1;
R__b << ffFitHarmonic2;
R__b << ffFitR2;
R__b << ffFitEdep;
R__b << fdEdep;
R__b << fdTime;
R__b << fuAddress;
R__b << fuAmpl;
R__b << fuZL;
R__b << fdEdepWfm;
R__b.SetByteCount(R__c, kTRUE);
}
}
}
ClassImp(CbmPsdDigi) ClassImp(CbmPsdDigi)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment