From 6968e40fe9c90b0da993b234c17e1fd5333b8d4f Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Wed, 29 Nov 2023 11:29:21 +0100 Subject: [PATCH] Fix MVD digitization Fix the digi time. There were two problems pilled up. The first problem was to get the event time to late during execution. By accident the event time was then also used twice, once when creating the temporary CbmPixelCharge buffer and a second time when creating the final digi. Flush all data which is still stored in the temporary buffer at the end of the run. --- .../tasks/CbmMvdSensorDigitizerTask.cxx | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx index 174e629f8c..c15bdce573 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(); -- GitLab