ROOT Version: 6.18/04
Platform: Ubuntu 18.04
Compiler: gcc 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
Dear co-rooters,
I’ve got a TTree
which has a couple TString
TBranches
. That’s the Print()
from the TTree
with the relevant TBranch
es and a Scan()
of the first 5 entries
******************************************************************************
*Tree :DICER : A test TTree for DICER *
*Entries : 5563134 : Total = 452144078 bytes File Size = 417002919 *
* : : Tree compression factor = 1.08 *
*............................................................................*
*Br 8 :paddle : TString *
*Entries : 5563134 : Total Size= 39137774 bytes File Size = 39099132 *
*Baskets : 1917 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
*Br 9 :beam_blocker : TString *
*Entries : 5563134 : Total Size= 78223106 bytes File Size = 78160020 *
*Baskets : 3138 : Basket Size= 32000 bytes Compression= 1.00 *
*............................................................................*
************************************************************************************************************************************************************************
* Row * ntof.ntof * detn.detn * event_ID. * Q_short.Q * Q_long.Q_ * RunNumber * ntof0.nto * PSD * paddle * beam_bloc * baseline. * std_basel * dt_min *
************************************************************************************************************************************************************************
* 0 * 1890288.6 * 200 * 322 * 2150 * 65535 * 40019 * 1890288.6 * 0.9671931 * Cd * both_open * 11343.299 * 27.544561 * -2e+12 *
* 1 * 762.66200 * 5 * 23 * 32767 * 182 * 40019 * 1890288.6 * -179.0384 * Cd * both_open * 14856.400 * 1.2608654 * -5e+10 *
* 2 * 846.82607 * 6 * 46 * 107 * 325 * 40019 * 1890288.6 * 0.6707692 * Cd * both_open * 14938.599 * 0.8239548 * 1000 *
* 3 * 4871.6034 * 4 * 24 * 5003 * 12836 * 40019 * 1890288.6 * 0.6102368 * Cd * both_open * 14910.900 * 0.0881507 * -4e+10 *
* 4 * 4876.4667 * 3 * 0 * 9961 * 24830 * 40019 * 1890288.6 * 0.5988320 * Cd * both_open * 14756 * 0.0367038 * -4.273437 *
I’m trying to read the TString TBranches
but I’m having the following issues.
-
If I declare my parsing variables as
TString
, I’m able to compile my code.TString paddle, beam_blocker; TTree *t = (TTree*)f_root->Get("DICER"); t->SetBranchAddress("paddle" , &paddle); t->SetBranchAddress("beam_blocker", &beam_blocker);
However, when I’m executing it, I get the following error
Error in <TTree::SetBranchAddress>: The address for "paddle" should be the address of a pointer! Error in <TTree::SetBranchAddress>: The address for "beam_blocker" should be the address of a pointer!
-
If I declare the parsing variables as pointers, I’m able to successfully compile, but once it reads the first entry, root crashes without any error message apart from “Break segmentation violation”
TString *paddle, *beam_blocker; TTree *t = (TTree*)f_root->Get("DICER"); t->SetBranchAddress("paddle" , &paddle); t->SetBranchAddress("beam_blocker", &beam_blocker);
-
I tried declaring my parsing variable as
TString
, but when getting theTBRanchAddress
I used theGetPointer()
function.TString paddle, beam_blocker; TTree *t = (TTree*)f_root->Get("DICER"); t->SetBranchAddress("paddle" , paddle.GetPointer() ); t->SetBranchAddress("beam_blocker", beam_blocker.GetPointer() );
The code compiles, but when I run it, I get the following error
Error in <TTree::SetBranchAddress>: The pointer type given "Char_t" (1) does not correspond to the type needed "TString" by the branch: paddle Error in <TTree::SetBranchAddress>: The pointer type given "Char_t" (1) does not correspond to the type needed "TString" by the branch: beam_blocker
Any idea on how to parse the TBranch
es?
Thanks in advance!