Save TEvePointSetArray in TFile

Hi,
I would like to save some event points per layer in a TFile and then re-showing them using the TEveManager. In order to do so, I have started with something that it seemed to perform a similar function in the tutorial in $ROOTSYS/tutorials/eve/pointset.C and tried to save the TEvePointSetArray in a TFile:

TEvePointSetArray* pointsetarray()
...
      l->Fill(rad*TMath::Cos(phi), rad*TMath::Sin(phi), z,
              r.Uniform(0, 110));
   }

   TFile* f = new TFile("pointsetarray.root", "recreate");
   l->Write();
   for (Int_t i = 1; i <= 9; ++i)
      l->GetBin(i)->Write();
   f->Close();
   l->CloseBins();

   gEve->Redraw3D();


   return l;
}

and then retrieving it with the following code:

#include <TFile.h>
#include <TEveManager.h>
#include <TEvePointSet.h>
#include <TEveRGBAPalette.h>
#include <TColor.h>

void pointsetarray_retrive()
{
   TFile* f = new TFile("pointsetarray.root", "read");
   TEveManager::Create();

   TEvePointSetArray* l = new TEvePointSetArray();
   f->GetObject("TPC hits - Charge Slices", l);

   gEve->AddElement(l);
   gEve->Redraw3D();

   f->Close();

}

With this code, I can reproduce only the main folder in the TEveManager, but not the TPointSets in it.
Any help is appreciated.

Thanks,
Erica

Hi, maybe @matevz can help with this

Sorry bad news, TEve objects were never implemented to be streamable.

What you can do is stream TPointSet3D or TPolyMarker3D of individual TEvePointests (its base-classes) and then use those to re-fill the point-set array … but you will need to create the correct bins for the TEvePointSetArray manually.

Alternatively, I don’t know what your final use-case is, TEvePointSetArray can be filled from a TTree.
It sublasses from TEvePointSelectorConsumer and this is in turn used by class TEvePointSelector : public TSelectorDraw.

https://root.cern/doc/v606/classTEvePointSelector.html

See this:

you just pass in point-set-array (with bins already set up) instead of the point-set ps.

Cheers,
Matevz

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.