From 7343ec1330c4f8900d600e17ae6b81bdfe432941 Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Mon, 17 Mar 2025 17:41:58 +0100 Subject: [PATCH] Apply clang-format --- sim/detectors/fsd/CbmFsdDigitize.cxx | 8 +- sim/detectors/much/CbmMuchDigitizeGem.cxx | 5 +- sim/detectors/psd/CbmPsdSimpleDigitizer.cxx | 5 +- sim/detectors/tof/CbmTofDigitize.cxx | 84 ++++++++++++++------- sim/detectors/trd/CbmTrdModuleSimR.cxx | 65 +++++++++++----- 5 files changed, 113 insertions(+), 54 deletions(-) diff --git a/sim/detectors/fsd/CbmFsdDigitize.cxx b/sim/detectors/fsd/CbmFsdDigitize.cxx index 13cf305f4..9c0db4483 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(); diff --git a/sim/detectors/much/CbmMuchDigitizeGem.cxx b/sim/detectors/much/CbmMuchDigitizeGem.cxx index bf63798dc..9e2b8bd58 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,7 +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); + CbmMuchDigi* digi = ConvertSignalToDigi(*LoopOver); // assert(digi); if (!digi) { LOG(debug2) << GetName() << ": Digi not created as signal is below threshold."; diff --git a/sim/detectors/psd/CbmPsdSimpleDigitizer.cxx b/sim/detectors/psd/CbmPsdSimpleDigitizer.cxx index aa8a41adb..2984b40f7 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> diff --git a/sim/detectors/tof/CbmTofDigitize.cxx b/sim/detectors/tof/CbmTofDigitize.cxx index 5647b8c40..3d411ba59 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; @@ -1056,9 +1062,9 @@ Bool_t CbmTofDigitize::MergeSameChanDigis() const Double_t dHitTot = 2.; CbmTofDigi* tDigi = new CbmTofDigi(uChanUId, dHitTime, dHitTot); if (fCreateMatches) { - CbmMatch* tMatch = new CbmMatch(); + CbmMatch* tMatch = new CbmMatch(); SendData(tDigi->GetTime(), tDigi, tMatch); // Send digi to DAQ - } + } else { SendData(tDigi->GetTime(), tDigi); // Send digi to DAQ } @@ -1155,12 +1161,12 @@ Bool_t CbmTofDigitize::MergeSameChanDigis() 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++; + SendData(digi->GetTime(), digi, match); // Send digi to DAQ + } + else { + SendData(digi->GetTime(), digi); // Send digi to DAQ + } + fiNbDigis++; // TOF QA if (fbMonitorHistos && NULL != digiMatch) { @@ -1199,10 +1205,10 @@ Bool_t CbmTofDigitize::MergeSameChanDigis() 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 + SendData(digi->GetTime(), digi, match); // Send digi to DAQ } else { - SendData(digi->GetTime(), digi); // Send digi to DAQ + SendData(digi->GetTime(), digi); // Send digi to DAQ } fiNbDigis++; @@ -1402,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 @@ -1434,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, " @@ -1576,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 @@ -1852,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 @@ -1884,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, " @@ -2045,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 @@ -2226,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; } @@ -2241,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; } @@ -2393,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; @@ -2626,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 @@ -2657,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, " @@ -2776,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 @@ -3144,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; @@ -3438,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) @@ -3891,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/CbmTrdModuleSimR.cxx b/sim/detectors/trd/CbmTrdModuleSimR.cxx index 01ed0883b..1b197514e 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) { @@ -697,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; } @@ -1054,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)); } @@ -1203,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++) { @@ -1217,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; @@ -1348,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 @@ -1377,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; } @@ -1877,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; -- GitLab