Question about SetBranch method


I would like to ask a question concerning problem I have when I run my code. I think the problem lies in following lines:


I’m not sure can I use this method that way on arrays. Could somebody tell me if there’s a way to use arrays in these method? Unfortunately I need them because it has to do with modular detector data, and leafs (and indexes in array) represent modules. This is the only way I know to make it automatic.

Thank you for any help provided!



[quote]This is the only way I know to make it automatic. [/quote]You should consider moving away from using the ‘leaflist’ method for branch creation and using (compiled) object instead.

What is the type of ‘var1’ and ‘sich’? What is the value of ‘form1’?


Can you explain a little more that to me? I’m not sure I understand this.

var1 and sich are UShort_t, and form1 is for example “SIE_18” for silicon module 18, and is obtained by sprintf for various numbers of modules.

Excuse me, I meant to say “SIE_18/s”.

[quote]var1 and sich are UShort_t, and form1 is for example “SIE_18” for silicon module 18[/quote]This does not match your codet2->Branch(bname1,&p.var1[j-1],form1);If var1 is a UShort_t than var1[j-1] is a syntax error.

Assuming that they are in fact array of UShort_t, then the codet2->Branch(bname1,&p.var1[j-1],form1); ... t->SetBranchAddress(bname1,&sich[j-1]);is seemingly correct. What is the error you see?


Yes they are arrays of UShort_t! But now it seems there’s no error, results seem o.k. now. Errors I saw yesterday were of type Error in TBasket::ReadBasketBuffers . I’m not sure what I did from yesterday to make it work. I checked previous most recent and last version and apparently, there’s been only one change with which I’m sure it didn’t work, I checked the date of modification. Is it possible for ROOT to work some time and some time not?



Hi Maja,

As in any software and hardware (including yours :slight_smile:), there could be deficiency and problem, some of them appearing intermittently. Under normal condition and when used as recommended, the ROOT I/O library does not lead to any problem as you describe.

An error message from TBasket::ReadBasketBuffers usually means that the file is ‘corrupted’ either by physical problem (hard drive) or severe segmentation fault during the writing.