GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TDetector.h
Go to the documentation of this file.
1#ifndef TDETECTOR_H
2#define TDETECTOR_H
3
4/** \addtogroup Detectors
5 * @{
6 */
7
8#include <stdexcept>
9#include <cstdio>
10#include <vector>
11#ifndef __CINT__
12#include <memory>
13#endif
14
15#include "TVector3.h"
16#include "TObject.h"
17
18#include "Globals.h"
19#include "TFragment.h"
20#include "TDetectorHit.h"
21#include "TChannel.h"
22
23/////////////////////////////////////////////////////////////////
24///
25/// \class TDetector
26///
27/// This is an abstract class that contains the basic info
28/// about a detector. This is where the hits are built and
29/// the data is filled. It's main role is to act as a wrapper
30/// for every other type of detector system.
31///
32/////////////////////////////////////////////////////////////////
33
34class TDetector : public TObject {
35public:
36 TDetector() = default;
37 TDetector(const TDetector&);
38 TDetector(TDetector&&) noexcept;
39 ~TDetector();
40 TDetector& operator=(const TDetector& other)
41 {
42 if(this != &other) {
43 other.Copy(*this);
44 }
45 return *this;
46 }
47 TDetector& operator=(TDetector&& other) noexcept
48 {
49 if(this != &other) {
50 other.Copy(*this);
51 }
52 return *this;
53 }
54
55 virtual void BuildHits() { AbstractMethod("BuildHits()"); } //!<!
56#ifndef __CINT__
57 virtual void AddFragment(const std::shared_ptr<const TFragment>&, TChannel*)
58 {
59 AbstractMethod("AddFragment()");
60 } //!<!
61#endif
62
63 virtual void AddHit(TDetectorHit* hit)
64 {
65 fHits.push_back(hit);
66 }
67 void Copy(TObject&) const override; //!<!
68 void Clear(Option_t* = "") override { fHits.clear(); } //!<!
69 virtual void ClearTransients(); //!<!
70 void Print(Option_t* opt = "") const override; //!<!
71 virtual void Print(std::ostream& out) const;
72
73 virtual Short_t GetMultiplicity() const { return static_cast<Short_t>(fHits.size()); }
74 virtual TDetectorHit* GetHit(const int& index) const;
75 virtual const std::vector<TDetectorHit*>& GetHitVector() const { return fHits; }
76 virtual bool NoHits() const { return fHits.empty(); }
77
78 std::vector<TDetectorHit*>& Hits() { return fHits; }
79 const std::vector<TDetectorHit*>& Hits() const { return fHits; }
80
81 friend std::ostream& operator<<(std::ostream& out, const TDetector& det)
82 {
83 det.Print(out);
84 return out;
85 }
86
87private:
88 std::vector<TDetectorHit*> fHits;
89
90 /// \cond CLASSIMP
91 ClassDefOverride(TDetector, 1) // NOLINT(readability-else-after-return)
92 /// \endcond
93};
94/*! @} */
95#endif
TDetector & operator=(TDetector &&other) noexcept
Definition TDetector.h:47
std::vector< TDetectorHit * > fHits
Definition TDetector.h:88
void Print(Option_t *opt="") const override
!
Definition TDetector.cxx:37
friend std::ostream & operator<<(std::ostream &out, const TDetector &det)
Definition TDetector.h:81
virtual void ClearTransients()
!
Definition TDetector.cxx:54
void Copy(TObject &) const override
!
Definition TDetector.cxx:24
virtual bool NoHits() const
Definition TDetector.h:76
virtual Short_t GetMultiplicity() const
Definition TDetector.h:73
virtual TDetectorHit * GetHit(const int &index) const
Definition TDetector.cxx:61
void Clear(Option_t *="") override
!
Definition TDetector.h:68
const std::vector< TDetectorHit * > & Hits() const
Definition TDetector.h:79
virtual const std::vector< TDetectorHit * > & GetHitVector() const
Definition TDetector.h:75
std::vector< TDetectorHit * > & Hits()
Definition TDetector.h:78
virtual void AddFragment(const std::shared_ptr< const TFragment > &, TChannel *)
!
Definition TDetector.h:57
TDetector()=default
virtual void BuildHits()
!
Definition TDetector.h:55
virtual void AddHit(TDetectorHit *hit)
Definition TDetector.h:63