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
13
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 <cmath>
27#include <cstdint>
28#include <string> // for string
29
30class CbmTofHit : public CbmPixelHit {
31 public:
35 CbmTofHit();
36
40 CbmTofHit(int32_t address, TVector3 pos, TVector3 dpos, int32_t refIndex, double time, double dtime, int32_t flag,
41 int32_t channel);
42
46 CbmTofHit(int32_t address, TVector3 pos, TVector3 dpos, int32_t refIndex, double tof, int32_t flag, int32_t channel);
47
51 CbmTofHit(int32_t address, TVector3 pos, TVector3 dpos, int32_t refIndex, double tof, int32_t flag);
52
56 CbmTofHit(int32_t address, TVector3 pos, TVector3 dpos, int32_t refIndex, double tof);
57
61 virtual ~CbmTofHit();
62
66 virtual std::string ToString() const;
67
71 int32_t GetPlaneId() const { return 0; }
72
74 int32_t GetFlag() const { return fFlag; }
75 int32_t GetCh() const { return fChannel; }
76
77 double GetR() const { return sqrt(GetX() * GetX() + GetY() * GetY() + GetZ() * GetZ()); }
78 double GetRt() const { return sqrt(GetX() * GetX() + GetY() * GetY()); }
79 double GetCosThe() const { return GetZ() / GetR(); }
80 double GetSinThe() const { return sqrt(GetX() * GetX() + GetY() * GetY()) / GetR(); }
81 double GetCosPhi() const { return GetX() / GetRt(); }
82 double GetSinPhi() const { return GetY() / GetRt(); }
83
84 inline double Dist3D(CbmTofHit* pHit)
85 {
86 return sqrt((GetX() - pHit->GetX()) * (GetX() - pHit->GetX()) + (GetY() - pHit->GetY()) * (GetY() - pHit->GetY())
87 + (GetZ() - pHit->GetZ()) * (GetZ() - pHit->GetZ()));
88 }
89
91 void SetFlag(int32_t flag) { fFlag = flag; };
92
93 // Make this method otherwise inherited from CbmHit through CbmPixelHit
94 // private to prevent its usage
95 int32_t GetRefId() const __attribute__((deprecated)) { return -1; }
96 // Field is instead used to store the number of strips used to generate the hit
97 int32_t GetClusterSize() { return CbmHit::GetRefId(); }
98
99 private:
100 int32_t fFlag;
101 int32_t fChannel;
102
104
105 template<class Archive>
106 void serialize(Archive& ar, const unsigned int /*version*/)
107 {
108 ar& fFlag;
109 ar& fChannel;
110 }
111
113};
114
115#endif
TVector3 dpos
friend fvec sqrt(const fvec &a)
double GetZ() const
Definition CbmHit.h:74
int32_t GetRefId() const
Definition CbmHit.h:76
double GetY() const
Definition CbmPixelHit.h:74
CbmPixelHit()
Default constructor.
double GetX() const
Definition CbmPixelHit.h:73
ClassDef(CbmPixelHit, 1)
int32_t GetPlaneId() const
Inherited from CbmBaseHit.
Definition CbmTofHit.h:71
void SetFlag(int32_t flag)
Definition CbmTofHit.h:91
int32_t fFlag
Flag for general purposes [TDC, event tagging...].
Definition CbmTofHit.h:100
void serialize(Archive &ar, const unsigned int)
Definition CbmTofHit.h:106
int32_t GetCh() const
Definition CbmTofHit.h:75
int32_t fChannel
Channel identifier.
Definition CbmTofHit.h:101
double GetSinThe() const
Definition CbmTofHit.h:80
double GetR() const
Definition CbmTofHit.h:77
double GetCosPhi() const
Definition CbmTofHit.h:81
double Dist3D(CbmTofHit *pHit)
Definition CbmTofHit.h:84
double GetCosThe() const
Definition CbmTofHit.h:79
virtual std::string ToString() const
Inherited from CbmBaseHit.
Definition CbmTofHit.cxx:66
int32_t GetFlag() const
Definition CbmTofHit.h:74
int32_t GetClusterSize()
Definition CbmTofHit.h:97
CbmTofHit()
Default constructor.
Definition CbmTofHit.cxx:21
friend class boost::serialization::access
Definition CbmTofHit.h:103
double GetSinPhi() const
Definition CbmTofHit.h:82
int32_t GetRefId() const __attribute__((deprecated))
Definition CbmTofHit.h:95
double GetRt() const
Definition CbmTofHit.h:78
virtual ~CbmTofHit()
Destructor.
Definition CbmTofHit.cxx:64