126{
127
130 G4cout << "LET::Store() called but skipped as calculation not enabled" << G4endl;
131 }
132 return;
133 }
134
136 G4Exception("LET::StoreLET", "NtuplesAlreadySaved", FatalException,
137 "Overwriting LET file. For multiple runs, change filename.");
138
140#define width 15L
142
143
145 std::ofstream ofs(
fPath);
146
147 if (ofs.is_open()) {
148
149 ofs << std::setprecision(6) << std::left << "i\tj\tk\t";
150 ofs << std::setw(
width) <<
"LDT";
151 ofs << std::setw(
width) <<
"LTT";
152
154 {
159 }
160 ofs << G4endl;
161
162
163 G4AnalysisManager* LETFragmentTuple = G4AnalysisManager::Instance();
164
165 LETFragmentTuple->SetVerboseLevel(1);
166 LETFragmentTuple->SetFirstHistoId(1);
167 LETFragmentTuple->SetFirstNtupleId(1);
168
169 LETFragmentTuple->SetDefaultFileType("xml");
170 LETFragmentTuple->OpenFile("LET");
171
172 LETFragmentTuple->CreateNtuple("coordinate", "LET");
173
174 LETFragmentTuple->CreateNtupleIColumn("i");
175 LETFragmentTuple->CreateNtupleIColumn("j");
176 LETFragmentTuple->CreateNtupleIColumn("k");
177 LETFragmentTuple->CreateNtupleDColumn("TotalLETD");
178 LETFragmentTuple->CreateNtupleDColumn("TotalLETT");
179 LETFragmentTuple->CreateNtupleIColumn("A");
180 LETFragmentTuple->CreateNtupleIColumn("Z");
181 LETFragmentTuple->CreateNtupleDColumn("IonLetD");
182 LETFragmentTuple->CreateNtupleDColumn("IonLetT");
183 LETFragmentTuple->FinishNtuple();
184
186
187 for (G4int i = 0; i < voxSensDet->GetVoxelNumberAlongX(); i++)
188 for (G4int j = 0; j < voxSensDet->GetVoxelNumberAlongY(); j++)
189 for (G4int k = 0; k < voxSensDet->GetVoxelNumberAlongZ(); k++) {
190 LETFragmentTuple->FillNtupleIColumn(1, 0, i);
191 LETFragmentTuple->FillNtupleIColumn(1, 1, j);
192 LETFragmentTuple->FillNtupleIColumn(1, 2, k);
193
194 G4int v = voxSensDet->GetThisVoxelNumber(i, j, k);
195
196
197 ofs << G4endl;
198 ofs << i << '\t' << j << '\t' << k << '\t';
201
202
204
207 }
208
209 LETFragmentTuple->FillNtupleDColumn(1, 3,
fTotalLETD[v] / (keV / um));
210 LETFragmentTuple->FillNtupleDColumn(1, 4,
fTotalLETT[v] / (keV / um));
211
213 LETFragmentTuple->FillNtupleIColumn(1, 5,
fIonLetStore[ll].GetA());
214 LETFragmentTuple->FillNtupleIColumn(1, 6,
fIonLetStore[ll].GetZ());
215
216 LETFragmentTuple->FillNtupleDColumn(1, 7,
fIonLetStore[ll].GetLETD()[v] / (keV / um));
217 LETFragmentTuple->FillNtupleDColumn(1, 8,
fIonLetStore[ll].GetLETT()[v] / (keV / um));
218 LETFragmentTuple->AddNtupleRow(1);
219 }
220 }
221 ofs.close();
222
223
224 LETFragmentTuple->CloseFile();
225 }
226 }
227
229}
std::vector< ExP01TrackerHit * > a