CbmRoot
CbmPsdDigi.cxx
Go to the documentation of this file.
1 
8 #include "CbmPsdDigi.h"
9 
10 #include <TBuffer.h> // for TBuffer
11 #include <TClass.h> // for CbmPsdDigi::IsA()
12 #include <TString.h> // for Form, TString
13 
14 #include <string> // for basic_string
15 
16 // --- Default constructor
18 
19 
20 // --- Constructor with assignment
21 CbmPsdDigi::CbmPsdDigi(UInt_t address, Double_t edep, Double_t time)
22  : fdEdep(edep), fdTime(time), fuAddress(address) {}
23 
24 
25 // --- Constructor with module and section number
26 CbmPsdDigi::CbmPsdDigi(UInt_t moduleId,
27  UInt_t sectionId,
28  Double_t edep,
29  Double_t time)
30  : fdEdep(edep), fdTime(time), fuAddress(0) {
31  fuAddress = CbmPsdAddress::GetAddress(moduleId, sectionId);
32 }
33 
34 
35 // --- Copy constructor
37  : fdEdep(digiIn.fdEdep), fdTime(digiIn.fdTime), fuAddress(digiIn.fuAddress) {}
38 
39 
40 // --- Move constructor
42  : fdEdep(other.fdEdep), fdTime(other.fdTime), fuAddress(other.fuAddress) {}
43 
44 
45 // --- Destructor
47 
48 
49 // --- Assignment operator
51  if (this != &rhs) {
52  fdEdep = rhs.fdEdep;
53  fdTime = rhs.fdTime;
54  fuAddress = rhs.fuAddress;
55  }
56  return *this;
57 }
58 
59 
60 // --- Move assignment operator
62  if (this != &other) {
63  fdEdep = other.fdEdep;
64  fdTime = other.fdTime;
65  fuAddress = other.fuAddress;
66  }
67  return *this;
68 }
69 
70 
71 // --- Set address from module and section number
72 void CbmPsdDigi::SetAddress(UInt_t moduleId, UInt_t sectionId) {
73  fuAddress = CbmPsdAddress::GetAddress(moduleId, sectionId);
74 }
75 
76 
77 // --- Info to string
78 std::string CbmPsdDigi::ToString() const {
79  TString string = Form("CbmPsdDigi: address = 0x%08X Charge = %f Time = %f",
80  fuAddress,
81  fdEdep,
82  fdTime);
83  return string.Data();
84 }
85 
86 // --- Custom Streamer
87 void CbmPsdDigi::Streamer(TBuffer& R__b) {
88  // Stream an object of class CbmPsdDigi.
89 
90  UInt_t R__s, R__c;
91  if (R__b.IsReading()) {
92  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
93  if (R__v) {}
94  // LOG(info) << "Reading CbmPsdDigi version " << R__v;
95  if (3 == R__v) {
96  R__b >> fdEdep;
97  R__b >> fdTime;
98  R__b >> fuAddress;
99  R__b.CheckByteCount(R__s, R__c, CbmPsdDigi::IsA());
100  } else if (4 == R__v) {
101  R__b >> ffFitHarmonic1;
102  R__b >> ffFitHarmonic2;
103  R__b >> ffFitR2;
104  R__b >> ffFitEdep;
105  R__b >> fdEdep;
106  R__b >> fdTime;
107  R__b >> fuAddress;
108  R__b >> fuAmpl;
109  R__b >> fuZL;
110  R__b >> fdEdepWfm;
111  R__b.CheckByteCount(R__s, R__c, CbmPsdDigi::IsA());
112  }
113  } else {
114  // The function WriteVersion does not return the version number
115  // but the position where ti write the next data
116  // to get the class version use TClass->GetClassVersion()
117 
118  R__c = R__b.WriteVersion(CbmPsdDigi::IsA(), kTRUE);
119  Version_t version = CbmPsdDigi::IsA()->GetClassVersion();
120 
121  // We don't intent to write data in old format
122  /*
123  if ( 3 == version ) {
124  R__b << fdEdep;
125  R__b << fdTime;
126  R__b << fuAddress;
127  R__b.SetByteCount(R__c, kTRUE);
128  } else if ( 4 == version ) {
129  */
130  if (4 == version) {
131  R__b << ffFitHarmonic1;
132  R__b << ffFitHarmonic2;
133  R__b << ffFitR2;
134  R__b << ffFitEdep;
135  R__b << fdEdep;
136  R__b << fdTime;
137  R__b << fuAddress;
138  R__b << fuAmpl;
139  R__b << fuZL;
140  R__b << fdEdepWfm;
141  R__b.SetByteCount(R__c, kTRUE);
142  }
143  }
144 }
145 
CbmPsdDigi.h
CbmPsdDigi::ffFitHarmonic2
Float_t ffFitHarmonic2
Definition: CbmPsdDigi.h:151
CbmPsdDigi::ToString
std::string ToString() const
String output.
Definition: CbmPsdDigi.cxx:78
CbmPsdDigi::fuAddress
UInt_t fuAddress
Time of measurement.
Definition: CbmPsdDigi.h:158
CbmPsdAddress::GetAddress
static UInt_t GetAddress(Int_t moduleId, Int_t sectionId)
Return address from system ID, module, Section.
Definition: CbmPsdAddress.h:38
CbmPsdDigi::ffFitR2
Float_t ffFitR2
Definition: CbmPsdDigi.h:152
CbmPsdDigi::fdTime
Double_t fdTime
Energy deposition.
Definition: CbmPsdDigi.h:157
CbmPsdDigi::operator=
CbmPsdDigi & operator=(const CbmPsdDigi &)
Definition: CbmPsdDigi.cxx:50
CbmPsdDigi::fuZL
UInt_t fuZL
Definition: CbmPsdDigi.h:162
CbmPsdDigi::fuAmpl
UInt_t fuAmpl
Unique channel address.
Definition: CbmPsdDigi.h:161
CbmPsdDigi::~CbmPsdDigi
~CbmPsdDigi()
Definition: CbmPsdDigi.cxx:46
CbmPsdDigi::ffFitEdep
Float_t ffFitEdep
Definition: CbmPsdDigi.h:153
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmPsdDigi::CbmPsdDigi
CbmPsdDigi()
Default constructor.
Definition: CbmPsdDigi.cxx:17
CbmPsdDigi::fdEdep
Double_t fdEdep
Definition: CbmPsdDigi.h:156
CbmPsdDigi::fdEdepWfm
Double_t fdEdepWfm
Definition: CbmPsdDigi.h:163
CbmPsdDigi
Data class for PSD digital information.
Definition: CbmPsdDigi.h:31
CbmPsdDigi::ffFitHarmonic1
Float_t ffFitHarmonic1
Definition: CbmPsdDigi.h:150
CbmPsdDigi::SetAddress
void SetAddress(Int_t address)
Definition: CbmPsdDigi.h:131