Skip to content

Commit

Permalink
Merge pull request #1492 from VinzenzBildstein/main
Browse files Browse the repository at this point in the history
Renamed Verbosity::kBasic to kBasicFlow
  • Loading branch information
VinzenzBildstein authored Jan 14, 2025
2 parents f3adfbf + b9867f7 commit ad6eae9
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 126 deletions.
2 changes: 1 addition & 1 deletion include/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 24 additions & 24 deletions libraries/GROOT/GH1D.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
}
Expand All @@ -287,7 +287,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window)
std::array<char, 2> 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)
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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();
}
}
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}
}
Expand All @@ -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) {
Expand All @@ -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 {
Expand Down Expand Up @@ -505,7 +505,7 @@ void GH1D::HandleEvent(Event_t* event, Window_t window)
}
RemoveCurrentRegion();
static_cast<TRegion*>(fRegions.Last())->Draw();
if(VerboseLevel() > EVerbosity::kBasic) {
if(VerboseLevel() > EVerbosity::kBasicFlow) {
PrintRegions();
}
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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;
}

Expand Down Expand Up @@ -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();
}
Expand All @@ -688,15 +688,15 @@ 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)) {
fLowX = stopX;
} else {
fHighX = stopX;
}
if(GH1D::VerboseLevel() > EVerbosity::kBasic) {
if(GH1D::VerboseLevel() > EVerbosity::kBasicFlow) {
std::cout << " => " << fLowX << " - " << fHighX << std::endl;
}
Update();
Expand Down
28 changes: 14 additions & 14 deletions libraries/TAnalysis/TCal/TEfficiencyCalibrator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ void TEfficiencyTab::Status(Int_t, Int_t px, Int_t py, TObject* selected)
TEfficiencyDatatypeTab::TEfficiencyDatatypeTab(TEfficiencyCalibrator* parent, std::vector<TNucleus*> nucleus, std::vector<std::tuple<TH1*, TH2*, TH2*>> 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
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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());
Expand All @@ -981,16 +981,16 @@ 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(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()");
}
}

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();
Expand All @@ -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) {
Expand Down Expand Up @@ -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();
Expand All @@ -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();
}
Expand Down
Loading

0 comments on commit ad6eae9

Please sign in to comment.