CbmRoot
CbmMvdSensor.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmMvdSensor source file -----
3 // ----- Created 31/01/11 by M. Deveaux -----
4 // -------------------------------------------------------------------------
5 
6 #include "CbmMvdSensor.h"
7 
8 //---Plugins
11 #include "plugins/tasks/CbmMvdSensorClusterfinderTask.h" //not needed khun
16 #include "plugins/tasks/CbmMvdSensorHitfinderTask.h" //not needed khun
17 //---Plugins
18 
20 #include "TGeoManager.h"
21 #include "TGeoMatrix.h"
22 #include "TGeoVolume.h"
23 
25 #include "FairEventHeader.h"
26 #include "FairLogger.h"
27 #include "FairMCEventHeader.h"
28 #include "FairPrimaryGenerator.h"
29 #include "FairRunAna.h"
30 #include "FairRunSim.h"
31 
33 #include <iostream>
34 #include <vector>
35 
36 using std::cout;
37 using std::endl;
38 using std::map;
39 using std::vector;
40 
41 // ----- Default constructor -------------------------------------------
43  : TNamed()
44  , fStationNr(0)
45  , fSensorNr(0)
46  , fVolumeId(-1)
47  , fDetectorID(-1)
48  , fDigiPlugin(-1)
49  , fHitPlugin(-1)
50  , fDigiLen(-1)
51  , fClusterPlugin(-1)
52  , fVolName("")
53  , fNodeName("")
54  , foutputDigis(NULL)
55  , foutputCluster(NULL)
56  , //not needed khun
57  foutputDigiMatch(NULL)
58  , foutputBuffer(NULL)
59  , fcurrentPoints(NULL)
60  , fcurrentEventTime(0.)
61  , epsilon()
62  , fShape(NULL)
63  , fMCMatrix(NULL)
64  , fRecoMatrix(NULL)
65  , fAlignmentCorr(NULL)
66  , fTempCoordinate()
67  , fSensorPosition()
68  , fSensorData(new CbmMvdSensorDataSheet())
69  , fSensorMap()
70  , fPluginArray(new TObjArray(1))
71  , fSensorStartTime(0.)
72  , initialized(kFALSE) {
73  cout << "-W- " << GetName()
74  << ": MVD-Sensor initialized without technical data.";
75  cout << " Assuming default sensor." << endl;
76 
77  cout << "-W- " << GetName()
78  << ": MVD-Sensor initialized without geometry data. ";
79  cout << " Must be added manually before using this class." << endl;
80 
81  cout << "-W- " << GetName()
82  << ": MVD-Sensor initialized without valid start time. ";
83  cout << " Must be added manually before using this class." << endl;
84 }
85 // -------------------------------------------------------------------------
86 
87 
88 // ----- Standard constructor ------------------------------------------
89 CbmMvdSensor::CbmMvdSensor(const char* name,
90  CbmMvdSensorDataSheet* dataSheet,
91  TString volName,
92  TString nodeName,
93  Int_t stationNr,
94  Int_t volumeId,
95  Double_t sensorStartTime)
96  : TNamed(name, "")
97  , fStationNr()
98  , fSensorNr(stationNr)
99  , fVolumeId(volumeId)
100  , fDetectorID(DetectorId(stationNr))
101  , fDigiPlugin(-1)
102  , fHitPlugin(-1)
103  , fDigiLen(-1)
104  , fClusterPlugin(-1)
105  , fVolName(volName)
106  , fNodeName(nodeName)
107  , foutputDigis(NULL)
108  , foutputCluster(NULL)
109  , //not needed khun
110  foutputDigiMatch(NULL)
111  , foutputBuffer(NULL)
112  , fcurrentPoints(NULL)
113  , fcurrentEventTime(0.)
114  , epsilon()
115  , fShape(NULL)
116  , fMCMatrix(NULL)
117  , fRecoMatrix(NULL)
118  , fAlignmentCorr(NULL)
119  , fTempCoordinate()
120  , fSensorPosition()
121  , fSensorData(dataSheet)
122  , fSensorMap()
123  , fPluginArray(new TObjArray(1))
124  , fSensorStartTime(sensorStartTime)
125  , initialized(kFALSE) {}
126 // -------------------------------------------------------------------------
127 
128 
129 // ----- Destructor ----------------------------------------------------
131 // -------Setters -----------------------------------------------------
132 
133 void CbmMvdSensor::SetAlignment(TGeoHMatrix* alignmentMatrix) {
134 
135  if (fAlignmentCorr) { delete fAlignmentCorr; };
137  (TGeoHMatrix*) alignmentMatrix->Clone(fNodeName + "_AlignmentData");
138 }
139 
140 
141 // -------Initialization tools -----------------------------------------------------
142 void CbmMvdSensor::ReadSensorGeometry(TString nodeName) {
143 
144  LOG(debug1) << "-I- nodeName is " << nodeName;
145 
146  if (fMCMatrix) {
147  delete fMCMatrix;
148  }; //delete local copy of the position information
149 
150  TGeoVolume* volume;
151  gGeoManager->cd(nodeName);
152  volume = gGeoManager->GetCurrentVolume();
153  LOG(debug2) << "At volume: " << volume->GetName();
154  fShape = (TGeoBBox*) volume->GetShape();
155  fMCMatrix = (TGeoHMatrix*) (gGeoManager->GetCurrentMatrix())
156  ->Clone(nodeName + "_MC_Matrix");
157  fMCMatrix->SetName(nodeName + "_MC_Matrix");
158 
159  Double_t first[3], last[3];
160  PixelToLocal(0, 0, first);
162  LOG(debug2) << "pixel 0,0 at: " << first[0] << ", " << first[1] << " Local";
163  LOG(debug2) << "pixel " << fSensorData->GetNPixelsX() << " "
164  << fSensorData->GetNPixelsY() << " at: " << last[0] << ", "
165  << last[1] << " Local";
166 
167  Double_t* tempCoordinate;
168 
169  if (!fRecoMatrix) {
170  Double_t pre[3], past[3], global[3];
171  Double_t local[3] = {0, 0, 0};
172  //The initial guess on the reconstructed position is that the MC-position is correct
173  //Short cut to misalignment, add a small error
174  fRecoMatrix = (TGeoHMatrix*) fMCMatrix->Clone(nodeName + "_Reco_Matrix");
175  PixelToTop(0, 0, pre);
176  tempCoordinate = fRecoMatrix->GetTranslation();
177  for (Int_t i = 0; i < 3; i++) {
178  tempCoordinate[i] = tempCoordinate[i] + epsilon[i];
179  }
180  fRecoMatrix->SetTranslation(tempCoordinate);
181  PixelToTop(0, 0, past);
182  LOG(debug2) << "shifted pixel 0,0 to: " << past[0] << ", " << past[1]
183  << " at z = " << past[2];
184  LocalToTop(local, global);
185  LOG(debug2) << "shifted local center to: " << global[0] << ", " << global[1]
186  << " at z = " << global[2];
187  } else {
188  tempCoordinate = fRecoMatrix->GetTranslation();
189  }
190  if (!fAlignmentCorr) {
191  //If no knowledge on the reco matrix is available there is plausibly no correction data.
192  fAlignmentCorr = new TGeoHMatrix(nodeName + "_AlignmentData");
193  }
194 
195  for (Int_t i = 0; i < 3; i++) {
196  fSensorPosition[i] = tempCoordinate[i];
197  }
198 }
199 
200 //-------------------------------------------------------------------
201 
202 //-------------------------------------------------------------------
204 
206 
207 
208  if (!initialized) {
209  foutputDigis = new TClonesArray("CbmMvdDigi", 1000);
210  foutputDigiMatch = new TClonesArray("CbmMatch", 1000);
211  foutputBuffer = new TClonesArray("CbmMvdHit", 1000);
212  foutputCluster = new TClonesArray("CbmMvdCluster", 1); //not needed khun
213  }
214 
215  Int_t nPlugin = fPluginArray->GetEntriesFast();
216 
217 
218  TClonesArray* dataArray;
219 
220  CbmMvdSensorTask* gentask;
221  CbmMvdSensorBuffer* genBuffer;
222 
223  CbmMvdSensorPlugin *pluginFirst, *pluginNext;
224 
225  for (Int_t i = 0; i < nPlugin; i++) {
226  pluginFirst = (CbmMvdSensorPlugin*) fPluginArray->At(i);
227  if (pluginFirst->GetPluginType() == buffer) {
228  genBuffer = (CbmMvdSensorBuffer*) fPluginArray->At(i);
229  genBuffer->InitBuffer(this);
230  }
231  if (pluginFirst->GetPluginType() == task) {
232  gentask = (CbmMvdSensorTask*) fPluginArray->At(i);
233  gentask->InitTask(this);
234  }
235  }
236  //Link data chain
237  if (nPlugin > 1) {
238 
239  for (Int_t i = 0; i < nPlugin - 1; i++) {
240 
241  pluginFirst = (CbmMvdSensorPlugin*) fPluginArray->At(i);
242  pluginNext = (CbmMvdSensorPlugin*) fPluginArray->At(i + 1);
243 
244  //Rules: The output array of the previous plugin is input of the next
245  dataArray = pluginFirst->GetOutputArray();
246  pluginNext->SetInputArray(dataArray);
247 
248  //The plugin knows its precessor and sucessor to communicate
249  pluginFirst->SetNextPlugin(pluginNext);
250  pluginNext->SetPreviousPlugin(pluginFirst);
251  }
252  }
253 
254 
255  if (nPlugin == 0) {
256  LOG(debug) << "No Plugins on this Sensor ";
257  pluginFirst = NULL;
258  }
259  initialized = kTRUE;
260 }
261 // -------------------------------------------------------------------------
262 
263 // -------------------------------------------------------------------------
265  //if(fDetectorID == 1537)
266  {
267  CbmMvdSensorPlugin* pluginLast;
268  pluginLast = (CbmMvdSensorPlugin*) fPluginArray->At(
269  fPluginArray->GetEntriesFast() - 1);
270  cout << endl
271  << "Set debug mode on Plugin " << fPluginArray->GetEntriesFast() - 1
272  << " at sensor " << GetName() << endl;
273  pluginLast->ShowDebugHistos();
274  }
275 }
276 // -------------------------------------------------------------------------
277 
278 // -------------------------------------------------------------------------
280  CbmMvdSensorPlugin* pluginFirst;
281  // CbmMvdSensorFrameBuffer* framebuffer;
282  CbmMvdSensorDigitizerTask* digitask;
283 
284  pluginFirst = (CbmMvdSensorPlugin*) fPluginArray->At(0);
285  if (pluginFirst->GetPluginType() == buffer) {
286  return;
287  } else if (pluginFirst->GetPluginType() == task) {
288  TString digitizername = "CbmMvdSensorDigitizerTask";
289 
290  if (pluginFirst->ClassName() == digitizername) {
291  digitask = (CbmMvdSensorDigitizerTask*) fPluginArray->At(0);
292  digitask->SetProduceNoise();
293  }
294 
295  else {
296  LOG(fatal) << "Invalid input typ";
297  }
298 
299  } else {
300  cout << endl << "ERROR!! undefind plugin!" << endl;
301  }
302 }
303 // -------------------------------------------------------------------------
304 
305 // -------------------------------------------------------------------------
307 
308  CbmMvdSensorPlugin* pluginFirst;
309 
310  CbmMvdSensorTask* digitask;
311 
312  pluginFirst = (CbmMvdSensorPlugin*) fPluginArray->At(0);
313 
314  if (pluginFirst->GetPluginType() == task) {
315  TString digitizername = "CbmMvdSensorDigitizerTask";
316  TString digitizerTBname = "CbmMvdSensorDigitizerTBTask";
317 
318  if (pluginFirst->ClassName() == digitizername
319  || pluginFirst->ClassName() == digitizerTBname) {
320  digitask = (CbmMvdSensorTask*) fPluginArray->At(0);
321  digitask->SetInput(point);
322  }
323 
324  else {
325  LOG(fatal) << "Invalid input typ";
326  }
327 
328  } else {
329  cout << endl << "ERROR!! undefind plugin!" << endl;
330  }
331 }
332 // -------------------------------------------------------------------------
333 
334 
335 // -------------------------------------------------------------------------
336 void CbmMvdSensor::SendInputDigi(CbmMvdDigi* digi) //for old CF
337 {
338  if (fHitPlugin != -1) {
339  CbmMvdSensorClusterfinderTask* clustertask =
341  clustertask->SetInputDigi(digi);
342  } else {
343  cout << endl << "Somthing seems fishy here" << endl;
344  }
345 }
346 // -------------------------------------------------------------------------
347 
348 
349 // -------------------------------------------------------------------------
350 void CbmMvdSensor::SendInputDigiToHit(CbmMvdDigi* digi) //for DigiToHit
351 {
352  if (fHitPlugin != -1) {
353  CbmMvdSensorDigiToHitTask* digitohittask =
355  digitohittask->SetInputDigi(digi);
356  } else {
357  cout << endl << "Somthing seems fishy here" << endl;
358  }
359 }
360 // -------------------------------------------------------------------------
361 
362 
363 //not needed khun/*
364 // -------------------------------------------------------------------------
366  if (fHitPlugin != -1) {
367  CbmMvdSensorHitfinderTask* findertask =
369  findertask->SetInputCluster(cluster);
370  } else {
371  cout << endl << "Somthing seems fishy in SendInputCluster" << endl;
372  }
373 }
374 // -------------------------------------------------------------------------
375 //not needed khun */
376 
377 
378 // -------------------------------------------------------------------------
379 
381 
382  FairRunSim* run = FairRunSim::Instance();
383  FairRunAna* ana = FairRunAna::Instance();
384  if (run) {
385  FairEventHeader* event = run->GetEventHeader();
386  fcurrentEventTime = event->GetEventTime();
387  }
388  if (ana) {
389  FairEventHeader* event = ana->GetEventHeader();
390  fcurrentEventTime = event->GetEventTime();
391  }
392  foutputDigis->Clear("C");
393  foutputDigiMatch->Clear("C");
394  foutputCluster->Clear("C"); //not needed khun
395  foutputBuffer->Clear("C");
396 
397 
398  CbmMvdSensorPlugin* plugin;
399  Int_t nPlugin = fPluginArray->GetEntriesFast();
400 
401  plugin = (CbmMvdSensorPlugin*) fPluginArray->At(0);
402 
403  plugin->ExecChain();
404  //cout << endl << "is plugin ready? "<< plugin->PluginReady() << " on sensor "<< this->GetName() << endl;
405  if (plugin->PluginReady()) {
406  //cout << endl << "exec chain on sensor "<< this->GetName() << endl;
407  for (Int_t i = 1; i < nPlugin; i++) {
408  //cout << endl << "exec plugin " << i << " on sensor "<< this->GetName() << endl;
409  plugin = (CbmMvdSensorPlugin*) fPluginArray->At(i);
410  plugin->ExecChain();
411  }
412  }
413 }
414 // -------------------------------------------------------------------------
415 
416 void CbmMvdSensor::Exec(UInt_t nPlugin) {
417  foutputDigis->Clear("C");
418  foutputDigiMatch->Clear("C");
419  foutputCluster->Clear("C"); //not needed khun
420  foutputBuffer->Clear("C");
421  UInt_t nPluginMax = fPluginArray->GetEntriesFast();
422  if (nPlugin > nPluginMax) {
423  Fatal(GetName(), " Error - Called non-existing plugin");
424  }
425  CbmMvdSensorPlugin* plugin = (CbmMvdSensorPlugin*) fPluginArray->At(nPlugin);
426  plugin->Exec();
427 }
428 // -------------------------------------------------------------------------
429 void CbmMvdSensor::ExecTo(UInt_t nPlugin) {
430  FairRunSim* run = FairRunSim::Instance();
431  FairPrimaryGenerator* gen = run->GetPrimaryGenerator();
432  FairMCEventHeader* event = gen->GetEvent();
433 
434  foutputDigis->Delete();
435  foutputCluster->Delete(); //not needed khun
436  foutputDigiMatch->Clear("C");
437  foutputBuffer->Clear("C");
438 
439  fcurrentEventTime = event->GetT();
440 
441  CbmMvdSensorPlugin* plugin;
442  UInt_t maxPlugin = fPluginArray->GetEntriesFast();
443 
444  plugin = (CbmMvdSensorPlugin*) fPluginArray->At(0);
445  if (nPlugin < maxPlugin) {
446  plugin->ExecChain();
447  //cout << endl << "is plugin ready? "<< plugin->PluginReady() << " on sensor "<< this->GetName() << endl;
448  if (plugin->PluginReady()) {
449  //cout << endl << "exec chain on sensor "<< this->GetName() << endl;
450  for (UInt_t i = 1; i <= nPlugin; i++) {
451  //cout << endl << "exec plugin " << i << " on sensor "<< this->GetName() << endl;
452  plugin = (CbmMvdSensorPlugin*) fPluginArray->At(i);
453  plugin->ExecChain();
454  }
455  }
456  } else {
457  cout << endl << "nPlugin to large" << endl;
458  }
459 }
460 
461 
462 // -------------------------------------------------------------------------
463 void CbmMvdSensor::ExecFrom(UInt_t nPlugin) {
464  FairRunSim* run = FairRunSim::Instance();
465  FairPrimaryGenerator* gen = run->GetPrimaryGenerator();
466  FairMCEventHeader* event = gen->GetEvent();
467 
468  fcurrentEventTime = event->GetT();
469 
470  CbmMvdSensorPlugin* plugin;
471  UInt_t maxPlugin = fPluginArray->GetEntriesFast();
472 
473  plugin = (CbmMvdSensorPlugin*) fPluginArray->At(nPlugin);
474  if (nPlugin <= maxPlugin) {
475  plugin->ExecChain();
476  //cout << endl << "is plugin ready? "<< plugin->PluginReady() << " on sensor "<< this->GetName() << endl;
477  if (plugin->PluginReady()) {
478  //cout << endl << "exec chain on sensor "<< this->GetName() << endl;
479  for (UInt_t i = nPlugin + 1; i < maxPlugin; i++) {
480  //cout << endl << "exec plugin " << i << " on sensor "<< this->GetName() << endl;
481  plugin = (CbmMvdSensorPlugin*) fPluginArray->At(i);
482  plugin->ExecChain();
483  }
484  }
485  } else {
486  cout << endl << "nPlugin to large" << endl;
487  }
488 }
489 
490 // -------------------------------------------------------------------------
491 TClonesArray* CbmMvdSensor::GetOutputArray(Int_t nPlugin) const {
492 
493  if (nPlugin == fHitPlugin)
494  GetOutputBuffer();
495  else if (nPlugin == fDigiPlugin) {
496  CbmMvdSensorDigitizerTask* digiplugin =
497  (CbmMvdSensorDigitizerTask*) fPluginArray->At(nPlugin);
498  Int_t ArrayLength = digiplugin->GetOutputArray()->GetEntriesFast() - 1;
499  if (ArrayLength >= 0) {
500  foutputDigis->AbsorbObjects(digiplugin->GetOutputArray());
501  foutputDigiMatch->AbsorbObjects(digiplugin->GetMatchArray());
502  //cout << endl << "got digis " << foutputDigis->GetEntriesFast() << " and matches " << foutputDigiMatch->GetEntriesFast() << endl;
503  }
504  return (foutputDigis);
505  } else if (nPlugin == fClusterPlugin) //khun not needed
506  {
507  CbmMvdSensorClusterfinderTask* clusterplugin =
509  Int_t ArrayLength = clusterplugin->GetOutputArray()->GetEntriesFast() - 1;
510  if (ArrayLength >= 0)
511  foutputCluster->AbsorbObjects(
512  clusterplugin->GetOutputArray(), 0, ArrayLength);
513  return (foutputCluster);
514  } else {
515  LOG(fatal) << "undefined plugin: " << nPlugin << " called";
516  }
517  return NULL;
518 }
519 // -------------------------------------------------------------------------
520 
521 // -------------------------------------------------------------------------
522 Int_t CbmMvdSensor::GetOutputArrayLen(Int_t nPlugin) const {
523 
524  GetOutputArray(nPlugin); // make sure that the arrays are filled
525 
526  if (nPlugin == fDigiPlugin) {
527  return (foutputDigis->GetEntriesFast() - 1);
528  }
529  //not needed khun
530  else if (nPlugin == fClusterPlugin) // && (noCluster==kFALSE))
531  {
532  return (foutputCluster->GetEntriesFast() - 1);
533  } else if (nPlugin == fHitPlugin) {
534  return (foutputBuffer->GetEntriesFast() - 1);
535  }
536 
537  else {
538  LOG(fatal) << "undefined plugin called";
539  return -1;
540  }
541 }
542 // -------------------------------------------------------------------------
543 
544 // -------------------------------------------------------------------------
545 TClonesArray* CbmMvdSensor::GetOutputMatch() const {
546 
547  return (foutputDigiMatch);
548 }
549 // -------------------------------------------------------------------------
550 
551 
552 // -------------------------------------------------------------------------
553 TClonesArray* CbmMvdSensor::GetOutputBuffer() const {
554 
555 
556  CbmMvdSensorPlugin* plugin =
557  (CbmMvdSensorPlugin*) fPluginArray->At(fPluginArray->GetLast());
558  foutputBuffer->AbsorbObjects(plugin->GetOutputArray());
559  return (foutputBuffer);
560 }
561 // -------------------------------------------------------------------------
562 
563 
564 // ----- Coordinate Transformations --------------------------------
565 
566 void CbmMvdSensor::LocalToTop(Double_t* local, Double_t* lab) {
567  fMCMatrix->LocalToMaster(local, lab);
568 };
569 // -------------------------------------------------------------------------
570 
571 
572 // -------------------------------------------------------------------------
573 void CbmMvdSensor::TopToLocal(Double_t* lab, Double_t* local) {
574  fMCMatrix->MasterToLocal(lab, local);
575  //cout << endl << "local 0 nach TopToLocal " << local[0] << endl;
576  //cout << endl << "local 1 nach TopToLocal " << local[1] << endl;
577 };
578 // -------------------------------------------------------------------------
579 
580 
581 // -------------------------------------------------------------------------
582 void CbmMvdSensor::LocalToPixel(Double_t* local,
583  Int_t& pixelNumberX,
584  Int_t& pixelNumberY) {
585 
586  //Compute position of the frame relativ to the border of the matrix
587  //which contains the pixel (0/0)
588  Double_t x = local[0] + (fSensorData->GetPixelSignX() * GetDX());
589  //cout << "From " << local[0] << " to Double_t x " << x << endl;
590  Double_t y = local[1] + (fSensorData->GetPixelSignY() * GetDY());
591  //cout << "From " << local[1] << " to Double_t y " << y << endl;
592  //Compute the number of the pixel hit.
593  //Note: substract 0.5 to move from border to center of pixel
594  pixelNumberX = Int_t(x / fSensorData->GetPixelPitchX() - 0.5);
595  //if (pixelNumberX < 0) cout << "pixelNumberX = " << pixelNumberX << " on Sensor " << this->GetName() << endl;
596  pixelNumberY = Int_t(y / fSensorData->GetPixelPitchY() - 0.5);
597  //if (pixelNumberY < 0) cout << "pixelNumberY = " << pixelNumberY << " on Sensor " << this->GetName() << endl;
598 };
599 // -------------------------------------------------------------------------
600 
601 
602 // -------------------------------------------------------------------------
603 void CbmMvdSensor::PixelToLocal(Int_t pixelNumberX,
604  Int_t pixelNumberY,
605  Double_t* local) {
606 
607  //Compute distance from border of the pixel matrix
608  //Ignore the direction of pixel numbering so far
609  //By definiton (x,y) is in the center of the pixel
610 
611  Double_t x = (pixelNumberX + 0.5) * fSensorData->GetPixelPitchX();
612  Double_t y = (pixelNumberY + 0.5) * fSensorData->GetPixelPitchY();
613 
614  //Perform coordinate transformation from border of matrix to center of volume
615  local[0] = x - fSensorData->GetPixelSignX() * GetDX();
616  local[1] = y - fSensorData->GetPixelSignY() * GetDY();
617 
618  local[2] = 0; //per definition always at the sensor surface;
619 };
620 // -------------------------------------------------------------------------
621 
622 
623 // -------------------------------------------------------------------------
624 void CbmMvdSensor::PixelToTop(Int_t pixelNumberX,
625  Int_t pixelNumberY,
626  Double_t* lab) {
627  PixelToLocal(pixelNumberX, pixelNumberY, fTempCoordinate);
629 };
630 // -------------------------------------------------------------------------
631 
632 
634  Int_t& pixelNumberX,
635  Int_t& pixelNumberY) {
637  LocalToPixel(fTempCoordinate, pixelNumberX, pixelNumberY);
638 };
639 // -------------------------------------------------------------------------
640 
641 
642 // -------------------------------------------------------------------------
643 Int_t CbmMvdSensor::GetFrameNumber(Int_t pixelNumberY,
644  Double_t absoluteTime) const {
645 
646 
647  Double_t timeSinceStart = absoluteTime - fSensorStartTime;
648 
649  Double_t timeInUnitsOfFrames =
650  timeSinceStart / fSensorData->GetIntegrationTime();
651 
652  // Get time substracting the full frames (140.3 -> 0.3)
653  Double_t timeSinceStartOfTheFrame =
654  timeInUnitsOfFrames - (Int_t) timeInUnitsOfFrames;
655 
656  Int_t rowUnderReadout =
657  Int_t(fSensorData->GetNPixelsY() * timeSinceStartOfTheFrame);
658 
659 
660  return (Int_t)(timeInUnitsOfFrames + (pixelNumberY < rowUnderReadout));
661  //
662  /* This statement is equivalent to:
663  if (pixelNumberY<rowUnderReadout) {return timeInUnitsOfFrames;}
664  else {return timeInUnitsOfFrames+1;}
665  */
666 }
667 // -------------------------------------------------------------------------
668 
669 // -------------------------------------------------------------------------
670 Double_t CbmMvdSensor::GetReadoutTime(Double_t absoluteTime) const {
671 
672 
673  Double_t timeSinceStart = absoluteTime - fSensorStartTime;
674 
675  Double_t timeInUnitsOfFrames =
676  timeSinceStart / fSensorData->GetIntegrationTime();
677 
678  Int_t nextFrame = (Int_t)(timeInUnitsOfFrames + 1);
679 
680  Double_t roTime = nextFrame * fSensorData->GetIntegrationTime();
681 
682  return roTime;
683 }
684 // -------------------------------------------------------------------------
685 
686 
687 // ----- Public method Print -------------------------------------------
688 void CbmMvdSensor::Print(Option_t* /*opt*/) const {
689  cout << " --- " << GetName() << ", sensor name" << fVolName << endl;
690  cout << " MC - ID: " << fVolumeId << endl;
691  cout << "---------------------------------------------------------" << endl;
692  cout << " Position information: " << endl;
693  fRecoMatrix->Print();
694  cout << " --------------------------------------------------------" << endl;
695  cout << " Technical information: " << endl;
696  fSensorData->Print("");
697  cout << " , MC Id " << fVolumeId << endl;
698  cout << "---------------------------------------------------------" << endl;
699 }
700 // -------------------------------------------------------------------------
701 
702 //-----------------------------------------------------------------------
704  CbmMvdSensorPlugin* plugin;
705  Int_t nPlugin = fPluginArray->GetEntriesFast();
706  for (Int_t i = 0; i < nPlugin; i++) {
707  plugin = (CbmMvdSensorPlugin*) fPluginArray->At(i);
708  plugin->Finish();
709  }
710 }
711 // -------------------------------------------------------------------------
712 
713 
CbmMvdSensorPlugin::Finish
virtual void Finish()
Definition: CbmMvdSensorPlugin.h:38
CbmMvdSensorDataSheet::GetIntegrationTime
virtual Double_t GetIntegrationTime()
Definition: CbmMvdSensorDataSheet.h:89
CbmMvdSensor::fRecoMatrix
TGeoHMatrix * fRecoMatrix
Definition: CbmMvdSensor.h:187
CbmMvdSensorPlugin::GetOutputArray
virtual TClonesArray * GetOutputArray()
Definition: CbmMvdSensorPlugin.h:41
CbmMvdSensorTask::SetInput
virtual void SetInput(CbmMvdPoint *)
Definition: CbmMvdSensorTask.h:40
CbmMvdSensor::fNodeName
TString fNodeName
Definition: CbmMvdSensor.h:173
CbmMvdSensor::GetOutputArray
TClonesArray * GetOutputArray(Int_t nPlugin) const
Definition: CbmMvdSensor.cxx:491
CbmMvdSensor::Exec
void Exec(UInt_t nPlugin)
Definition: CbmMvdSensor.cxx:416
CbmMvdSensor::SendInputCluster
void SendInputCluster(CbmMvdCluster *cluster)
Definition: CbmMvdSensor.cxx:365
CbmMvdSensor::fPluginArray
TObjArray * fPluginArray
Definition: CbmMvdSensor.h:199
CbmMvdSensorHitfinderTask.h
CbmMvdSensorDataSheet::GetPixelPitchY
virtual Double_t GetPixelPitchY()
Definition: CbmMvdSensorDataSheet.h:82
CbmMvdSensorPlugin::ShowDebugHistos
void ShowDebugHistos()
Definition: CbmMvdSensorPlugin.h:61
CbmMvdSensorClusterfinderTask.h
CbmMvdSensor::GetDY
Double_t GetDY() const
Definition: CbmMvdSensor.h:67
CbmMvdSensor::GetReadoutTime
Double_t GetReadoutTime(Double_t absoluteTime) const
Definition: CbmMvdSensor.cxx:670
CbmMvdSensor::TopToLocal
void TopToLocal(Double_t *lab, Double_t *local)
Definition: CbmMvdSensor.cxx:573
CbmMvdSensorPlugin
Definition: CbmMvdSensorPlugin.h:24
CbmMvdSensorFindHitTask.h
CbmMvdSensor::ExecFrom
void ExecFrom(UInt_t nPlugin)
Definition: CbmMvdSensor.cxx:463
CbmMvdSensor::PixelToLocal
void PixelToLocal(Int_t pixelNumberX, Int_t pixelNumberY, Double_t *local)
Definition: CbmMvdSensor.cxx:603
CbmMvdSensor::fTempCoordinate
Double_t fTempCoordinate[3]
Definition: CbmMvdSensor.h:191
CbmMvdSensor::Finish
void Finish()
Definition: CbmMvdSensor.cxx:703
CbmMvdSensorPlugin::ExecChain
virtual void ExecChain()
Definition: CbmMvdSensorPlugin.h:37
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmMvdSensor.h
CbmMvdSensor::fShape
TGeoBBox * fShape
Definition: CbmMvdSensor.h:184
CbmMvdSensorPlugin::GetPluginType
virtual MvdSensorPluginType GetPluginType()=0
CbmMvdSensorPlugin::SetPreviousPlugin
virtual void SetPreviousPlugin(CbmMvdSensorPlugin *plugin)
Definition: CbmMvdSensorPlugin.h:52
CbmMvdSensor::Print
virtual void Print(Option_t *opt="") const
Definition: CbmMvdSensor.cxx:688
CbmMvdSensor::Init
void Init()
Definition: CbmMvdSensor.cxx:203
CbmMvdSensor::fcurrentEventTime
Double_t fcurrentEventTime
Definition: CbmMvdSensor.h:179
CbmMvdSensorClusterfinderTask
Definition: CbmMvdSensorClusterfinderTask.h:38
CbmMvdSensor::LocalToTop
void LocalToTop(Double_t *local, Double_t *lab)
Definition: CbmMvdSensor.cxx:566
CbmMvdCluster
Definition: CbmMvdCluster.h:27
CbmMvdSensorDataSheet::Print
virtual void Print(Option_t *opt="") const
Definition: CbmMvdSensorDataSheet.cxx:55
CbmMvdSensorDigitizerTask
Definition: CbmMvdSensorDigitizerTask.h:47
CbmMvdSensor::fDigiPlugin
Int_t fDigiPlugin
Definition: CbmMvdSensor.h:168
lab
Double_t lab[3]
Definition: CbmMvdSensorDigiToHitTask.cxx:62
CbmMvdSensorDataSheet::GetNPixelsX
virtual Int_t GetNPixelsX()
Definition: CbmMvdSensorDataSheet.h:83
CbmMvdSensor::fSensorPosition
Double_t fSensorPosition[3]
Definition: CbmMvdSensor.h:192
CbmMvdSensorTask::InitTask
virtual void InitTask(CbmMvdSensor *mySensor)
Definition: CbmMvdSensorTask.h:47
CbmMvdSensor::epsilon
Float_t epsilon[3]
Definition: CbmMvdSensor.h:180
CbmMvdSensor::ExecChain
void ExecChain()
Definition: CbmMvdSensor.cxx:380
CbmMvdSensor::LocalToPixel
void LocalToPixel(Double_t *local, Int_t &pixelNumberX, Int_t &pixelNumberY)
Definition: CbmMvdSensor.cxx:582
CbmMvdSensorTask
Definition: CbmMvdSensorTask.h:26
CbmMvdSensor::ReadSensorGeometry
void ReadSensorGeometry(TString nodeName)
Definition: CbmMvdSensor.cxx:142
CbmMvdSensorFrameBuffer.h
CbmMvdSensorDigitizerTask.h
CbmMvdSensor
Definition: CbmMvdSensor.h:40
CbmMvdPoint
Definition: CbmMvdPoint.h:28
CbmMvdSensorClusterfinderTask::SetInputDigi
virtual void SetInputDigi(CbmMvdDigi *digi)
Definition: CbmMvdSensorClusterfinderTask.h:63
CbmMvdSensor::SendInput
void SendInput(CbmMvdPoint *point)
Definition: CbmMvdSensor.cxx:306
CbmMvdSensor::GetOutputMatch
TClonesArray * GetOutputMatch() const
Definition: CbmMvdSensor.cxx:545
CbmMvdSensor::fMCMatrix
TGeoHMatrix * fMCMatrix
Definition: CbmMvdSensor.h:186
CbmMvdSensor::GetOutputArrayLen
Int_t GetOutputArrayLen(Int_t nPlugin) const
Definition: CbmMvdSensor.cxx:522
buffer
@ buffer
Definition: CbmMvdSensorPlugin.h:22
CbmMvdSensor::SendInputDigiToHit
void SendInputDigiToHit(CbmMvdDigi *digi)
Definition: CbmMvdSensor.cxx:350
CbmMvdSensorBuffer::InitBuffer
virtual void InitBuffer(CbmMvdSensor *mySensor)
Definition: CbmMvdSensorBuffer.h:54
CbmMvdSensorDigitizerTask::SetProduceNoise
void SetProduceNoise()
Definition: CbmMvdSensorDigitizerTask.h:77
CbmMvdSensorHitfinderTask
Definition: CbmMvdSensorHitfinderTask.h:40
CbmMvdSensor::foutputDigis
TClonesArray * foutputDigis
Definition: CbmMvdSensor.h:174
CbmMvdSensorDataSheet::GetPixelPitchX
virtual Double_t GetPixelPitchX()
Definition: CbmMvdSensorDataSheet.h:81
task
@ task
Definition: CbmMvdSensorPlugin.h:22
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMvdSensor::ExecTo
void ExecTo(UInt_t nPlugin)
Definition: CbmMvdSensor.cxx:429
CbmMvdSensor::PixelToTop
void PixelToTop(Int_t pixelNumberX, Int_t pixelNumberY, Double_t *lab)
Definition: CbmMvdSensor.cxx:624
first
bool first
Definition: LKFMinuit.cxx:143
CbmMvdSensorDataSheet::GetPixelSignX
virtual Int_t GetPixelSignX()
Definition: CbmMvdSensorDataSheet.h:86
CbmMvdSensor::fHitPlugin
Int_t fHitPlugin
Definition: CbmMvdSensor.h:169
CbmMvdSensorDigiToHitTask
Definition: CbmMvdSensorDigiToHitTask.h:40
CbmMvdSensorPlugin::SetNextPlugin
virtual void SetNextPlugin(CbmMvdSensorPlugin *plugin)
Definition: CbmMvdSensorPlugin.h:49
CbmMvdSensor::foutputBuffer
TClonesArray * foutputBuffer
Definition: CbmMvdSensor.h:177
CbmMvdSensor::SendInputDigi
void SendInputDigi(CbmMvdDigi *digi)
Definition: CbmMvdSensor.cxx:336
CbmMvdSensorDigitizerTask::GetMatchArray
TClonesArray * GetMatchArray()
Definition: CbmMvdSensorDigitizerTask.h:69
CbmMvdSensor::GetOutputBuffer
TClonesArray * GetOutputBuffer() const
Definition: CbmMvdSensor.cxx:553
CbmMvdSensor::fVolumeId
Int_t fVolumeId
Definition: CbmMvdSensor.h:166
CbmMvdSensor::fSensorStartTime
Double_t fSensorStartTime
Definition: CbmMvdSensor.h:203
CbmMvdSensor::initialized
Bool_t initialized
Definition: CbmMvdSensor.h:207
CbmMvdSensor::SetAlignment
void SetAlignment(TGeoHMatrix *alignmentMatrix)
Definition: CbmMvdSensor.cxx:133
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmMvdSensor::CbmMvdSensor
CbmMvdSensor()
Definition: CbmMvdSensor.cxx:42
CbmMvdSensorDataSheet::GetPixelSignY
virtual Int_t GetPixelSignY()
Definition: CbmMvdSensorDataSheet.h:87
CbmMvdSensor::~CbmMvdSensor
virtual ~CbmMvdSensor()
Definition: CbmMvdSensor.cxx:130
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmMvdDigi
Definition: CbmMvdDigi.h:21
CbmMvdSensorPlugin::PluginReady
bool PluginReady()
Definition: CbmMvdSensorPlugin.h:59
CbmMvdSensor::foutputCluster
TClonesArray * foutputCluster
Definition: CbmMvdSensor.h:175
CbmMvdSensorPlugin::Exec
virtual void Exec()
Definition: CbmMvdSensorPlugin.h:36
CbmMvdSensor::GetDX
Double_t GetDX() const
Definition: CbmMvdSensor.h:66
CbmMvdSensorDigitizerTask::GetOutputArray
TClonesArray * GetOutputArray()
Definition: CbmMvdSensorDigitizerTask.h:68
CbmMvdSensorHitfinderTask::SetInputCluster
void SetInputCluster(CbmMvdCluster *cluster)
Definition: CbmMvdSensorHitfinderTask.h:65
CbmMvdSensor::GetFrameNumber
Int_t GetFrameNumber(Int_t pixelNumberY, Double_t absoluteTime) const
Definition: CbmMvdSensor.cxx:643
CbmMvdSensorDataSheet::GetNPixelsY
virtual Int_t GetNPixelsY()
Definition: CbmMvdSensorDataSheet.h:84
CbmMvdSensor::fClusterPlugin
Int_t fClusterPlugin
Definition: CbmMvdSensor.h:171
CbmMvdSensor::TopToPixel
void TopToPixel(Double_t *lab, Int_t &pixelNumberX, Int_t &pixelNumberY)
Definition: CbmMvdSensor.cxx:633
CbmMvdSensor::foutputDigiMatch
TClonesArray * foutputDigiMatch
Definition: CbmMvdSensor.h:176
CbmMvdSensor::SetProduceNoise
void SetProduceNoise()
Definition: CbmMvdSensor.cxx:279
CbmMvdSensorTrackingBuffer.h
CbmMvdSensor::fSensorData
CbmMvdSensorDataSheet * fSensorData
Definition: CbmMvdSensor.h:195
CbmMvdSensor::fAlignmentCorr
TGeoHMatrix * fAlignmentCorr
Definition: CbmMvdSensor.h:189
CbmMvdSensorPlugin::SetInputArray
virtual void SetInputArray(TClonesArray *)
Definition: CbmMvdSensorPlugin.h:45
CbmMvdSensor::fVolName
TString fVolName
Definition: CbmMvdSensor.h:172
CbmMvdSensorDigiToHitTask::SetInputDigi
virtual void SetInputDigi(CbmMvdDigi *digi)
Definition: CbmMvdSensorDigiToHitTask.h:64
CbmMvdSensorDataSheet
Definition: CbmMvdSensorDataSheet.h:22
CbmMvdSensorTask::GetOutputArray
virtual TClonesArray * GetOutputArray()
Definition: CbmMvdSensorTask.h:45
CbmMvdSensorDigiToHitTask.h
CbmMvdSensorDigitizerTBTask.h
CbmMvdSensor::ShowDebugHistos
void ShowDebugHistos()
Definition: CbmMvdSensor.cxx:264
CbmMvdSensorBuffer
Definition: CbmMvdSensorBuffer.h:28