23 using std::placeholders::_1;
24 void(TClass::*dxtor)(
void*, Bool_t) = &TClass::Destructor;
25 std::function<void(
void*)> del = std::bind(dxtor,
tclass, _1,
false);
43 int offsettab_len,
bool branch_fill ) :
47 m_splitLevel( splitLevel ),
48 m_branchOffsetTabLen( offsettab_len ),
49 m_branchFillMode( branch_fill )
55 if( offsettab_len > 0 ) {
56 if(
b->GetEntryOffsetLen() > 0 )
57 b->SetEntryOffsetLen( offsettab_len );
58 TIter biter(
b->GetListOfBranches() );
59 TBranch* subbranch(
nullptr);
60 while( (subbranch = (TBranch*)biter.Next()) ) {
69 std::string error_type(
"is unknown");
70 const std::type_info& ti = *
info.typeinfo;
72 auto createBasicAuxBranch = [&](
const char* typeopt) {
73 info.is_basic_type =
true;
77 if ( ti ==
typeid(UInt_t) ) createBasicAuxBranch(
"/i");
78 else if( ti ==
typeid(Int_t) ) createBasicAuxBranch(
"/I");
79 else if( ti ==
typeid(Double_t) ) createBasicAuxBranch(
"/D");
80 else if( ti ==
typeid(Float_t) ) createBasicAuxBranch(
"/F");
81 else if( ti ==
typeid(Long64_t) or ti ==
typeid(std::int64_t) ) createBasicAuxBranch(
"/L");
82 else if( ti ==
typeid(ULong64_t) or ti ==
typeid(
std::uint64_t) ) createBasicAuxBranch(
"/l");
83 else if( ti ==
typeid(Short_t) ) createBasicAuxBranch(
"/S");
84 else if( ti ==
typeid(UShort_t) ) createBasicAuxBranch(
"/s");
85 else if( ti ==
typeid(Char_t) ) createBasicAuxBranch(
"/B");
86 else if( ti ==
typeid(UChar_t) ) createBasicAuxBranch(
"/b");
87 else if( ti ==
typeid(
bool) ) createBasicAuxBranch(
"/O");
88 else if( ti ==
typeid(
char*) || ti ==
typeid(
unsigned char*) ) createBasicAuxBranch(
"/C");
90 TClass*
cl = TClass::GetClass(
info.type_name.c_str());
92 error_type =
" has no TClass";
93 }
else if( !
cl->GetStreamerInfo() ) {
94 error_type =
" has no streamer";
95 }
else if( !
cl->HasDictionary() ) {
96 error_type =
" has no dictionary";
109 error_type += std::string(
" Exception msg: ") +
e.what();
112 error_type +=
" Unknown exception.";
116 throw std::runtime_error( std::string(
"Failed to create Auxiliary branch '") +
info.branch_name
117 +
"'. Class: " +
info.type_name + error_type );
120 info.branch->SetAutoDelete(kFALSE);
130 size_t backfill_nrows )
133 int bytes_written = 0;
138 for(
auto& aux_info_entry :
m_auxInfoMap ) aux_info_entry.second.written =
false;
154 if( backfill_nrows ) {
156 ATH_MSG_DEBUG(
" Backfilling " << backfill_nrows <<
" entries for " << attrInfo.
name);
161 for(
size_t r=0;
r<backfill_nrows; ++
r ) {
162 bytes_written += attrInfo.
branch->BackFill();
164 " Tree size=" <<
m_ttree->GetEntries()
165 <<
" branch size:" << attrInfo.
branch->GetEntries() );
176 AuxInfo& attrInfo = aux_info_entry.second;
184 bytes_written += attrInfo.
branch->Fill();
189 return bytes_written;
194 ATH_MSG_WARNING(
"Commit for TBranchAuxDynWriter should be handled on the DB level");