Errors in drawing TEvePointSet markers in my event display

I’ve been working through building my own event display with TEve, following closely the tutorials/eve/alice_vsd.C. I can display my geometry just fine in the 3D window as well as the multiview frames, but I am failing to plot any of my actual events.

My data format is atypical to any tutorial example; I’m essentially reading the x,y,z coordinates of LAr “hits” from std::vectors. I’m using TEvePointSet markers to display this information, but when it comes time to drawing them with

gEve->Redraw3D(kFALSE, kTRUE);

I get this error repeated over and over again, followed by intermittent errors with the TGLCamera

Error in <TGLPlane::Normalise>: trying to normalise plane with zero magnitude normal
Error in <TGLPerspectiveCamera::TGLCamera::FrustumCenter()>: frustum planes invalid

I’ve tried all different variations of gEve->Redraw3D() I can think of in my code, and nothing has worked. I should note when I do this the 3D geometry is not displayed at all either. I’ve pasted the relevant portions of my code below; any help would be greatly appreciated!

   TEveManager::Create();

   TEveGeoShape *gentle_geom = 0;

   auto file = TFile::Open("guitools/simple_geom.root");
   if (!file) return;
   auto gse = (TEveGeoShapeExtract*) file->Get("Gentle");
   gentle_geom = TEveGeoShape::ImportShapeExtract(gse, 0);
   file->Close();

   gEve->AddGlobalElement(gentle_geom);

   gMultiView = new MultiView;
   gMultiView->f3DView->GetGLViewer()->SetStyle(TGLRnrCtx::kOutline);

   gMultiView->SetDepth(-10);
   gMultiView->ImportGeomRPhi(gentle_geom);
   gMultiView->ImportGeomRhoZ(gentle_geom);
   gMultiView->SetDepth(0);

   // Final stuff
   //=============

   gEve->GetViewers()->SwitchColorSet();
   gEve->GetDefaultGLViewer()->SetStyle(TGLRnrCtx::kWireFrame);

   gEve->GetBrowser()->GetTabRight()->SetTab(1);

   MyMainFrame* main = new MyMainFrame(); // takes the place of make_gui(); in the tutorial, it's almost verbatim what exists in that function just with additional buttons/text boxes for my event display GUI.

   gEve->AddEvent(new TEveEventManager("Event", "ICARUS CAF Event"));
   GetSpectrumSelection(); // Fills the hit position vectors for the LAr hits
   gEve->Redraw3D(kTRUE); // Reset camera after the first event has been shown.
   LoadHits();
   gEve->Redraw3D(kFALSE,kFALSE);

void LoadHits()
{
    int c = 0;
    for (int sliceID : uniqueSliceIDs) { // loop through all unique slices in a neutrino spill

      int target = sliceID;
      std::vector<int> indices = findItems(SliceID[spill], target); //finds all the indices in my hits vector for this slice

      char slice[5];
      sprintf(slice,"%d",target);
      auto marker = new TEvePointSet(slice,indices.size()); // create the TEvePointSet object for each slice and reserve the number of points by the number of hits present in the slice
      marker->SetOwnIds(kTRUE);
      marker->SetElementName(slice);
      marker->SetMarkerSize(.5);
      marker->SetMarkerStyle(2);

      for (auto &e: indices) { // loop through all the hits in the slice
        if (SliceID[spill][e] != sliceID) { continue; } // I only want the hits for this slice
          marker->SetPoint(e,X[spill][e],Z[spill][e],Y[spill][e]); // set each point in the TEvePointSet for each hit
          marker->SetPointId(new TNamed(Form("Point %d", e), ""));
      }

      marker->SetMainColor(1+c);
      marker->IncDenyDestroy();
      marker->SetTitle(TString::Format("N=%d", marker->Size()));
      gEve->AddElement(marker);
      c++;
    }
    gEve->Redraw3D(kFALSE,kTRUE); // once all the TEvePointSet objects are filled per neutrino spill, plot them in my TEve
}

ROOT Version: v6_22_08d
Platform: linux-gnu
Compiler: linuxx8664gcc


I’ve gotten it working. I changed the instantiation to

 auto marker = new TEvePointSet();

And changed from doing SetPoint(…) to

marker->SetNextPoint(X[spill][e],Z[spill][e],Y[spill][e]);

Finally I moved the Redraw command inside the for loop. Hopefully this helps someone else in the future!

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