GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TRcmpHit.cxx
Go to the documentation of this file.
1#include <iostream>
2#include "TRcmpHit.h"
3
4#include <cstdlib>
5#include <cmath>
6
7// function implementations are below
8
10{
11 /// this is the copy constructor for a single TRcmpHit parameter
12 rhs.Copy(*this);
13}
14
16 : fStrip(frag.GetSegment()) // set the (front or back) strip number of the hit (note that this would be between 00-31 since there are 32 strips)
17{
18 /// this is the constructor that builds RCMP hits out of a single fragment (either front or back)
19 frag.Copy(*this);
20}
21
22TRcmpHit::TRcmpHit(const TFragment& fragFront, const TFragment& fragBack)
23 : fFrontStrip(fragFront.GetSegment()), fBackStrip(fragBack.GetSegment()) // set the front and back strip number of the hit (goes from 00-31)
24{
25 /// this is the constructor that builds RCMP hits out of a front and a back fragment (energy, time, etc. is taken from the front-strip)
26 fragFront.Copy(*this); // we want to use the information from the front (P-side) strip such as energy, time, etc.
27}
28
29void TRcmpHit::Copy(TObject& rhs) const
30{
31 /// Copy function
33
34 // copy the strip number data members
35 static_cast<TRcmpHit&>(rhs).fFrontStrip = fFrontStrip;
36 static_cast<TRcmpHit&>(rhs).fBackStrip = fBackStrip;
37 static_cast<TRcmpHit&>(rhs).fStrip = fStrip;
38}
39
40void TRcmpHit::Copy(TObject& rhs, bool waveform) const
41{
42 Copy(rhs);
43 if(waveform) {
44 CopyWave(rhs);
45 }
46}
47
48void TRcmpHit::Clear(Option_t* opt)
49{
50 TDetectorHit::Clear(opt); // clears the base (address, position and waveform)
51
52 // set the data members to default values
53 fFrontStrip = -1;
54 fBackStrip = -1;
55 fStrip = -1;
56}
57
58void TRcmpHit::Print(Option_t*) const
59{
60 Print(std::cout);
61}
62
63void TRcmpHit::Print(std::ostream& out) const
64{
65 std::ostringstream str;
66 str << "Rcmp Detector: " << GetDetector() << std::endl;
67 str << "Rcmp Energy: " << GetEnergy() << std::endl;
68 str << "Rcmp hit time: " << GetTime() << std::endl;
69 str << "Front strip: " << fFrontStrip << std::endl;
70 str << "Back strip: " << fBackStrip << std::endl;
71 out << str.str();
72}
virtual double GetEnergy(Option_t *opt="") 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
!
Short_t fBackStrip
this corresponds to the back strip number for a Pixel Hit
Definition TRcmpHit.h:50
Short_t fFrontStrip
this corresponds to the front strip number for a Pixel Hit
Definition TRcmpHit.h:49
void Copy(TObject &) const override
!
Definition TRcmpHit.cxx:29
void Print(Option_t *opt="") const override
!
Definition TRcmpHit.cxx:58
Short_t fStrip
this corresponds to the front strip number for a front hit and the back strip number for a back hit
Definition TRcmpHit.h:51
void Clear(Option_t *opt="") override
!
Definition TRcmpHit.cxx:48
TRcmpHit()=default
default constructor