diff --git a/core/data/mvd/CbmMvdDigi.cxx b/core/data/mvd/CbmMvdDigi.cxx index 13dc4cd977370c02522b9c1e4c3ca72ee049290a..38ccbbb8f25127a0b01c1e83144ee47ff97efd03 100644 --- a/core/data/mvd/CbmMvdDigi.cxx +++ b/core/data/mvd/CbmMvdDigi.cxx @@ -22,8 +22,6 @@ CbmMvdDigi::CbmMvdDigi() , fCharge(0.) , fChannelNrX(0) , fChannelNrY(0) - , fTrackID(-1) - , fPointID(0) , fPixelSizeX(0.) , fPixelSizeY(0.) , fDetectorId(0) @@ -84,8 +82,6 @@ CbmMvdDigi::CbmMvdDigi(int32_t iStation, int32_t iChannelNrX, int32_t iChannelNr , fCharge(charge) , fChannelNrX(iChannelNrX) , fChannelNrY(iChannelNrY) - , fTrackID(0) - , fPointID(0) , fPixelSizeX(pixelSizeX) , fPixelSizeY(pixelSizeY) , fDetectorId(DetectorId(iStation)) diff --git a/core/data/mvd/CbmMvdDigi.h b/core/data/mvd/CbmMvdDigi.h index b70e9775a10e8d2fc9d37e6d6f21570afefa5557..1d50697d7b55ce354be25bc54e24323f9e723d5a 100644 --- a/core/data/mvd/CbmMvdDigi.h +++ b/core/data/mvd/CbmMvdDigi.h @@ -86,8 +86,8 @@ private: float fCharge; int32_t fChannelNrX; int32_t fChannelNrY; - int32_t fTrackID; - int32_t fPointID; + //int32_t fTrackID; + //int32_t fPointID; float fPixelSizeX; float fPixelSizeY; int32_t fDetectorId; @@ -99,7 +99,7 @@ private: int32_t fDigiFlag; // Debugging and analysis information - ClassDef(CbmMvdDigi, 2); + ClassDef(CbmMvdDigi, 3); }; diff --git a/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.cxx b/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.cxx index 5cfbf73722cb5e6b792104e20fc180de7da917fb..4edd0b58b7ce8f167d8d7ae1830c6a4ce6e00dfa 100644 --- a/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.cxx +++ b/core/detectors/mvd/SensorDataSheets/CbmMvdMimosis.cxx @@ -32,7 +32,7 @@ CbmMvdMimosis::CbmMvdMimosis() fEpiTh = 25e-4; // Thickness of the epitaxial layer fChargeThreshold = 1.; - fAnalogThreshold = 150; //Threshold in electrons + fAnalogThreshold = 90; //Threshold in electrons, must not be below 90e /** Description of the sensor for the digitizer //mesaured by melisa for Mimosa26AHR**/ fNoise = 13; @@ -56,7 +56,7 @@ CbmMvdMimosis::CbmMvdMimosis() fPixelsPerBank = 64; fSignalRiseTime = 0.1; // to be updated. - fSignalFallTime = 10; // to be updated. + fSignalFallTime = 1e6; // to be updated. fShaperNormalisationFactor=1.; // to be updated diff --git a/macro/mvd/qa/mvd_qa3_digitize.C b/macro/mvd/qa/mvd_qa3_digitize.C index aac940edd1bd5714c3afa107bbf075668049d065..16d2a1c64f376abbbff6057f0960a5228ced3989 100644 --- a/macro/mvd/qa/mvd_qa3_digitize.C +++ b/macro/mvd/qa/mvd_qa3_digitize.C @@ -106,7 +106,7 @@ void mvd_qa3_digitize(const char* setup = "sis100_electron") cbm::sim::TimeDist timeDist = cbm::sim::TimeDist::Uniform; run.SetDigitizer(ECbmModuleId::kMvd, digi); - run.AddInput(0,inFile, timeDist, 1e4); + run.AddInput(0,inFile, timeDist, 2e4); run.Run(nEvents); // ------------------------------------------------------------------------ diff --git a/sim/detectors/mvd/CbmMvdDigitizer.cxx b/sim/detectors/mvd/CbmMvdDigitizer.cxx index 1fc16f3dccbe9faf737008fe8073d512ebec36b1..690caca94899988c3b8b4626eb4159709cdf3f7e 100644 --- a/sim/detectors/mvd/CbmMvdDigitizer.cxx +++ b/sim/detectors/mvd/CbmMvdDigitizer.cxx @@ -127,6 +127,7 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) // Add points from BG and Delta files to the array if needed BuildEvent(); + Int_t nPoints = fInputPoints->GetEntriesFast(); Int_t nDigis = 0; CbmMvdPoint* point = 0; @@ -142,8 +143,12 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) Int_t nTargetPlugin = DetectPlugin(100); // Distribute the points from the input array to the sensors + + + for (Int_t i = 0; i < nPoints; i++) { point = (CbmMvdPoint*) fInputPoints->At(i); + fDetector->SendInputToSensorPlugin(point->GetDetectorID(), nTargetPlugin, static_cast<TObject*>(point)); } @@ -154,7 +159,7 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) fDetector->Exec(fDigiPluginNr); LOG(debug) << fName << ": End Chain"; - cout << fName <<"Debug: 3" << endl; + //cout << fName <<"Debug: 3" << endl; // --- Send produced digis to DAQ //fTmpDigi = fDetector->GetOutputDigis(); //fTmpMatch = fDetector->GetOutputDigiMatchs(); @@ -190,7 +195,7 @@ void CbmMvdDigitizer::Exec(Option_t* /*opt*/) SendData(digi1->GetTime(), digi1, match1); nDigis++; - cout << fName <<"Debug: 7" << endl; + // cout << fName <<"Debug: 7" << endl; } @@ -442,6 +447,7 @@ void CbmMvdDigitizer::BuildEvent() for (Int_t iPoint = 0; iPoint < points->GetEntriesFast(); iPoint++) { point = (CbmMvdPoint*) points->At(iPoint); point->SetTrackID(-2); + point->SetPointId(-2); nPile++; new ((*fInputPoints)[fInputPoints->GetEntriesFast()]) CbmMvdPoint(*((CbmMvdPoint*) points->At(iPoint))); } @@ -475,6 +481,7 @@ void CbmMvdDigitizer::BuildEvent() for (Int_t iPoint = 0; iPoint < pointsD->GetEntriesFast(); iPoint++) { point = (CbmMvdPoint*) pointsD->At(iPoint); point->SetTrackID(-3); // Mark the points as delta electron + point->SetPointId(-3); new ((*fInputPoints)[fInputPoints->GetEntriesFast()]) CbmMvdPoint(*((CbmMvdPoint*) pointsD->At(iPoint))); nElec++; } diff --git a/sim/detectors/mvd/CbmMvdPixelCharge.cxx b/sim/detectors/mvd/CbmMvdPixelCharge.cxx index 4622f9c3d4e6e1d8cc251b3ee590e199565b0728..0c9b26fff0fcec1e0ba94cca4ede7f889503342a 100644 --- a/sim/detectors/mvd/CbmMvdPixelCharge.cxx +++ b/sim/detectors/mvd/CbmMvdPixelCharge.cxx @@ -17,20 +17,14 @@ Bool_t CbmMvdPixelCharge::TestXY(Int_t channelNrX, Int_t channelNrY) } // ----- Constructor with parameters ----------------------------------- -CbmMvdPixelCharge::CbmMvdPixelCharge(Float_t charge, Int_t channelNrX, Int_t channelNrY, Int_t pointId, Int_t trackId, - Float_t pointPosX, Float_t pointPosY, Float_t time, Int_t frame, Float_t endOfBusyTime) +CbmMvdPixelCharge::CbmMvdPixelCharge(Float_t charge, Int_t channelNrX, Int_t channelNrY) : TObject() - , fFrame(frame) //, fCharge(charge) , fMaxChargeContribution(charge) , fChannelNrX(channelNrX) , fChannelNrY(channelNrY) , fTrackCharge(charge) - , fPixelTime(time) - , fEndOfBusyTime(endOfBusyTime) { - fCharge.push_back(charge); - fDominatorIndex = fPointWeight.size(); } // ------- DigestCharge ----------------------------------------------------# @@ -43,9 +37,9 @@ void CbmMvdPixelCharge::DigestCharge(Float_t pointX, Float_t pointY, Double_t ti { Float_t chargeContr = fTrackCharge; - for (auto charge : fPointWeight) { - chargeContr -= charge; - } +// for (auto charge : fPointWeight) { +// chargeContr -= charge; +// } if (chargeContr > 0.) { fCharge.push_back(fTrackCharge); @@ -62,6 +56,7 @@ void CbmMvdPixelCharge::DigestCharge(Float_t pointX, Float_t pointY, Double_t ti fDominatorIndex = fPointWeight.size(); fMaxChargeContribution = chargeContr; } + fTrackCharge=0.; } } diff --git a/sim/detectors/mvd/CbmMvdPixelCharge.h b/sim/detectors/mvd/CbmMvdPixelCharge.h index 2e0c87f5c887dc666fd868c66f7a1aac8668fc53..5808e750989d2d4ca98c49993f064ff774164d10 100644 --- a/sim/detectors/mvd/CbmMvdPixelCharge.h +++ b/sim/detectors/mvd/CbmMvdPixelCharge.h @@ -24,8 +24,7 @@ public: /** Constructor with all variables **/ - CbmMvdPixelCharge(Float_t charge, Int_t channelNrX, Int_t channelNrY, Int_t hitId, Int_t trackId, Float_t pointX, - Float_t pointY, Float_t time = 0.0, Int_t frame = 0,Float_t endOfBusyTime=-1); + CbmMvdPixelCharge(Float_t charge, Int_t channelNrX, Int_t channelNrY); virtual ~CbmMvdPixelCharge() = default; @@ -65,14 +64,13 @@ public: Float_t GetEndOfBusyTime() {return fEndOfBusyTime;} //>>>>>>> ddd5fbbb (Time response added) - Int_t GetFrame() { return fFrame; } + void SetEndOfBusyTime(Double_t endOfBusyTime) {fEndOfBusyTime=endOfBusyTime;} virtual void Clear(Option_t* = "") {}; private: - Int_t fFrame = {-1}; /* <<<<<<< HEAD diff --git a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx index ad68fbe76f3b14d6b82081a8a4b5cb5cc060f3f6..4b5cd47be2762daf76be86d2277b42ec9f3dfdf1 100644 --- a/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx +++ b/sim/detectors/mvd/plugins/tasks/CbmMvdSensorDigitizerTask.cxx @@ -472,41 +472,59 @@ void CbmMvdSensorDigitizerTask::Exec() // fixme - This seems too much deleting - fPixelCharge->Delete(); - fChargeMap.clear(); - fInputPoints->Delete(); + // fPixelCharge->Delete(); + //fChargeMap.clear(); + fInputPoints->Clear(); fSignalPoints.clear(); } // end of exec // ------------------------------------------------------------------------- void CbmMvdSensorDigitizerTask::ProduceDigis(){ - + pair<Int_t, Int_t> thispoint; Int_t nDigis = 0; CbmMvdPixelCharge* pixel; + GetEventInfo(fInputNr, fEventNr, fEventTime); LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - NumberOfPixelCharge = " << fPixelCharge->GetEntriesFast(); + + + for (Int_t i = 0; i < fPixelCharge->GetEntriesFast(); i++) { pixel = (CbmMvdPixelCharge*) fPixelCharge->At(i); +// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Length of array : " << fPixelCharge->GetEntriesFast(); +// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Working on PixelCharge " << i << " Address = " << pixel; +// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelChargeTime = " << pixel->GetEndOfBusyTime(); +// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - EventTime = " << fEventTime; - LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - Working on PixelCharge " << i; - LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - PixelChargeTime = " << pixel->GetEndOfBusyTime(); - LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - EventTime = " << fEventTime; - - if (pixel->GetEndOfBusyTime()>fEventTime){continue;} + if (pixel->GetEndOfBusyTime()>fEventTime){ //LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - will care for this later"; + continue;} /* The digi is only generated once the busy-time has passed. This is an easy way to avoid double counting of hits. * If no digi is formed, the initial hit information remains stored in the CbmMvdPixelCharge */ - LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - Working on PixelCharge " << i; +// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Working on PixelCharge " << i << " Address = " << pixel; Int_t numberOfContributorCausingHit=CheckForHit(pixel); - if (numberOfContributorCausingHit==-1){ - fPixelCharge->RemoveAt(i); // pixel did not fire and busy time has expired. Forget about it. + LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelCharge >" << pixel->GetEarliestHitCharge() ; + + if (numberOfContributorCausingHit==-1){// pixel did not fire and busy time has expired. Forget about it. + thispoint = std::make_pair(pixel->GetX(), pixel->GetY()); + fChargeMap.erase(thispoint); // Delete entry in the fChargeMap (points from coordinate to the pixel + fPixelCharge->RemoveAt(i); // Delete the pixelCharge object + LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelCharge " << i << " deleted (to few charge)."; + + continue; } - Int_t diodeCharge= GetPixelCharge(pixel, pixel->GetTime()[numberOfContributorCausingHit]); - // Compute charge causing the hitCharge +// LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - Starting to create Digi from PixelCharge " << i; + + Int_t diodeCharge= pixel->GetCharge()[numberOfContributorCausingHit] + GetPixelCharge(pixel, pixel->GetTime()[numberOfContributorCausingHit]); + // Compute charge causing the hit. Note: GetPixelCharge does not account for the charge caused by the last hit if handed over the time of the last hit as the + // signal in the shaper did not yet build up. Therefore, this charge is added explicitely. + + LOG(debug)<< " --- CbmMvdSensorDigitizerTask::ProduceDigis() - DiodeCharge0 = " << pixel->GetCharge()[0]; + LOG(debug)<< " --- CbmMvdSensorDigitizerTask::ProduceDigis() - Full diode charge = " << diodeCharge; Double_t analogHitTime= fSensor->ComputeIndecatedAnalogTime(pixel->GetTime()[numberOfContributorCausingHit], diodeCharge); @@ -528,12 +546,29 @@ void CbmMvdSensorDigitizerTask::ProduceDigis(){ new ((*fDigiMatch)[nDigis]) CbmMatch(); CbmMatch* match = (CbmMatch*) fDigiMatch->At(nDigis); for (Int_t iLink = 0; iLink < pixel->GetNContributors(); iLink++) { - if (pixel->GetTrackID()[iLink] > -1) + + if (pixel->GetTrackID()[iLink] > -2) { match->AddLink((Double_t) pixel->GetPointWeight()[iLink], pixel->GetPointID()[iLink], fEventNr, fInputNr); + std::cout << "CbmMvdSensorDigitizerTask::ProduceDigis() : PointID= " <<pixel->GetPointID()[iLink] << std::endl; + } + else match->AddLink((Double_t) pixel->GetPointWeight()[iLink], pixel->GetPointID()[iLink]); } - } + + thispoint = std::make_pair(pixel->GetX(), pixel->GetY()); + fChargeMap.erase(thispoint); // Delete entry in the fChargeMap (points from coordinate to the pixel + fPixelCharge->RemoveAt(i); // Delete the pixelCharge object + LOG(debug)<< " CbmMvdSensorDigitizerTask::ProduceDigis() - PixelCharge " << i << " deleted (digi produced)."; + + + } + +// LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - NumberOfPixelCharge before compress = " << fPixelCharge->GetEntriesFast(); + + fPixelCharge->Compress(); + +// LOG(debug)<< "CbmMvdSensorDigitizerTask::ProduceDigis() - NumberOfPixelCharge after compress = " << fPixelCharge->GetEntriesFast(); } @@ -581,6 +616,13 @@ Int_t CbmMvdSensorDigitizerTask::CheckForHit(CbmMvdPixelCharge* pixel){ * The number of the contributor is returned */ if (!fSensorDataSheet) {std::cout << " - E - CbmMvdSensorDigitizerTask::CheckForHit : Missing Datasheet." << std::endl;} + +// std::vector<Float_t>& chargeArray=pixel->GetCharge(); +// if(chargeArray.size() != pixel->GetNContributors()) {Fatal("ContributorCrash","ContributorCrash");} +// +// for(Int_t i=0; i<pixel->GetNContributors(); i++){ std::cout << " " << chargeArray[i];} +// std::cout << std::endl; + if (pixel->GetEarliestHitCharge() > fSensorDataSheet->GetAnalogThreshold()) {return 0;} /* The pixel fired immedeately, easiest case.else ... * Else: Check if a later impact fired the pixel @@ -620,10 +662,13 @@ Int_t CbmMvdSensorDigitizerTask::GetPixelCharge(CbmMvdPixelCharge* myPixel, Doub if (hitTime>readoutTime){break;} Int_t hitCharge=myPixel->GetCharge()[hitNr]; + //pixelCharge=pixelCharge+hitCharge; + //Use ideal charge accumulation in the pixel at this time pixelCharge=pixelCharge + hitCharge * (1- TMath::Exp(-(readoutTime-hitTime)/pixelSignalRiseTime)); //exponential signal rise of the analog charge pixelCharge=pixelCharge - hitCharge * (1- TMath::Exp(-(readoutTime-hitTime)/pixelSignalFallTime)); //exponential signal fall of the analog charge pixelCharge=pixelCharge * fSensorDataSheet->GetShaperNormalisationFactor(); + } return pixelCharge; @@ -796,7 +841,7 @@ void CbmMvdSensorDigitizerTask::ProduceIonisationPoints(CbmMvdPoint* point) //Smear the energy on each track segment Double_t charge = fLandauRandom->Landau(fLandauGain, fLandauSigma / fLandauMPV); - //if (fShowDebugHistos ) LOG(debug) << "charge " << charge << endl; + LOG(debug) << "CbmMvdSensorTask:: ProduceIonisationPoints() : LandauCharge = " << charge << endl; if (charge > (12000 / fLandauMPV)) { charge = 12000 / fLandauMPV; } //limit Random generator behaviour @@ -1008,7 +1053,7 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) / fPixelSize / fPixelSize + 0.25 * fPar1 * fPar1) + fPar2); - + //Todo: Equation wrong, hardcoded pixel size is set to wrong number. if (totCharge < 1) { @@ -1026,8 +1071,7 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) // Pixel not yet in map -> Add new pixel if (fChargeMapIt == fChargeMap.end()) { pixel = new ((*fPixelCharge)[fPixelCharge->GetEntriesFast()]) CbmMvdPixelCharge( - totCharge, ix, iy, point->GetPointId(), point->GetTrackID(), (point->GetX() + point->GetXOut()) / 2, - (point->GetY() + point->GetYOut()) / 2, point->GetTime(), point->GetFrame()); + totCharge, ix, iy); //LOG(debug) << "new charched pixel with charge " << totCharge << " at " << ix << " " << iy; // fPixelChargeShort.push_back(pixel); // LOG(debug) << "added pixel to ChargeShort vector "; @@ -1050,7 +1094,7 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) // LOG(debug) <<"put charge"; } - + totClusterCharge = totClusterCharge + totCharge; if (fShowDebugHistos) { xCharge = xCharge + Current[0] * totCharge; yCharge = yCharge + Current[1] * totCharge; @@ -1079,9 +1123,11 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) Float_t latestHitCharge=pixelCharge->GetLatestHitCharge(); Double_t endOfBusyTime= fSensor->ComputeEndOfBusyTime(fEventTime + point->GetTime(), latestHitCharge, pixelCharge->GetY()); - LOG(debug) << "CbmMvdSensorDigitizerTask::ProducePixelCharge() - latestHitCharge = "<< latestHitCharge; + /* LOG(debug) << "CbmMvdSensorDigitizerTask::ProducePixelCharge() - latestHitCharge = "<< latestHitCharge; LOG(debug) << "CbmMvdSensorDigitizerTask::ProducePixelCharge() - MCTime = "<< fEventTime + point->GetTime(); LOG(debug) << "CbmMvdSensorDigitizerTask::ProducePixelCharge() - EndOfBusyTime = "<< endOfBusyTime; + */ + if (endOfBusyTime > pixelCharge->GetEndOfBusyTime()) {pixelCharge->SetEndOfBusyTime(endOfBusyTime);} /* Next, the pixelChargeObject is combined with a time information on the endOfBusyTime of the pixelChargeObject. @@ -1090,14 +1136,14 @@ void CbmMvdSensorDigitizerTask::ProducePixelCharge(CbmMvdPoint* point) * Note: This endOfBusyTime is not equal to the analog dead time of the channel but accounts also for the frame readout. */ - + LOG(debug) << "CbmMvdSensorDigitizerTask: Produced pixelCharge with charge " << latestHitCharge; } else { LOG(warning) << "Warning working on broken pixel "; } } - + LOG(debug) << "CbmMvdSensorDigitizerTask: Produced cluster with " << fPixelChargeShort.size() << " active pixels and with total charge of " << totClusterCharge; if (fShowDebugHistos) { //LOG(debug) << "produced " << fPixelChargeShort.size() << " Digis with total charge of " << totClusterCharge; TVector3 momentum, position; @@ -1142,7 +1188,7 @@ void CbmMvdSensorDigitizerTask::ProduceNoise() if (fChargeMapIt == fChargeMap.end()) { pixel = new ((*fPixelCharge)[fPixelCharge->GetEntriesFast()]) - CbmMvdPixelCharge(1000, xPix, yPix, 0, -4, Current[0], Current[1]); // TODO: Add time + CbmMvdPixelCharge(1000, xPix, yPix); // TODO: Add time pixel->DigestCharge(Current[0], Current[1], fEventTime, 0, -4); fChargeMap[thispoint] = pixel; }