// vis_helpers.h (or paste into anasenMS.cpp) #include #include #include #include #include static TEvePointSet* gVisPts = nullptr; static std::mutex gVisMutex; // Call from your ROOT session after creating TEve objects: void SetVisPointSet(TEvePointSet* pts){ gVisPts = pts; } // Call this from your sim loop to update visualization and optionally write data: void PushEventAndRecord(const std::vector& x, const std::vector& y, const std::vector& z, TTree* outTree = nullptr) { if(outTree){ outTree->SetBranchAddress("x",(void*)&x); outTree->SetBranchAddress("y",(void*)&y); outTree->SetBranchAddress("z",(void*)&z); outTree->Fill(); outTree->GetCurrentFile()->Flush(); } if(!gVisPts) return; std::lock_guard lk(gVisMutex); gVisPts->Reset(); for(size_t i=0;iSetNextPoint(x[i], y[i], z[i]); gEve->Redraw3D(); gSystem->ProcessEvents(); }