CbmRoot
Loading...
Searching...
No Matches
CbmMuchSignal.cxx
Go to the documentation of this file.
1
/* Copyright (C) 2017-2019 Variable Energy Cyclotron Centre, Kolkata
2
SPDX-License-Identifier: GPL-3.0-only
3
Authors: Vikas Singhal [committer] */
4
28
#include "
CbmMuchSignal.h
"
29
30
#include "
CbmMuchAddress.h
"
31
#include "
CbmMuchDigi.h
"
32
#include "
CbmMuchDigiMatch.h
"
33
34
#include <Logger.h>
// for Logger, LOG
35
36
#include "TMath.h"
37
#include "TRandom.h"
38
39
#include <memory>
40
41
using namespace
std
;
42
43
/*
44
CbmMuchSignal::CbmMuchSignal(CbmMuchSignal* signal)
45
: TObject(),
46
fAddress(signal->fAddress),
47
fTimeStart(signal->fTimeStart),
48
fTimeStop(signal->fTimeStop),
49
fSignalShape(signal->fSignalShape)
50
{
51
}
52
*/
53
CbmMuchSignal::CbmMuchSignal
(
const
CbmMuchSignal
& rhs)
54
: TObject()
55
, fAddress(rhs.fAddress)
56
, fTimeStart(rhs.fTimeStart)
57
, fTimeStop(rhs.fTimeStop)
58
,
59
//fPileUpTime(rhs.fPileUpTime),
60
fCharge(rhs.fCharge)
61
,
62
//fModifiedCharge(rhs.fModifiedCharge),
63
fPileUpCount(rhs.fPileUpCount)
64
,
65
//fSignalShape(rhs.fSignalShape),
66
fMatch(rhs.fMatch)
67
{
68
}
69
/*
70
CbmMuchSignal& CbmMuchSignal::operator=(const CbmMuchSignal& rhs)
71
{
72
73
if (this != &rhs) {
74
TObject::operator=(rhs);
75
fAddress = rhs.fAddress;
76
fTimeStop = rhs.fTimeStop;
77
fTimeStart = rhs.fTimeStart;
78
fSignalShape = rhs.fSignalShape;
79
fMatch = rhs.fMatch;
80
}
81
return *this;
82
}
83
*/
84
85
86
/*void CbmMuchSignal::MakeSignalShape(UInt_t charge, TArrayD shape) {
87
Int_t bin0 = 0;
88
//Int_t((fT0)/gkResponseBin);
89
Int_t nbins = bin0+shape.GetSize();
90
if (fSignalShape.GetSize()<nbins) fSignalShape.Set(nbins);
91
for (Int_t j=0;j<shape.GetSize();j++) fSignalShape[bin0 + j]+=charge*shape[j];
92
}*/
93
// -------------------------------------------------------------------------
94
//
95
//
96
// -------------------------------------------------------------------------
97
//Below function will add the Signal shapes of 2 signal
98
99
void
CbmMuchSignal::MergeSignal
(
CbmMuchSignal
* signal)
100
{
101
fPileUpCount
++;
102
fPileUpCount
+= signal->
GetPileUpCount
();
103
Long_t StartDiff = signal->
GetTimeStart
() -
fTimeStart
;
104
Long_t StopDiff = signal->
GetTimeStop
() -
fTimeStop
;
105
Bool_t MeFirst = kTRUE;
106
Long_t PileUpTime = 0;
107
LOG(debug4) <<
" Start Difference "
<< StartDiff <<
" Stop Difference "
<< StopDiff;
108
if
(StopDiff > 0)
109
fTimeStop
=
110
signal
111
->
GetTimeStop
();
//Shows Second signal Stop time is larger than first signal stop time, therefore fStopTime modified.
112
if
(StartDiff < 0) {
113
//Shows that New Signal is earlier than This signal.
114
// std::cout<<"First Signal start time " <<fTimeStart<<" Second Signal start time is " <<signal->GetTimeStart() << endl;
115
MeFirst = kFALSE;
116
//StartDiff = (-1)*StartDiff;
117
PileUpTime =
fTimeStart
;
118
fTimeStart
= signal->
GetTimeStart
();
119
}
120
else
{
121
PileUpTime = signal->
GetTimeStart
();
122
}
123
Long_t PileUpDiff = PileUpTime -
fTimeStart
;
124
if
(PileUpDiff < 0) { LOG(info) << GetName() <<
" Problem: Check this particular pile up case."
; }
125
if
(PileUpDiff <
SLOWSHAPERPEAK
) {
fCharge
+= signal->
GetCharge
(); }
126
else
if
(!MeFirst)
127
fCharge
= signal->
GetCharge
();
128
129
/*TArrayD SecondSignalShape = signal->GetSignalShape();
130
fSignalShape.Set(fSignalShape.GetSize()+StopDiff);
131
//std::cout<<"MergeSignal called and size of fSignalShape "<<fSignalShape.GetSize()<<endl;
132
for (Int_t j=0;j<fSignalShape.GetSize()&&j<SecondSignalShape.GetSize();j++)
133
134
fSignalShape[j+StartDiff]=fSignalShape[j+StartDiff]+SecondSignalShape[j];
135
//SignalShape will be added in the first signal at location from where second signal start.
136
*/
137
}
138
139
void
CbmMuchSignal::AddNoise
(UInt_t meanNoise)
140
{
141
fCharge
+= TMath::Abs(meanNoise * gRandom->Gaus());
142
// for (Int_t i=0;i<fSignalShape.GetSize();i++){
143
// fSignalShape[i]+=TMath::Abs(meanNoise*gRandom->Gaus());
144
// }
145
}
146
147
148
/*Int_t CbmMuchSignal::GetMaxCharge(){
149
Int_t max_charge = -1;
150
for (Int_t i=0;i<fSignalShape.GetSize();i++){
151
Int_t charge = fSignalShape[i];
152
if (charge>max_charge) max_charge = charge;
153
}
154
return max_charge;
155
}*/
156
157
158
/*Int_t CbmMuchSignal::GetTimeStamp(Int_t threshold){
159
//Int_t threshold = 10000;
160
Int_t bin1 = -1;
161
for (Int_t i=0;i<fSignalShape.GetSize();i++){
162
if (bin1<0 && fSignalShape[i]>threshold) {
163
bin1 = i;
164
return fTimeStart+bin1*gkResponseBin;
165
}
166
}
167
return -1;
168
}*/
169
// -------------------------------------------------------------------------
170
171
172
/* Below functions will not be used as ADC or Charge value will be calculated on the basis of fSignalShape of the Analog Signal.
173
// ----- Add charge ----------------------------------------------------
174
void CbmMuchSignal::AddAdc(Int_t adc) {
175
Int_t newAdc = GetAdc() + adc;
176
SetAdc(newAdc);
177
}
178
// -------------------------------------------------------------------------
179
180
181
// ----- Set new charge ------------------------------------------------
182
void CbmMuchSignal::SetAdc(Int_t adc) {
183
//Charge value should not be more than saturation
184
185
UShort_t saturation = 4095; //2 ^ 12 - 1;
186
if(adc>saturation){
187
fCharge=saturation;
188
fSaturationFlag=1;
189
}
190
else if (adc < 0) fCharge=0;
191
else fCharge = (UShort_t)adc;
192
}
193
// -------------------------------------------------------------------------
194
*/
195
196
ClassImp
(
CbmMuchSignal
)
ClassImp
ClassImp(CbmConverterManager)
CbmMuchAddress.h
CbmMuchDigiMatch.h
CbmMuchDigi.h
CbmMuchSignal.h
SLOWSHAPERPEAK
#define SLOWSHAPERPEAK
Definition
CbmMuchSignal.h:22
CbmMuchSignal
Data class for an analog signal in the MUCH Simple data class used in the digitisation process of the...
Definition
CbmMuchSignal.h:36
CbmMuchSignal::fPileUpCount
UInt_t fPileUpCount
Definition
CbmMuchSignal.h:125
CbmMuchSignal::AddNoise
void AddNoise(UInt_t)
Definition
CbmMuchSignal.cxx:139
CbmMuchSignal::GetCharge
UInt_t GetCharge() const
Definition
CbmMuchSignal.h:92
CbmMuchSignal::MergeSignal
void MergeSignal(CbmMuchSignal *)
Definition
CbmMuchSignal.cxx:99
CbmMuchSignal::GetTimeStop
Long64_t GetTimeStop() const
Definition
CbmMuchSignal.h:90
CbmMuchSignal::fTimeStart
Long64_t fTimeStart
Definition
CbmMuchSignal.h:120
CbmMuchSignal::CbmMuchSignal
CbmMuchSignal()
Definition
CbmMuchSignal.h:39
CbmMuchSignal::GetPileUpCount
UInt_t GetPileUpCount() const
Definition
CbmMuchSignal.h:94
CbmMuchSignal::fCharge
UInt_t fCharge
Definition
CbmMuchSignal.h:123
CbmMuchSignal::fTimeStop
Long64_t fTimeStop
Definition
CbmMuchSignal.h:121
CbmMuchSignal::GetTimeStart
Long_t GetTimeStart() const
Definition
CbmMuchSignal.h:87
std
Hash for CbmL1LinkKey.
Definition
algo/base/Options.cxx:21
sim
detectors
much
CbmMuchSignal.cxx
Generated on Sun Dec 22 2024 23:04:18 for CbmRoot by
1.12.0