# Without creating a root file when using detectors to collect particle information, the program cannot continue to run

**URL:** <https://geant4-forum.web.cern.ch/t/without-creating-a-root-file-when-using-detectors-to-collect-particle-information-the-program-cannot-continue-to-run/12138>\
**Category:** Particles, Track, Event, Run and Biasing\
**Created:** [April 24, 2024, 3:32pm UTC](https://geant4-forum.web.cern.ch/t/without-creating-a-root-file-when-using-detectors-to-collect-particle-information-the-program-cannot-continue-to-run/12138 "2024-04-24T15:32:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xinshouqiujiao](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/xinshouqiujiao/32/8389_2.png) [@xinshouqiujiao](https://geant4-forum.web.cern.ch/u/xinshouqiujiao)\
**Post date:** [April 24, 2024, 3:32pm UTC](https://geant4-forum.web.cern.ch/t/without-creating-a-root-file-when-using-detectors-to-collect-particle-information-the-program-cannot-continue-to-run/12138/1 "2024-04-24T15:32:35Z")

</div>

Please fill out the following information to help in answering your question, and also see [tips for posting code snippets](https://geant4-forum.web.cern.ch/t/how-to-post-code-snippets/9944). If you don’t provide this information it will take more time to help with your problem!

\_Geant4 Version:\_11.1.1  
\_Operating System:\_linux  
_Compiler/Version:_  
_CMake Version:_

—When using a detector to collect particle information, I do not want to create a root file, but the program cannot run without creating a root file. The specific situation is:  
void muonSimRunAction::BeginOfRunAction(const G4Run \*run){

G4int runID = run-\>GetRunID();

G4cout \<\< “### Run " \<\< runID \<\< " start.” \<\< G4endl;

G4AnalysisManager \*analysisManager = G4AnalysisManager::Instance();

std::string fileName = “muonSim\_” + std::to\_string(runID) + “.root”;  
analysisManager-\>OpenFile(fileName);  
}  
After deleting these few lines of program(G4AnalysisManager \*analysisManager = G4AnalysisManager::Instance();

std::string fileName = “muonSim\_” + std::to\_string(runID) + “.root”;  
analysisManager-\>OpenFile(fileName)😉  
The following results have occurred:  
 ![截图 2024-04-24 20-38-12](https://geant4-forum.web.cern.ch/uploads/default/original/2X/7/73989ec111f63c24b7f8e058352feb54159d4c17.png)  
Is there any solution to this problem
