Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove explicit numeric limits #106

Merged
merged 4 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion macros/REST_Detector_CheckReadout.C
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ Int_t REST_Detector_CheckReadout(TString rootFile, TString name, Double_t region
vector<TGraph*> modGraph(nModConst);
vector<TLatex*> channelIDLabel(nPixConst);

double xmin = 1E9, xmax = -1E9, ymin = 1E9, ymax = -1E9;
double xmin = std::numeric_limits<Double_t>::max(), xmax = std::numeric_limits<Double_t>::min(),
ymin = std::numeric_limits<Double_t>::max(), ymax = std::numeric_limits<Double_t>::min();

Int_t graph = 0;
Int_t modGraphID = 0;
Expand Down
9 changes: 5 additions & 4 deletions macros/REST_Detector_ViewReadout.C
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ int REST_Detector_ViewReadout(TString rootFile, TString name = "", Int_t plane =
vector<TGraph*> modGraph(nModConst);
vector<TLatex*> channelIDLabel(nPixConst);

double xmin = 1E9, xmax = -1E9, ymin = 1E9, ymax = -1E9;
double xmin = std::numeric_limits<Double_t>::max(), xmax = std::numeric_limits<Double_t>::min(),
ymin = std::numeric_limits<Double_t>::max(), ymax = std::numeric_limits<Double_t>::min();

Int_t graph = 0;
Int_t modGraphID = 0;
Expand Down Expand Up @@ -120,9 +121,9 @@ int REST_Detector_ViewReadout(TString rootFile, TString name = "", Int_t plane =
// pixelGraph[graph]->SetMinimum( -200 );
// pixelGraph[graph]->GetXaxis()->SetLimits(-200,200);

Double_t xMin = 1e10;
Double_t yMin = 1e10;
Double_t xMax = -1e10;
Double_t xMin = numeric_limits<Double_t>::max();
Double_t yMin = numeric_limits<Double_t>::max();
Double_t xMax = numeric_limits<Double_t>::min();
for (int l = 0; l < 5; l++) {
if (x[l] < xMin) xMin = x[l];
if (y[l] < yMin) yMin = y[l];
Expand Down
2 changes: 1 addition & 1 deletion src/TRestDetectorDaqChannelSwitchingProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void TRestDetectorDaqChannelSwitchingProcess::InitProcess() {
auto mod = fReadout->GetReadoutModuleWithID(iter->first);
if (mod == nullptr) continue;
// finding out the old "firstdaqchannel" value
int mindaq = 1e9;
int mindaq = std::numeric_limits<Int_t>::max();
for (size_t i = 0; i < mod->GetNumberOfChannels(); i++) {
if (mod->GetChannel(i)->GetDaqID() < mindaq) {
mindaq = mod->GetChannel(i)->GetDaqID();
Expand Down
3 changes: 2 additions & 1 deletion src/TRestDetectorGarfieldDriftProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ void TRestDetectorGarfieldDriftProcess::InitProcess() {
fGfSensor->AddElectrode(fGeometry->GetGfComponent(0), "m");
fGfSensor->SetTimeWindow(0., 0.1, 500);

double xmin = -1e9, xmax = 1e9, ymin = -1e9, ymax = 1e9;
double xmin = std::numeric_limits<Double_t>::min(), xmax = std::numeric_limits<Double_t>::max(),
ymin = std::numeric_limits<Double_t>::min(), ymax = std::numeric_limits<Double_t>::max();
TGeoShape* readoutshape = fGeometry->GetReadoutElecNode(0)->GetVolume()->GetShape();
TGeoMatrix* readoutmatrix = fGeometry->GetReadoutElecNode(0)->GetMatrix();
double xmid = 10. * readoutmatrix->GetTranslation()[0],
Expand Down
2 changes: 1 addition & 1 deletion src/TRestDetectorGas.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ using namespace std;

ClassImp(TRestDetectorGas);

// const char* defaultServer = "https://sultan.unizar.es/gasFiles/";
// const char* defaultServer = "https://rest-for-physics.github.io/gas-files/";

/////////////////////////////////////////////
/// \brief TRestDetectorGas default constructor
Expand Down
2 changes: 1 addition & 1 deletion src/TRestDetectorHits3DReconstructionProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ TRestEvent* TRestDetectorHits3DReconstructionProcess::ProcessEvent(TRestEvent* i
.z();
double dz = maxz2 - maxz1;

double mindistmean = 1e9;
double mindistmean = std::numeric_limits<Double_t>::max();
for (double i = -fZRange * 2; i <= fZRange * 2; i += fZRange / 2) {
double distsum2 = 0;
for (auto hit : hits1) {
Expand Down
2 changes: 1 addition & 1 deletion src/TRestDetectorReadoutEventViewer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void TRestDetectorReadoutEventViewer::DrawReadoutPulses() {

int maxIndex;

zmin = 1E9;
zmin = std::numeric_limits<Double_t>::max();
zmax = 1E-9;

double z;
Expand Down
3 changes: 2 additions & 1 deletion src/TRestDetectorReadoutPlane.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ void TRestDetectorReadoutPlane::GetBoundaries(double& xmin, double& xmax, double
Double_t x[4];
Double_t y[4];

xmin = 1E9, xmax = -1E9, ymin = 1E9, ymax = -1E9;
xmin = std::numeric_limits<Double_t>::max(), xmax = std::numeric_limits<Double_t>::min(),
ymin = std::numeric_limits<Double_t>::max(), ymax = std::numeric_limits<Double_t>::min();

for (size_t mdID = 0; mdID < this->GetNumberOfModules(); mdID++) {
TRestDetectorReadoutModule* module = &fReadoutModules[mdID];
Expand Down
28 changes: 14 additions & 14 deletions src/TRestDetectorSignalEvent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ void TRestDetectorSignalEvent::Initialize() {
TRestEvent::Initialize();
fSignal.clear();
fPad = nullptr;
fMinValue = 1E10;
fMaxValue = -1E10;
fMinTime = 1E10;
fMaxTime = -1E10;
fMinValue = std::numeric_limits<Double_t>::max();
fMaxValue = std::numeric_limits<Double_t>::min();
fMinTime = std::numeric_limits<Double_t>::max();
fMaxTime = std::numeric_limits<Double_t>::min();
}

void TRestDetectorSignalEvent::AddSignal(const TRestDetectorSignal& signal) {
Expand Down Expand Up @@ -112,10 +112,10 @@ void TRestDetectorSignalEvent::PrintEvent() {

// TODO: GetMaxTimeFast, GetMinTimeFast, GetMaxValueFast that return the value of fMinTime, fMaxTime, etc.
void TRestDetectorSignalEvent::SetMaxAndMin() {
fMinValue = 1E10;
fMaxValue = -1E10;
fMinTime = 1E10;
fMaxTime = -1E10;
fMinValue = std::numeric_limits<Double_t>::max();
fMaxValue = std::numeric_limits<Double_t>::min();
fMinTime = std::numeric_limits<Double_t>::max();
fMaxTime = std::numeric_limits<Double_t>::min();

for (int s = 0; s < GetNumberOfSignals(); s++) {
if (fMinTime > fSignal[s].GetMinTime()) fMinTime = fSignal[s].GetMinTime();
Expand All @@ -137,7 +137,7 @@ Double_t TRestDetectorSignalEvent::GetMinValue() {
}

Double_t TRestDetectorSignalEvent::GetMinTime() {
Double_t minTime = 1.e10;
Double_t minTime = numeric_limits<Double_t>::max();
for (int s = 0; s < GetNumberOfSignals(); s++)
if (minTime > fSignal[s].GetMinTime()) {
minTime = fSignal[s].GetMinTime();
Expand All @@ -146,7 +146,7 @@ Double_t TRestDetectorSignalEvent::GetMinTime() {
}

Double_t TRestDetectorSignalEvent::GetMaxTime() {
Double_t maxTime = -1.e10;
Double_t maxTime = numeric_limits<Double_t>::min();
for (int s = 0; s < GetNumberOfSignals(); s++) {
if (maxTime < fSignal[s].GetMaxTime()) {
maxTime = fSignal[s].GetMaxTime();
Expand All @@ -166,10 +166,10 @@ TPad* TRestDetectorSignalEvent::DrawEvent(const TString& option) {
return nullptr;
}

fMinValue = 1E10;
fMaxValue = -1E10;
fMinTime = 1E10;
fMaxTime = -1E10;
fMinValue = std::numeric_limits<Double_t>::max();
fMaxValue = std::numeric_limits<Double_t>::min();
fMinTime = std::numeric_limits<Double_t>::max();
fMaxTime = std::numeric_limits<Double_t>::min();

fPad = new TPad(this->GetName(), " ", 0, 0, 1, 1);
fPad->Draw();
Expand Down
2 changes: 1 addition & 1 deletion src/TRestDetectorSingleChannelAnalysisProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ void TRestDetectorSingleChannelAnalysisProcess::FitChannelGain() {
TSpectrum spc;
int n = spc.Search(h);
double* peaks = spc.GetPositionX();
double min = 1e9;
double min = std::numeric_limits<Double_t>::max();
int minpos = 0;
for (int i = 0; i < n; i++) {
double dist = abs(peaks[i] - middle);
Expand Down
Loading