diff --git a/sim/detectors/fsd/CbmFsdDigitize.cxx b/sim/detectors/fsd/CbmFsdDigitize.cxx index b889b53a559bbe24c9dca0ed6ffa20f9e29b3b21..9c0db4483d27dc0e275daf8fbdf0398ba9051afc 100644 --- a/sim/detectors/fsd/CbmFsdDigitize.cxx +++ b/sim/detectors/fsd/CbmFsdDigitize.cxx @@ -40,7 +40,9 @@ using std::pair; // ----- Public method Init -------------------------------------------- InitStatus CbmFsdDigitize::Init() { - if (!fEventMode) { LOG(info) << GetName() << " uses TimeBased mode."; } + if (!fEventMode) { + LOG(info) << GetName() << " uses TimeBased mode."; + } else { LOG(info) << GetName() << " uses Events mode."; } @@ -92,7 +94,9 @@ void CbmFsdDigitize::SetParContainers() void CbmFsdDigitize::InitParams() { - if (!fDigiPar) { LOG(fatal) << GetName() << ": parameter container CbmFsdDigiPar not found!!"; } + if (!fDigiPar) { + LOG(fatal) << GetName() << ": parameter container CbmFsdDigiPar not found!!"; + } // Get values from loaded parameter container fNumPhotoDets = fDigiPar->GetNumPhotoDets(); @@ -182,10 +186,15 @@ void CbmFsdDigitize::Exec(Option_t*) // not within time cut -> send the digi from buffer and replace by the new one CbmFsdDigi* oldDigi = new CbmFsdDigi(it->second.first->GetAddress(), it->second.first->GetTime(), it->second.first->GetEdep()); - CbmMatch* oldDigiMatch = new CbmMatch(*it->second.second); - if (fCreateMatches) SendData(oldDigi->GetTime(), oldDigi, oldDigiMatch); - else + if (fCreateMatches) { + CbmMatch* oldDigiMatch = new CbmMatch(*it->second.second); + SendData(oldDigi->GetTime(), oldDigi, oldDigiMatch); + delete it->second.second; + } + else { SendData(oldDigi->GetTime(), oldDigi); + } + delete it->second.first; fDigiBuffer.erase(it); CbmFsdDigi* digi = new CbmFsdDigi(address, time, eloss); @@ -248,10 +257,16 @@ void CbmFsdDigitize::ReleaseBuffer(Bool_t sendEverything) for (const auto& dp : fDigiBuffer) { CbmFsdDigi* digi = new CbmFsdDigi(dp.second.first->GetAddress(), dp.second.first->GetTime(), dp.second.first->GetEdep()); - CbmMatch* digiMatch = new CbmMatch(*dp.second.second); - if (fCreateMatches) SendData(digi->GetTime(), digi, digiMatch); - else + if (fCreateMatches) { + CbmMatch* digiMatch = new CbmMatch(*dp.second.second); + SendData(digi->GetTime(), digi, digiMatch); + delete dp.second.first; + delete dp.second.second; + } + else { SendData(digi->GetTime(), digi); + delete dp.second.first; + } } // # digi buffer fDigiBuffer.clear(); } @@ -266,11 +281,14 @@ void CbmFsdDigitize::ReleaseBuffer(Bool_t sendEverything) // send this digi CbmFsdDigi* digi = new CbmFsdDigi(dp.second.first->GetAddress(), dp.second.first->GetTime(), dp.second.first->GetEdep()); - CbmMatch* digiMatch = new CbmMatch(*dp.second.second); - if (fCreateMatches) SendData(digi->GetTime(), digi, digiMatch); - else + if (fCreateMatches) { + CbmMatch* digiMatch = new CbmMatch(*dp.second.second); + SendData(digi->GetTime(), digi, digiMatch); + delete dp.second.second; + } + else { SendData(digi->GetTime(), digi); - + } // save which keys were sent and should be removed keysSent.push_back(dp.first); } // ? time diff --git a/sim/detectors/much/CbmMuchDigitizeGem.cxx b/sim/detectors/much/CbmMuchDigitizeGem.cxx index 05b89110b8e83e1a75f6660934c93db0733a0bee..9e2b8bd584bb2ea903bb0049a137accf75f5da6d 100644 --- a/sim/detectors/much/CbmMuchDigitizeGem.cxx +++ b/sim/detectors/much/CbmMuchDigitizeGem.cxx @@ -56,11 +56,11 @@ #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRunSim.h" + #include <Logger.h> // Includes from Cbm #include "CbmMCTrack.h" - #include "TCanvas.h" #include "TChain.h" #include "TDatabasePDG.h" @@ -68,6 +68,7 @@ #include "TH1D.h" #include "TObjArray.h" #include "TRandom.h" + #include <TGeoManager.h> #include <cassert> @@ -701,8 +702,7 @@ void CbmMuchDigitizeGem::ReadAndRegister(Long_t eventTime) << SignalList.size() << " entries."; for (std::vector<CbmMuchSignal*>::iterator LoopOver = SignalList.begin(); LoopOver != SignalList.end(); LoopOver++) { - CbmMuchDigi* digi = ConvertSignalToDigi(*LoopOver); - CbmMatch* digiMatch = new CbmMatch(*(*LoopOver)->GetMatch()); // must be copied from signal + CbmMuchDigi* digi = ConvertSignalToDigi(*LoopOver); // assert(digi); if (!digi) { LOG(debug2) << GetName() << ": Digi not created as signal is below threshold."; @@ -711,7 +711,13 @@ void CbmMuchDigitizeGem::ReadAndRegister(Long_t eventTime) LOG(debug2) << GetName() << ": New digi: sector = " << CbmMuchAddress::GetSectorIndex(digi->GetAddress()) << " channel= " << CbmMuchAddress::GetChannelIndex(digi->GetAddress()); - SendData(digi->GetTime(), digi, digiMatch); + if (fCreateMatches) { + CbmMatch* digiMatch = new CbmMatch(*(*LoopOver)->GetMatch()); // must be copied from signal + SendData(digi->GetTime(), digi, digiMatch); + } + else { + SendData(digi->GetTime(), digi); + } fNofDigis++; } } diff --git a/sim/detectors/psd/CbmPsdSimpleDigitizer.cxx b/sim/detectors/psd/CbmPsdSimpleDigitizer.cxx index d1c9fe4937401bf6eeec338ed9ef8afd18bff2a4..2984b40f7ca502582af268a9cfeaa0d6c76659c0 100644 --- a/sim/detectors/psd/CbmPsdSimpleDigitizer.cxx +++ b/sim/detectors/psd/CbmPsdSimpleDigitizer.cxx @@ -13,14 +13,13 @@ #include "CbmMatch.h" #include "CbmPsdDigi.h" #include "CbmPsdPoint.h" - #include "FairRootManager.h" -#include <Logger.h> - #include "TClonesArray.h" #include "TMath.h" #include "TStopwatch.h" +#include <Logger.h> + #include <cassert> #include <iomanip> #include <iostream> @@ -154,7 +153,12 @@ void CbmPsdSimpleDigitizer::Exec(Option_t*) eLossSmeared += eNoise; CbmPsdDigi* digi = new CbmPsdDigi(entry.second.first.GetAddress(), entry.second.first.GetTime() + fCurrentEventTime, eLossSmeared); - SendData(digi->GetTime(), digi, entry.second.second); + if (fCreateMatches) { + SendData(digi->GetTime(), digi, entry.second.second); + } + else { + SendData(digi->GetTime(), digi); + } nDigis++; LOG(debug1) << fName << ": Digi " << nDigis << " Time " << entry.second.first.GetTime() + fCurrentEventTime << " Section " << entry.second.first.GetSectionID() << " Module " << entry.second.first.GetModuleID() diff --git a/sim/detectors/tof/CbmTofDigitize.cxx b/sim/detectors/tof/CbmTofDigitize.cxx index 32f8b487d16a00daab503276874d12ce05a04d93..3d411ba59640feb5a4e0c7894f8c36fd3473ad3f 100644 --- a/sim/detectors/tof/CbmTofDigitize.cxx +++ b/sim/detectors/tof/CbmTofDigitize.cxx @@ -24,6 +24,7 @@ #include "TROOT.h" #include "TRandom3.h" #include "TVector3.h" + #include <TFile.h> // FAIR classes and includes @@ -33,6 +34,7 @@ #include "FairRunAna.h" #include "FairRunSim.h" #include "FairRuntimeDb.h" + #include <Logger.h> // CBM includes @@ -678,7 +680,9 @@ Bool_t CbmTofDigitize::LoadBeamtimeValues() // Histogramming functions Bool_t CbmTofDigitize::CreateHistos() { - if (!fbMonitorHistos) { return kTRUE; } + if (!fbMonitorHistos) { + return kTRUE; + } TDirectory* oldir = gDirectory; // <= To prevent histos from being sucked in by the param file of the TRootManager! gROOT->cd(); // <= To prevent histos from being sucked in by the param file of the TRootManager ! @@ -1001,7 +1005,9 @@ Bool_t CbmTofDigitize::WriteHistos() } Bool_t CbmTofDigitize::DeleteHistos() { - if (!fbMonitorHistos) { return kTRUE; } + if (!fbMonitorHistos) { + return kTRUE; + } delete fhTofPointsPerTrack; delete fhTofPtsInTrkVsGapInd; @@ -1055,8 +1061,13 @@ Bool_t CbmTofDigitize::MergeSameChanDigis() Double_t dHitTime = fCurrentEventTime + gRandom->Gaus(0., 0.04); const Double_t dHitTot = 2.; CbmTofDigi* tDigi = new CbmTofDigi(uChanUId, dHitTime, dHitTot); - CbmMatch* tMatch = new CbmMatch(); - SendData(tDigi->GetTime(), tDigi, tMatch); // Send digi to DAQ + if (fCreateMatches) { + CbmMatch* tMatch = new CbmMatch(); + SendData(tDigi->GetTime(), tDigi, tMatch); // Send digi to DAQ + } + else { + SendData(tDigi->GetTime(), tDigi); // Send digi to DAQ + } fiNbDigis++; LOG(debug) << Form("Add fake diamond digis 0x%08x mode with t = %7.3f", uChanUId, dHitTime); //delete tDigi; @@ -1146,11 +1157,15 @@ Bool_t CbmTofDigitize::MergeSameChanDigis() // The original digi will be deleted below, together with the unused digis from the buffer. CbmTofDigi* digi = new CbmTofDigi(*(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iNbSides * iCh + iSide][iDigi0].first)); - CbmMatch* match = - new CbmMatch(*(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iNbSides * iCh + iSide][iDigi0].second)); - digi->SetTime(digi->GetTime() * fdDigiTimeConvFactor + fCurrentEventTime); // ns->ps - SendData(digi->GetTime(), digi, match); // Send digi to DAQ + if (fCreateMatches) { + CbmMatch* match = + new CbmMatch(*(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iNbSides * iCh + iSide][iDigi0].second)); + SendData(digi->GetTime(), digi, match); // Send digi to DAQ + } + else { + SendData(digi->GetTime(), digi); // Send digi to DAQ + } fiNbDigis++; // TOF QA @@ -1186,10 +1201,16 @@ Bool_t CbmTofDigitize::MergeSameChanDigis() // The original digi will be deleted below, together with the unused digis from the buffer. CbmTofDigi* digi = new CbmTofDigi(*(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iNbSides * iCh + iSide][iDigi0].first)); - CbmMatch* match = - new CbmMatch(*(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iNbSides * iCh + iSide][iDigi0].second)); digi->SetTime(digi->GetTime() * fdDigiTimeConvFactor + fCurrentEventTime); // ns->ps - SendData(digi->GetTime(), digi, match); // Send digi to DAQ + if (fCreateMatches) { + CbmMatch* match = + new CbmMatch(*(fStorDigi[iSmType][iSm * iNbRpc + iRpc][iNbSides * iCh + iSide][iDigi0].second)); + SendData(digi->GetTime(), digi, match); // Send digi to DAQ + } + else { + SendData(digi->GetTime(), digi); // Send digi to DAQ + } + fiNbDigis++; if (fbMonitorHistos) { @@ -1387,7 +1408,9 @@ Bool_t CbmTofDigitize::DigitizeDirectClusterSize() // digi timestamps in event-based mode. In time-based mode, event start time // reconstruction is not considered here. Double_t dStartJitter = 0.; - if (fEventMode) { dStartJitter = gRandom->Gaus(0.0, fDigiBdfPar->GetStartTimeRes()); } + if (fEventMode) { + dStartJitter = gRandom->Gaus(0.0, fDigiBdfPar->GetStartTimeRes()); + } for (Int_t iPntInd = 0; iPntInd < nTofPoint; iPntInd++) { // Get a pointer to the TOF point @@ -1419,7 +1442,8 @@ Bool_t CbmTofDigitize::DigitizeDirectClusterSize() // Catch case where the MC track was removed from the transport stack if (iTrkId < 0) { - if (fbAllowPointsWithoutTrack) continue; + if (fbAllowPointsWithoutTrack) + continue; else LOG(fatal) << "CbmTofDigitize::DigitizeDirectClusterSize => TofPoint without " "valid MC track Index, " @@ -1561,7 +1585,8 @@ Bool_t CbmTofDigitize::DigitizeDirectClusterSize() break; } // If it is the case, we should reuse the timing already assigned to this track - if (kTRUE == bFoundIt) dCentralTime = fvlTrckRpcTime[iTrkId][uTrkRpcPair]; + if (kTRUE == bFoundIt) + dCentralTime = fvlTrckRpcTime[iTrkId][uTrkRpcPair]; else { dCentralTime = pPoint->GetTime() + gRandom->Gaus(0.0, fDigiBdfPar->GetResolution(iSmType)) + dStartJitter; // Same contrib. for all points in same event @@ -1837,7 +1862,9 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() // digi timestamps in event-based mode. In time-based mode, event start time // reconstruction is not considered here. Double_t dStartJitter = 0.; - if (!fbTimeBasedOutput) { dStartJitter = gRandom->Gaus(0.0, fDigiBdfPar->GetStartTimeRes()); } + if (!fbTimeBasedOutput) { + dStartJitter = gRandom->Gaus(0.0, fDigiBdfPar->GetStartTimeRes()); + } for (Int_t iPntInd = 0; iPntInd < nTofPoint; iPntInd++) { // Get a pointer to the TOF point @@ -1869,7 +1896,8 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() // Catch case where the MC track was removed from the transport stack if (iTrkId < 0) { - if (fbAllowPointsWithoutTrack) continue; + if (fbAllowPointsWithoutTrack) + continue; else LOG(fatal) << "CbmTofDigitize::DigitizeDirectClusterSize => TofPoint without " "valid MC track Index, " @@ -2030,7 +2058,8 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() break; } // If it is the case, we should reuse the timing already assigned to this track - if (kTRUE == bFoundIt) dCentralTime = fvlTrckRpcTime[iTrkId][uTrkRpcPair]; + if (kTRUE == bFoundIt) + dCentralTime = fvlTrckRpcTime[iTrkId][uTrkRpcPair]; else { dCentralTime = pPoint->GetTime() + gRandom->Gaus(0.0, fDigiBdfPar->GetResolution(iSmType)) + dStartJitter; // Same contrib. for all points in same event @@ -2211,13 +2240,15 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() // Horizontal channels: First go down, then up while (0 <= iMinChanInd) { dClusterDist = TMath::Abs(poipos_local[1] - (+fChannelInfo->GetSizey() * (iMinChanInd - iChannel + 0.5))); - if (dClusterDist < dClusterSize) iMinChanInd--; + if (dClusterDist < dClusterSize) + iMinChanInd--; else break; } while (iMaxChanInd < iNbCh) { dClusterDist = TMath::Abs(poipos_local[1] - (+fChannelInfo->GetSizey() * (iMaxChanInd - iChannel - 0.5))); - if (dClusterDist < dClusterSize) iMaxChanInd++; + if (dClusterDist < dClusterSize) + iMaxChanInd++; else break; } @@ -2226,13 +2257,15 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() // Vertical channels: First go to the left, then to the right while (0 <= iMinChanInd) { dClusterDist = TMath::Abs(poipos_local[0] - (+fChannelInfo->GetSizex() * (iMinChanInd - iChannel + 0.5))); - if (dClusterDist < dClusterSize) iMinChanInd--; + if (dClusterDist < dClusterSize) + iMinChanInd--; else break; } while (iMaxChanInd < iNbCh) { dClusterDist = TMath::Abs(poipos_local[0] - (+fChannelInfo->GetSizex() * (iMaxChanInd - iChannel - 0.5))); - if (dClusterDist < dClusterSize) iMaxChanInd++; + if (dClusterDist < dClusterSize) + iMaxChanInd++; else break; } @@ -2378,7 +2411,8 @@ Bool_t CbmTofDigitize::DigitizeFlatDisc() Double_t dClusterDist = 0; Int_t iRow; Bool_t bCheckOtherRow = kFALSE; - if (iChannel < iNbCh / 2.0) iRow = 0; + if (iChannel < iNbCh / 2.0) + iRow = 0; else iRow = 1; @@ -2611,7 +2645,9 @@ Bool_t CbmTofDigitize::DigitizeGaussCharge() // digi timestamps in event-based mode. In time-based mode, event start time // reconstruction is not considered here. Double_t dStartJitter = 0.; - if (!fbTimeBasedOutput) { dStartJitter = gRandom->Gaus(0.0, fDigiBdfPar->GetStartTimeRes()); } + if (!fbTimeBasedOutput) { + dStartJitter = gRandom->Gaus(0.0, fDigiBdfPar->GetStartTimeRes()); + } for (Int_t iPntInd = 0; iPntInd < nTofPoint; iPntInd++) { // Get a pointer to the TOF point @@ -2642,7 +2678,8 @@ Bool_t CbmTofDigitize::DigitizeGaussCharge() // Catch case where the MC track was removed from the transport stack if (iTrkId < 0) { - if (fbAllowPointsWithoutTrack) continue; + if (fbAllowPointsWithoutTrack) + continue; else LOG(fatal) << "CbmTofDigitize::DigitizeDirectClusterSize => TofPoint without " "valid MC track Index, " @@ -2761,7 +2798,8 @@ Bool_t CbmTofDigitize::DigitizeGaussCharge() break; } // If it is the case, we should reuse the timing already assigned to this track - if (kTRUE == bFoundIt) dCentralTime = fvlTrckRpcTime[iTrkId][uTrkRpcPair]; + if (kTRUE == bFoundIt) + dCentralTime = fvlTrckRpcTime[iTrkId][uTrkRpcPair]; else { dCentralTime = pPoint->GetTime() + gRandom->Gaus(0.0, fDigiBdfPar->GetResolution(iSmType)) + dStartJitter; // Same contrib. for all points in same event @@ -3129,7 +3167,8 @@ Bool_t CbmTofDigitize::DigitizeGaussCharge() // Double_t dClusterDist = 0;// -> Comment to remove warning because set but never used Int_t iRow; // Bool_t bCheckOtherRow = kFALSE; // -> Comment to remove warning because set but never used - if (iChannel < iNbCh / 2.0) iRow = 0; + if (iChannel < iNbCh / 2.0) + iRow = 0; else iRow = 1; @@ -3423,7 +3462,8 @@ Double_t CbmTofDigitize::ComputeClusterAreaOnChannel(Int_t iChanId, Double_t dCl LOG(debug3) << "CbmTofDigitize::ComputeClusterAreaOnChannel => CC out Ch " << dClustRadius << " " << dEdgeR[0] << " " << dEdgeR[1] << " " << dEdgeR[2] << " " << dEdgeR[3]; - if (TMath::Abs(dEdgeR[0]) < dClustRadius) return DiscSectionArea(dClustRadius, TMath::Abs(dEdgeR[0])); + if (TMath::Abs(dEdgeR[0]) < dClustRadius) + return DiscSectionArea(dClustRadius, TMath::Abs(dEdgeR[0])); else if (TMath::Abs(dEdgeR[1]) < dClustRadius) return DiscSectionArea(dClustRadius, TMath::Abs(dEdgeR[1])); else if (TMath::Abs(dEdgeR[2]) < dClustRadius) @@ -3876,7 +3916,8 @@ Double_t CbmTofDigitize::DistanceCircleToBase(Double_t dClustRadius, Double_t dB // The distance to the base is then the height of the isoscele triangle. Double_t dBaseLength = TMath::Sqrt(TMath::Power(dBaseXb - dBaseXa, 2) + TMath::Power(dBaseYb - dBaseYa, 2)); Double_t dRoot = dClustRadius * dClustRadius - dBaseLength * dBaseLength / 4; - if (0.0 <= dRoot) return TMath::Sqrt(dRoot); + if (0.0 <= dRoot) + return TMath::Sqrt(dRoot); else { LOG(error) << "CbmTofDigitize::DistanceCircleToBase => Invalid values: " << " base end-points not on circle (negative root" << dRoot << ") "; diff --git a/sim/detectors/trd/CbmTrdDigitizer.cxx b/sim/detectors/trd/CbmTrdDigitizer.cxx index 432c618cf8d3dfe0b3261209b7fcc724afd4f4bf..7f0b83d8954ccafc4f2cf90a69c8350eab94966b 100644 --- a/sim/detectors/trd/CbmTrdDigitizer.cxx +++ b/sim/detectors/trd/CbmTrdDigitizer.cxx @@ -225,7 +225,12 @@ void CbmTrdDigitizer::Exec(Option_t*) for (std::map<Int_t, pair<CbmTrdDigi*, CbmMatch*>>::iterator it = digis->begin(); it != digis->end(); it++) { assert(it->second.second); CbmTrdDigi* digi = it->second.first; - SendData(digi->GetTime(), digi, it->second.second); + if (fCreateMatches) { + SendData(digi->GetTime(), digi, it->second.second); + } + else { + SendData(digi->GetTime(), digi); + } nDigis++; } //# modules digis->clear(); @@ -263,7 +268,12 @@ void CbmTrdDigitizer::FlushBuffers() for (std::map<Int_t, pair<CbmTrdDigi*, CbmMatch*>>::iterator it = digis->begin(); it != digis->end(); it++) { assert(it->second.second); CbmTrdDigi* digi = it->second.first; - SendData(digi->GetTime(), digi, it->second.second); + if (fCreateMatches) { + SendData(digi->GetTime(), digi, it->second.second); + } + else { + SendData(digi->GetTime(), digi); + } nDigis++; } //# modules digis->clear(); diff --git a/sim/detectors/trd/CbmTrdModuleSimR.cxx b/sim/detectors/trd/CbmTrdModuleSimR.cxx index be6f1a092d7914307272d3a09ca529b8a8426691..1b197514e2f9f1e48555634a3562e0cad3b6cde3 100644 --- a/sim/detectors/trd/CbmTrdModuleSimR.cxx +++ b/sim/detectors/trd/CbmTrdModuleSimR.cxx @@ -32,12 +32,11 @@ // Includes from C++ #include "CbmTrdRawToDigiR.h" +#include <cmath> #include <fstream> #include <iomanip> #include <iostream> -#include <cmath> - //_________________________________________________________________________________ CbmTrdModuleSimR::CbmTrdModuleSimR(Int_t mod, Int_t ly, Int_t rot) @@ -209,10 +208,16 @@ void CbmTrdModuleSimR::ProcessPulseBuffer(Int_t address, Bool_t FNcall, Bool_t M if (iBuff == fPulseBuffer.end() || tBuff == fTimeBuffer.end()) return; Int_t trigger = CheckTrigger(fPulseBuffer[address].first); - if (fPulseBuffer[address].first.size() < 32) { return; } + if (fPulseBuffer[address].first.size() < 32) { + return; + } - if (trigger == 0 && !FNcall) { return; } - if (trigger == 1 && FNcall) { FNcall = false; } + if (trigger == 0 && !FNcall) { + return; + } + if (trigger == 1 && FNcall) { + FNcall = false; + } Int_t col = CbmTrdAddress::GetColumnId(address); Int_t row = CbmTrdAddress::GetRowId(address); @@ -297,7 +302,8 @@ void CbmTrdModuleSimR::ProcessPulseBuffer(Int_t address, Bool_t FNcall, Bool_t M fQA->FillProfile("ASYM MAP", temp[fMinBin], temp[fMaxBin], timeshift); - if (trigger == 1 && MultiCall && digi->GetCharge() > 0.) fQA->Fill("Multi Quote", 1); + if (trigger == 1 && MultiCall && digi->GetCharge() > 0.) + fQA->Fill("Multi Quote", 1); else fQA->Fill("Multi Quote", 0); @@ -377,9 +383,15 @@ void CbmTrdModuleSimR::ProcessPulseBuffer(Int_t address, Bool_t FNcall, Bool_t M // digi->SetAddressModule(fModAddress); Not required anymore, now handled in the digi c'tor - if (trigger == 1) { digi->SetTriggerType(CbmTrdDigi::eTriggerType::kSelf); } - if (trigger == 0 && FNcall) { digi->SetTriggerType(CbmTrdDigi::eTriggerType::kNeighbor); } - if (trigger == 1 && MultiCall) { digi->SetTriggerType(CbmTrdDigi::eTriggerType::kMulti); } + if (trigger == 1) { + digi->SetTriggerType(CbmTrdDigi::eTriggerType::kSelf); + } + if (trigger == 0 && FNcall) { + digi->SetTriggerType(CbmTrdDigi::eTriggerType::kNeighbor); + } + if (trigger == 1 && MultiCall) { + digi->SetTriggerType(CbmTrdDigi::eTriggerType::kMulti); + } //digi->SetMatch(digiMatch); if (fDebug) { @@ -400,6 +412,7 @@ void CbmTrdModuleSimR::ProcessPulseBuffer(Int_t address, Bool_t FNcall, Bool_t M fDigiMap[address] = std::make_pair(digi, digiMatch); + delete fPulseBuffer[address].second; fPulseBuffer.erase(address); if (!FNcall && !MultiCall && trigger == 1) { @@ -696,7 +709,9 @@ void CbmTrdModuleSimR::AddToPulse(Int_t address, Double_t charge, Double_t reldr fTimeBuffer[address] = fCurrentTime; } - if (trigger == 2) { fMultiBuffer[address].second = fCurrentTime; } + if (trigger == 2) { + fMultiBuffer[address].second = fCurrentTime; + } fPulseBuffer[address].first = pulse; } @@ -1053,7 +1068,8 @@ Double_t CbmTrdModuleSimR::CalcPRF(Double_t x, Double_t W, Double_t h) Double_t CbmTrdModuleSimR::CalcResponse(Double_t t) { - if (fShapingOrder == 1) return (t / fTau) * TMath::Exp(-(t / fTau)); + if (fShapingOrder == 1) + return (t / fTau) * TMath::Exp(-(t / fTau)); else return (t / fTau) * (t / fTau) * TMath::Exp(-(t / fTau)); } @@ -1202,7 +1218,9 @@ Bool_t CbmTrdModuleSimR::MakeDigi(CbmTrdPoint* point, Double_t time, Bool_t TR) nCluster = fnClusterConst; // Set number of cluster to constant value } - if (nCluster < 1) { return kFALSE; } + if (nCluster < 1) { + return kFALSE; + } nCluster = 1; for (Int_t i = 0; i < 3; i++) { @@ -1216,8 +1234,12 @@ Bool_t CbmTrdModuleSimR::MakeDigi(CbmTrdPoint* point, Double_t time, Bool_t TR) //to change the number of ionization points in the gas Int_t epoints = fepoints; - if (fDistributionMode == 3) { epoints = nCluster; } - if (fDistributionMode == 5) { epoints = 1; } + if (fDistributionMode == 3) { + epoints = nCluster; + } + if (fDistributionMode == 5) { + epoints = 1; + } //in development std::vector<Double_t> vec; @@ -1347,7 +1369,9 @@ void CbmTrdModuleSimR::ScanPadPlane(const Double_t* local_point, Double_t reldri { Int_t sectorId(-1), columnId(-1), rowId(-1); fDigiPar->GetPadInfo(local_point, sectorId, columnId, rowId); - if (sectorId < 0 && columnId < 0 && rowId < 0) { return; } + if (sectorId < 0 && columnId < 0 && rowId < 0) { + return; + } else { for (Int_t i = 0; i < sectorId; i++) { rowId += fDigiPar->GetNofRowsInSector(i); // local -> global row @@ -1376,11 +1400,15 @@ void CbmTrdModuleSimR::ScanPadPlane(const Double_t* local_point, Double_t reldri else { targRow = iRow; targCol = iCol; - if (iCol < 0) { targCol = 0; } + if (iCol < 0) { + targCol = 0; + } else if (iCol > fnCol - 1) { targCol = fnCol - 1; } - if (iRow < 0) { targRow = 0; } + if (iRow < 0) { + targRow = 0; + } else if (iRow > fnRow - 1) { targRow = fnRow - 1; } @@ -1876,7 +1904,9 @@ Int_t CbmTrdModuleSimR::FlushBuffer(ULong64_t time) done = true; for (timeit = fTimeBuffer.begin(); timeit != fTimeBuffer.end(); timeit++) { Int_t add = timeit->first; - if (!fPulseSwitch) { ProcessBuffer(add); } + if (!fPulseSwitch) { + ProcessBuffer(add); + } if (fPulseSwitch) { std::vector<Double_t> pulse; pulse = fPulseBuffer[add].first;