GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TTdrPlasticHit.cxx
Go to the documentation of this file.
1#include "TTdrPlasticHit.h"
2
3#include <iostream>
4#include <algorithm>
5#include <climits>
6
7#include "Globals.h"
8#include "TTdrPlastic.h"
9#include "TGRSIOptions.h"
10
12{
13 // Default Constructor
14#if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)
15 Class()->IgnoreTObjectStreamer(kTRUE);
16#endif
17 Clear();
18}
19
21
23{
24 // Copy Constructor
25#if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)
26 Class()->IgnoreTObjectStreamer(kTRUE);
27#endif
28 Clear();
29 rhs.Copy(*this);
30}
31
33{
35 if(frag.GetWaveform()->empty()) {
36 printf("Warning, TTdrPlastic::SetWave() set, but data waveform size is zero!\n");
37 }
38 if(false) {
39 std::vector<Short_t> x;
40 // Need to reorder waveform data for S1507 data from December 2014
41 // All pairs of samples are swapped.
42 // The first two samples are also delayed by 8.
43 // We choose to throw out the first 2 samples (junk) and the last 6 samples (convience)
44 x = *(frag.GetWaveform());
45 size_t length = x.size() - (x.size() % 8);
46 Short_t temp;
47
48 if(length > 8) {
49 for(size_t i = 0; i < length - 8; i += 8) {
50 x[i] = x[i + 9];
51 x[i + 1] = x[i + 8];
52 temp = x[i + 2];
53 x[i + 2] = x[i + 3];
54 x[i + 3] = temp;
55 temp = x[i + 4];
56 x[i + 4] = x[i + 5];
57 x[i + 5] = temp;
58 temp = x[i + 6];
59 x[i + 6] = x[i + 7];
60 x[i + 7] = temp;
61 }
62 x.resize(length - 8);
63 }
64 SetWaveform(x);
65 } else {
66 frag.CopyWave(*this);
67 }
68 }
69}
70
71void TTdrPlasticHit::Copy(TObject& rhs) const
72{
73 // Copies a TTdrPlasticHit
75 static_cast<TTdrPlasticHit&>(rhs).fFilter = fFilter;
76}
77
78void TTdrPlasticHit::Copy(TObject& obj, bool waveform) const
79{
80 Copy(obj);
81 if(waveform) {
82 CopyWave(obj);
83 }
84}
85
86TVector3 TTdrPlasticHit::GetPosition(Double_t) const
87{
88 // Gets the position of the current TTdrPlasticHit
90}
91
93{
94 // Gets the position of the current TTdrPlasticHit
96}
97
99{
100 // check if the desired filter is in wanted filter;
101 // return the answer;
102 return true;
103}
104
106{
107 // Clears the TdrPlasticHit
108 fFilter = 0;
110}
111
112void TTdrPlasticHit::Print(Option_t*) const
113{
114 // Prints the TdrPlasticHit. Returns:
115 // Detector
116 // Energy
117 // Time
118 Print(std::cout);
119}
120
121void TTdrPlasticHit::Print(std::ostream& out) const
122{
123 std::ostringstream str;
124 str << "TdrPlastic Detector: " << GetDetector() << std::endl;
125 str << "TdrPlastic hit energy: " << GetEnergy() << std::endl;
126 str << "TdrPlastic hit time: " << GetTime() << std::endl;
127 out << str.str();
128}
virtual double GetEnergy(Option_t *opt="") const
void SetWaveform(const std::vector< Short_t > &val)
!
const std::vector< Short_t > * GetWaveform() const
!
void Clear(Option_t *opt="") override
!
virtual Int_t GetDetector() const
!
void Copy(TObject &) const override
!
virtual Double_t GetTime(const ETimeFlag &correct_flag=ETimeFlag::kAll, Option_t *opt="") const
Returns a time value to the nearest nanosecond!
virtual void CopyWave(TObject &) const
!
void Clear(Option_t *opt="") override
!
bool InFilter(Int_t)
!
void Print(Option_t *opt="") const override
!
TVector3 GetPosition() const override
!
~TTdrPlasticHit() override
Double_t GetDefaultDistance() const
void Copy(TObject &) const override
!
static TVector3 GetPosition(int DetNbr)
!
Definition TTdrPlastic.h:39
static bool SetWave()
!
Definition TTdrPlastic.h:50