195#include "TRestGeant4AnalysisProcess.h"
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();
298 cout <<
"??????????????????????????????????????????????????" << endl;
299 cout <<
"REST warning : TRestGeant4AnalysisProcess." << endl;
300 cout <<
"------------------------------------------" << endl;
302 cout <<
" Volume " << volName <<
" is not an active volume" << endl;
304 cout <<
"List of active volumes : " << endl;
305 cout <<
"------------------------ " << endl;
309 cout <<
"??????????????????????????????????????????????????" << endl;
314 if (fObservables[i].find(
"MeanPos") != string::npos) {
315 TString volName2 = fObservables[i].substr(0, fObservables[i].length() - 8).c_str();
316 std::string dirId = fObservables[i].substr(fObservables[i].length() - 1, 1);
327 cout <<
"??????????????????????????????????????????????????" << endl;
328 cout <<
"REST warning : TRestGeant4AnalysisProcess." << endl;
329 cout <<
"------------------------------------------" << endl;
331 cout <<
" Volume " << volName2 <<
" is not an active volume" << endl;
333 cout <<
"List of active volumes : " << endl;
334 cout <<
"------------------------ " << endl;
338 cout <<
"??????????????????????????????????????????????????" << endl;
342 if ((dirId !=
"X") && (dirId !=
"Y") && (dirId !=
"Z")) {
344 cout <<
"??????????????????????????????????????????????????" << endl;
345 cout <<
"REST warning : TRestGeant4AnalysisProcess." << endl;
346 cout <<
"------------------------------------------" << endl;
348 cout <<
" Direction " << dirId <<
" is not valid" << endl;
349 cout <<
" Only X, Y or Z accepted" << endl;
353 if (fObservables[i].find(
"Process") != string::npos) {
355 if (fObservables[i].find(
"RadiactiveDecay") != string::npos) ls = 15;
356 if (fObservables[i].find(
"Photoelectric") != string::npos) ls = 13;
357 if (fObservables[i].find(
"PhotonNuclear") != string::npos) ls = 13;
358 if (fObservables[i].find(
"Bremstralung") != string::npos) ls = 12;
359 if (fObservables[i].find(
"NInelastic") != string::npos) ls = 10;
360 if (fObservables[i].find(
"HadElastic") != string::npos) ls = 10;
361 if (fObservables[i].find(
"NCapture") != string::npos) ls = 8;
362 if (fObservables[i].find(
"Compton") != string::npos) ls = 7;
363 if (fObservables[i].find(
"Neutron") != string::npos) ls = 7;
364 if (fObservables[i].find(
"Alpha") != string::npos) ls = 5;
365 if (fObservables[i].find(
"Argon") != string::npos) ls = 5;
366 if (fObservables[i].find(
"Xenon") != string::npos) ls = 5;
367 if (fObservables[i].find(
"Neon") != string::npos) ls = 4;
369 TString processName = fObservables[i].substr(fObservables[i].length() - (ls + 7), ls).c_str();
370 TString volName3 = fObservables[i].substr(0, fObservables[i].length() - (ls + 7)).c_str();
379 if (fObservables[i].find(
"TracksCounter") != string::npos) {
380 TString particleName = fObservables[i].substr(0, fObservables[i].length() - 13).c_str();
385 if (fObservables[i].find(
"TracksEDep") != string::npos) {
386 TString particleName = fObservables[i].substr(0, fObservables[i].length() - 10).c_str();
403 cout <<
"----------------------------" << endl;
405 cout <<
"Sensitive volume Energy : " << energy << endl;
406 cout <<
"Total energy : " <<
fOutputG4Event->GetTotalDepositedEnergy() << endl;
418 Double_t xDirection =
fOutputG4Event->GetPrimaryEventDirection(0).X();
421 Double_t yDirection =
fOutputG4Event->GetPrimaryEventDirection(0).Y();
424 Double_t zDirection =
fOutputG4Event->GetPrimaryEventDirection(0).Z();
427 TVector3 v(xDirection, yDirection, zDirection);
431 Double_t energyPrimary =
fOutputG4Event->GetPrimaryEventEnergy(0);
443 vector<string> processNames = {
"phot",
"compt"};
444 for (
auto& processName : processNames) {
445 Int_t containsProcess = 0;
450 if (!processName.empty()) {
451 processName[0] = toupper(processName[0]);
478 if (
fDirID[n] == (TString)
"X")
481 else if (
fDirID[n] == (TString)
"Y")
484 else if (
fDirID[n] == (TString)
"Z")
491 cout <<
"G4 Tracks : " <<
fOutputG4Event->GetNumberOfTracks() << endl;
492 cout <<
"----------------------------" << endl;
void SetObservableValue(const std::string &name, const T &value)
Set observable value for AnalysisTree.
A base class for any REST event.
A pure analysis process to extract information from a TRestGeant4Event.
void Initialize() override
Function to initialize input/output event members and define the section name.
std::vector< std::string > fEnergyInObservables
It stores the name of observables xxxVolumeEDep related to the energy deposition in volume xxx.
std::vector< std::string > fDirID
void InitProcess() override
Process initialization. Observable names are interpreted and auxiliar observable members,...
TRestGeant4Event * fInputG4Event
A pointer to the specific TRestGeant4Event input.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
TRestGeant4Metadata * fG4Metadata
A pointer to the simulation metadata information accessible to TRestRun.
~TRestGeant4AnalysisProcess()
Default destructor.
std::vector< std::string > fTracksEDepObservables
A std::vector storing the observable name xxxTracksEDep for a given xxx particle.
std::vector< std::string > fParticleTrackCounter
A std::vector storing the xxx particle name extracted from xxxTracksCounter.
std::vector< std::string > fProcessObservables
A std::vector storing the name of observables related to processes in a particular active volume.
std::vector< Int_t > fVolumeID2
A std::vector storing the active volume ids corresponding mean position observable xxxMeanPosX,...
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
std::vector< Int_t > fVolumeID
A std::vector storing the active volume ids of observables xxxVolumeEDep.
TRestGeant4Event * fOutputG4Event
A pointer to the specific TRestGeant4Event output.
std::vector< std::string > fTrackCounterObservables
A std::vector storing the observable name xxxTracksCounter for a given xxx particle.
std::vector< Int_t > fVolumeID3
A std::vector storing the active volume ids corresponding process observable .
TRestGeant4AnalysisProcess()
Default constructor.
std::vector< std::string > fMeanPosObservables
It stores the name of observables (xxxMeanPosX,Y,Z) related to mean hits position in volume xxx.
std::vector< std::string > fProcessName
A std::vector storing the name of processes.
void EndProcess() override
Function to include required actions after all events have been processed.
std::vector< std::string > fParticleTrackEdep
A std::vector storing the xxx particle name extracted from xxxTracksEDep.
An event class to store geant4 generated event information.
Double_t GetBoundingBoxSize()
This method returns the event size as the size of the bounding box enclosing all hits.
@ REST_Debug
+show the defined debug messages