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