CbmRoot
CbmTrdModuleRecR.cxx
Go to the documentation of this file.
1 #include "CbmTrdModuleRecR.h"
2 
3 #include "CbmTrdAddress.h"
4 #include "CbmTrdCluster.h"
5 #include "CbmTrdClusterFinder.h"
6 #include "CbmTrdDigi.h"
7 #include "CbmTrdHit.h"
8 #include "CbmTrdParModDigi.h"
9 #include "CbmTrdParSetDigi.h"
10 
11 #include "TGeoMatrix.h"
12 #include <TCanvas.h>
13 #include <TClonesArray.h>
14 #include <TH2F.h>
15 #include <TImage.h>
16 #include <TVector3.h>
17 #include <iostream>
18 
19 #include "CbmDigiManager.h"
20 #include <FairLogger.h>
21 
22 constexpr Double_t CbmTrdModuleRecR::kxVar_Value[2][5];
23 constexpr Double_t CbmTrdModuleRecR::kyVar_Value[2][5];
24 
25 //_______________________________________________________________________________
27  : CbmTrdModuleRec(), fDigiCounter(0), fDigiMap(), fClusterMap() {
28  SetNameTitle("TrdModuleRecR", "Reconstructor for rectangular pad TRD module");
29 }
30 
31 //_______________________________________________________________________________
32 CbmTrdModuleRecR::CbmTrdModuleRecR(Int_t mod, Int_t ly, Int_t rot)
33  : CbmTrdModuleRec(mod, ly, rot), fDigiCounter(0), fDigiMap(), fClusterMap() {
34  SetNameTitle(Form("TrdModuleRecR%02d", mod),
35  "Reconstructor for rectangular pad TRD module");
36 }
37 
38 //_______________________________________________________________________________
40 
41 //_______________________________________________________________________________
42 Bool_t CbmTrdModuleRecR::AddDigi(const CbmTrdDigi* digi, Int_t id) {
43 
44  // fill the digimap
45  fDigiMap.push_back(std::make_tuple(id, false, digi));
46  fDigiCounter++;
47  return kTRUE;
48 }
49 
50 //_______________________________________________________________________________
51 void CbmTrdModuleRecR::Clear(Option_t* opt) {
52  if (strcmp(opt, "cls") == 0) {
53  fDigiMap.erase(fDigiMap.begin(), fDigiMap.end());
54  fClusterMap.erase(fClusterMap.begin(), fClusterMap.end());
55  fDigiCounter = 0;
56  }
58 }
59 
60 //_______________________________________________________________________________
62 
63  std::deque<std::tuple<Int_t, Bool_t, const CbmTrdDigi*>>::iterator
64  mainit; // subiterator for the deques in each module; searches for
65  // main-trigger to then add the neighbors
66  std::deque<std::tuple<Int_t, Bool_t, const CbmTrdDigi*>>::iterator
67  FNit; // last
68  // iterator to
69  // find the FN
70  // digis which
71  // correspond
72  // to the main
73  // trigger or
74  // the
75  // adjacent
76  // main
77  // triggers
78  std::deque<std::tuple<Int_t, Bool_t, const CbmTrdDigi*>>::iterator
79  start; // marker to
80  // erase
81  // already
82  // processed
83  // entries
84  // from the
85  // map to
86  // reduce the
87  // complexity
88  // of the
89  // algorithm
90  std::deque<std::tuple<Int_t, Bool_t, const CbmTrdDigi*>>::iterator
91  stop; // marker to
92  // erase
93  // already
94  // processed
95  // entries
96  // from the
97  // map to
98  // reduce the
99  // complexity
100  // of the
101  // algorithm
102 
103  // reset time information; used to erase processed digis from the map
104  Double_t time = 0;
105  Double_t lasttime = 0;
106  Double_t timediff = -1000;
107 
108  Int_t Clustercount = 0;
109  Double_t interval = CbmTrdDigi::Clk(CbmTrdDigi::kSPADIC);
110  Bool_t print = false;
111 
112  // iterator for the main trigger; searches for an unprocessed main triggered
113  // digi and then starts a subloop to directly construct the cluster
114  // while(!fDigiMap.empty()){
115  // std::cout<<fDigiMap.size()<<std::endl;
116  if (print) {
117  std::cout << fDigiMap.size() << std::endl;
118  for (mainit = fDigiMap.begin(); mainit != fDigiMap.end(); mainit++) {
119  const CbmTrdDigi* digi = (const CbmTrdDigi*) std::get<2>(*mainit);
120  Double_t ptime = digi->GetTime();
121  // Int_t digiAddress = digi->GetAddress();
122  Float_t Charge = digi->GetCharge();
123  // Int_t digiId = std::get<0>(*mainit);
124  Int_t channel = digi->GetAddressChannel();
125  Int_t ncols = fDigiPar->GetNofColumns();
126  Int_t triggerId = digi->GetTriggerType();
127 
128  std::cout << " module: " << fModAddress << " time: " << ptime
129  << " charge: " << Charge << " col: " << channel % ncols
130  << " row: " << channel / ncols << " trigger: " << triggerId
131  << " ncols: " << ncols << std::endl;
132  }
133  }
134 
135  start = fDigiMap.begin();
136  for (mainit = fDigiMap.begin(); mainit != fDigiMap.end(); mainit++) {
137 
138  // block to erase processed entries
139  const CbmTrdDigi* digi = (const CbmTrdDigi*) std::get<2>(*mainit);
140  if (!digi) continue;
141 
142  time = digi->GetTime();
143  if (lasttime > 0) timediff = time - lasttime;
144  lasttime = time;
145  // if(timediff < -interval) start=mainit;
146  if (timediff > interval && lasttime > 0) { start = mainit; }
147  // if(timediff > interval) {start=mainit;stop=mainit;break;}
148  if (timediff > interval) {
149  fDigiMap.erase(fDigiMap.begin(), stop + 1);
150  start = mainit;
151  stop = mainit;
152  }
153  if (timediff < interval) stop = mainit;
154 
155  Int_t triggerId = digi->GetTriggerType();
156  Bool_t marked = std::get<1>(*mainit);
157  if (triggerId != CbmTrdDigi::kSelf || marked) continue;
158 
159  // variety of neccessary address information; uses the "combiId" for the
160  // comparison of digi positions
161  // Int_t digiAddress = digi->GetAddress();
162  Float_t Charge = digi->GetCharge();
163  Int_t digiId = std::get<0>(*mainit);
164  Int_t channel = digi->GetAddressChannel();
165  Int_t ncols = fDigiPar->GetNofColumns();
166 
167  // some logic information which is used to process and find the clusters
168  Int_t lowcol = channel;
169  Int_t highcol = channel;
170  Int_t lowrow = channel;
171  Int_t highrow = channel;
172 
173  // counter which is used to easily break clusters which are at the edge and
174  // therefore do not fullfill the classical look
175  Int_t dmain = 1;
176 
177  // information buffer to handle neighbor rows and cluster over two rows; the
178  // identification of adjacent rows is done by comparing their center of
179  // gravity
180  Int_t counterrow = 1;
181  Int_t countertop = 0;
182  Int_t counterbot = 0;
183  Double_t buffertop[3] = {0, 0, 0};
184  Double_t bufferbot[3] = {0, 0, 0};
185  Double_t bufferrow[3] = {Charge, 0, 0};
186  // vector<Double_t> buffertop;
187  // vector<Double_t> bufferbot;
188  // vector<Double_t> bufferrow;
189  Double_t CoGtop = 0.;
190  Double_t CoGbot = 0.;
191  Double_t CoGrow = 0.;
192  std::tuple<const CbmTrdDigi*, const CbmTrdDigi*, const CbmTrdDigi*>
193  topdigi; // used to store the necassary digis for the CoG calculation
194  // without the need to revisit those digis
195  std::tuple<const CbmTrdDigi*, const CbmTrdDigi*, const CbmTrdDigi*> botdigi;
196 
197  // //some logical flags to reject unnecessary steps
198  Bool_t finished =
199  false; // is turned true either if the implemented trigger
200  // logic is fullfilled or if there are no more
201  // adjacend pads due to edges,etc.
202  Bool_t sealtopcol =
203  false; // the "seal" bools register when the logical end
204  // of the cluster was found
205  Bool_t sealbotcol = false;
206  Bool_t sealtoprow = false;
207  Bool_t sealbotrow = false;
208  Bool_t rowchange = false; // flags that there is a possible two row cluster
209  Bool_t addtop = false; // adds the buffered information of the second row
210  Bool_t addbot = false;
211 
212  // //deque which contains the actual cluster
213  std::deque<std::pair<Int_t, const CbmTrdDigi*>> cluster;
214  cluster.push_back(std::make_pair(digiId, digi));
215  if (print)
216  std::cout << " module: " << fModAddress << " time: " << time
217  << " charge: " << Charge << " col: " << channel % ncols
218  << " row: " << channel / ncols << " trigger: " << triggerId
219  << " ncols: " << ncols << std::endl;
220  // std::cout<<" module: " << fModAddress<<" time: " << time<<"
221  // charge: " << Charge<<" col: " << channel % ncols<<" trigger: " <<
222  // triggerId<<" ncols: " << ncols<<std::endl;
223  std::get<1>(*mainit) = true;
224 
225  // Bool_t mergerow=CbmTrdClusterFinder::HasRowMerger();
226  Bool_t mergerow = true;
227  // loop to find the other pads corresponding to the main trigger
228  while (!finished) {
229  dmain = 0;
230 
231  // for (FNit=fDigiMap.begin() ; FNit != fDigiMap.end();FNit++) {
232  for (FNit = start; FNit != fDigiMap.end(); FNit++) {
233 
234  // some information to serparate the time space and to skip processed
235  // digis
236  // continue;
237 
238  const CbmTrdDigi* d = (const CbmTrdDigi*) std::get<2>(*FNit);
239  Double_t newtime = d->GetTime();
240  Double_t dt = newtime - time;
241  Bool_t filled = std::get<1>(*FNit);
242  if (filled) continue;
243  if (dt < -interval) continue;
244  if (dt > interval) break;
245 
246  // position information of the possible neighbor digis
247  Double_t charge = d->GetCharge();
248  // digiAddress = d->GetAddress();
249  Int_t digiid = std::get<0>(*FNit);
250  Int_t ch = d->GetAddressChannel();
251  Int_t col = ch % ncols;
252  Int_t trigger = d->GetTriggerType();
253 
254  if (mergerow) {
255  // multiple row processing
256  // first buffering
257 
258  if (ch == channel - ncols && !rowchange
259  && trigger == CbmTrdDigi::kSelf && !std::get<1>(*FNit)) {
260  rowchange = true;
261  bufferbot[0] = charge;
262  counterbot++;
263  std::get<0>(botdigi) = d;
264  }
265  if (ch == (channel - ncols) - 1 && rowchange && !std::get<1>(*FNit)) {
266  bufferbot[1] = charge;
267  counterbot++;
268  std::get<1>(botdigi) = d;
269  }
270  if (ch == (channel - ncols) + 1 && rowchange && !std::get<1>(*FNit)) {
271  bufferbot[2] = charge;
272  counterbot++;
273  std::get<2>(botdigi) = d;
274  }
275  if (ch == channel + ncols && !rowchange
276  && trigger == CbmTrdDigi::kSelf && !std::get<1>(*FNit)) {
277  rowchange = true;
278  buffertop[0] = charge;
279  countertop++;
280  std::get<0>(topdigi) = d;
281  }
282  if (ch == (channel + ncols) - 1 && rowchange && !std::get<1>(*FNit)) {
283  buffertop[1] = charge;
284  countertop++;
285  std::get<1>(topdigi) = d;
286  }
287  if (ch == (channel + ncols) + 1 && rowchange && !std::get<1>(*FNit)) {
288  buffertop[2] = charge;
289  countertop++;
290  std::get<2>(topdigi) = d;
291  }
292 
293  if (ch == channel - 1) {
294  bufferrow[1] = charge;
295  counterrow++;
296  std::get<1>(topdigi) = d;
297  }
298  if (ch == channel + 1) {
299  bufferrow[2] = charge;
300  counterrow++;
301  std::get<2>(topdigi) = d;
302  }
303 
304  // then the calculation of the center of gravity with the
305  // identification of common CoGs
306  if (countertop == 3) {
307  CoGtop =
308  (buffertop[2] / buffertop[0]) - (buffertop[1] / buffertop[0]);
309  }
310  if (counterbot == 3) {
311  CoGbot =
312  (bufferbot[2] / bufferbot[0]) - (bufferbot[1] / bufferbot[0]);
313  }
314  if (counterrow == 3) {
315  CoGrow =
316  (bufferrow[2] / bufferrow[0]) - (bufferrow[1] / bufferrow[0]);
317  }
318  if (countertop == 3 && counterrow == 3 && !addtop
319  && TMath::Abs((CoGtop - CoGrow)) < 0.25 * CoGrow) {
320  addtop = true;
321  }
322  if (counterbot == 3 && counterrow == 3 && !addbot
323  && TMath::Abs((CoGbot - CoGrow)) < 0.25 * CoGrow) {
324  addbot = true;
325  }
326  }
327 
328  // logical implementation of the trigger logic in the same row as the
329  // main trigger
330  if (ch == lowcol - 1 && trigger == CbmTrdDigi::kSelf
331  && !std::get<1>(*FNit)) {
332  cluster.push_back(std::make_pair(digiid, d));
333  lowcol = ch;
334  dmain++;
335  std::get<1>(*FNit) = true;
336  if (print)
337  std::cout << " time: " << newtime << " charge: " << charge
338  << " col: " << col << " row: " << ch / ncols
339  << " trigger: " << trigger << std::endl;
340  }
341  if (ch == highcol + 1 && trigger == CbmTrdDigi::kSelf
342  && !std::get<1>(*FNit)) {
343  cluster.push_back(std::make_pair(digiid, d));
344  highcol = ch;
345  dmain++;
346  std::get<1>(*FNit) = true;
347  if (print)
348  std::cout << " time: " << newtime << " charge: " << charge
349  << " col: " << col << " row: " << ch / ncols
350  << " trigger: " << trigger << std::endl;
351  }
352  if (ch == highcol + 1 && trigger == CbmTrdDigi::kNeighbor
353  && !std::get<1>(*FNit) && !sealtopcol) {
354  cluster.push_back(std::make_pair(digiid, d));
355  sealtopcol = true;
356  dmain++;
357  std::get<1>(*FNit) = true;
358  if (print)
359  std::cout << " time: " << newtime << " charge: " << charge
360  << " col: " << col << " row: " << ch / ncols
361  << " trigger: " << trigger << std::endl;
362  }
363  if (ch == lowcol - 1 && trigger == CbmTrdDigi::kNeighbor
364  && !std::get<1>(*FNit) && !sealbotcol) {
365  cluster.push_back(std::make_pair(digiid, d));
366  sealbotcol = true;
367  dmain++;
368  std::get<1>(*FNit) = true;
369  if (print)
370  std::cout << " time: " << newtime << " charge: " << charge
371  << " col: " << col << " row: " << ch / ncols
372  << " trigger: " << trigger << std::endl;
373  }
374  if (col == ncols) { sealtopcol = true; }
375  if (col == 0) { sealbotcol = true; }
376 
377  if (mergerow) {
378  // adding of the neighboring row
379  if (ch == channel - ncols && addbot && !std::get<1>(*FNit)) {
380  cluster.push_back(std::make_pair(digiid, d));
381  lowrow = ch;
382  highrow = ch;
383  dmain++;
384  std::get<1>(*FNit) = true;
385  }
386  if (ch == channel + ncols && addtop && !std::get<1>(*FNit)) {
387  cluster.push_back(std::make_pair(digiid, d));
388  lowrow = ch;
389  highrow = ch;
390  dmain++;
391  std::get<1>(*FNit) = true;
392  }
393  if (rowchange && ch == lowrow - 1 && lowrow != channel
394  && trigger == CbmTrdDigi::kSelf && !std::get<1>(*FNit)) {
395  cluster.push_back(std::make_pair(digiid, d));
396  lowrow = ch;
397  dmain++;
398  std::get<1>(*FNit) = true;
399  }
400  if (rowchange && ch == highrow + 1 && highrow != channel
401  && trigger == CbmTrdDigi::kSelf && !std::get<1>(*FNit)) {
402  cluster.push_back(std::make_pair(digiid, d));
403  highrow = ch;
404  dmain++;
405  std::get<1>(*FNit) = true;
406  }
407  if (rowchange && ch == highrow + 1 && highrow != channel
408  && trigger == CbmTrdDigi::kNeighbor && !std::get<1>(*FNit)
409  && !sealtoprow) {
410  cluster.push_back(std::make_pair(digiid, d));
411  sealtoprow = true;
412  dmain++;
413  std::get<1>(*FNit) = true;
414  }
415  if (rowchange && ch == lowrow - 1 && lowrow != channel
416  && trigger == CbmTrdDigi::kNeighbor && !std::get<1>(*FNit)
417  && !sealbotrow) {
418  cluster.push_back(std::make_pair(digiid, d));
419  sealbotrow = true;
420  dmain++;
421  std::get<1>(*FNit) = true;
422  }
423  }
424  }
425 
426  // some finish criteria
427  if (((sealbotcol && sealtopcol) && !rowchange) || dmain == 0)
428  finished = true;
429  if ((sealbotcol && sealtopcol && sealtoprow && sealbotrow) || dmain == 0)
430  finished = true;
431  // finished=true;
432  if (print) std::cout << dmain << std::endl;
433  } // end of cluster completion
434  if (print) std::cout << dmain << std::endl;
435  if (print) std::cout << std::endl;
436  // fClusterMap.push_back(cluster);
437  Clustercount++;
438  addClusters(cluster);
439  } // end of main trigger loop
440  // fDigiMap.erase(fDigiMap.begin(),fDigiMap.end());
441  // }
442 
443  // Int_t checkcount=0;
444  // for (mainit=fDigiMap.begin() ; mainit != fDigiMap.end(); mainit++) {
445  // if(!std::get<1>(*mainit)) checkcount++;
446  // }
447  // std:cout<< checkcount<<" " << fDigiMap.size()<<std::endl;
448 
449  return Clustercount;
450 }
451 
452 //_____________________________________________________________________
454  std::deque<std::pair<Int_t, const CbmTrdDigi*>> cluster) {
455  // create vector for indice matching
456  std::vector<Int_t> digiIndices(cluster.size());
457  Int_t idigi = 0;
458 
460 
461  for (std::deque<std::pair<Int_t, const CbmTrdDigi*>>::iterator iDigi =
462  cluster.begin();
463  iDigi != cluster.end();
464  iDigi++) {
465  // add digi id to vector
466  digiIndices[idigi] = iDigi->first;
467  idigi++;
468  }
469 
470  // add the clusters to the Array
471  // const CbmDigi* digi = static_cast<const
472  // CbmDigi*>(fDigis->At(digiIndices.front()));
473  Int_t size = fClusters->GetEntriesFast();
474  CbmTrdCluster* newcluster = new ((*fClusters)[size]) CbmTrdCluster();
475 
476  // std::cout<<idigi<<std::endl;
477  newcluster->SetAddress(fModAddress);
478  newcluster->SetDigis(digiIndices);
479  newcluster->SetNCols(idigi);
480 
481  // BuildChannelMap(cluster);
482 }
483 
484 //_______________________________________________________________________________
485 Bool_t CbmTrdModuleRecR::MakeHits() { return kTRUE; }
486 
487 //_______________________________________________________________________________
489  const CbmTrdCluster* /*cluster*/,
490  std::vector<const CbmTrdDigi*>* digis) {
491 
492  TVector3 hit_posV;
493  TVector3 local_pad_posV;
494  TVector3 local_pad_dposV;
495  for (Int_t iDim = 0; iDim < 3; iDim++) {
496  hit_posV[iDim] = 0.0;
497  local_pad_posV[iDim] = 0.0;
498  local_pad_dposV[iDim] = 0.0;
499  }
500 
501  Double_t xVar = 0;
502  Double_t yVar = 0;
503  Double_t totalCharge = 0;
504  // Double_t totalChargeTR = 0;
505  // Double_t momentum = 0.;
506  // Int_t moduleAddress = 0;
507  Double_t time = 0.;
508  Int_t errorclass = 0.;
509  Bool_t EB = false;
510  Bool_t EBP = false;
511  for (std::vector<const CbmTrdDigi*>::iterator id = digis->begin();
512  id != digis->end();
513  id++) {
514  const CbmTrdDigi* digi = (*id);
515  if (!digi) {
516  continue;
517  std::cout << " no digi " << std::endl;
518  }
519 
520  Double_t digiCharge = digi->GetCharge();
521  errorclass = digi->GetErrorClass();
522  EB = digi->IsFlagged(0);
523  EBP = digi->IsFlagged(1);
524 
525  // if (digiCharge <= 0) {std::cout<<" charge 0 " <<
526  // std::endl;continue;}
527  if (digiCharge <= 0.05) { continue; }
528 
529  time += digi->GetTime();
530  // time += digi->GetTimeDAQ();
531 
532  totalCharge += digi->GetCharge();
533 
535  digi->GetAddressChannel(), true, local_pad_posV, local_pad_dposV);
536 
537  Double_t xMin = local_pad_posV[0] - local_pad_dposV[0];
538  Double_t xMax = local_pad_posV[0] + local_pad_dposV[0];
539  xVar += (xMax * xMax + xMax * xMin + xMin * xMin) * digiCharge;
540 
541  Double_t yMin = local_pad_posV[1] - local_pad_dposV[1];
542  Double_t yMax = local_pad_posV[1] + local_pad_dposV[1];
543  yVar += (yMax * yMax + yMax * yMin + yMin * yMin) * digiCharge;
544 
545  for (Int_t iDim = 0; iDim < 3; iDim++) {
546  hit_posV[iDim] += local_pad_posV[iDim] * digiCharge;
547  }
548  }
549  time /= digis->size();
550 
551  if (totalCharge <= 0) return NULL;
552 
553  Double_t hit_pos[3];
554  for (Int_t iDim = 0; iDim < 3; iDim++) {
555  hit_posV[iDim] /= totalCharge;
556  hit_pos[iDim] = hit_posV[iDim];
557  }
558 
559  if (EB) {
560  xVar = kxVar_Value[0][errorclass];
561  yVar = kyVar_Value[0][errorclass];
562  } else {
563  if (EBP)
564  time -=
565  46; //due to the event time of 0 in the EB mode and the ULong in the the digi time
566  //TODO: move to parameter file
567  xVar = kxVar_Value[1][errorclass];
568  yVar = kyVar_Value[1][errorclass];
569  }
570 
571  TVector3 cluster_pad_dposV(xVar, yVar, 0);
572 
573  // --- If a TGeoNode is attached, transform into global coordinate system
574  Double_t global[3];
575  LocalToMaster(hit_pos, global);
576 
577  if (!EB) { // preliminary correction for angle dependence in the position
578  // reconsutrction
579  global[0] = global[0] + (0.00214788 + global[0] * 0.000195394);
580  global[1] = global[1] + (0.00370566 + global[1] * 0.000213235);
581  }
582 
583  fDigiPar->TransformHitError(cluster_pad_dposV);
584 
585  // TODO: get momentum for more exact spacial error
586  if ((fDigiPar->GetOrientation() == 1) || (fDigiPar->GetOrientation() == 3)) {
587  cluster_pad_dposV[0] = sqrt(fDigiPar->GetPadSizeY(1));
588  } else {
589  cluster_pad_dposV[1] = sqrt(fDigiPar->GetPadSizeY(1));
590  }
591 
592  Int_t nofHits = fHits->GetEntriesFast();
593 
594  // return new ((*fHits)[nofHits]) CbmTrdHit(fModAddress, global,
595  // cluster_pad_dposV, 0, clusterId,0, 0,
596  // totalCharge/1e6,time,Double_t(CbmTrdDigi::Clk(CbmTrdDigi::kSPADIC)));
597  return new ((*fHits)[nofHits])
599  global,
600  cluster_pad_dposV,
601  0,
602  clusterId,
603  totalCharge / 1e6,
604  time,
605  Double_t(8.5)); // TODO: move to parameter file
606 }
607 
608 Double_t CbmTrdModuleRecR::GetSpaceResolution(Double_t val) {
609 
610  std::pair<Double_t, Double_t> res[12] = {std::make_pair(0.5, 0.4),
611  std::make_pair(1, 0.35),
612  std::make_pair(2, 0.3),
613  std::make_pair(2.5, 0.3),
614  std::make_pair(3.5, 0.28),
615  std::make_pair(4.5, 0.26),
616  std::make_pair(5.5, 0.26),
617  std::make_pair(6.5, 0.26),
618  std::make_pair(7.5, 0.26),
619  std::make_pair(8.5, 0.26),
620  std::make_pair(8.5, 0.26),
621  std::make_pair(9.5, 0.26)};
622 
623  Double_t selval = 0.;
624 
625  for (Int_t n = 0; n < 12; n++) {
626  if (val < res[0].first) selval = res[0].second;
627  if (n == 11) {
628  selval = res[11].second;
629  break;
630  }
631  if (val >= res[n].first && val <= res[n + 1].first) {
632  Double_t dx = res[n + 1].first - res[n].first;
633  Double_t dy = res[n + 1].second - res[n].second;
634  Double_t slope = dy / dx;
635  selval = (val - res[n].first) * slope + res[n].second;
636  break;
637  }
638  }
639 
640  return selval;
641 }
642 
CbmTrdParModDigi::GetPadSizeY
Double_t GetPadSizeY(Int_t i) const
Definition: CbmTrdParModDigi.h:37
CbmTrdAddress.h
Helper class to convert unique channel ID back and forth.
CbmTrdModuleAbstract::fModAddress
UShort_t fModAddress
unique identifier for current module
Definition: CbmTrdModuleAbstract.h:78
CbmTrdDigi::IsFlagged
Bool_t IsFlagged(const Int_t iflag) const
Query flag status (generic)
Definition: CbmTrdDigi.cxx:165
CbmTrdDigi::GetErrorClass
Int_t GetErrorClass() const
Channel status. SPADIC specific see LUT.
Definition: CbmTrdDigi.h:112
CbmTrdDigi::kNeighbor
@ kNeighbor
Definition: CbmTrdDigi.h:20
CbmTrdCluster::SetNCols
void SetNCols(UShort_t ncols)
Definition: CbmTrdCluster.h:91
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
CbmTrdParModDigi::TransformHitError
void TransformHitError(TVector3 &hitErr) const
Definition: CbmTrdParModDigi.cxx:676
CbmTrdModuleRecR::addClusters
void addClusters(std::deque< std::pair< Int_t, const CbmTrdDigi * >> cluster)
Definition: CbmTrdModuleRecR.cxx:453
CbmDigiManager::Init
InitStatus Init()
Initialisation.
Definition: CbmDigiManager.cxx:71
CbmTrdDigi::GetAddressChannel
Int_t GetAddressChannel() const
Getter read-out id.
Definition: CbmTrdDigi.cxx:119
CbmTrdHit
data class for a reconstructed Energy-4D measurement in the TRD
Definition: CbmTrdHit.h:35
CbmTrdDigi::kSelf
@ kSelf
Definition: CbmTrdDigi.h:19
CbmTrdModuleRec
Abstract class for module wise cluster finding and hit reconstruction.
Definition: CbmTrdModuleRec.h:16
CbmTrdModuleRecR::Clear
virtual void Clear(Option_t *opt="")
Clear local storage.
Definition: CbmTrdModuleRecR.cxx:51
CbmDigiManager::Instance
static CbmDigiManager * Instance()
Static instance.
Definition: CbmDigiManager.h:93
CbmTrdModuleRecR::MakeHit
virtual CbmTrdHit * MakeHit(Int_t cId, const CbmTrdCluster *c, std::vector< const CbmTrdDigi * > *digis)
Steering routine for converting cluster to hit.
Definition: CbmTrdModuleRecR.cxx:488
CbmTrdModuleRecR::~CbmTrdModuleRecR
virtual ~CbmTrdModuleRecR()
Definition: CbmTrdModuleRecR.cxx:39
CbmTrdCluster
Data Container for TRD clusters.
Definition: CbmTrdCluster.h:23
CbmTrdModuleRecR::AddDigi
virtual Bool_t AddDigi(const CbmTrdDigi *d, Int_t id)
Add digi to local module.
Definition: CbmTrdModuleRecR.cxx:42
CbmTrdDigi.h
CbmTrdDigi::Clk
static Float_t Clk(CbmTrdAsicType ty)
DAQ clock accessor for each ASIC.
Definition: CbmTrdDigi.h:87
CbmTrdModuleRecR.h
d
double d
Definition: P4_F64vec2.h:24
CbmTrdParModDigi::GetOrientation
Int_t GetOrientation() const
Definition: CbmTrdParModDigi.h:35
CbmTrdModuleRecR::fDigiMap
std::deque< std::tuple< Int_t, Bool_t, const CbmTrdDigi * > > fDigiMap
Definition: CbmTrdModuleRecR.h:71
CbmTrdParModDigi.h
CbmTrdModuleRecR::kyVar_Value
static constexpr Double_t kyVar_Value[2][5]
Definition: CbmTrdModuleRecR.h:66
CbmTrdParModDigi::GetPadPosition
void GetPadPosition(const Int_t sector, const Int_t col, const Int_t row, TVector3 &padPos, TVector3 &padPosErr) const
Definition: CbmTrdParModDigi.cxx:718
CbmTrdHit.h
Class for hits in TRD detector.
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmCluster::SetDigis
void SetDigis(const std::vector< Int_t > &indices)
Set array of digi to cluster. Overwrites existing array.
Definition: CbmCluster.h:61
first
bool first
Definition: LKFMinuit.cxx:143
CbmTrdModuleAbstract::fDigiPar
const CbmTrdParModDigi * fDigiPar
read-out description of module
Definition: CbmTrdModuleAbstract.h:83
CbmTrdModuleRecR::fClusterMap
std::deque< std::deque< std::pair< Int_t, const CbmTrdDigi * > > > fClusterMap
Definition: CbmTrdModuleRecR.h:73
CbmTrdModuleRecR
Rectangular pad module; Cluster finding and hit reconstruction algorithms.
Definition: CbmTrdModuleRecR.h:14
CbmTrdParSetDigi.h
CbmTrdModuleRecR::MakeHits
virtual Bool_t MakeHits()
Steering routine for building hits.
Definition: CbmTrdModuleRecR.cxx:485
CbmCluster::SetAddress
void SetAddress(Int_t address)
Definition: CbmCluster.h:94
CbmTrdModuleRec::fClusters
TClonesArray * fClusters
module wise storage of reconstructed cluster
Definition: CbmTrdModuleRec.h:66
CbmDigiManager.h
CbmTrdDigi::kSPADIC
@ kSPADIC
Definition: CbmTrdDigi.h:16
CbmTrdDigi::GetTriggerType
Int_t GetTriggerType() const
Channel trigger type. SPADIC specific see CbmTrdTriggerType.
Definition: CbmTrdDigi.h:135
CbmTrdModuleRecR::fDigiCounter
Int_t fDigiCounter
Definition: CbmTrdModuleRecR.h:57
CbmTrdModuleAbstract::LocalToMaster
virtual void LocalToMaster(Double_t in[3], Double_t out[3])
Definition: CbmTrdModuleAbstract.cxx:33
CbmTrdDigi
Definition: CbmTrdDigi.h:14
CbmTrdClusterFinder.h
CbmTrdDigi::GetTime
Double_t GetTime() const
Getter for physical time [ns]. Accounts for clock representation of each ASIC. In SPADIC case physica...
Definition: CbmTrdDigi.h:127
CbmTrdCluster.h
Data Container for TRD clusters.
CbmTrdModuleRecR::kxVar_Value
static constexpr Double_t kxVar_Value[2][5]
Definition: CbmTrdModuleRecR.h:63
CbmTrdModuleRec::Clear
virtual void Clear(Option_t *opt="")
Clear local storage.
Definition: CbmTrdModuleRec.cxx:32
CbmTrdDigi::GetCharge
Double_t GetCharge() const
Charge getter for SPADIC.
Definition: CbmTrdDigi.cxx:133
CbmTrdModuleRec::fHits
TClonesArray * fHits
module wise storage of reconstructed hits
Definition: CbmTrdModuleRec.h:67
CbmTrdModuleRecR::CbmTrdModuleRecR
CbmTrdModuleRecR()
Default constructor.
Definition: CbmTrdModuleRecR.cxx:26
CbmTrdModuleRecR::FindClusters
virtual Int_t FindClusters()
Steering routine for finding digits clusters.
Definition: CbmTrdModuleRecR.cxx:61
CbmTrdModuleRecR::GetSpaceResolution
Double_t GetSpaceResolution(Double_t val=3.0)
Definition: CbmTrdModuleRecR.cxx:608
CbmTrdParModDigi::GetNofColumns
Int_t GetNofColumns() const
Definition: CbmTrdParModDigi.cxx:321