I’m writing a macro to do the combinatorial between two particles. I created a tree with all needed properties and now I want to read it but I have a problem in the macro within loops. The histo of invariant mass has the good number of entries but their value are wrong. (I have also a ntuple with the mass already calculated for crosscheck)
When doing:for(Int_t i=0; i<nentries; i=i+nMuTracks)
{
b_nMuTracks->GetEntry(i);
...
for(Int_t k=j+1; k < i+nMuTracks; k++)
{
b_px->GetEntry(k);
You are reading a completely different entry for the branch ‘px’ and now ‘px’ and nMuTrack are totally unrelated.
It looks like ‘px’ is an array inside each entry rather than a single value. I suggest that you study carefully at the header file mysel.h created by tree->MakeSelector(“mysel”) ; this will indicate to you how to declare the variable and how to set the addresses (and you may also actually use the file mysel.C and mysel.h to implement you processing ; see TTree::Process).
[quote]But the important point is the lorentz vector. After build it with SetPxPyPzE(), there is no problem, I think.[/quote]Well the code using the lorentz vector looks fine but the data your put in is definitively wrong.
[quote]what is the meaning of Track(random);;[/quote]This is the way to ‘create/initialize’ the Track object. Indeed passing a random number to it is unlikely to be useful for a real event.
Thanks for your answer. I have written the class and I want to compile it. I modified the makefile in $ROOTSYS/test in order to compile only my class EventMuon but I did a mistake. Here is the code of the modified makfile
[quote]I don’t want MainEvent.cxx. I will use EventMuon in a tree on real data[/quote]humm okay Then what entity are you trying to build with the link line you shown? You probably do not need it and I am guessing you are attempting to build a shared library in which case, check the rules of libEvent.so