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