74 std::deque<std::tuple<Int_t, Bool_t, const CbmTrdDigi*>>::iterator mainit;
76 std::deque<std::tuple<Int_t, Bool_t, const CbmTrdDigi*>>::iterator FNit;
78 std::deque<std::tuple<Int_t, Bool_t, const CbmTrdDigi*>>::iterator start;
80 std::deque<std::tuple<Int_t, Bool_t, const CbmTrdDigi*>>::iterator stop;
85 Double_t lasttime = 0;
86 Double_t timediff = -1000;
88 Int_t Clustercount = 0;
97 std::cout <<
fDigiMap.size() << std::endl;
100 Double_t ptime = digi->
GetTime();
108 std::cout <<
" module: " <<
fModAddress <<
" time: " << ptime <<
" charge: " << Charge
109 <<
" col: " << channel % ncols <<
" row: " << channel / ncols <<
" trigger: " << triggerId
110 <<
" ncols: " << ncols << std::endl;
122 if (lasttime > 0) timediff = time - lasttime;
125 if (timediff > interval && lasttime > 0) {
129 if (timediff > interval) {
134 if (timediff < interval) stop = mainit;
138 Bool_t marked = std::get<1>(*mainit);
145 Int_t digiId = std::get<0>(*mainit);
150 Int_t lowcol = channel;
151 Int_t highcol = channel;
152 Int_t lowrow = channel;
153 Int_t highrow = channel;
162 Int_t counterrow = 1;
163 Int_t countertop = 0;
164 Int_t counterbot = 0;
165 Double_t buffertop[3] = {0, 0, 0};
166 Double_t bufferbot[3] = {0, 0, 0};
167 Double_t bufferrow[3] = {Charge, 0, 0};
171 Double_t CoGtop = 0.;
172 Double_t CoGbot = 0.;
173 Double_t CoGrow = 0.;
174 std::tuple<const CbmTrdDigi*, const CbmTrdDigi*, const CbmTrdDigi*>
177 std::tuple<const CbmTrdDigi*, const CbmTrdDigi*, const CbmTrdDigi*> botdigi;
180 Bool_t finished =
false;
183 Bool_t sealtopcol =
false;
185 Bool_t sealbotcol =
false;
186 Bool_t sealtoprow =
false;
187 Bool_t sealbotrow =
false;
188 Bool_t rowchange =
false;
189 Bool_t addtop =
false;
190 Bool_t addbot =
false;
193 std::deque<std::pair<Int_t, const CbmTrdDigi*>> cluster;
194 cluster.push_back(std::make_pair(digiId, digi));
196 std::cout <<
" module: " <<
fModAddress <<
" time: " << time <<
" charge: " << Charge
197 <<
" col: " << channel % ncols <<
" row: " << channel / ncols <<
" trigger: " << triggerId
198 <<
" ncols: " << ncols << std::endl;
202 std::get<1>(*mainit) =
true;
205 if (channel % ncols == ncols - 1) {
208 if (channel % ncols == 0) {
213 Bool_t mergerow =
true;
219 for (FNit = start; FNit !=
fDigiMap.end(); FNit++) {
226 Double_t newtime = d->
GetTime();
227 Double_t dt = newtime - time;
228 Bool_t filled = std::get<1>(*FNit);
229 if (filled)
continue;
230 if (dt < -interval)
continue;
231 if (dt > interval)
break;
236 Int_t digiid = std::get<0>(*FNit);
238 Int_t col = ch % ncols;
247 && !std::get<1>(*FNit)) {
249 bufferbot[0] = charge;
251 std::get<0>(botdigi) = d;
253 if (ch == (channel - ncols) - 1 && rowchange && !std::get<1>(*FNit) && !sealbotcol) {
254 bufferbot[1] = charge;
256 std::get<1>(botdigi) = d;
258 if (ch == (channel - ncols) + 1 && rowchange && !std::get<1>(*FNit) && !sealtopcol) {
259 bufferbot[2] = charge;
261 std::get<2>(botdigi) = d;
264 && !std::get<1>(*FNit)) {
266 buffertop[0] = charge;
268 std::get<0>(topdigi) = d;
270 if (ch == (channel + ncols) - 1 && rowchange && !std::get<1>(*FNit) && !sealbotcol) {
271 buffertop[1] = charge;
273 std::get<1>(topdigi) = d;
275 if (ch == (channel + ncols) + 1 && rowchange && !std::get<1>(*FNit) && !sealtopcol) {
276 buffertop[2] = charge;
278 std::get<2>(topdigi) = d;
281 if (ch == channel - 1 && !sealbotcol) {
282 bufferrow[1] = charge;
284 std::get<1>(topdigi) = d;
286 if (ch == channel + 1 && !sealtopcol) {
287 bufferrow[2] = charge;
289 std::get<2>(topdigi) = d;
294 if (countertop == 3) {
295 CoGtop = (buffertop[2] / buffertop[0]) - (buffertop[1] / buffertop[0]);
297 if (counterbot == 3) {
298 CoGbot = (bufferbot[2] / bufferbot[0]) - (bufferbot[1] / bufferbot[0]);
300 if (counterrow == 3) {
301 CoGrow = (bufferrow[2] / bufferrow[0]) - (bufferrow[1] / bufferrow[0]);
303 if (countertop == 3 && counterrow == 3 && !addtop && TMath::Abs((CoGtop - CoGrow)) < 0.25 * CoGrow) {
306 if (counterbot == 3 && counterrow == 3 && !addbot && TMath::Abs((CoGbot - CoGrow)) < 0.25 * CoGrow) {
314 cluster.push_back(std::make_pair(digiid, d));
317 std::get<1>(*FNit) =
true;
319 std::cout <<
" time: " << newtime <<
" charge: " << charge <<
" col: " << col <<
" row: " << ch / ncols
320 <<
" trigger: " << trigger << std::endl;
323 cluster.push_back(std::make_pair(digiid, d));
326 std::get<1>(*FNit) =
true;
328 std::cout <<
" time: " << newtime <<
" charge: " << charge <<
" col: " << col <<
" row: " << ch / ncols
329 <<
" trigger: " << trigger << std::endl;
333 cluster.push_back(std::make_pair(digiid, d));
336 std::get<1>(*FNit) =
true;
338 std::cout <<
" time: " << newtime <<
" charge: " << charge <<
" col: " << col <<
" row: " << ch / ncols
339 <<
" trigger: " << trigger << std::endl;
343 cluster.push_back(std::make_pair(digiid, d));
346 std::get<1>(*FNit) =
true;
348 std::cout <<
" time: " << newtime <<
" charge: " << charge <<
" col: " << col <<
" row: " << ch / ncols
349 <<
" trigger: " << trigger << std::endl;
351 if (col == ncols - 1) {
360 if (ch == channel - ncols && addbot && !std::get<1>(*FNit)) {
361 cluster.push_back(std::make_pair(digiid, d));
365 std::get<1>(*FNit) =
true;
367 if (ch == channel + ncols && addtop && !std::get<1>(*FNit)) {
368 cluster.push_back(std::make_pair(digiid, d));
372 std::get<1>(*FNit) =
true;
381 && !std::get<1>(*FNit) && !sealbotrow) {
382 cluster.push_back(std::make_pair(digiid, d));
385 std::get<1>(*FNit) =
true;
386 if (lowrow % ncols == 0) sealbotrow =
true;
389 && !std::get<1>(*FNit) && !sealtoprow) {
390 cluster.push_back(std::make_pair(digiid, d));
393 std::get<1>(*FNit) =
true;
394 if (highrow % ncols == ncols - 1) sealtoprow =
true;
397 && !std::get<1>(*FNit) && !sealtoprow) {
398 cluster.push_back(std::make_pair(digiid, d));
401 std::get<1>(*FNit) =
true;
404 && !std::get<1>(*FNit) && !sealbotrow) {
405 cluster.push_back(std::make_pair(digiid, d));
408 std::get<1>(*FNit) =
true;
414 if (((sealbotcol && sealtopcol) && !rowchange) || dmain == 0) finished =
true;
415 if ((sealbotcol && sealtopcol && sealtoprow && sealbotrow) || dmain == 0) finished =
true;
417 if (print) std::cout << dmain << std::endl;
419 if (print) std::cout << dmain << std::endl;
420 if (print) std::cout << std::endl;
472 std::vector<const CbmTrdDigi*>* digis)
476 TVector3 local_pad_posV;
477 TVector3 local_pad_dposV;
478 for (Int_t iDim = 0; iDim < 3; iDim++) {
479 hit_posV[iDim] = 0.0;
480 local_pad_posV[iDim] = 0.0;
481 local_pad_dposV[iDim] = 0.0;
486 Double_t totalCharge = 0;
491 Int_t errorclass = 0.;
494 for (std::vector<const CbmTrdDigi*>::iterator
id = digis->begin();
id != digis->end();
id++) {
498 std::cout <<
" no digi " << std::endl;
508 if (digiCharge <= 0.05) {
519 Double_t xMin = local_pad_posV[0] - local_pad_dposV[0];
520 Double_t xMax = local_pad_posV[0] + local_pad_dposV[0];
521 xVar += (xMax * xMax + xMax * xMin + xMin * xMin) * digiCharge;
523 Double_t yMin = local_pad_posV[1] - local_pad_dposV[1];
524 Double_t yMax = local_pad_posV[1] + local_pad_dposV[1];
525 yVar += (yMax * yMax + yMax * yMin + yMin * yMin) * digiCharge;
527 for (Int_t iDim = 0; iDim < 3; iDim++) {
528 hit_posV[iDim] += local_pad_posV[iDim] * digiCharge;
531 time /= digis->size();
533 if (totalCharge <= 0)
return NULL;
536 for (Int_t iDim = 0; iDim < 3; iDim++) {
537 hit_posV[iDim] /= totalCharge;
538 hit_pos[iDim] = hit_posV[iDim];
552 TVector3 cluster_pad_dposV(xVar, yVar, 0);
560 global[0] = global[0] + (0.00214788 + global[0] * 0.000195394);
561 global[1] = global[1] + (0.00370566 + global[1] * 0.000213235);
577 Int_t nofHits =
fHits->GetEntriesFast();
582 return new ((*fHits)[nofHits])
590 std::pair<Double_t, Double_t> res[12] = {
591 std::make_pair(0.5, 0.4), std::make_pair(1, 0.35), std::make_pair(2, 0.3), std::make_pair(2.5, 0.3),
592 std::make_pair(3.5, 0.28), std::make_pair(4.5, 0.26), std::make_pair(5.5, 0.26), std::make_pair(6.5, 0.26),
593 std::make_pair(7.5, 0.26), std::make_pair(8.5, 0.26), std::make_pair(8.5, 0.26), std::make_pair(9.5, 0.26)};
595 Double_t selval = 0.;
597 for (Int_t n = 0; n < 12; n++) {
598 if (val < res[0].
first) selval = res[0].second;
600 selval = res[11].second;
603 if (val >= res[n].
first && val <= res[n + 1].
first) {
604 Double_t dx = res[n + 1].first - res[n].first;
605 Double_t dy = res[n + 1].second - res[n].second;
606 Double_t slope = dy / dx;
607 selval = (val - res[n].first) * slope + res[n].second;