# Need an example that can covert data to tevetrack and tevepointset for jsroot

**URL:** <https://root-forum.cern.ch/t/need-an-example-that-can-covert-data-to-tevetrack-and-tevepointset-for-jsroot/50432>\
**Category:** Newbie\
**Tags:** jsroot\
**Created:** [June 16, 2022, 9:10am UTC](https://root-forum.cern.ch/t/need-an-example-that-can-covert-data-to-tevetrack-and-tevepointset-for-jsroot/50432 "2022-06-16T09:10:47Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![iyuicu](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/iyuicu/32/30021_2.png) [@iyuicu](https://root-forum.cern.ch/u/iyuicu)\
**Post date:** [June 18, 2022, 10:33am UTC](https://root-forum.cern.ch/t/need-an-example-that-can-covert-data-to-tevetrack-and-tevepointset-for-jsroot/50432/4 "2022-06-18T10:33:30Z")

</div>

Sorry, it took me some time to learn [how to save `TList`](https://root-forum.cern.ch/t/saving-tlist-in-root-file/29366/2). Your advice help me a lot! I put the simplest example below that can generate some random data and save as root file. By the way, what are the differences between `TPolyLine3D` & `TGeoTrack` & `TEveTrack` and `TPolyMarker3D` & `TEvePointSet`? They look same in JSROOT. What do you recommend for event displayer?

Thank you,  
Aiyu

```c++
void random_hits_tracks()
{
    const Int_t n_hits = 150;
    TPolyMarker3D *hits = new TPolyMarker3D(n_hits, 1);

    Double_t x, y, z;
    auto r = new TRandom();

    hits->SetMarkerColor(kGreen);
    for (Int_t i=0;i<n_hits;i++) {
        r->Sphere(x, y, z, 30);
        hits->SetPoint(i,x+1,y+1,z+1);
    }

    const Int_t n_tracks_points = 150;
    const Int_t scale_tracks = 10;
    TPolyLine3D *tracks = new TPolyLine3D(n_tracks_points);
    for (Int_t i=0;i<n_tracks_points;i++) {
        tracks->SetPoint(i,scale_tracks*std::sin(.1*i),scale_tracks*std::cos(.1*i),0.1*i);
    }

    tracks->SetLineColor(kRed);
    // tracks->SetLineWidth(20); //doesn't work
    

    TFile* f = new TFile("random_hits_tracks.root", "recreate");
    TList* fList_hits = new TList();
    fList_hits->Add(hits,"testhit1");
    TList* fList_tracks = new TList();
    fList_tracks->Add(tracks,"testtrack1");
    
    f->cd();
    fList_hits->Write("testhit", 1);
    fList_tracks->Write("testtrack", 1);
    f->Close();
}

```

---

_[View the full topic](https://root-forum.cern.ch/t/need-an-example-that-can-covert-data-to-tevetrack-and-tevepointset-for-jsroot/50432)._
