65 const vector< pair<Short_t, asicChannel> >
getLibraryCrossTalk(Short_t channel, Short_t TDCin, Short_t ADCin, Short_t TOTin,
66 size_t entry = 0,
bool insertSignalToOutput =
false)
const
69 vector< pair<Short_t, asicChannel> > outRec;
70 auto prob = gRandom->Uniform();
74 if (insertSignalToOutput)
75 outRec.emplace_back(std::make_pair(channel,
asicChannel{TDCin, ADCin, TOTin}));
80 Short_t ch8 = channel % 8;
84 size_t size = std::distance(pADC.first, pADC.second);
93 val = gRandom->Integer(size);
97 bool recNotSet =
true;
103 if (pADC.first->Channel == ch8) {
104 rec = (pADC.first)->record;
107 if ((--pADC.first)->Channel == ch8) {
108 rec = (--pADC.first)->record;
111 B2WARNING(
"Could not find CDC Cross talk library entry for channel, ADC: " << channel <<
" " << ADCin);
112 if (insertSignalToOutput)
113 outRec.emplace_back(std::make_pair(channel,
asicChannel{TDCin, ADCin, TOTin}));
120 for (
auto p = pADC.first; p != pADC.second; ++p) {
129 B2ASSERT(
"CDC cross talk record not set", !recNotSet);
132 Short_t DeltaTDC = TDCin - rec[ch8].TDC;
134 if (abs(DeltaTDC) > 1000) {
135 B2WARNING(
"Large xTalk DeltaTDC=" << DeltaTDC);
141 for (
int i = 0; i < 8; i += 1) {
142 if (rec[i].TDC > 0) {
144 B2ASSERT(
"CDC Cross talk entry for the selected channel cannot be empty " << ch8 <<
" " << rec[ch8].TDC, rec[ch8].TDC > -1);
145 if (insertSignalToOutput)
146 outRec.emplace_back(std::make_pair(channel,
asicChannel{TDCin, ADCin, TOTin}));
148 Short_t TDCout = rec[i].TDC + DeltaTDC;
149 outRec.emplace_back(std::make_pair(i - ch8 + channel,
asicChannel{TDCout, rec[i].ADC, rec[i].TOT}));