24 , fDigitizer(digitizer)
37 for (
auto sigIt = (chanIt->second).begin(); sigIt != (chanIt->second).end(); sigIt++) {
66 Bool_t isMerged = kFALSE;
72 if (TMath::Abs((*it)->GetTime() - time) < deadTime) {
77 (*it)->SetTime(TMath::Min((*it)->GetTime(), time));
78 (*it)->AddLink(charge, index, entry, file);
103 Double_t tFirst = -1.;
104 Double_t tLast = -1.;
105 Double_t tSignal = -1.;
111 for (
auto sigIt = (chanIt->second).begin(); sigIt != (chanIt->second).end(); sigIt++) {
113 tSignal = (*sigIt)->GetTime();
115 tFirst = tFirst < 0. ? tSignal : TMath::Min(tFirst, tSignal);
116 tLast = TMath::Max(tLast, tSignal);
122 nofSignals = nSignals;
142 Short_t adc = asic.ChargeToAdc(charge);
146 Double_t deltaT = 0.;
147 if (!(asic.GetTimeResol() < 0.)) deltaT = gRandom->Gaus(0., asic.GetTimeResol());
148 Long64_t dTime = Long64_t(round(signal->
GetTime() + deltaT));
166 if (!(t2 > t1))
return 0;
174 Double_t nNoiseMean = asic.GetNoiseRate() * nAsicChannels * (t2 - t1);
177 Int_t nNoise = gRandom->Poisson(nNoiseMean);
180 for (Int_t iNoise = 0; iNoise < nNoise; iNoise++) {
183 UInt_t channel = UInt_t(gRandom->Uniform(Double_t(nAsicChannels)));
184 Double_t time = gRandom->Uniform(t1, t2);
185 Double_t charge = asic.GetRandomNoiseCharge();
186 UInt_t moduleChannel = iAsic * nAsicChannels + channel;
190 AddSignal(moduleChannel, time, charge, -1, -1, -1);
205 Bool_t isValid = kTRUE;
206 if (name.Length() != 16) isValid = kFALSE;
208 if (!name.BeginsWith(
"STS")) isValid = kFALSE;
209 if (name[4] !=
'U') isValid = kFALSE;
210 if (name[8] !=
'L') isValid = kFALSE;
211 if (name[13] !=
'M') isValid = kFALSE;
215 Int_t unit = 10 * (name[5] -
'0') + name[6] -
'0' - 1;
216 Int_t ladder = 10 * (name[9] -
'0') + name[10] -
'0' - 1;
217 Int_t hLadder = (name[11] ==
'U' ? 0 : 1);
218 Int_t module = 10 * (name[14] -
'0') + name[15] -
'0' - 1;
230 multiset<CbmStsSignal*, CbmStsSignal::Before> mset;
245 sigset::iterator sigIt;
247 sigset::iterator oldIt;
248 sigset::iterator endIt;
254 if (!(chanIt.second).empty()) {
265 Double_t timeLimit = readoutTime - 5. * asic.
GetTimeResol() - asic.GetDeadTime();
268 sigIt = (chanIt.second).begin();
270 endIt = (chanIt.second).end();
271 while (sigIt != endIt) {
275 if (readoutTime >= 0. && (*sigIt)->GetTime() > timeLimit)
break;
287 (chanIt.second).erase(oldIt);
302 ss <<
"Module " <<
fElement->GetName() <<
": dynRange " << asic.GetDynRange() <<
"e, thresh. " << asic.GetThreshold()
303 <<
"e, nAdc " << asic.GetNofAdc() <<
", time res. " << asic.GetTimeResol() <<
"ns, dead time "
304 << 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.
void CreateDigi(Int_t address, UShort_t channel, Long64_t time, UShort_t adc, const CbmMatch &match)
Class representing an element of the STS setup.
double GetTimeResol() const
Time resolution.
double GetDeadTime() const
Single-channel dead time.
Parameters for one STS module.
uint32_t GetNofChannels() const
Number of channels.
uint32_t GetNofAsics() const
Number of ASICs.
uint32_t GetNofAsicChannels() const
Number of channels per ASIC.
bool IsChannelActive(uint32_t channel) const
Check for a channel being active.
const std::vector< CbmStsParAsic > & GetAsicParams() const
All ASIC parameters.
const CbmStsParAsic & GetParAsic(uint32_t channel) const
ASIC parameters for a given channel.
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.