Skip to content

Commit f253932

Browse files
sawenzelalcaliva
authored andcommitted
Custom member streamer for CalArray<o2::tpc::PadFlags>::mData
This commit expands on #14427 and fixes the issue brought up in https://its.cern.ch/jira/browse/O2-4671. After debugging/testing it turns out that the approach taken via a customer streamer for std::vector<o2::tpc::PadFlags> does not take effect in the ROOT/IO because apparently ROOT still prefers to use the CollectionProxy for std::vector and does not employ the custom streamer. Instead, after discussion with @pcanal, this commit proposes to implement a custom stream just for the mData data member of CalArray<o2::tpc::PadFlags>. This is the only place where we use o2::tpc::PadFlags in IO and it fixes the problem when reading CCDB objects containing such data. I have verified that the following code ``` o2-ccdb-downloadccdbfile -p TPC/Calib/IDC_PadStatusMap_A -t 1731274461770 -d ./ -o tpc_idc.root --no-preserve-path root tpc_idc.root gFile->Get<o2::tpc::CalDet<o2::tpc::PadFlags>>("ccdb_object") ``` correctly executes the custom streamer function. Note that there is also no need to make the code ROOT version dependent. We need to fix the reading in any case and the writing will just stay the same. Concerning situations, where future classes will write data containing std::vector<o2::tpc::PadFlags> we should be protected by the fact that this bug has been fixed >= ROOT 6.36 in any case. This commit relates also to root-project/root#17009 The commit also re-enables dictionary creation of related classes and adds a dictionary for CalArray<o2::tpc::PadFlags> previously missing.
1 parent 6a8191c commit f253932

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

DataFormats/Detectors/TPC/src/DataFormatsTPCLinkDef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
#pragma link C++ class o2::tpc::ClusterHardwareContainerFixedSize < 8192> + ;
2323
#pragma link C++ class o2::tpc::ClusterNativeContainer + ;
2424
#pragma link C++ class o2::tpc::Digit + ;
25+
#pragma link C++ enum o2::tpc::PadFlags + ; // enum itself
2526
#pragma link C++ class o2::tpc::ZeroSuppressedContainer8kb + ;
2627
#pragma link C++ class std::vector < o2::tpc::ClusterNative> + ;
2728
#pragma link C++ class std::vector < o2::tpc::ClusterNativeContainer> + ;
2829
#pragma link C++ class std::vector < o2::tpc::ClusterHardware> + ;
2930
#pragma link C++ class std::vector < o2::tpc::ClusterHardwareContainerFixedSize < 8192>> + ;
3031
#pragma link C++ class std::vector < o2::tpc::ClusterHardwareContainer8kb> + ;
3132
#pragma link C++ class std::vector < o2::tpc::Digit> + ;
33+
#pragma link C++ class std::vector < o2::tpc::PadFlags> + ;
3234
#pragma link C++ class std::vector < o2::tpc::ZeroSuppressedContainer8kb> + ;
3335
#pragma link C++ class o2::tpc::TrackTPC + ;
3436
#pragma link C++ class o2::tpc::LaserTrack + ;

Detectors/TPC/base/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ o2_add_library(TPCBase
4343
O2::DetectorsRaw O2::CCDB FairRoot::Base)
4444

4545
o2_target_root_dictionary(TPCBase
46+
EXTRA_PATCH src/TPCFlagsMemberCustomStreamer.cxx
4647
HEADERS include/TPCBase/CalArray.h
4748
include/TPCBase/CalDet.h
4849
include/TPCBase/CDBInterface.h

Detectors/TPC/base/src/TPCBaseLinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#pragma link C++ class o2::tpc::CalArray < unsigned> + ;
2222
#pragma link C++ class o2::tpc::CalArray < short> + ;
2323
#pragma link C++ class o2::tpc::CalArray < bool> + ;
24+
#pragma link C++ class o2::tpc::CalArray < o2::tpc::PadFlags> + ;
2425
#pragma link C++ class o2::tpc::CalDet < float> + ;
2526
#pragma link C++ class o2::tpc::CalDet < double> + ;
2627
#pragma link C++ class o2::tpc::CalDet < int> + ;

Detectors/TPC/base/src/TPCFlagsMemberCustomStreamer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ static __attribute__((used)) int _R__dummyStreamer_3 =
8383
return 0;
8484
})();
8585
} // namespace ROOT
86-
#endif
86+
#endif

0 commit comments

Comments
 (0)