diff --git a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx index 174e629f8c92a5823c153270abda2127955b3ab4..c15bdce573cc992c56390d5cd53b2efa17658014 100644 --- a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx +++ b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx @@ -418,6 +418,9 @@ void CbmMvdSensorDigitizerTask::Exec() fDigiMatch->Clear("C"); + //Int_t nDigis = 0; + GetEventInfo(fInputNr, fEventNr, fEventTime); + if (fInputPoints->GetEntriesFast() > 0) { for (Int_t iPoint = 0; iPoint < fInputPoints->GetEntriesFast(); iPoint++) { @@ -448,8 +451,6 @@ void CbmMvdSensorDigitizerTask::Exec() ProducePixelCharge(point); } //loop on MCpoints - //Int_t nDigis = 0; - GetEventInfo(fInputNr, fEventNr, fEventTime); ProduceDigis(); CleanPixelChargeList(); @@ -553,12 +554,12 @@ void CbmMvdSensorDigitizerTask::FlushBuffer(CbmMvdPixelCharge* pixel, Int_t i) new ((*fDigis)[nDigis]) CbmMvdDigi(fSensor->GetSensorNr(), pixel->GetX(), pixel->GetY(), diodeCharge, fPixelSizeX, fPixelSizeY, - fEventTime + analogHitTime, fSensor->GetFrameNumber(fEventTime + analogHitTime, pixel->GetY())); + analogHitTime, fSensor->GetFrameNumber(analogHitTime, pixel->GetY())); new ((*fOutputBuffer)[nDigis]) CbmMvdDigi(fSensor->GetSensorNr(), pixel->GetX(), pixel->GetY(), diodeCharge, fPixelSizeX, fPixelSizeY, - fEventTime + analogHitTime, fSensor->GetFrameNumber(fEventTime + analogHitTime, pixel->GetY())); + analogHitTime, fSensor->GetFrameNumber(analogHitTime, pixel->GetY())); // To Do: Time and pixel charge are now in an array. Write function testing if the pixel is busy at a given time. // Write function which computes the status of the pixel at the time of readout and which cell one has to readout. @@ -1303,17 +1304,18 @@ void CbmMvdSensorDigitizerTask::ReInit(CbmMvdSensor* sensor) void CbmMvdSensorDigitizerTask::Finish() { - // In time base mode flush the buffers after the last event - if (!fEventMode) { + // Convert the CbmMvdPixelCharge still in the buffer to CbmMvdDigis + fOutputBuffer->Clear("C"); + fDigis->Clear("C"); + fDigiMatch->Clear("C"); - GetEventInfo(fInputNr, fEventNr, fEventTime); - LOG(debug) << "CbmMvdSensorDigitizerTask::Finish() - NumberOfPixelCharge = " << fPixelCharge->GetEntriesFast(); + GetEventInfo(fInputNr, fEventNr, fEventTime); + LOG(debug) << "CbmMvdSensorDigitizerTask::Finish() - NumberOfPixelCharge = " << fPixelCharge->GetEntriesFast(); - for (Int_t i = 0; i < fPixelCharge->GetEntriesFast(); i++) { - CbmMvdPixelCharge* pixel = (CbmMvdPixelCharge*) fPixelCharge->At(i); + for (Int_t i = 0; i < fPixelCharge->GetEntriesFast(); i++) { + CbmMvdPixelCharge* pixel = (CbmMvdPixelCharge*) fPixelCharge->At(i); - FlushBuffer(pixel, i); - } + FlushBuffer(pixel, i); } // PrintParameters();