271 std::vector<string> fObservables;
272 fObservables = TRestEventProcess::ReadObservables();
274 if (fPerProcessSensitiveEnergy) {
275 fObservables.emplace_back(
"PerProcessPhotoelectric");
276 fObservables.emplace_back(
"PerProcessCompton");
277 fObservables.emplace_back(
"PerProcessElectronicIoni");
278 fObservables.emplace_back(
"PerProcessAlphaIoni");
279 fObservables.emplace_back(
"PerProcessIonIoni");
280 fObservables.emplace_back(
"PerProcessHadronicIoni");
281 fObservables.emplace_back(
"PerProcessProtonIoni");
282 fObservables.emplace_back(
"PerProcessMsc");
283 fObservables.emplace_back(
"PerProcessHadronElastic");
284 fObservables.emplace_back(
"PerProcessNeutronElastic");
286 for (
unsigned int i = 0; i < fObservables.size(); i++) {
287 if (fObservables[i].find(
"VolumeEDep") != string::npos) {
288 TString volName = fObservables[i].substr(0, fObservables[i].length() - 10).c_str();
290 Int_t volId =
fG4Metadata->GetActiveVolumeID(volName);
294 fVolumeName.push_back(volName.Data());
299 cout <<
"??????????????????????????????????????????????????" << endl;
300 cout <<
"REST warning : TRestGeant4AnalysisProcess." << endl;
301 cout <<
"------------------------------------------" << endl;
303 cout <<
" Volume " << volName <<
" is not an active volume" << endl;
305 cout <<
"List of active volumes : " << endl;
306 cout <<
"------------------------ " << endl;
308 for (
unsigned int n = 0; n <
fG4Metadata->GetNumberOfActiveVolumes(); n++)
309 cout <<
"Volume " << n <<
" : " <<
fG4Metadata->GetActiveVolumeName(n) << endl;
310 cout <<
"??????????????????????????????????????????????????" << endl;
315 if (fObservables[i].find(
"MeanPos") != string::npos) {
316 TString volName2 = fObservables[i].substr(0, fObservables[i].length() - 8).c_str();
317 std::string dirId = fObservables[i].substr(fObservables[i].length() - 1, 1);
319 Int_t volId2 =
fG4Metadata->GetActiveVolumeID(volName2);
328 cout <<
"??????????????????????????????????????????????????" << endl;
329 cout <<
"REST warning : TRestGeant4AnalysisProcess." << endl;
330 cout <<
"------------------------------------------" << endl;
332 cout <<
" Volume " << volName2 <<
" is not an active volume" << endl;
334 cout <<
"List of active volumes : " << endl;
335 cout <<
"------------------------ " << endl;
337 for (
unsigned int n = 0; n <
fG4Metadata->GetNumberOfActiveVolumes(); n++)
338 cout <<
"Volume " << n <<
" : " <<
fG4Metadata->GetActiveVolumeName(n) << endl;
339 cout <<
"??????????????????????????????????????????????????" << endl;
343 if ((dirId !=
"X") && (dirId !=
"Y") && (dirId !=
"Z")) {
345 cout <<
"??????????????????????????????????????????????????" << endl;
346 cout <<
"REST warning : TRestGeant4AnalysisProcess." << endl;
347 cout <<
"------------------------------------------" << endl;
349 cout <<
" Direction " << dirId <<
" is not valid" << endl;
350 cout <<
" Only X, Y or Z accepted" << endl;
354 if (fObservables[i].find(
"Process") != string::npos) {
356 if (fObservables[i].find(
"RadiactiveDecay") != string::npos) ls = 15;
357 if (fObservables[i].find(
"Photoelectric") != string::npos) ls = 13;
358 if (fObservables[i].find(
"PhotonNuclear") != string::npos) ls = 13;
359 if (fObservables[i].find(
"Bremstralung") != string::npos) ls = 12;
360 if (fObservables[i].find(
"NInelastic") != string::npos) ls = 10;
361 if (fObservables[i].find(
"HadElastic") != string::npos) ls = 10;
362 if (fObservables[i].find(
"NCapture") != string::npos) ls = 8;
363 if (fObservables[i].find(
"Compton") != string::npos) ls = 7;
364 if (fObservables[i].find(
"Neutron") != string::npos) ls = 7;
365 if (fObservables[i].find(
"Alpha") != string::npos) ls = 5;
366 if (fObservables[i].find(
"Argon") != string::npos) ls = 5;
367 if (fObservables[i].find(
"Xenon") != string::npos) ls = 5;
368 if (fObservables[i].find(
"Neon") != string::npos) ls = 4;
370 TString processName = fObservables[i].substr(fObservables[i].length() - (ls + 7), ls).c_str();
371 TString volName3 = fObservables[i].substr(0, fObservables[i].length() - (ls + 7)).c_str();
372 Int_t volId3 =
fG4Metadata->GetActiveVolumeID(volName3);
380 if (fObservables[i].find(
"TracksCounter") != string::npos) {
381 TString particleName = fObservables[i].substr(0, fObservables[i].length() - 13).c_str();
386 if (fObservables[i].find(
"TracksEDep") != string::npos) {
387 TString particleName = fObservables[i].substr(0, fObservables[i].length() - 10).c_str();
401 const auto sensitiveVolumeName =
fG4Metadata->GetSensitiveVolume();
403 Double_t sensitiveVolumeEnergy =
fOutputG4Event->GetEnergyInVolume(sensitiveVolumeName.Data());
405 double hitTime = std::numeric_limits<double>::infinity();
407 const auto hits = track.GetHits();
408 for (
size_t hitIndex = 0; hitIndex < hits.GetNumberOfHits(); hitIndex++) {
409 const auto volumeName = hits.GetVolumeName(hitIndex);
410 if (volumeName != sensitiveVolumeName) {
413 const double energy = hits.GetEnergy(hitIndex);
418 const double time = hits.GetTime(hitIndex);
419 if (time < hitTime) {
427 cout <<
"----------------------------" << endl;
429 cout <<
"Sensitive volume Energy : " << sensitiveVolumeEnergy << endl;
430 cout <<
"Total energy : " <<
fOutputG4Event->GetTotalDepositedEnergy() << endl;
444 Double_t xDirection =
fOutputG4Event->GetPrimaryEventDirection(0).X();
447 Double_t yDirection =
fOutputG4Event->GetPrimaryEventDirection(0).Y();
450 Double_t zDirection =
fOutputG4Event->GetPrimaryEventDirection(0).Z();
453 TVector3 v(xDirection, yDirection, zDirection);
457 Double_t energyPrimary =
fOutputG4Event->GetPrimaryEventEnergy(0);
469 vector<string> processNames = {
"phot",
"compt"};
470 for (
auto& processName : processNames) {
471 Int_t containsProcess = 0;
476 if (!processName.empty()) {
477 processName[0] = toupper(processName[0]);
504 if (
fDirID[n] == (TString)
"X")
507 else if (
fDirID[n] == (TString)
"Y")
510 else if (
fDirID[n] == (TString)
"Z")
517 cout <<
"G4 Tracks : " <<
fOutputG4Event->GetNumberOfTracks() << endl;
518 cout <<
"----------------------------" << endl;