CbmRoot
Loading...
Searching...
No Matches
CbmTofHit.h
Go to the documentation of this file.
1/* Copyright (C) 2006-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: E. Cordier, Andrey Lebedev, Florian Uhlig, Denis Bertini [committer], Pierre-Alain Loizeau */
4
14#ifndef CBMTOFHIT_H_
15#define CBMTOFHIT_H_
16
17#include "CbmHit.h" // for CbmHit
18#include "CbmPixelHit.h" // for CbmPixelHit
19
20#include <Rtypes.h> // for ClassDef
21#include <TVector3.h> // for TVector3
22
23#include <boost/serialization/access.hpp>
24#include <boost/serialization/base_object.hpp>
25
26#include <cstdint>
27#include <string> // for string
28
29#include <cmath>
30
31class CbmTofHit : public CbmPixelHit {
32public:
36 CbmTofHit();
37
41 CbmTofHit(int32_t address, TVector3 pos, TVector3 dpos, int32_t refIndex, double time, double dtime, int32_t flag,
42 int32_t channel);
43
47 CbmTofHit(int32_t address, TVector3 pos, TVector3 dpos, int32_t refIndex, double tof, int32_t flag, int32_t channel);
48
52 CbmTofHit(int32_t address, TVector3 pos, TVector3 dpos, int32_t refIndex, double tof, int32_t flag);
53
57 CbmTofHit(int32_t address, TVector3 pos, TVector3 dpos, int32_t refIndex, double tof);
58
62 virtual ~CbmTofHit();
63
67 virtual std::string ToString() const;
68
72 int32_t GetPlaneId() const { return 0; }
73
75 int32_t GetFlag() const { return fFlag; }
76 int32_t GetCh() const { return fChannel; }
77
78 double GetR() const { return sqrt(GetX() * GetX() + GetY() * GetY() + GetZ() * GetZ()); }
79 double GetRt() const { return sqrt(GetX() * GetX() + GetY() * GetY()); }
80 double GetCosThe() const { return GetZ() / GetR(); }
81 double GetSinThe() const { return sqrt(GetX() * GetX() + GetY() * GetY()) / GetR(); }
82 double GetCosPhi() const { return GetX() / GetRt(); }
83 double GetSinPhi() const { return GetY() / GetRt(); }
84
85 inline double Dist3D(CbmTofHit* pHit)
86 {
87 return sqrt((GetX() - pHit->GetX()) * (GetX() - pHit->GetX()) + (GetY() - pHit->GetY()) * (GetY() - pHit->GetY())
88 + (GetZ() - pHit->GetZ()) * (GetZ() - pHit->GetZ()));
89 }
90
92 void SetFlag(int32_t flag) { fFlag = flag; };
93
94 // Make this method otherwise inherited from CbmHit through CbmPixelHit
95 // private to prevent its usage
96 int32_t GetRefId() const __attribute__((deprecated)) { return -1; }
97 // Field is instead used to store the number of strips used to generate the hit
98 int32_t GetClusterSize() { return CbmHit::GetRefId(); }
99
100private:
101 int32_t fFlag;
102 int32_t fChannel;
103
105
106 template<class Archive>
107 void serialize(Archive& ar, const unsigned int /*version*/)
108 {
109 ar& fFlag;
110 ar& fChannel;
111 }
112
114};
115
116#endif
TVector3 dpos
friend fvec sqrt(const fvec &a)
double GetZ() const
Definition CbmHit.h:71
int32_t GetRefId() const
Definition CbmHit.h:73
double GetY() const
Definition CbmPixelHit.h:74
double GetX() const
Definition CbmPixelHit.h:73
ClassDef(CbmPixelHit, 1)
int32_t GetPlaneId() const
Inherited from CbmBaseHit.
Definition CbmTofHit.h:72
void SetFlag(int32_t flag)
Definition CbmTofHit.h:92
int32_t fFlag
Flag for general purposes [TDC, event tagging...].
Definition CbmTofHit.h:101
void serialize(Archive &ar, const unsigned int)
Definition CbmTofHit.h:107
int32_t GetCh() const
Definition CbmTofHit.h:76
int32_t fChannel
Channel identifier.
Definition CbmTofHit.h:102
double GetSinThe() const
Definition CbmTofHit.h:81
double GetR() const
Definition CbmTofHit.h:78
double GetCosPhi() const
Definition CbmTofHit.h:82
double Dist3D(CbmTofHit *pHit)
Definition CbmTofHit.h:85
double GetCosThe() const
Definition CbmTofHit.h:80
virtual std::string ToString() const
Inherited from CbmBaseHit.
Definition CbmTofHit.cxx:66
int32_t GetFlag() const
Definition CbmTofHit.h:75
int32_t GetClusterSize()
Definition CbmTofHit.h:98
CbmTofHit()
Default constructor.
Definition CbmTofHit.cxx:21
friend class boost::serialization::access
Definition CbmTofHit.h:104
double GetSinPhi() const
Definition CbmTofHit.h:83
int32_t GetRefId() const __attribute__((deprecated))
Definition CbmTofHit.h:96
double GetRt() const
Definition CbmTofHit.h:79
virtual ~CbmTofHit()
Destructor.
Definition CbmTofHit.cxx:64