ROOT Version: 6.20/08
Built for linuxx8664gcc on Mar 15 2021, 18:52:00
From tags/v6-20-08-alice1@v6-20-08-1-g700d618
I need to have two iterators on the same TTree to combine founded values so I have defined two TTreeReader which advance separately. When I read the value of the entry with GetCurrentyEntry the two readers show different values and they are correct but when I access the values stored for the 2 TTreaderValue I get same values.
I have done a test in the console (I use a custom class AliEvent but the problem should be independent):
root [1] #include "AliEvent.h"
root [2] #include "AliParticle.h"
root [3] TFile fEvents("output-WC/AnalysisResults_WC.root", "READ")
(TFile &) Name: output-WC/AnalysisResults_WC.root Title:
root [4] TList *outputList = (TList *) fEvents.Get("RsnOut_MyRareTest");
root [5] TTree *events = (TTree*) (*outputList)("Events");
root [6] TTreeReader tREv(events);
root [7] TTreeReaderValue<INFNCatania::AliEvent> event(tREv, "EventCollection");
root [8] TTreeReader tREvComb(events);
root [9] TTreeReaderValue<INFNCatania::AliEvent> eventComb(tREvComb, "EventCollection");
root [10] eventComb->CountK0()
E-TTreeReaderValue::Get(): Value reader not properly initialized, did you remember to call TTreeReader.Set(Next)Entry()?
n
E-HandleInterpreterException: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
ROOT_prompt_10:1:1: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
eventComb->CountK0()
^~~~~~~~~
root [11] tREv->N
"tREv" is not of pointer type. Use this operator: .
variable "tREv->N" not defined.
root [11] tREv.Next()
(bool) true
root [12] eventComb->CountK0()
E-TTreeReaderValue::Get(): Value reader not properly initialized, did you remember to call TTreeReader.Set(Next)Entry()?
E-HandleInterpreterException: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
ROOT_prompt_12:1:1: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
eventComb->CountK0()
^~~~~~~~~
root [13]
root [13]
root [13]
root [13]
root [13]
root [13] tREvComb.N
Next
Notify
root [13] tREvComb.Next()
(bool) true
root [14] eventComb->CountK0()
(int) 15
root [15] tREv.Next()
(bool) true
root [16] eventComb->CountK0()
(int) 15
root [17] tREv.Next()
(bool) true
root [18] eventComb->CountK0()
(int) 15
root [19] event->CountK0()
(int) 18
root [20] tREv.Next()
(bool) true
root [21] event->CountK0()
(int) 5
root [22] eventComb->CountK0()
(int) 5
root [23] event->CountK0()
As you can see after a Next operation both TTreeReaderValue provide the same results although only one should change.