CbmRoot
Loading...
Searching...
No Matches
CbmMvdSensorTrackingBuffer.cxx
Go to the documentation of this file.
1/* Copyright (C) 2012-2015 Institut fuer Kernphysik, Goethe-Universitaet Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Philipp Sitzmann [committer] */
4
5// -------------------------------------------------------------------------
6// ----- CbmMvdSensorTrackingBuffer source file -----
7// ----- Created 14/02/12 by P.Sitzmann -----
8// -------------------------------------------------------------------------
10
11#include <Logger.h>
12
13// ----- Default constructor -------------------------------------------
16 , ftimeStart(-1)
17 , ftimeStop(-1)
18 , ftimestep(-1) {};
19// -------------------------------------------------------------------------
20
21// ----- Destructor ----------------------------------------------------
28// -------------------------------------------------------------------------
29
30// ----- Init ----------------------------------------------------
32{
33
34 fBuffer = new TClonesArray("CbmMvdHit", 1000);
35 fCurrentEvent = new TClonesArray("CbmMvdHit", 1000);
36 fSensor = mySensor;
37 ftimeStart = 0;
38 ftimeStop = 5000;
39 ftimestep = 5000;
40 bFlag = false;
41};
42// -------------------------------------------------------------------------
43
44// ----- Exec ----------------------------------------------------
46{
47
48 SetInputArray(fPreviousPlugin->GetOutputArray()); // auto datatransport from Plugin to Plugin
50 false); // Flag Plugin as working. as long as now timeslice is available Plugin is still on working state
51 Int_t lastEntrie = fBuffer->GetLast();
52 CbmMvdHit* myHit;
53 Int_t time;
54 // LOG(debug)<< "exec output buffer";
55 if (lastEntrie > -1) {
56 myHit = (CbmMvdHit*) fBuffer->At(lastEntrie);
57 time = myHit->GetTimeStamp();
58
59 if (time > (ftimeStop + ftimestep)) // computing full timeslice
60 {
65 if (fCurrentEvent->GetEntriesFast() > 0) {
66 SetPluginReady(true);
67
68 LOG(info) << "OutputBuffer is ready for readout on sensor " << fSensor->GetName();
69 //fCurrentEvent->Print();
70 }
71 }
72 }
73};
74// -------------------------------------------------------------------------
75
76//--------------------------------------------------------------------------
77void CbmMvdSensorTrackingBuffer::BuildTimeSlice(Double_t tStart, Double_t tStop)
78{
79 Int_t nEntries = fBuffer->GetEntriesFast();
80 CbmMvdHit* myHit;
81 Int_t time;
82 Int_t nHits;
83
84 for (Int_t i = 0; i < nEntries; i++) {
85 myHit = (CbmMvdHit*) fBuffer->At(i);
86 time = myHit->GetTimeStamp();
87 if (tStart <= time && time <= (tStop + fSensor->GetIntegrationtime())) // building full timeslice
88 {
89 nHits = fCurrentEvent->GetEntriesFast();
90 new ((*fCurrentEvent)[nHits]) CbmMvdHit(*myHit);
91 //LOG(debug) << "new Hits in Output";
92 }
93 }
94 ClearTimeSlice(tStart, tStop);
95};
96//--------------------------------------------------------------------------
97
98//--------------------------------------------------------------------------
99void CbmMvdSensorTrackingBuffer::ClearTimeSlice(Double_t tStart, Double_t tStop)
100{
101
102 Int_t nEntries = fBuffer->GetEntriesFast();
103 CbmMvdHit* myHit;
104 Int_t time;
105 Int_t nHits;
106
107
108 for (Int_t i = 0; i < nEntries; i++) {
109 myHit = (CbmMvdHit*) fBuffer->At(i);
110 time = myHit->GetTimeStamp();
111 if (tStart <= time && time < tStop) { fBuffer->Remove(myHit); }
112 };
113};
114//--------------------------------------------------------------------------
115
116
117//--------------------------------------------------------------------------
118void CbmMvdSensorTrackingBuffer::SetInputArray(TClonesArray* inputStream)
119{
120
121 fBuffer->AbsorbObjects(inputStream);
122 fBuffer->Compress();
123 //LOG(debug) << "new Objects in Output buffer";
124};
125//--------------------------------------------------------------------------
126
127
ClassImp(CbmConverterManager)
TClonesArray * fCurrentEvent
virtual TClonesArray * GetOutputArray()
CbmMvdSensorPlugin * fPreviousPlugin
void SetPluginReady(bool flag)
virtual void BuildTimeSlice(Double_t tStart, Double_t tStop)
virtual void SetInputArray(TClonesArray *inputStream)
virtual void ClearTimeSlice(Double_t tStart, Double_t tStop)
virtual void InitBuffer(CbmMvdSensor *mySensor)
Double_t GetIntegrationtime() const