From a286b51e4ed1daf022af0ed4c79f4ec43ac7b7b4 Mon Sep 17 00:00:00 2001 From: VinzenzBildstein <7277216+VinzenzBildstein@users.noreply.github.com> Date: Mon, 13 Jan 2025 20:02:57 +0000 Subject: [PATCH 1/3] [MegaLinter] Apply linters automatic fixes --- include/TSourceCalibration.h | 2 +- libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/TSourceCalibration.h b/include/TSourceCalibration.h index dc19f0385cd..9a55338b7b8 100644 --- a/include/TSourceCalibration.h +++ b/include/TSourceCalibration.h @@ -234,7 +234,7 @@ class TSourceCalibration : public TGMainFrame { static void SourceboxWidth(int val) { fSourceboxWidth = val; } static void DigitWidth(int val) { fDigitWidth = val; } - static void VerboseLevel(EVerbosity val) { fVerboseLevel = val; } + static void VerboseLevel(EVerbosity val) { fVerboseLevel = val; } static EVerbosity VerboseLevel() { return fVerboseLevel; } static void ZoomX(); diff --git a/libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx b/libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx index 763c83fa101..c15ad0ff82a 100644 --- a/libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx +++ b/libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx @@ -982,7 +982,7 @@ void TEfficiencyCalibrator::SetSource(Int_t windowId, Int_t entryId) void TEfficiencyCalibrator::Start() { if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) - if(fEmitter == nullptr) { // we only want to do this once at the beginning (after fEmitter was initialized to nullptr) + if(fEmitter == nullptr) { // we only want to do this once at the beginning (after fEmitter was initialized to nullptr) fEmitter = fStartButton; TTimer::SingleShot(100, "TEfficiencyCalibrator", this, "HandleTimer()"); } From 123176f5122048f7e019bb86ae2c84f2855f9770 Mon Sep 17 00:00:00 2001 From: VinzenzBildstein Date: Mon, 13 Jan 2025 16:40:00 -0500 Subject: [PATCH 2/3] Renamed kBasic to kBasicFlow --- include/Globals.h | 2 +- libraries/GROOT/GH1D.cxx | 48 +++---- .../TAnalysis/TCal/TEfficiencyCalibrator.cxx | 26 ++-- libraries/TGUI/TCalibrationGraph.cxx | 40 +++--- libraries/TGUI/TSourceCalibration.cxx | 132 +++++++++--------- 5 files changed, 124 insertions(+), 124 deletions(-) diff --git a/include/Globals.h b/include/Globals.h index ba9d5464047..b43fcba8208 100644 --- a/include/Globals.h +++ b/include/Globals.h @@ -142,7 +142,7 @@ inline std::string hex(T val, int width = -1) enum EVerbosity : int { kQuiet = 0, - kBasic = 1, + kBasicFlow = 1, kSubroutines = 2, kLoops = 3, kAll = 4 diff --git a/libraries/GROOT/GH1D.cxx b/libraries/GROOT/GH1D.cxx index f2984256a28..a56f49dae12 100644 --- a/libraries/GROOT/GH1D.cxx +++ b/libraries/GROOT/GH1D.cxx @@ -257,7 +257,7 @@ void GH1D::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TObject* } else if(eventType == kButton1Down) { fStartX = currentX; fStartY = currentY; - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "button 1 down at " << currentX << ", " << currentY << std::endl; } } else if(eventType == kButton1Motion) { @@ -266,7 +266,7 @@ void GH1D::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TObject* } } else if(eventType == kButton1Up) { region->Update(fStartX, currentX); - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "button 1 up at " << currentX << ", " << currentY << std::endl; } } @@ -287,7 +287,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) std::array str; gVirtualX->LookupString(event, str.data(), str.size(), keySymbol); - if((VerboseLevel() > EVerbosity::kBasic && event->fType != kMotionNotify && event->fType != kLeaveNotify) || + if((VerboseLevel() > EVerbosity::kBasicFlow && event->fType != kMotionNotify && event->fType != kLeaveNotify) || (VerboseLevel() > EVerbosity::kSubroutines && event->fState != 0) || (VerboseLevel() > EVerbosity::kLoops)) { std::cout << __PRETTY_FUNCTION__ << ", event " << event << ", window " << window << ", type " << event->fType << ", code " << event->fCode << ", state " << event->fState << ", x " << event->fX << ", root-x " << event->fXRoot << ", y " << event->fY << ", root-y " << event->fYRoot << ", x/y coordinates: x " << fPad->PixeltoX(event->fX) << ", y " << fPad->PixeltoY(event->fY - fPad->GetWh()) << ", root-x " << fPad->PixeltoX(event->fXRoot) << ", root-y " << fPad->PixeltoY(event->fYRoot - fPad->GetWh()) << ", key symbol " << keySymbol << " = " << hex(keySymbol) << "; fPad " << fPad << " = \"" << fPad->GetName() << "\", gPad " << gPad << " = \"" << gPad->GetName() << "\"" << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) @@ -335,7 +335,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) UpdatePad(); DrawRegions(); UpdatePad(); - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { PrintRegions(); } break; @@ -345,7 +345,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) UpdatePad(); DrawRegions(); UpdatePad(); - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { PrintRegions(); } break; @@ -370,7 +370,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) UpdatePad(); DrawRegions(); UpdatePad(); - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { PrintRegions(); } break; @@ -393,7 +393,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) fCurrentRegion->SetFillColorAlpha(fRegionColor[fNofRegions % fRegionColor.size()], 0.2); } fCurrentRegion->Draw(); - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { PrintRegions(); } } @@ -427,7 +427,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) UpdatePad(); DrawRegions(); UpdatePad(); - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { PrintRegions(); } break; @@ -446,7 +446,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) fCurrentRegion->SetY2(currentY); fCurrentRegion->Draw(); UpdatePad(); - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { PrintRegions(); } } @@ -458,7 +458,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) // check whether we are in the frame or not double currentX = fPad->PixeltoX(event->fX); double currentY = fPad->PixeltoY(event->fY - fPad->GetWh()); - if(VerboseLevel() > EVerbosity::kBasic) { std::cout << "current x " << currentX << ", current y " << currentY << std::endl; } + if(VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "current x " << currentX << ", current y " << currentY << std::endl; } if(Pad()->GetFrame()->GetX1() < currentX && currentX < Pad()->GetFrame()->GetX2() && Pad()->GetFrame()->GetY1() < currentY && currentY < Pad()->GetFrame()->GetY2()) { if(VerboseLevel() > EVerbosity::kQuiet) { @@ -475,7 +475,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) UpdatePad(); DrawRegions(); UpdatePad(); - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { PrintRegions(); } } else { @@ -505,7 +505,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window) } RemoveCurrentRegion(); static_cast(fRegions.Last())->Draw(); - if(VerboseLevel() > EVerbosity::kBasic) { + if(VerboseLevel() > EVerbosity::kBasicFlow) { PrintRegions(); } } @@ -586,7 +586,7 @@ bool TRegion::Update() bool result = true; auto* frame = fParent->Pad()->GetFrame(); - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "Frame: " << frame->GetX1() << " - " << frame->GetX2() << ", " << frame->GetY1() << " - " << frame->GetY2() << " -> updating y-range from " << GetY1() << " - " << GetY2(); } if(fParent->Pad()->GetLogy() == 0) { @@ -598,16 +598,16 @@ bool TRegion::Update() SetY1(TMath::Power(10., frame->GetY1())); SetY2(TMath::Power(10., frame->GetY2())); } - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " to " << GetY1() << " - " << GetY2() << std::endl; } - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "Updating x-range from " << GetX1() << " - " << GetX2() << " (" << fLowX << " - " << fHighX << ")"; } if(frame->GetX1() < fLowX && fHighX < frame->GetX2()) { // whole region is visible -> use original range - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " (whole region)"; } SetX1(fLowX); @@ -617,33 +617,33 @@ bool TRegion::Update() // Using GetUxmin() and GetUxmax() to set range to values outside the pad range and not just the frame range does not work. // So we simply hide this region whenever it is outside the frame. // This also means we have to actively draw it whenever it is (partly) in frame (in case it was hidden before). - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " (out of " << frame->GetX1() << " - " << frame->GetX2() << ")"; } result = false; } else if(fHighX < frame->GetX2()) { // low part of region is out of frame -> adjust low x - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " (high part)"; } SetX1(frame->GetX1()); SetX2(fHighX); } else if(frame->GetX1() < fLowX) { // high part of region is out of frame -> adjust high x - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " (low part)"; } SetX1(fLowX); SetX2(frame->GetX2()); } else { // region is larger than visible range on both side -> adjust both - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " (region too big)"; } SetX1(frame->GetX1()); SetX2(frame->GetX2()); } - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " to " << GetX1() << " - " << GetX2() << std::endl; } @@ -679,7 +679,7 @@ void TRegion::Hide() } fParent->Pad()->GetListOfPrimitives()->Remove(this); - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "hid region " << fLowX << " - " << fHighX << std::endl; fParent->PrintRegions(); } @@ -688,7 +688,7 @@ void TRegion::Hide() void TRegion::Update(double startX, double stopX) { /// Depending on the starting position this function updates the left or right edge of the region to the stopping position. - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "region " << fLowX << " - " << fHighX << ", start x " << startX << ", stop x " << stopX; } if(std::abs(startX - fLowX) < std::abs(startX - fHighX)) { @@ -696,7 +696,7 @@ void TRegion::Update(double startX, double stopX) } else { fHighX = stopX; } - if(GH1D::VerboseLevel() > EVerbosity::kBasic) { + if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " => " << fLowX << " - " << fHighX << std::endl; } Update(); diff --git a/libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx b/libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx index 763c83fa101..fed2c94e238 100644 --- a/libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx +++ b/libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx @@ -263,7 +263,7 @@ void TEfficiencyTab::Status(Int_t, Int_t px, Int_t py, TObject* selected) TEfficiencyDatatypeTab::TEfficiencyDatatypeTab(TEfficiencyCalibrator* parent, std::vector nucleus, std::vector> hists, TGCompositeFrame* frame, const std::string& dataType, TGHProgressBar* progressBar) : fFrame(frame), fNucleus(std::move(nucleus)), fParent(parent), fDataType(dataType) { - if(TEfficiencyCalibrator::VerboseLevel() > EVerbosity::kBasic) { + if(TEfficiencyCalibrator::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "======================================== creating tab for data type " << dataType << std::endl; } // create new subdirectory for this tab (and its channel tabs), but store the old directory @@ -372,7 +372,7 @@ TEfficiencyDatatypeTab::TEfficiencyDatatypeTab(TEfficiencyCalibrator* parent, st if(TEfficiencyCalibrator::VerboseLevel() > EVerbosity::kSubroutines) { std::cout << " = " << fMainDirectory->GetName() << ", sub directory is " << fSubDirectory << " = " << (fSubDirectory == nullptr ? "" : fSubDirectory->GetName()) << std::endl; } - if(TEfficiencyCalibrator::VerboseLevel() > EVerbosity::kBasic) { + if(TEfficiencyCalibrator::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "======================================== done creating tab for data type " << dataType << std::endl; } } @@ -679,7 +679,7 @@ void TEfficiencyDatatypeTab::FitEfficiency() void TEfficiencyDatatypeTab::FittingControl(Int_t id) { int currentTabId = fDataTab->GetCurrent(); - if(TEfficiencyCalibrator::VerboseLevel() > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": id " << id << ", current tab id " << currentTabId << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TEfficiencyCalibrator::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": id " << id << ", current tab id " << currentTabId << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) ReadValues(); switch(id) { case 1: // re-fit @@ -823,7 +823,7 @@ TEfficiencyCalibrator::TEfficiencyCalibrator(int n...) auto type = fDataType.begin(); for(auto it = fHistograms.begin(); it != fHistograms.end();) { if(it->size() != fFiles.size()) { - if(fVerboseLevel > EVerbosity::kBasic) { + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << std::distance(fHistograms.begin(), it) << ": found " << it->size() << " histograms for " << fFiles.size() << " files, removing this type" << std::endl; } it = fHistograms.erase(it); @@ -902,7 +902,7 @@ void TEfficiencyCalibrator::BuildFirstInterface() /// Build initial interface with histogram <-> source assignment auto* layoutManager = new TGTableLayout(this, fFiles.size() + 1, 2, true, 5); - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << "created table layout manager with 2 columns, " << fFiles.size() + 1 << " rows" << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "created table layout manager with 2 columns, " << fFiles.size() + 1 << " rows" << std::endl; } SetLayoutManager(layoutManager); // The matrices and source selection boxes @@ -932,9 +932,9 @@ void TEfficiencyCalibrator::BuildFirstInterface() } // The buttons - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << "Attaching start button to 0, 2, " << i << ", " << i + 1 << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "Attaching start button to 0, 2, " << i << ", " << i + 1 << std::endl; } fStartButton = new TGTextButton(this, "Accept && Continue", kStartButton); - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << "start button " << fStartButton << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "start button " << fStartButton << std::endl; } AddFrame(fStartButton, new TGTableLayoutHints(0, 2, i, i + 1, kLHintsCenterX | kLHintsCenterY)); Layout(); } @@ -972,7 +972,7 @@ void TEfficiencyCalibrator::DeleteFirst() void TEfficiencyCalibrator::SetSource(Int_t windowId, Int_t entryId) { int index = windowId - kSourceBox; - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": windowId " << windowId << ", entryId " << entryId << " => " << index << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": windowId " << windowId << ", entryId " << entryId << " => " << index << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) TNucleus* nucleus = fSources[index]; delete nucleus; nucleus = new TNucleus(fSourceBox[index]->GetListBox()->GetEntry(entryId)->GetTitle()); @@ -981,7 +981,7 @@ void TEfficiencyCalibrator::SetSource(Int_t windowId, Int_t entryId) void TEfficiencyCalibrator::Start() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fEmitter == nullptr) { // we only want to do this once at the beginning (after fEmitter was initialized to nullptr) fEmitter = fStartButton; TTimer::SingleShot(100, "TEfficiencyCalibrator", this, "HandleTimer()"); @@ -990,7 +990,7 @@ void TEfficiencyCalibrator::Start() void TEfficiencyCalibrator::HandleTimer() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fEmitter == fStartButton) { // disconnect signals of first screen and remove all elements DisconnectFirst(); @@ -1003,7 +1003,7 @@ void TEfficiencyCalibrator::HandleTimer() void TEfficiencyCalibrator::SecondWindow() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) // check that all sources have been set for(size_t i = 0; i < fSources.size(); ++i) { if(fSources[i] == nullptr) { @@ -1090,7 +1090,7 @@ void TEfficiencyCalibrator::BuildSecondInterface() void TEfficiencyCalibrator::MakeSecondConnections() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) // we don't need to connect the range, threshold, and degree number entries, those are automatically read when we start the calibration for(auto* sourceTab : fEfficiencyDatatypeTab) { sourceTab->MakeConnections(); @@ -1099,7 +1099,7 @@ void TEfficiencyCalibrator::MakeSecondConnections() void TEfficiencyCalibrator::DisconnectSecond() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay) for(auto* sourceTab : fEfficiencyDatatypeTab) { sourceTab->Disconnect(); } diff --git a/libraries/TGUI/TCalibrationGraph.cxx b/libraries/TGUI/TCalibrationGraph.cxx index d66967b0a93..85783f39f27 100644 --- a/libraries/TGUI/TCalibrationGraph.cxx +++ b/libraries/TGUI/TCalibrationGraph.cxx @@ -11,10 +11,10 @@ Int_t TCalibrationGraph::RemovePoint() { - if(TCalibrationGraphSet::VerboseLevel() > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TCalibrationGraphSet::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) Int_t px = gPad->GetEventX(); Int_t py = gPad->GetEventY(); - if(TCalibrationGraphSet::VerboseLevel() > EVerbosity::kBasic) { std::cout << "px, py " << px << ", " << py << " on gPad " << gPad->GetName() << std::endl; } + if(TCalibrationGraphSet::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "px, py " << px << ", " << py << " on gPad " << gPad->GetName() << std::endl; } if(fIsResidual) { return fParent->RemoveResidualPoint(px, py); } return fParent->RemovePoint(px, py); } @@ -37,17 +37,17 @@ EVerbosity TCalibrationGraphSet::fVerboseLevel = EVerbosity::kQuiet; TCalibrationGraphSet::TCalibrationGraphSet(TGraphErrors* graph, const std::string& label) : fTotalGraph(new TGraphErrors), fTotalResidualGraph(new TGraphErrors) { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << " fTotalGraph " << fTotalGraph << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << " fTotalGraph " << fTotalGraph << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(graph != nullptr) { Add(graph, label); - if(fVerboseLevel > EVerbosity::kBasic) { Print(); } + if(fVerboseLevel > EVerbosity::kBasicFlow) { Print(); } } } TCalibrationGraphSet::TCalibrationGraphSet(std::string xAxisLabel, std::string yAxisLabel) : fTotalGraph(new TGraphErrors), fTotalResidualGraph(new TGraphErrors), fXAxisLabel(std::move(xAxisLabel)), fYAxisLabel(std::move(yAxisLabel)) { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << " fTotalGraph " << fTotalGraph << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << " fTotalGraph " << fTotalGraph << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } TCalibrationGraphSet::~TCalibrationGraphSet() @@ -58,7 +58,7 @@ TCalibrationGraphSet::~TCalibrationGraphSet() int TCalibrationGraphSet::Add(TGraphErrors* graph, const std::string& label) { - if(fVerboseLevel > EVerbosity::kBasic) { + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ", fTotalGraph " << fTotalGraph << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) Print(); } @@ -128,7 +128,7 @@ int TCalibrationGraphSet::Add(TGraphErrors* graph, const std::string& label) fResidualGraphs.back().SetMarkerColor(static_cast(fResidualGraphs.size())); fResidualGraphs.back().SetMarkerStyle(static_cast(fResidualGraphs.size())); - if(fVerboseLevel > EVerbosity::kBasic) { + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "done" << std::endl; Print(); } @@ -137,7 +137,7 @@ int TCalibrationGraphSet::Add(TGraphErrors* graph, const std::string& label) bool TCalibrationGraphSet::SetResidual(const bool& force) { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << " gpad " << gPad->GetName() << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << " gpad " << gPad->GetName() << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) TF1* calibration = FitFunction(); if(calibration != nullptr && (!fResidualSet || force)) { double* x = fTotalGraph->GetX(); @@ -207,7 +207,7 @@ void TCalibrationGraphSet::DrawCalibration(Option_t* opt, TLegend* legend) } for(size_t i = 0; i < fGraphs.size(); ++i) { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << " drawing " << i << ". graph with option \"" << opt << "\", marker color " << fGraphs[i].GetMarkerColor() << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << " drawing " << i << ". graph with option \"" << opt << "\", marker color " << fGraphs[i].GetMarkerColor() << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) fGraphs[i].Draw(opt); if(legend != nullptr) { legend->AddEntry(&(fGraphs[i]), fLabel[i].c_str()); @@ -230,7 +230,7 @@ void TCalibrationGraphSet::DrawResidual(Option_t* opt, TLegend* legend) } for(size_t i = 0; i < fResidualGraphs.size(); ++i) { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << " drawing " << i << ". residual graph with option \"" << opt << "\", marker color " << fResidualGraphs[i].GetMarkerColor() << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << " drawing " << i << ". residual graph with option \"" << opt << "\", marker color " << fResidualGraphs[i].GetMarkerColor() << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) fResidualGraphs[i].Draw(opt); if(legend != nullptr) { legend->AddEntry(&(fResidualGraphs[i]), fLabel[i].c_str()); @@ -242,7 +242,7 @@ Int_t TCalibrationGraphSet::RemovePoint(const Int_t& px, const Int_t& py) { /// This function is primarily a copy of TGraph::RemovePoint with some added bits to remove a point that has been selected in the calibration graph from it and the corresponding point from the residual graph and the total graphs - if(fVerboseLevel > EVerbosity::kBasic) { + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": point " << px << ", " << py << "; gPad " << gPad->GetName() << ": " << gPad->AbsPixeltoX(px) << ", " << gPad->AbsPixeltoY(py) << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) Print(); } @@ -276,7 +276,7 @@ Int_t TCalibrationGraphSet::RemovePoint(const Int_t& px, const Int_t& py) } return ipoint; } - if(fVerboseLevel > EVerbosity::kBasic) { + if(fVerboseLevel > EVerbosity::kBasicFlow) { Print(); } fTotalGraph->RemovePoint(ipoint); @@ -312,7 +312,7 @@ Int_t TCalibrationGraphSet::RemovePoint(const Int_t& px, const Int_t& py) if(fVerboseLevel > EVerbosity::kSubroutines) { std::cout << "Modified and updated pad " << pad << " = " << mother->GetPad(pad)->GetName() << std::endl; } pad++; } - if(fVerboseLevel > EVerbosity::kBasic) { Print(); } + if(fVerboseLevel > EVerbosity::kBasicFlow) { Print(); } std::array args = {px, py}; if(fVerboseLevel > EVerbosity::kSubroutines) { std::cout << "Emitting RemovePoint(Int_t, Int_t) with " << px << ", " << py << " - " << args.data() << std::endl; } Emit("RemovePoint(Int_t, Int_t)", args.data()); @@ -339,7 +339,7 @@ Int_t TCalibrationGraphSet::RemoveResidualPoint(const Int_t& px, const Int_t& py } } if(ipoint < 0) { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << "Failed to find point close to " << px << ", " << py << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "Failed to find point close to " << px << ", " << py << std::endl; } if(fVerboseLevel > EVerbosity::kSubroutines) { std::cout << __PRETTY_FUNCTION__ << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) Print(); @@ -377,7 +377,7 @@ Int_t TCalibrationGraphSet::RemoveResidualPoint(const Int_t& px, const Int_t& py if(fVerboseLevel > EVerbosity::kSubroutines) { std::cout << "Modified pad " << pad << " = " << mother->GetPad(pad)->GetName() << std::endl; } pad++; } - if(fVerboseLevel > EVerbosity::kBasic) { Print(); } + if(fVerboseLevel > EVerbosity::kBasicFlow) { Print(); } std::array args = {px, py}; if(fVerboseLevel > EVerbosity::kSubroutines) { std::cout << "Emitting RemoveResidualPoint(Int_t, Int_t) with " << px << ", " << py << " - " << args.data() << std::endl; } Emit("RemoveResidualPoint(Int_t, Int_t)", args.data()); @@ -389,7 +389,7 @@ void TCalibrationGraphSet::Scale(bool useAllPrevious) /// Scale all graphs to fit each other (based on the first "previous" graph found or just the first graph). /// If no overlap is being found between the graph that is being scaled and the first graph (or all graphs before this one), /// the current graph isn't being scaled and we continue with the next graph. - if(fVerboseLevel > EVerbosity::kBasic) { + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) Print(); } @@ -406,7 +406,7 @@ void TCalibrationGraphSet::Scale(bool useAllPrevious) for(g2 = 0; (useAllPrevious ? g2 < g : g2 < 1); ++g2) { double minRef = fGraphs[g2].GetX()[0]; double maxRef = fGraphs[g2].GetX()[fGraphs[g2].GetN() - 1]; - if(fVerboseLevel > EVerbosity::kBasic) { + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "Checking overlap between " << g2 << ". graph (" << fGraphs[g2].GetN() << ": " << minRef << " - " << maxRef << ") and " << g << ". graph (" << graph.GetN() << std::flush << ": " << x[0] << " - " << x[graph.GetN() - 1] << ")" << std::endl; } if(maxRef < x[0] || x[graph.GetN() - 1] < minRef) { @@ -433,13 +433,13 @@ void TCalibrationGraphSet::Scale(bool useAllPrevious) std::cout << "No overlap(s) between 0. to " << g2 - 1 << ". graph and " << g << ". graph (" << graph.GetN() << ": " << x[0] << " - " << x[graph.GetN() - 1] << "), not scaling this one!" << std::endl; } } - if(fVerboseLevel > EVerbosity::kBasic) { Print(); } + if(fVerboseLevel > EVerbosity::kBasicFlow) { Print(); } ResetTotalGraph(); } void TCalibrationGraphSet::ResetTotalGraph() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fGraphs.empty()) { std::cerr << "No graphs added yet, makes no sense to reset total graph?" << std::endl; return; @@ -492,7 +492,7 @@ void TCalibrationGraphSet::ResetTotalGraph() void TCalibrationGraphSet::Print(Option_t* opt) const { - if(fVerboseLevel > EVerbosity::kBasic) { + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ", fTotalGraph " << fTotalGraph << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } diff --git a/libraries/TGUI/TSourceCalibration.cxx b/libraries/TGUI/TSourceCalibration.cxx index fb33d264a04..32088154a55 100644 --- a/libraries/TGUI/TSourceCalibration.cxx +++ b/libraries/TGUI/TSourceCalibration.cxx @@ -31,7 +31,7 @@ std::map> Match(std::vector EVerbosity::kBasic) { std::cout << RESET_COLOR << "Matching " << peaks.size() << " peaks with " << sources.size() << " source energies" << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << RESET_COLOR << "Matching " << peaks.size() << " peaks with " << sources.size() << " source energies" << std::endl; } std::map> result; std::sort(peaks.begin(), peaks.end()); @@ -149,7 +149,7 @@ std::map> SmartMatch(std::vec /// This function tries to match a list of found peaks (channels) to a list of provided peaks (energies). /// It does so in slightly smarter way than the brute force method `Match`, by taking the reported intensity of the source peaks into account. - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << RESET_COLOR << "\"Smart\" matching " << peaks.size() << " peaks with " << sources.size() << " source energies" << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << RESET_COLOR << "\"Smart\" matching " << peaks.size() << " peaks with " << sources.size() << " source energies" << std::endl; } if(TSourceCalibration::VerboseLevel() > EVerbosity::kLoops) { for(size_t i = 0; i < peaks.size() || i < sources.size(); ++i) { std::cout << i << ".: " << std::setw(8); @@ -310,7 +310,7 @@ TSourceTab::TSourceTab(TChannelTab* parent, TGCompositeFrame* frame, GH1D* proje TSourceTab::TSourceTab(const TSourceTab& rhs) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DCYAN << __PRETTY_FUNCTION__ << RESET_COLOR << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DCYAN << __PRETTY_FUNCTION__ << RESET_COLOR << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) fParent = rhs.fParent; fSourceFrame = rhs.fSourceFrame; fProjectionCanvas = rhs.fProjectionCanvas; @@ -377,11 +377,11 @@ void TSourceTab::ProjectionStatus(Event_t* event) } } if(event->fType == kEnterNotify) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "Entered source tab => changing gPad from " << gPad->GetName(); } gPad = fProjectionCanvas->GetCanvas(); - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " to " << gPad->GetName() << std::endl; } } @@ -408,7 +408,7 @@ void TSourceTab::ProjectionStatus(Int_t event, Int_t px, Int_t py, TObject* sele switch(event) { case kButton1Down: if(selected == fProjection) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DCYAN << "Adding new marker at " << px << ", " << py << " (pixel to user: " << fProjectionCanvas->GetCanvas()->PixeltoX(px) << ", " << fProjectionCanvas->GetCanvas()->PixeltoY(py - fProjectionCanvas->GetCanvas()->GetWh()) << ", abs pixel to user: " << fProjectionCanvas->GetCanvas()->AbsPixeltoX(px) << ", " << fProjectionCanvas->GetCanvas()->AbsPixeltoY(py) << ")" << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DCYAN << "Adding new marker at " << px << ", " << py << " (pixel to user: " << fProjectionCanvas->GetCanvas()->PixeltoX(px) << ", " << fProjectionCanvas->GetCanvas()->PixeltoY(py - fProjectionCanvas->GetCanvas()->GetWh()) << ", abs pixel to user: " << fProjectionCanvas->GetCanvas()->AbsPixeltoX(px) << ", " << fProjectionCanvas->GetCanvas()->AbsPixeltoY(py) << ")" << std::endl; } auto* polym = static_cast(fProjection->GetListOfFunctions()->FindObject("TPolyMarker")); if(polym == nullptr) { std::cerr << "No peaks defined yet?" << std::endl; @@ -423,7 +423,7 @@ void TSourceTab::ProjectionStatus(Int_t event, Int_t px, Int_t py, TObject* sele //fPeakFitter.Fit(fProjection, "qretryfit"); if(peak->Area() > 0) { fPeaks.push_back(peak); - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << "Fitted peak " << fProjectionCanvas->GetCanvas()->AbsPixeltoX(px) - range << " - " << fProjectionCanvas->GetCanvas()->AbsPixeltoX(px) + range << " -> centroid " << peak->Centroid() << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "Fitted peak " << fProjectionCanvas->GetCanvas()->AbsPixeltoX(px) - range << " - " << fProjectionCanvas->GetCanvas()->AbsPixeltoX(px) + range << " -> centroid " << peak->Centroid() << std::endl; } } else { std::cout << "Ignoring peak at " << peak->Centroid() << " with negative area " << peak->Area() << std::endl; } @@ -514,10 +514,10 @@ void TSourceTab::FindPeaks(const double& sigma, const double& threshold, const d /// This list is then used to find all peaks that lie on a straight line. if(fPeakRatio != peakRatio) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DCYAN << __PRETTY_FUNCTION__ << ": updating peak ratio from " << fPeakRatio << " to " << peakRatio << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DCYAN << __PRETTY_FUNCTION__ << ": updating peak ratio from " << fPeakRatio << " to " << peakRatio << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) fPeakRatio = peakRatio; } - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DCYAN << __PRETTY_FUNCTION__ << std::flush << " " << fProjection->GetName() << ": got " << fPeaks.size() << " peaks" << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DCYAN << __PRETTY_FUNCTION__ << std::flush << " " << fProjection->GetName() << ": got " << fPeaks.size() << " peaks" << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fPeaks.empty() || fData == nullptr || sigma != fSigma || threshold != fThreshold || force) { if(TSourceCalibration::VerboseLevel() > EVerbosity::kSubroutines) { @@ -621,7 +621,7 @@ void TSourceTab::FindPeaks(const double& sigma, const double& threshold, const d void TSourceTab::Add(std::map> map) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DCYAN << "Adding map with " << map.size() << " data points, fData = " << fData << std::endl; } if(fData == nullptr) { @@ -651,7 +651,7 @@ void TSourceTab::Add(std::map auto energyErr = std::get<1>(iter->second); // drop this peak if the uncertainties in area or position are too large if(peakPosErr > 0.1 * peakPos || peakAreaErr > peakArea || std::isnan(peakPosErr) || std::isnan(peakAreaErr)) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "Dropping peak with position " << peakPos << " +- " << peakPosErr << ", area " << peakArea << " +- " << peakAreaErr << ", energy " << energy << std::endl; } iter = map.erase(iter); @@ -670,7 +670,7 @@ void TSourceTab::Add(std::map ++i; } } - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "Accepted " << map.size() << " peaks" << std::endl; } // if we dropped a peak, we need to resize the graph, if we haven't dropped any this doesn't do anything @@ -760,14 +760,14 @@ void TSourceTab::Add(std::map void TSourceTab::RemovePoint(Int_t px, Int_t py) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DCYAN << __PRETTY_FUNCTION__ << ": px " << px << ", py " << py << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } // we removed a point of the calibration graph at px, py, where px is the channel and py is the energy // so we try and find a peak with its centroid close to px for(auto it = fPeaks.begin(); it != fPeaks.end(); ++it) { if(TMath::Abs((*it)->Centroid() - px) < fSigma) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DCYAN << "Erasing peak " << TMath::Abs((*it)->Centroid() - px) << " < " << fSigma << std::endl; (*it)->Print(); } @@ -785,7 +785,7 @@ void TSourceTab::RemovePoint(Int_t px, Int_t py) centroid = static_cast(item)->Centroid(); } if(TMath::Abs(centroid - px) < fSigma) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DCYAN << "Removing function " << TMath::Abs(centroid - px) << " < " << fSigma << std::endl; item->Print(); } @@ -823,7 +823,7 @@ void TSourceTab::RemovePoint(Int_t px, Int_t py) void TSourceTab::RemoveResidualPoint(Int_t px, Int_t py) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DCYAN << __PRETTY_FUNCTION__ << ": px " << px << ", py " << py << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } // we removed a point of the residual graph at px, py, where px is the residual and py is the energy @@ -851,7 +851,7 @@ void TSourceTab::PrintLayout() const TChannelTab::TChannelTab(TSourceCalibration* parent, std::vector nuclei, std::vector projections, std::string name, TGCompositeFrame* frame, double sigma, double threshold, int degree, std::vector>> sourceEnergies, TGHProgressBar* progressBar) : fChannelFrame(frame), fSourceTab(new TGTab(frame, TSourceCalibration::PanelWidth(), TSourceCalibration::PanelHeight() + 2 * TSourceCalibration::StatusbarHeight())), fCanvasTab(new TGTab(frame, TSourceCalibration::PanelWidth(), TSourceCalibration::PanelHeight() + 2 * TSourceCalibration::StatusbarHeight())), fProgressBar(progressBar), fParent(parent), fNuclei(std::move(nuclei)), fProjections(std::move(projections)), fName(std::move(name)), fSigma(sigma), fThreshold(threshold), fDegree(degree), fSourceEnergies(std::move(sourceEnergies)) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DYELLOW << "========================================" << std::endl; std::cout << __PRETTY_FUNCTION__ << std::endl // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) << " name = " << fName << ", fData = " << fData << std::endl; @@ -861,7 +861,7 @@ TChannelTab::TChannelTab(TSourceCalibration* parent, std::vector nucl fChannelFrame->SetLayoutManager(new TGHorizontalLayout(fChannelFrame)); fSources.resize(fNuclei.size(), nullptr); - //if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": creating channels for bin 1 to " << fMatrix->GetNbinsX() << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + //if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": creating channels for bin 1 to " << fMatrix->GetNbinsX() << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) for(size_t source = 0; source < fNuclei.size(); ++source) { CreateSourceTab(source); } @@ -912,7 +912,7 @@ TChannelTab::TChannelTab(TSourceCalibration* parent, std::vector nucl fFwhm->DrawCalibration("*"); fLegend->Draw(); - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DYELLOW << "----------------------------------------" << std::endl; std::cout << __PRETTY_FUNCTION__ << std::endl // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) << " channel " << fName << " done" << std::endl; @@ -944,7 +944,7 @@ TChannelTab::~TChannelTab() void TChannelTab::CreateSourceTab(size_t source) { if(fProjections[source]->GetEntries() > 1000) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DYELLOW << "Creating source tab " << source << ", using fParent " << fParent << std::flush; if(fParent != nullptr) { std::cout << ", peak ratio " << fParent->PeakRatio(); @@ -956,11 +956,11 @@ void TChannelTab::CreateSourceTab(size_t source) fProgressBar->Increment(1); } else { fSources[source] = nullptr; - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DYELLOW << "Skipping projection of source " << source << " = " << fProjections[source]->GetName() << ", only " << fProjections[source]->GetEntries() << " entries" << std::endl; } } - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << " source " << source << " done" << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } } @@ -991,9 +991,9 @@ void TChannelTab::Disconnect() void TChannelTab::SelectedTab(Int_t id) { /// Simple function that enables and disables the previous and next buttons depending on which tab was selected. - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DYELLOW << __PRETTY_FUNCTION__ << ": id " << id << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DYELLOW << __PRETTY_FUNCTION__ << ": id " << id << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) fActiveSourceTab = id; - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << "active source tab " << fActiveSourceTab << RESET_COLOR << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "active source tab " << fActiveSourceTab << RESET_COLOR << std::endl; } if(fSources[fActiveSourceTab] == nullptr) { std::cout << "Failed to get fSources[" << fActiveSourceTab << "]" << RESET_COLOR << std::endl; return; @@ -1006,20 +1006,20 @@ void TChannelTab::SelectedTab(Int_t id) std::cout << "Failed to get fSources[" << fActiveSourceTab << "]->ProjectionCanvas()->GetCanvas()" << RESET_COLOR << std::endl; return; } - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DGREEN << "Changing gpad from \"" << gPad->GetName() << "\" to \""; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DGREEN << "Changing gpad from \"" << gPad->GetName() << "\" to \""; } gPad = fSources[fActiveSourceTab]->ProjectionCanvas()->GetCanvas(); fSources[fActiveSourceTab]->ProjectionCanvas()->GetCanvas()->cd(); - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << gPad->GetName() << "\"" << RESET_COLOR << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << gPad->GetName() << "\"" << RESET_COLOR << std::endl; } } void TChannelTab::SelectCanvas(Event_t* event) { if(event->fType == kEnterNotify) { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "Entered channel tab => changing gPad from " << gPad->GetName(); } gPad = fCalibrationCanvas->GetCanvas(); - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << " to " << gPad->GetName() << std::endl; } } @@ -1065,10 +1065,10 @@ void TChannelTab::CalibrationStatus(Int_t event, Int_t px, Int_t py, TObject* se void TChannelTab::UpdateData() { /// Copy data from all sources into one graph (which we use for the calib && source < fSources.size()ration). - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DYELLOW << __PRETTY_FUNCTION__ << " fData = " << fData << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DYELLOW << __PRETTY_FUNCTION__ << " fData = " << fData << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fData == nullptr) { fData = new TCalibrationGraphSet("ADC channel", "Energy [keV]"); - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << " created fData = " << fData << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << " created fData = " << fData << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } fData->Clear(); @@ -1096,10 +1096,10 @@ void TChannelTab::UpdateData() void TChannelTab::UpdateFwhm() { /// Copy data from all sources into one graph (which we use for the calib && source < fSources.size()ration). - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DYELLOW << __PRETTY_FUNCTION__ << " fFwhm = " << fFwhm << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DYELLOW << __PRETTY_FUNCTION__ << " fFwhm = " << fFwhm << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fFwhm == nullptr) { fFwhm = new TCalibrationGraphSet("ADC channel", "FWHM [ADC channel]"); - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << " created fFwhm = " << fFwhm << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << " created fFwhm = " << fFwhm << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } fFwhm->Clear(); @@ -1147,7 +1147,7 @@ void TChannelTab::Calibrate() /// This function fit's the final data of the given channel. It requires all other elements to have been created already. TF1* calibration = new TF1("fitfunction", ::Polynomial, 0., 10000., fDegree + 2); calibration->FixParameter(0, fDegree); - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DYELLOW << "fData " << fData << ": " << (fData != nullptr ? fData->GetN() : -1) << " data points being fit" << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DYELLOW << "fData " << fData << ": " << (fData != nullptr ? fData->GetN() : -1) << " data points being fit" << std::endl; } fData->Fit(calibration, "Q"); TString text = Form("%.6f + %.6f*x", calibration->GetParameter(1), calibration->GetParameter(2)); for(int i = 2; i <= fDegree; ++i) { @@ -1195,12 +1195,12 @@ void TChannelTab::Calibrate() delete calibration; - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << " done" << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << " done" << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } void TChannelTab::UpdateChannel() { - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DYELLOW << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DYELLOW << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) // write the actual parameters of the fit std::stringstream str; str << std::hex << fName; @@ -1220,7 +1220,7 @@ void TChannelTab::UpdateChannel() TChannel* channel = TChannel::GetChannel(address, false); if(channel == nullptr) { std::cerr << "Failed to get channel for address " << hex(address, 4) << std::endl; - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": done" << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": done" << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) return; } channel->SetENGCoefficients(parameters); @@ -1463,10 +1463,10 @@ TSourceCalibration::TSourceCalibration(double sigma, double threshold, int degre fActiveBins.push_back(bin); channelToIndex[bin] = fNofBins; // this map simply stores which bin ends up at which index fChannelLabel.push_back(fMatrices[0]->GetXaxis()->GetBinLabel(bin)); - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << bin << ". bin: fNofBins " << fNofBins << ", channelToIndex[" << bin << "] " << channelToIndex[bin] << ", fActualChannelId.back() " << fActualChannelId.back() << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << bin << ". bin: fNofBins " << fNofBins << ", channelToIndex[" << bin << "] " << channelToIndex[bin] << ", fActualChannelId.back() " << fActualChannelId.back() << std::endl; } ++fNofBins; } else { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << "skipping bin " << bin << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "skipping bin " << bin << std::endl; } } } // now loop over all other matrices and check vs. the first one @@ -1533,7 +1533,7 @@ void TSourceCalibration::BuildFirstInterface() /// Build initial interface with histogram <-> source assignment auto* layoutManager = new TGTableLayout(this, fMatrices.size() + 1, 2, true, 5); - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << "created table layout manager with 2 columns, " << fMatrices.size() + 1 << " rows" << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "created table layout manager with 2 columns, " << fMatrices.size() + 1 << " rows" << std::endl; } SetLayoutManager(layoutManager); // The matrices and source selection boxes @@ -1616,9 +1616,9 @@ void TSourceCalibration::BuildFirstInterface() } // The buttons - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << "Attaching start button to 0, 2, " << i << ", " << i + 1 << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "Attaching start button to 0, 2, " << i << ", " << i + 1 << std::endl; } fStartButton = new TGTextButton(this, "Accept && Continue", kStartButton); - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << "start button " << fStartButton << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << "start button " << fStartButton << std::endl; } AddFrame(fStartButton, new TGTableLayoutHints(0, 2, i, i + 1, kLHintsCenterX | kLHintsCenterY)); Layout(); } @@ -1671,7 +1671,7 @@ void TSourceCalibration::DeleteFirst() void TSourceCalibration::SetSource(Int_t windowId, Int_t entryId) { int index = windowId - kSourceBox; - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": windowId " << windowId << ", entryId " << entryId << " => " << index << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": windowId " << windowId << ", entryId " << entryId << " => " << index << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) delete fSource[index]; auto* nucleus = new TNucleus(fSourceBox[index]->GetListBox()->GetEntry(entryId)->GetTitle()); TIter iter(nucleus->GetTransitionList()); @@ -1684,7 +1684,7 @@ void TSourceCalibration::SetSource(Int_t windowId, Int_t entryId) void TSourceCalibration::HandleTimer() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << ", fAcceptAllButton " << fAcceptAllButton << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << ", fAcceptAllButton " << fAcceptAllButton << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fEmitter == fStartButton) { SecondWindow(); } else if(fEmitter == fAcceptAllButton) { @@ -1703,7 +1703,7 @@ void TSourceCalibration::HandleTimer() void TSourceCalibration::Start() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fEmitter == nullptr) { // we only want to do this once at the beginning (after fEmitter was initialized to nullptr) fEmitter = fStartButton; TTimer::SingleShot(fWaitMs, "TSourceCalibration", this, "HandleTimer()"); @@ -1712,7 +1712,7 @@ void TSourceCalibration::Start() void TSourceCalibration::SecondWindow() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) // check that all sources have been set for(size_t i = 0; i < fSource.size(); ++i) { if(fSource[i] == nullptr) { @@ -1788,7 +1788,7 @@ void TSourceCalibration::BuildSecondInterface() fChannelTab[bin - 1] = new TChannelTab(this, fSource, projections, fMatrices[0]->GetXaxis()->GetBinLabel(bin), fTab->AddTab(fMatrices[0]->GetXaxis()->GetBinLabel(bin)), fDefaultSigma, fDefaultThreshold, fDefaultDegree, fSourceEnergy, fProgressBar); } - //if(fVerboseLevel > EVerbosity::kBasic) { std::cout << fMatrices.size() << " matrices with " << fMatrices[0]->GetNbinsX() << " x-bins, fNofBins " << fNofBins << ", fActualChannelId.size() " << fActualChannelId.size() << ", fChannelTab[0]->SourceTab()->GetNumberOfTabs() " << fChannelTab[0]->SourceTab()->GetNumberOfTabs() << std::endl; } + //if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << fMatrices.size() << " matrices with " << fMatrices[0]->GetNbinsX() << " x-bins, fNofBins " << fNofBins << ", fActualChannelId.size() " << fActualChannelId.size() << ", fChannelTab[0]->SourceTab()->GetNumberOfTabs() " << fChannelTab[0]->SourceTab()->GetNumberOfTabs() << std::endl; } //for(int i = 0; i < fChannelTab[0]->SourceTab()->GetNumberOfTabs(); ++i) { //if(fVerboseLevel > EVerbosity::kSubroutines) { std::cout << i << ": " << fChannelTab[0]->SourceTab()->GetTabTab(i)->GetText()->GetString() << std::endl; } @@ -1859,7 +1859,7 @@ void TSourceCalibration::BuildSecondInterface() void TSourceCalibration::MakeSecondConnections() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) fNavigationGroup->Connect("Clicked(Int_t)", "TSourceCalibration", this, "Navigate(Int_t)"); fTab->Connect("Selected(Int_t)", "TSourceCalibration", this, "SelectedTab(Int_t)"); // we don't need to connect the sigma, threshold, and degree number entries, those are automatically read when we start the calibration @@ -1872,7 +1872,7 @@ void TSourceCalibration::MakeSecondConnections() void TSourceCalibration::DisconnectSecond() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) fNavigationGroup->Disconnect("Clicked(Int_t)", this, "Navigate(Int_t)"); fTab->Disconnect("Selected(Int_t)", this, "SelectedTab(Int_t)"); for(auto* sourceTab : fChannelTab) { @@ -1890,8 +1890,8 @@ void TSourceCalibration::Navigate(Int_t id) int currentChannelId = fTab->GetCurrent(); int actualChannelId = fActualChannelId[currentChannelId]; int nofTabs = fTab->GetNumberOfTabs(); - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << ": id " << id << ", channel tab id " << currentChannelId << ", actual channel tab id " << actualChannelId << ", # of tabs " << nofTabs << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << "Before: active source tab of tab " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->Name() << ", #" << fTab->GetCurrent() << " = bin " << fActiveBins[fTab->GetCurrent()] << ": " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->ActiveSourceTab() << std::endl; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << ": id " << id << ", channel tab id " << currentChannelId << ", actual channel tab id " << actualChannelId << ", # of tabs " << nofTabs << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << "Before: active source tab of tab " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->Name() << ", #" << fTab->GetCurrent() << " = bin " << fActiveBins[fTab->GetCurrent()] << ": " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->ActiveSourceTab() << std::endl; } switch(id) { case ENavigate::kPrevious: // previous fTab->SetTab(currentChannelId - 1); @@ -1930,14 +1930,14 @@ void TSourceCalibration::Navigate(Int_t id) default: break; } - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DGREEN << "After: active source tab of tab " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->Name() << ", #" << fTab->GetCurrent() << " = bin " << fActiveBins[fTab->GetCurrent()] << ": " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->ActiveSourceTab() << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DGREEN << "After: active source tab of tab " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->Name() << ", #" << fTab->GetCurrent() << " = bin " << fActiveBins[fTab->GetCurrent()] << ": " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->ActiveSourceTab() << std::endl; } } void TSourceCalibration::SelectedTab(Int_t id) { /// Simple function that enables and disables the previous and next buttons depending on which tab was selected. /// Also sets gPad to the projection of the source selected in this tab. - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << ": id " << id << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << ": id " << id << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(id < 0) { return; } if(id == 0) { fPreviousButton->SetEnabled(false); @@ -1951,7 +1951,7 @@ void TSourceCalibration::SelectedTab(Int_t id) fNextButton->SetEnabled(true); } - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DGREEN << "active source tab of tab " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->Name() << ", #" << fTab->GetCurrent() << " = bin " << fActiveBins[fTab->GetCurrent()] << ": " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->ActiveSourceTab() << RESET_COLOR << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DGREEN << "active source tab of tab " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->Name() << ", #" << fTab->GetCurrent() << " = bin " << fActiveBins[fTab->GetCurrent()] << ": " << fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->ActiveSourceTab() << RESET_COLOR << std::endl; } if(fChannelTab[fActiveBins[id] - 1] == nullptr) { std::cout << "Failed to get fChannelTab[" << fActiveBins[id] - 1 << " = fActiveBins[" << id << "]-1]" << RESET_COLOR << std::endl; @@ -1969,15 +1969,15 @@ void TSourceCalibration::SelectedTab(Int_t id) std::cout << "Failed to get fChannelTab[" << fActiveBins[id] - 1 << " = fActiveBins[" << id << "]-1]->SelectedSourceTab()->ProjectionCanvas()->GetCanvas()" << RESET_COLOR << std::endl; return; } - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << DGREEN << "Changing gpad from \"" << gPad->GetName() << "\" to \""; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << DGREEN << "Changing gpad from \"" << gPad->GetName() << "\" to \""; } gPad = fChannelTab[fActiveBins[id] - 1]->SelectedSourceTab()->ProjectionCanvas()->GetCanvas(); fChannelTab[fActiveBins[id] - 1]->SelectedSourceTab()->ProjectionCanvas()->GetCanvas()->cd(); - if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasic) { std::cout << gPad->GetName() << "\"" << RESET_COLOR << std::endl; } + if(TSourceCalibration::VerboseLevel() > EVerbosity::kBasicFlow) { std::cout << gPad->GetName() << "\"" << RESET_COLOR << std::endl; } } void TSourceCalibration::AcceptChannel(const int& channelId) { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << ": channelId " << channelId << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << ": channelId " << channelId << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) // select the next (or if we are on the last tab, the previous) tab int nofTabs = fTab->GetNumberOfTabs(); @@ -2014,60 +2014,60 @@ void TSourceCalibration::AcceptChannel(const int& channelId) fEmitter = fAcceptAllButton; TTimer::SingleShot(fWaitMs, "TSourceCalibration", this, "HandleTimer()"); } - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << RESET_COLOR << std::flush; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << RESET_COLOR << std::flush; } } void TSourceCalibration::FindPeaks() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fChannelTab[fActiveBins[fTab->GetCurrent()] - 1] != nullptr) { fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->FindPeaks(Sigma(), Threshold(), PeakRatio(), true, false); // force = true, fast = false Calibrate(); } else { std::cout << __PRETTY_FUNCTION__ << ": fChannelTab[" << fActiveBins[fTab->GetCurrent()] << " = fActiveBins[" << fTab->GetCurrent() << "]] is a nullptr!" << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << RESET_COLOR << std::flush; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << RESET_COLOR << std::flush; } } void TSourceCalibration::FindPeaksFast() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fChannelTab[fActiveBins[fTab->GetCurrent()] - 1] != nullptr) { fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->FindPeaks(Sigma(), Threshold(), PeakRatio(), true, true); // force = true, fast = true Calibrate(); } else { std::cout << __PRETTY_FUNCTION__ << ": fChannelTab[" << fActiveBins[fTab->GetCurrent()] << " = fActiveBins[" << fTab->GetCurrent() << "]] is a nullptr!" << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << RESET_COLOR << std::flush; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << RESET_COLOR << std::flush; } } void TSourceCalibration::Calibrate() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fChannelTab[fActiveBins[fTab->GetCurrent()] - 1] != nullptr) { fChannelTab[fActiveBins[fTab->GetCurrent()] - 1]->Calibrate(Degree(), true); } else { std::cout << __PRETTY_FUNCTION__ << ": fChannelTab[" << fActiveBins[fTab->GetCurrent()] << " = fActiveBins[" << fTab->GetCurrent() << "]] is a nullptr!" << std::endl; // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) } - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << RESET_COLOR << std::flush; } + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << RESET_COLOR << std::flush; } } void TSourceCalibration::WriteCalibration() { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) std::ostringstream fileName; for(auto* source : fSource) { fileName << source->GetName(); } fileName << ".cal"; TChannel::WriteCalFile(fileName.str()); - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << ": wrote " << fileName.str() << " with " << TChannel::GetNumberOfChannels() << " channels" << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << ": wrote " << fileName.str() << " with " << TChannel::GetNumberOfChannels() << " channels" << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) if(fVerboseLevel > EVerbosity::kSubroutines) { TChannel::WriteCalFile(); } } void TSourceCalibration::PrintLayout() const { - if(fVerboseLevel > EVerbosity::kBasic) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) + if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << DGREEN << __PRETTY_FUNCTION__ << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) Print(); if(fBottomFrame != nullptr) { fBottomFrame->Print(); } From 81c780770b774860cd2a29af2066b0ae336386c1 Mon Sep 17 00:00:00 2001 From: VinzenzBildstein <7277216+VinzenzBildstein@users.noreply.github.com> Date: Mon, 13 Jan 2025 21:43:49 +0000 Subject: [PATCH 3/3] [MegaLinter] Apply linters automatic fixes --- libraries/TGUI/TSourceCalibration.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/TGUI/TSourceCalibration.cxx b/libraries/TGUI/TSourceCalibration.cxx index 32088154a55..bb333bb2f8a 100644 --- a/libraries/TGUI/TSourceCalibration.cxx +++ b/libraries/TGUI/TSourceCalibration.cxx @@ -1704,7 +1704,7 @@ void TSourceCalibration::HandleTimer() void TSourceCalibration::Start() { if(fVerboseLevel > EVerbosity::kBasicFlow) { std::cout << __PRETTY_FUNCTION__ << ": fEmitter " << fEmitter << ", fStartButton " << fStartButton << std::endl; } // NOLINT(cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-bounds-array-to-pointer-decay) - if(fEmitter == nullptr) { // we only want to do this once at the beginning (after fEmitter was initialized to nullptr) + if(fEmitter == nullptr) { // we only want to do this once at the beginning (after fEmitter was initialized to nullptr) fEmitter = fStartButton; TTimer::SingleShot(fWaitMs, "TSourceCalibration", this, "HandleTimer()"); }