24 , fDigitizer(digitizer)
37 for (
auto sigIt = (chanIt->second).begin(); sigIt != (chanIt->second).end(); sigIt++) {
53 if (!
fParams->IsChannelActive(channel))
return;
68 Double_t deadTime =
fParams->GetParAsic(channel).GetDeadTime();
72 if (TMath::Abs((*it)->GetTime() - time) < deadTime) {
77 (*it)->SetTime(TMath::Min((*it)->GetTime(), time));
78 (*it)->AddLink(charge, index, entry, file);
109 Double_t tFirst = -1.;
110 Double_t tLast = -1.;
111 Double_t tSignal = -1.;
117 for (
auto sigIt = (chanIt->second).begin(); sigIt != (chanIt->second).end(); sigIt++) {
119 tSignal = (*sigIt)->GetTime();
121 tFirst = tFirst < 0. ? tSignal : TMath::Min(tFirst, tSignal);
122 tLast = TMath::Max(tLast, tSignal);
128 nofSignals = nSignals;
142 auto& asic =
fParams->GetParAsic(channel);
148 Short_t adc = asic.ChargeToAdc(charge);
152 Double_t deltaT = 0.;
153 if (!(asic.GetTimeResol() < 0.)) deltaT = gRandom->Gaus(0., asic.GetTimeResol());
154 Long64_t dTime = Long64_t(round(signal->
GetTime() + deltaT));
157 UInt_t address =
fElement->GetAddress();
172 if (!(t2 > t1))
return 0;
174 UInt_t nAsicChannels =
fParams->GetNofAsicChannels();
176 for (UInt_t iAsic = 0; iAsic <
fParams->GetNofAsics(); iAsic++) {
177 auto& asic =
fParams->GetAsicParams().at(iAsic);
180 Double_t nNoiseMean = asic.GetNoiseRate() * nAsicChannels * (t2 - t1);
183 Int_t nNoise = gRandom->Poisson(nNoiseMean);
186 for (
Int_t iNoise = 0; iNoise < nNoise; iNoise++) {
189 UInt_t channel = UInt_t(gRandom->Uniform(Double_t(nAsicChannels)));
190 Double_t time = gRandom->Uniform(t1, t2);
191 Double_t charge = asic.GetRandomNoiseCharge();
192 UInt_t moduleChannel = iAsic * nAsicChannels + channel;
196 AddSignal(moduleChannel, time, charge, -1, -1, -1);
212 if (name.Length() != 16) isValid = kFALSE;
214 if (!name.BeginsWith(
"STS")) isValid = kFALSE;
215 if (name[4] !=
'U') isValid = kFALSE;
216 if (name[8] !=
'L') isValid = kFALSE;
217 if (name[13] !=
'M') isValid = kFALSE;
221 Int_t unit = 10 * (name[5] -
'0') + name[6] -
'0' - 1;
222 Int_t ladder = 10 * (name[9] -
'0') + name[10] -
'0' - 1;
223 Int_t hLadder = (name[11] ==
'U' ? 0 : 1);
224 Int_t module = 10 * (name[14] -
'0') + name[15] -
'0' - 1;
235 for (UShort_t channel = 0; channel <
fParams->GetNofChannels(); channel++) {
236 multiset<CbmStsSignal*, CbmStsSignal::Before> mset;
251 sigset::iterator sigIt;
253 sigset::iterator oldIt;
254 sigset::iterator endIt;
260 if (!(chanIt.second).empty()) {
261 auto& asic =
fParams->GetParAsic(chanIt.first);
271 Double_t timeLimit = readoutTime - 5. * asic.GetTimeResol() - asic.GetDeadTime();
274 sigIt = (chanIt.second).begin();
276 endIt = (chanIt.second).end();
277 while (sigIt != endIt) {
281 if (readoutTime >= 0. && (*sigIt)->GetTime() > timeLimit)
break;
293 (chanIt.second).erase(oldIt);
307 auto& asic =
fParams->GetParAsic(0);
308 ss <<
"Module " <<
fElement->GetName() <<
": dynRange " << asic.GetDynRange() <<
"e, thresh. " << asic.GetThreshold()
309 <<
"e, nAdc " << asic.GetNofAdc() <<
", time res. " << asic.GetTimeResol() <<
"ns, dead time "
310 << asic.GetDeadTime() <<
"ns, noise " << asic.GetNoise() <<
"e, zero noise rate " << asic.GetZeroNoiseRate()
ClassImp(CbmStsSimModule) CbmStsSimModule
Task class for simulating the detector response of the STS.
Class representing an element of the STS setup.
Parameters for one STS module.
Data class for an analog signal in the STS.
const CbmMatch & GetMatch() const
Double_t GetCharge() const
Class for the simulation of a readout unit in the CBM-STS.
Int_t ProcessAnalogBuffer(Double_t readoutTime)
CbmStsSimModule(CbmStsElement *setupModule=nullptr, const CbmStsParModule *modulePar=nullptr, CbmStsDigitize *digitizer=nullptr)
Standard constructor.
const CbmStsParModule * fParams
Digitizer.
void AddSignal(UShort_t channel, Double_t time, Double_t charge, Int_t index=0, Int_t entry=0, Int_t file=0)
static Int_t GetAddressFromName(TString name)
Get the address from the module name (static)
void Digitize(UShort_t channel, CbmStsSignal *signal)
UShort_t GetNofChannels() const
Number of electronic channels @value Number of ADC channels.
std::map< UShort_t, sigset > fAnalogBuffer
std::string ToString() const
virtual ~CbmStsSimModule()
Destructor.
Int_t GenerateNoise(Double_t t1, Double_t t2)
Generate noise.
void BufferStatus(Int_t &nofSignals, Double_t &timeFirst, Double_t &timeLast)
CbmStsDigitize * fDigitizer
Element in geometry setup.
int32_t GetAddress(uint32_t unit=0, uint32_t ladder=0, uint32_t halfladder=0, uint32_t module=0, uint32_t sensor=0, uint32_t side=0, uint32_t version=kCurrentVersion)
Construct address.