17#include "TRestGeant4BlobAnalysisProcess.h"
23TRestGeant4BlobAnalysisProcess::TRestGeant4BlobAnalysisProcess() {
Initialize(); }
25TRestGeant4BlobAnalysisProcess::TRestGeant4BlobAnalysisProcess(
const char* configFilename) {
31TRestGeant4BlobAnalysisProcess::~TRestGeant4BlobAnalysisProcess() {
delete fG4Event; }
33void TRestGeant4BlobAnalysisProcess::LoadDefaultConfig() { SetTitle(
"Default config"); }
43void TRestGeant4BlobAnalysisProcess::LoadConfig(
const string& configFilename,
const string& name) {
48 std::vector<string> fObservables;
49 fObservables = TRestEventProcess::ReadObservables();
51 for (
unsigned int i = 0; i < fObservables.size(); i++) {
52 if (fObservables[i].find(
"Q1_R") != string::npos) fQ1_Observables.push_back(fObservables[i]);
53 if (fObservables[i].find(
"Q2_R") != string::npos) fQ2_Observables.push_back(fObservables[i]);
56 for (
unsigned int i = 0; i < fQ1_Observables.size(); i++) {
57 Double_t r1 = atof(fQ1_Observables[i].substr(4, fQ1_Observables[i].length() - 4).c_str());
58 fQ1_Radius.push_back(r1);
61 for (
unsigned int i = 0; i < fQ2_Observables.size(); i++) {
62 Double_t r2 = atof(fQ2_Observables[i].substr(4, fQ2_Observables[i].length() - 4).c_str());
63 fQ2_Radius.push_back(r2);
66 fG4Metadata = GetMetadata<TRestGeant4Metadata>();
76 Double_t xBlob1 = 0, yBlob1 = 0, zBlob1 = 0;
77 Double_t xBlob2 = 0, yBlob2 = 0, zBlob2 = 0;
79 for (
unsigned int tck = 0; tck < fG4Event->GetNumberOfTracks(); tck++) {
80 const auto& track = fG4Event->GetTrack(tck);
81 if (track.GetParentID() == 0) {
82 if (track.GetParticleName() !=
"e-") {
83 cout <<
"TRestGeant4BlobAnalysis Warning. Primary particle is not an "
86 cout <<
"Skipping." << endl;
90 if (track.GetNumberOfHits() == 0) {
91 cout <<
"REST. FindG4Blobs WARNING. A primary electron with no hits "
94 cout <<
"Skipping." << endl;
99 cout <<
"TRestGeant4BlobAnalysis Warning. More than 2 e- primaries "
108 xBlob1 = track.GetHits().GetX(nHits - 1);
109 yBlob1 = track.GetHits().GetY(nHits - 1);
110 zBlob1 = track.GetHits().GetZ(nHits - 1);
112 xBlob2 = track.GetHits().GetX(nHits - 1);
113 yBlob2 = track.GetHits().GetY(nHits - 1);
114 zBlob2 = track.GetHits().GetZ(nHits - 1);
122 cout <<
"REST. FindG4Blobs ERROR. Blobs != 2. Blobs found " << nBlobs << endl;
129 if (fabs(zBlob1) < fabs(zBlob2)) {
159 Double_t deltaX = xBlob1 - xBlob2;
160 Double_t deltaY = yBlob1 - yBlob2;
161 Double_t deltaZ = zBlob1 - zBlob2;
163 Double_t blobDistance = deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ;
164 blobDistance = TMath::Sqrt(blobDistance);
171 for (
unsigned int n = 0; n < fQ1_Observables.size(); n++) {
177 for (
unsigned int n = 0; n < fQ2_Observables.size(); n++) {
void SetObservableValue(const std::string &name, const T &value)
Set observable value for AnalysisTree.
A base class for any REST event.
void Initialize() override
Making default settings.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void EndProcess() override
To be executed at the end of the run (outside event loop)
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
An event class to store geant4 generated event information.
TRestHits GetHits(Int_t volID=-1) const
Function that returns all the hit depositions in the Geant4 event. If a specific volume is given as a...
size_t GetNumberOfHits(Int_t volID=-1) const
Function that returns the number of hit depositions found inside the TRestGeant4Track....
It saves a 3-coordinate position and an energy for each punctual deposition.
Double_t GetEnergyInSphere(const TVector3 &pos0, Double_t radius) const
It determines the total energy contained in a sphere with position pos0 for a given spherical radius.