CbmRoot
CbmMvdSensorTrackingBuffer.cxx
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- CbmMvdSensorTrackingBuffer source file -----
3 // ----- Created 14/02/12 by P.Sitzmann -----
4 // -------------------------------------------------------------------------
6 
7 
8 // ----- Default constructor -------------------------------------------
10  : CbmMvdSensorBuffer(), ftimeStart(-1), ftimeStop(-1), ftimestep(-1) {};
11 // -------------------------------------------------------------------------
12 
13 // ----- Destructor ----------------------------------------------------
15 
16  fBuffer->Delete();
17  delete fBuffer;
18 };
19 // -------------------------------------------------------------------------
20 
21 // ----- Init ----------------------------------------------------
23 
24  fBuffer = new TClonesArray("CbmMvdHit", 1000);
25  fCurrentEvent = new TClonesArray("CbmMvdHit", 1000);
26  fSensor = mySensor;
27  ftimeStart = 0;
28  ftimeStop = 5000;
29  ftimestep = 5000;
30  bFlag = false;
31 };
32 // -------------------------------------------------------------------------
33 
34 // ----- Exec ----------------------------------------------------
36 
39  ->GetOutputArray()); // auto datatransport from Plugin to Plugin
41  false); // Flag Plugin as working. as long as now timeslice is available Plugin is still on working state
42  Int_t lastEntrie = fBuffer->GetLast();
43  CbmMvdHit* myHit;
44  Int_t time;
45  // cout << endl << "exec output buffer" << endl;
46  if (lastEntrie > -1) {
47  myHit = (CbmMvdHit*) fBuffer->At(lastEntrie);
48  time = myHit->GetTimeStamp();
49 
50  if (time > (ftimeStop + ftimestep)) // computing full timeslice
51  {
56  if (fCurrentEvent->GetEntriesFast() > 0) {
57  SetPluginReady(true);
58 
59  cout << endl
60  << "OutputBuffer is ready for readout on sensor "
61  << fSensor->GetName() << endl;
62  //fCurrentEvent->Print();
63  }
64  }
65  }
66 };
67 // -------------------------------------------------------------------------
68 
69 //--------------------------------------------------------------------------
71  Double_t tStop) {
72  Int_t nEntries = fBuffer->GetEntriesFast();
73  CbmMvdHit* myHit;
74  Int_t time;
75  Int_t nHits;
76 
77  for (Int_t i = 0; i < nEntries; i++) {
78  myHit = (CbmMvdHit*) fBuffer->At(i);
79  time = myHit->GetTimeStamp();
80  if (tStart <= time
81  && time
82  <= (tStop
83  + fSensor->GetIntegrationtime())) // building full timeslice
84  {
85  nHits = fCurrentEvent->GetEntriesFast();
86  new ((*fCurrentEvent)[nHits]) CbmMvdHit(*myHit);
87  //cout << endl << "new Hits in Output" << endl;
88  }
89  }
90  ClearTimeSlice(tStart, tStop);
91 };
92 //--------------------------------------------------------------------------
93 
94 //--------------------------------------------------------------------------
96  Double_t tStop) {
97 
98  Int_t nEntries = fBuffer->GetEntriesFast();
99  CbmMvdHit* myHit;
100  Int_t time;
101  Int_t nHits;
102 
103 
104  for (Int_t i = 0; i < nEntries; i++) {
105  myHit = (CbmMvdHit*) fBuffer->At(i);
106  time = myHit->GetTimeStamp();
107  if (tStart <= time && time < tStop) { fBuffer->Remove(myHit); }
108  };
109 };
110 //--------------------------------------------------------------------------
111 
112 
113 //--------------------------------------------------------------------------
114 void CbmMvdSensorTrackingBuffer::SetInputArray(TClonesArray* inputStream) {
115 
116  fBuffer->AbsorbObjects(inputStream);
117  fBuffer->Compress();
118  //cout << endl << "new Objects in Output buffer" << endl;
119 };
120 //--------------------------------------------------------------------------
121 
122 
CbmMvdSensorTrackingBuffer::ftimeStop
Int_t ftimeStop
Definition: CbmMvdSensorTrackingBuffer.h:62
CbmMvdSensorTrackingBuffer
Definition: CbmMvdSensorTrackingBuffer.h:25
CbmMvdSensorBuffer::fCurrentEvent
TClonesArray * fCurrentEvent
Definition: CbmMvdSensorBuffer.h:82
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
CbmMvdSensorPlugin::fPreviousPlugin
CbmMvdSensorPlugin * fPreviousPlugin
Definition: CbmMvdSensorPlugin.h:67
CbmMvdSensor::GetIntegrationtime
Double_t GetIntegrationtime() const
Definition: CbmMvdSensor.h:76
CbmMvdSensorTrackingBuffer::GetOutputArray
virtual TClonesArray * GetOutputArray()
Definition: CbmMvdSensorTrackingBuffer.h:42
CbmMvdHit
Definition: CbmMvdHit.h:29
CbmMvdSensorTrackingBuffer::ftimestep
Int_t ftimestep
Definition: CbmMvdSensorTrackingBuffer.h:63
CbmMvdSensorTrackingBuffer::InitBuffer
virtual void InitBuffer(CbmMvdSensor *mySensor)
Definition: CbmMvdSensorTrackingBuffer.cxx:22
CbmMvdSensor
Definition: CbmMvdSensor.h:40
CbmMvdSensorBuffer::fBuffer
TClonesArray * fBuffer
Definition: CbmMvdSensorBuffer.h:78
CbmMvdSensorTrackingBuffer::ftimeStart
Int_t ftimeStart
Definition: CbmMvdSensorTrackingBuffer.h:61
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition: CbmConverterManager.cxx:12
CbmMvdSensorPlugin::bFlag
bool bFlag
Definition: CbmMvdSensorPlugin.h:70
CbmMvdSensorBuffer::fSensor
CbmMvdSensor * fSensor
Definition: CbmMvdSensorBuffer.h:83
CbmMvdSensorTrackingBuffer::~CbmMvdSensorTrackingBuffer
virtual ~CbmMvdSensorTrackingBuffer()
Definition: CbmMvdSensorTrackingBuffer.cxx:14
CbmMvdSensorTrackingBuffer::ExecChain
virtual void ExecChain()
Definition: CbmMvdSensorTrackingBuffer.cxx:35
CbmMvdSensorTrackingBuffer::SetInputArray
virtual void SetInputArray(TClonesArray *inputStream)
Definition: CbmMvdSensorTrackingBuffer.cxx:114
CbmMvdSensorPlugin::SetPluginReady
void SetPluginReady(bool flag)
Definition: CbmMvdSensorPlugin.h:60
CbmMvdSensorTrackingBuffer::BuildTimeSlice
virtual void BuildTimeSlice(Double_t tStart, Double_t tStop)
Definition: CbmMvdSensorTrackingBuffer.cxx:70
CbmMvdSensorTrackingBuffer::CbmMvdSensorTrackingBuffer
CbmMvdSensorTrackingBuffer()
Definition: CbmMvdSensorTrackingBuffer.cxx:9
CbmMvdSensorTrackingBuffer.h
CbmMvdSensorTrackingBuffer::ClearTimeSlice
virtual void ClearTimeSlice(Double_t tStart, Double_t tStop)
Definition: CbmMvdSensorTrackingBuffer.cxx:95
CbmMvdSensorBuffer
Definition: CbmMvdSensorBuffer.h:28