CbmRoot
Loading...
Searching...
No Matches
CbmTofInteraction.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
10
11
12#include "CbmTofInteraction.h"
13
14#include "Logger.h"
15
16#include <sstream>
17
18// ---------------------------------------------------------------------------------------------------------------------
19//
21
22// ---------------------------------------------------------------------------------------------------------------------
23//
25{
26 // ----- Update track and detector ID
27 if (fNofPoints == 0) {
28 fTrackID = pPoint->GetTrackID();
29 fDetectorID = pPoint->GetDetectorID();
30 }
31 else {
32 // Track and detector IDs schold be equal for every point
33 LOG_IF(fatal, pPoint->GetTrackID() != fTrackID) << "Attempt to add point with inconsistent track ID";
34 LOG_IF(fatal, pPoint->GetDetectorID() != fDetectorID) << "Attempt to add point with inconsistent detector ID";
35 }
36
37 // ----- Update position and momenta
38 UpdateAverage(pPoint->GetX(), fX);
39 UpdateAverage(pPoint->GetY(), fY);
40 UpdateAverage(pPoint->GetZ(), fZ);
41 UpdateAverage(pPoint->GetTime(), fTime);
42
43 UpdateAverage(pPoint->GetPx(), fPx);
44 UpdateAverage(pPoint->GetPy(), fPy);
45 UpdateAverage(pPoint->GetPz(), fPz);
46 UpdateAverage(pPoint->GetLength(), fLength); // Is it correct?
47 fELoss += pPoint->GetEnergyLoss(); // Is it correct?
48 fvpPoints.push_back(pPoint);
49 fNofPoints++;
50}
51
52// ---------------------------------------------------------------------------------------------------------------------
53//
55{
56 fTrackID = -1;
57 fDetectorID = -1;
58 fEventId = 0;
59 fPx = 0.;
60 fPy = 0.;
61 fPz = 0.;
62 fTime = 0.;
63 fLength = 0.;
64 fELoss = 0.;
65 fX = 0.;
66 fY = 0.;
67 fZ = 0.;
68 fNofPoints = 0;
69}
70
71// ---------------------------------------------------------------------------------------------------------------------
72//
74{
75 // Check consistency of the point and the interaction
76 LOG_IF(fatal, fTrackID != pPoint->GetTrackID() || fDetectorID != pPoint->GetDetectorID())
77 << "CbmTofInteraction: attempt to add point with inconsistent track or detector IDs: track " << fTrackID << " vs. "
78 << pPoint->GetTrackID() << ", sensor " << fDetectorID << " vs. " << pPoint->GetDetectorID();
79
80 fX = pPoint->GetX();
81 fY = pPoint->GetY();
82 fZ = pPoint->GetZ();
83 fTime = pPoint->GetTime();
84 fPx = pPoint->GetPx();
85 fPy = pPoint->GetPy();
86 fPz = pPoint->GetPz();
87 fLength = pPoint->GetLength();
88 fELoss = pPoint->GetEnergyLoss();
89}
90
91// ---------------------------------------------------------------------------------------------------------------------
92//
93std::string CbmTofInteraction::ToString() const
94{
95 std::stringstream msg;
96 msg << CbmTofPoint::ToString();
97 msg << " Number of points: " << fNofPoints;
98 return msg.str();
99}
Representation of MC track interaction with a TOF module.
void AddPoint(const CbmTofPoint *pPoint)
Adds a point to the interaction New point updates the following properties of the interaction: positi...
void SetFromPoint(const CbmTofPoint *pPoint)
Sets parameters from a particular TOF MC-point.
int fNofPoints
Number of CbmTofPoint objects, from which the interaction is constructed.
std::vector< const CbmTofPoint * > fvpPoints
Vector of point pointer (TMP!!!!)
void Clear(Option_t *)
Clears the instance.
std::string ToString() const
Saves content of the class to string.
void UpdateAverage(const T &update, T &property)
Updates average of the property from original TOF MC-point.
CbmTofInteraction()
Default constructor.
Geometric intersection of a MC track with a TOFb detector.
Definition CbmTofPoint.h:44
virtual std::string ToString() const
String representation of the object. @value String representation of the object.