From fa19410583c4e87304394c451d9d3e6091e6e840 Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Thu, 7 Dec 2023 14:19:22 +0100 Subject: [PATCH] Fix MC matching for time based mode Up to now the input and event numbers where added to the match when the match was created. In time based mode the digi and match objects are not necessarily created at the same event to witch the MvdPoint belongs. This results in wrongly matching the digis to the MvdPoints. Add information about input and event number to the pixel charge to store the the correct information about input and event numbers. Use this information when creating the match object. --- sim/detectors/mvd/CbmMvdPixelCharge.cxx | 6 ++- sim/detectors/mvd/CbmMvdPixelCharge.h | 41 ++++--------------- .../tasks/CbmMvdSensorDigitizerTask.cxx | 11 ++--- 3 files changed, 20 insertions(+), 38 deletions(-) diff --git a/sim/detectors/mvd/CbmMvdPixelCharge.cxx b/sim/detectors/mvd/CbmMvdPixelCharge.cxx index 75f8b58990..0896421353 100644 --- a/sim/detectors/mvd/CbmMvdPixelCharge.cxx +++ b/sim/detectors/mvd/CbmMvdPixelCharge.cxx @@ -33,7 +33,9 @@ CbmMvdPixelCharge::CbmMvdPixelCharge(Float_t charge, Int_t channelNrX, Int_t cha // all segments of a track). Checks if a new track contributed charge to the pixel // Checks if the new track is dominant -void CbmMvdPixelCharge::DigestCharge(Float_t pointX, Float_t pointY, Double_t time, Int_t pointId, Int_t trackId) +void CbmMvdPixelCharge::DigestCharge(Float_t pointX, Float_t pointY, Double_t time, + Int_t pointId, Int_t trackId, + Int_t inputNr, Int_t eventNr) { Float_t chargeContr = fTrackCharge; @@ -45,6 +47,8 @@ void CbmMvdPixelCharge::DigestCharge(Float_t pointX, Float_t pointY, Double_t ti fCharge.push_back(fTrackCharge); fTrackId.push_back(trackId); fPointId.push_back(pointId); + fInputNr.push_back(inputNr); + fEventNr.push_back(eventNr); fPointWeight.push_back(chargeContr); fPointX.push_back(pointX); diff --git a/sim/detectors/mvd/CbmMvdPixelCharge.h b/sim/detectors/mvd/CbmMvdPixelCharge.h index 3fb14d4c9a..0d44f3cc39 100644 --- a/sim/detectors/mvd/CbmMvdPixelCharge.h +++ b/sim/detectors/mvd/CbmMvdPixelCharge.h @@ -31,7 +31,7 @@ public: Bool_t TestXY(Int_t channelNrX, Int_t channelNrY); void DigestCharge(Float_t pointX, Float_t pointY, Double_t time, Int_t PointId, - Int_t trackId); // TODO: add time here + Int_t trackId, Int_t inputNr, Int_t eventNr); // TODO: add time here void AddCharge(Float_t charge) { fTrackCharge = fTrackCharge + charge; }; @@ -40,16 +40,15 @@ public: Float_t GetMaxChargeContribution() { return fMaxChargeContribution; }; Short_t GetNContributors() { return fContributors; }; Int_t GetDominatorIndex() { return fDominatorIndex; } + std::vector<Int_t>& GetTrackID() { return fTrackId; } std::vector<Int_t>& GetPointID() { return fPointId; } + std::vector<Int_t>& GetInputNr() { return fInputNr; } + std::vector<Int_t>& GetEventNr() { return fEventNr; } std::vector<Float_t>& GetPointX() { return fPointX; } std::vector<Float_t>& GetPointY() { return fPointY; } std::vector<Float_t>& GetPointWeight() { return fPointWeight; } - /*<<<<<<< HEAD - std::vector<Double_t>& GetTime() { return fTime; } - Float_t GetPixelTime() { return fPixelTime; } -======= -*/ + std::vector<Double_t>& GetTime() { return fTime; } std::vector<Float_t>& GetCharge() { return fCharge; }; Float_t GetPixelTime() @@ -92,7 +91,6 @@ public: Float_t GetEndOfBusyTime() { return fEndOfBusyTime; } - //>>>>>>> ddd5fbbb (Time response added) void SetEndOfBusyTime(Double_t endOfBusyTime) { fEndOfBusyTime = endOfBusyTime; } @@ -100,29 +98,7 @@ public: private: - /* -<<<<<<< HEAD - Float_t fCharge = {-1.}; - Float_t fMaxChargeContribution = {0.}; - Float_t fDominatingPointX = {-1.}; - Float_t fDominatingPointY = {-1.}; - Short_t fContributors = {0}; - Int_t fChannelNrX = {0}; - Int_t fChannelNrY = {0}; - Float_t fTrackCharge = {0.}; - Int_t fDominatorTrackId = {-1}; - Int_t fDominatorPointId = {-1}; - Short_t fDominatorIndex = {0}; - Float_t fPixelTime = {-1.}; - std::vector<Int_t> fTrackId = {}; - std::vector<Int_t> fPointId = {}; - std::vector<Float_t> fPointWeight = {}; - std::vector<Float_t> fPointX = {}; - std::vector<Float_t> fPointY = {}; - std::vector<Double_t> fTime = {}; - std::vector<CbmLink> fLink = {}; -======= -*/ + //Float_t fCharge = {-1.}; Float_t fMaxChargeContribution = {0.}; Float_t fDominatingPointX = {-1.}; @@ -139,15 +115,16 @@ private: std::vector<Int_t> fTrackId = {}; std::vector<Int_t> fPointId = {}; + std::vector<Int_t> fInputNr = {}; + std::vector<Int_t> fEventNr = {}; std::vector<Float_t> fPointWeight = {}; std::vector<Float_t> fPointX = {}; std::vector<Float_t> fPointY = {}; std::vector<Double_t> fTime = {}; std::vector<Float_t> fCharge = {}; std::vector<CbmLink> fLink = {}; - //>>>>>>> ddd5fbbb (Time response added) - ClassDef(CbmMvdPixelCharge, 1); + ClassDef(CbmMvdPixelCharge, 2); }; #endif diff --git a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx index e9fb9c2326..d98f05ee28 100644 --- a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx +++ b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx @@ -568,8 +568,9 @@ void CbmMvdSensorDigitizerTask::FlushBuffer(CbmMvdPixelCharge* pixel, Int_t i) CbmMatch* match = (CbmMatch*) fDigiMatch->At(nDigis); for (Int_t iLink = 0; iLink < pixel->GetNContributors(); iLink++) { - if (pixel->GetTrackID()[iLink] > -2) { - match->AddLink((Double_t) pixel->GetPointWeight()[iLink], pixel->GetPointID()[iLink], fEventNr, fInputNr); + if (pixel->GetTrackID()[iLink] > -2) { + match->AddLink((Double_t) pixel->GetPointWeight()[iLink], pixel->GetPointID()[iLink], + pixel->GetEventNr()[iLink], pixel->GetInputNr()[iLink]); // std::cout << "CbmMvdSensorDigitizerTask::ProduceDigis() : PointID= " << pixel->GetPointID()[iLink] << std::endl; } @@ -1127,7 +1128,7 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) if (pixelCharge) { pixelCharge->DigestCharge(((float) (point->GetX() + point->GetXOut()) / 2), ((float) (point->GetY() + point->GetYOut()) / 2), fEventTime + point->GetTime(), - point->GetPointId(), point->GetTrackID()); + point->GetPointId(), point->GetTrackID(), fInputNr, fEventNr); // So far, the charge created by this MC-hit in a given pixel was added up in the Pixel charge objects. @@ -1203,13 +1204,13 @@ void CbmMvdSensorDigitizerTask::ProduceNoise() if (fChargeMapIt == fChargeMap.end()) { pixel = new ((*fPixelCharge)[fPixelCharge->GetEntriesFast()]) CbmMvdPixelCharge(1000, xPix, yPix); // TODO: Add time - pixel->DigestCharge(Current[0], Current[1], fEventTime, 0, -4); + pixel->DigestCharge(Current[0], Current[1], fEventTime, 0, -4, -1, -1); fChargeMap[thispoint] = pixel; } else { pixel = fChargeMapIt->second; pixel->AddCharge(1000); // TODO: Add time - pixel->DigestCharge(Current[0], Current[1], fEventTime, 0, -4); + pixel->DigestCharge(Current[0], Current[1], fEventTime, 0, -4, -1, -1); } } } -- GitLab