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);
45 m_bufferSize( bufferSize ),
46 m_splitLevel( splitLevel ),
47 m_branchOffsetTabLen( offsettab_len ),
48 m_branchFillMode( branch_fill )
54 if( offsettab_len > 0 ) {
55 if(
b->GetEntryOffsetLen() > 0 )
56 b->SetEntryOffsetLen( offsettab_len );
57 TIter biter(
b->GetListOfBranches() );
58 TBranch* subbranch(
nullptr);
59 while( (subbranch = (TBranch*)biter.Next()) ) {
68 std::string error_type(
"is unknown");
69 const std::type_info& ti = *
info.typeinfo;
71 auto createBasicAuxBranch = [&](
const char* typeopt) {
72 info.is_basic_type =
true;
76 if ( ti ==
typeid(UInt_t) ) createBasicAuxBranch(
"/i");
77 else if( ti ==
typeid(Int_t) ) createBasicAuxBranch(
"/I");
78 else if( ti ==
typeid(Double_t) ) createBasicAuxBranch(
"/D");
79 else if( ti ==
typeid(Float_t) ) createBasicAuxBranch(
"/F");
80 else if( ti ==
typeid(Long64_t) or ti ==
typeid(std::int64_t) ) createBasicAuxBranch(
"/L");
81 else if( ti ==
typeid(ULong64_t) or ti ==
typeid(
std::uint64_t) ) createBasicAuxBranch(
"/l");
82 else if( ti ==
typeid(Short_t) ) createBasicAuxBranch(
"/S");
83 else if( ti ==
typeid(UShort_t) ) createBasicAuxBranch(
"/s");
84 else if( ti ==
typeid(Char_t) ) createBasicAuxBranch(
"/B");
85 else if( ti ==
typeid(UChar_t) ) createBasicAuxBranch(
"/b");
86 else if( ti ==
typeid(
bool) ) createBasicAuxBranch(
"/O");
87 else if( ti ==
typeid(
char*) || ti ==
typeid(
unsigned char*) ) createBasicAuxBranch(
"/C");
89 TClass*
cl = TClass::GetClass(
info.type_name.c_str());
91 error_type =
" has no TClass";
92 }
else if( !
cl->GetStreamerInfo() ) {
93 error_type =
" has no streamer";
94 }
else if( !
cl->HasDictionary() ) {
95 error_type =
" has no dictionary";
108 error_type += std::string(
" Exception msg: ") +
e.what();
111 error_type +=
" Unknown exception.";
115 throw std::runtime_error( std::string(
"Failed to create Auxiliary branch '") +
info.branch_name
116 +
"'. Class: " +
info.type_name + error_type );
119 info.branch->SetAutoDelete(kFALSE);
129 size_t backfill_nrows )
131 int bytes_written = 0;
136 for(
auto& aux_info_entry :
m_auxInfoMap ) aux_info_entry.second.written =
false;
161 if( backfill_nrows ) {
163 ATH_MSG_DEBUG(
" Backfilling " << backfill_nrows <<
" entries for " << attrInfo.
name);
168 for(
size_t r=0;
r<backfill_nrows; ++
r ) {
169 bytes_written += attrInfo.
branch->BackFill();
171 " Tree size=" <<
m_ttree->GetEntries()
172 <<
" branch size:" << attrInfo.
branch->GetEntries() );
183 AuxInfo& attrInfo = aux_info_entry.second;
194 bytes_written += attrInfo.
branch->Fill();
199 return bytes_written;
204 ATH_MSG_WARNING(
"Commit for TBranchAuxDynWriter should be handled on the DB level");