@@ -65,9 +65,8 @@ void WCSimRunAction::BeginOfRunAction(const G4Run* /*aRun*/)
65
65
hfile->SetCompressionLevel (2 );
66
66
67
67
// Event tree
68
- TTree* tree = new TTree (" wcsimT" ," WCSim Tree" );
68
+ WCSimTree = new TTree (" wcsimT" ," WCSim Tree" );
69
69
70
- SetTree (tree);
71
70
wcsimrootsuperevent = new WCSimRootEvent (); // empty list
72
71
// wcsimrootsuperevent->AddSubEvent(); // make at least one event
73
72
wcsimrootsuperevent->Initialize (); // make at least one event
@@ -76,16 +75,20 @@ void WCSimRunAction::BeginOfRunAction(const G4Run* /*aRun*/)
76
75
Int_t bufsize = 64000 ;
77
76
78
77
// TBranch *branch = tree->Branch("wcsimrootsuperevent", "Jhf2kmrootsuperevent", &wcsimrootsuperevent, bufsize,0);
79
- TBranch *branch = tree ->Branch (" wcsimrootevent" , " WCSimRootEvent" , &wcsimrootsuperevent, bufsize,2 );
78
+ TBranch *branch = WCSimTree ->Branch (" wcsimrootevent" , " WCSimRootEvent" , &wcsimrootsuperevent, bufsize,2 );
80
79
81
80
// Geometry tree
82
81
83
82
geoTree = new TTree (" wcsimGeoT" ," WCSim Geometry Tree" );
84
- SetGeoTree (geoTree);
85
83
wcsimrootgeom = new WCSimRootGeom ();
86
84
TBranch *geoBranch = geoTree->Branch (" wcsimrootgeom" , " WCSimRootGeom" , &wcsimrootgeom, bufsize,0 );
87
85
88
86
FillGeoTree ();
87
+
88
+ // Options tree
89
+ optionsTree = new TTree (" wcsimRootOptionsT" ," WCSim Options Tree" );
90
+ wcsimrootoptions = new WCSimRootOptions ();
91
+ optionsTree->Branch (" wcsimrootoptions" , " WCSimRootOptions" , &wcsimrootoptions, bufsize, 0 );
89
92
}
90
93
91
94
void WCSimRunAction::EndOfRunAction (const G4Run*)
@@ -102,6 +105,11 @@ void WCSimRunAction::EndOfRunAction(const G4Run*)
102
105
// G4cout << (float(numberOfTimesCatcherHit)/float(numberOfEventsGenerated))*100.
103
106
// << "% through-going (hit Catcher)" << G4endl;
104
107
108
+ // Write the options tree
109
+ G4cout << " EndOfRunAction" << G4endl;
110
+ optionsTree->Fill ();
111
+ optionsTree->Write ();
112
+
105
113
// Close the Root file at the end of the run
106
114
107
115
TFile* hfile = WCSimTree->GetCurrentFile ();
@@ -183,6 +191,5 @@ void WCSimRunAction::FillGeoTree(){
183
191
wcsimrootgeom-> SetWCNumPMT (numpmt);
184
192
185
193
geoTree->Fill ();
186
- TFile* hfile = geoTree->GetCurrentFile ();
187
- hfile->Write ();
194
+ geoTree->Write ();
188
195
}
0 commit comments