Skip to content
Draft
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
12 changes: 6 additions & 6 deletions src/TMS_Bar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,18 @@ bool TMS_Bar::FindModules(double xval, double yval, double zval) {

// If this is a y-bar, remove the y coordinate
if (BarOrient == kXBar) {
x = -99999000;
x = NAN;
// Flip the widths
double tempyw = yw;
yw = xw;
xw = tempyw;
} else if (BarOrient == kUBar || BarOrient == kVBar || BarOrient == kYBar) {
y = -99999000;
y = NAN;
// Don't need to flip the widths because they're already correct (yw = large, xw = 4cm)
} else {
x = -99999000;
y = -99999000;
z = -99999000;
x = NAN;
y = NAN;
z = NAN;
}

// Reset the geom navigator node level in case it's used again
Expand All @@ -133,7 +133,7 @@ bool TMS_Bar::FindModules(double xval, double yval, double zval) {
BarNumber += 1;
}
} else {
BarNumber = -999;
BarNumber = __TMS_BAD_INT__;
}

CheckBar();
Expand Down
8 changes: 4 additions & 4 deletions src/TMS_Bar.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TMS_Bar {
else if (BarOrient == kYBar) return x;
else if (BarOrient == kVBar) return x;
else if (BarOrient == kUBar) return x;
return -9999999999;
return NAN;
}

double GetXw() const { return xw; };
Expand All @@ -48,7 +48,7 @@ class TMS_Bar {
else if (BarOrient == kYBar) return xw;
else if (BarOrient == kVBar) return xw;
else if (BarOrient == kUBar) return xw;
return -9999999999;
return NAN;
}

void Print() const;
Expand All @@ -73,8 +73,8 @@ class TMS_Bar {
if (z > zmax || z < zmin) return false;

// Now check 2D point is inside in not z
double xmin = -9999999999999;
double xmax = 9999999999999;
double xmin = NAN;
double xmax = NAN;
//if (BarOrient == kXBar) {
// xmin = GetY() - GetYw() / 2;
// xmax = GetY() + GetYw() / 2;
Expand Down
2 changes: 1 addition & 1 deletion src/TMS_Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Number of maximum particles in an edep-sim event
#define __EDEP_SIM_MAX_PART__ 4000

#define __TMS_BAD_NUMBER__ -999.99
#define __TMS_BAD_INT__ -99999999

// Constants
namespace TMS_KinConst {
Expand Down
20 changes: 10 additions & 10 deletions src/TMS_Event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
int TMS_Event::EventCounter = 0;

TMS_Event::TMS_Event() {
EventNumber = -999;
EventNumber = __TMS_BAD_INT__;
SliceNumber = 0;
SpillNumber = -999;
nTrueTrajectories = -999;
VertexIdOfMostEnergyInEvent = -999;
SpillNumber = __TMS_BAD_INT__;
nTrueTrajectories = __TMS_BAD_INT__;
VertexIdOfMostEnergyInEvent = __TMS_BAD_INT__;
LightWeight = true;
}

Expand Down Expand Up @@ -41,7 +41,7 @@ TMS_Event::TMS_Event(TG4Event &event, bool FillEvent) {
SliceNumber = 0;
SpillNumber = EventCounter;
NSlices = 1; // By default there's at least one
VertexIdOfMostEnergyInEvent = -999;
VertexIdOfMostEnergyInEvent = __TMS_BAD_INT__;

// Check the integrity of the event
//CheckIntegrity();
Expand Down Expand Up @@ -192,7 +192,7 @@ TMS_Event::TMS_Event(TG4Event &event, bool FillEvent) {
for (TG4HitSegmentContainer::iterator kt = tms_hits.begin(); kt != tms_hits.end(); ++kt) {
TG4HitSegment edep_hit = *kt;
int track_id = edep_hit.GetPrimaryId();
int vertex_id = -999;
int vertex_id =__TMS_BAD_INT__ ;
auto value = mapping_track_to_vertex_id.find(track_id);
if (value == mapping_track_to_vertex_id.end()) {
//std::cout<<"Didn't find track id in mapping_track_to_vertex_id! track_id = "<<track_id<<", mapping_track_to_vertex_id.size() = "<<mapping_track_to_vertex_id.size()<<std::endl;
Expand Down Expand Up @@ -257,8 +257,8 @@ TMS_Event::TMS_Event(TMS_Event &event, int slice) : TMS_Hits(event.GetHits(slice
SpillNumber = event.SpillNumber;


nTrueTrajectories = -999;
VertexIdOfMostEnergyInEvent = -999;
nTrueTrajectories = __TMS_BAD_INT__;
VertexIdOfMostEnergyInEvent = __TMS_BAD_INT__;
LightWeight = true;
GetVertexIdOfMostVisibleEnergy();

Expand Down Expand Up @@ -828,7 +828,7 @@ int TMS_Event::GetVertexIdOfMostVisibleEnergy() {

// Now find the most energetic vertex
double max = -1e9;
int max_vertex_id = -999;
int max_vertex_id = __TMS_BAD_INT__;
double total_energy = 0;
for (auto it : TrueVisibleEnergyPerVertex) {
double vertex = it.first;
Expand Down Expand Up @@ -895,7 +895,7 @@ void TMS_Event::Print() {

double TMS_Event::GetMuonTrueKE() {
std::vector<TMS_TrueParticle> TrueParticles = GetTrueParticles();
double HighestKE = -999.99;
double HighestKE = __TMS_BAD_INT__;
for (auto it = TrueParticles.begin(); it != TrueParticles.end(); ++it) {
// Only save muon info for now
if (abs((*it).GetPDG()) != 13) continue;
Expand Down
4 changes: 2 additions & 2 deletions src/TMS_Geom.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ class TMS_Geom {
while (step < Unscale(__GEOM_LARGE_STEP__) && target_dist-dist > 0) {
// Plane, bar, global
int *Plane = new int[3];
for (int i = 0; i < 3; ++i) Plane[i] = -999;
for (int i = 0; i < 3; ++i) Plane[i] = __TMS_BAD_INT__;

std::string NodeName = std::string(geom->GetCurrentNode()->GetName());
const double *pt = geom->GetCurrentPoint();
Expand Down Expand Up @@ -502,7 +502,7 @@ class TMS_Geom {
}

// Don't push back if we're missing info; likely means the volume wasn't a scintillator bar
if (Plane[0] == -999 || Plane[1] == -999 || Plane[2] == -999) continue;
if (Plane[0] == __TMS_BAD_INT__|| Plane[1] == __TMS_BAD_INT__|| Plane[2] == __TMS_BAD_INT__) continue;

// Push back the information
std::pair<int*, TVector3> temp(Plane, Scale(pt_vec));
Expand Down
4 changes: 2 additions & 2 deletions src/TMS_Hit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ TMS_Hit::TMS_Hit(TG4HitSegment &edep_seg, int vertex_id) :
Time((edep_seg.GetStop().T()+edep_seg.GetStart().T())/2),
Slice(0),
#ifdef RECORD_HIT_DEADTIME
DeadtimeStart(-999.0),
DeadtimeStop(-999.0),
DeadtimeStart(NAN),
DeadtimeStop(NAN),
#endif
PedSuppressed(false),
PE(edep_seg.GetEnergyDeposit() * TMS_Readout_Manager::GetInstance().Get_Sim_Optical_LightYield()) {
Expand Down
12 changes: 6 additions & 6 deletions src/TMS_Reco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ void TMS_TrackFinder::EvaluateTrackFinding(TMS_Event &event) {
// Calculate the total track energy
double TMS_TrackFinder::CalculateTrackEnergy(const std::vector<TMS_Hit> &Candidate) {
// Look at the reconstructred tracks
if (Candidate.size() == 0) return -999.;
if (Candidate.size() == 0) return NAN;

// Sort by increasing z
//std::sort((*Candidate).begin(), (*Candidate).end(), TMS_Hit::SortByZInc);
Expand All @@ -1423,7 +1423,7 @@ double TMS_TrackFinder::CalculateTrackEnergy(const std::vector<TMS_Hit> &Candida

double TMS_TrackFinder::CalculateTrackEnergy3D(const TMS_Track &Track3D) {
// Look at the reconstructed tracks
if ((Track3D.Hits).size() == 0) return -999.;
if ((Track3D.Hits).size() == 0) return NAN;

double total = 0;
// Loop over each Hough Candidate and find the track energy
Expand All @@ -1434,15 +1434,15 @@ double TMS_TrackFinder::CalculateTrackEnergy3D(const TMS_Track &Track3D) {
}

double TMS_TrackFinder::CalculateTrackKEByRange(const TMS_Track &Track3D) {
if (Track3D.Length <= 0.0) return -999.0;
if (Track3D.Length <= 0.0) return NAN;

return 82. + 1.75*Track3D.Length; // Magic Clarence number
}

// Calculate the track length for each track
double TMS_TrackFinder::CalculateTrackLength(const std::vector<TMS_Hit> &Candidate) {
// Look at the reconstructed track
if (Candidate.size() == 0) return 999.;
if (Candidate.size() == 0) return NAN;

double final_total = 0;
int max_n_nodes_used = 0;
Expand Down Expand Up @@ -1480,7 +1480,7 @@ double TMS_TrackFinder::CalculateTrackLength(const std::vector<TMS_Hit> &Candida

double TMS_TrackFinder::CalculateTrackLength3D(const TMS_Track &Track3D) {
// Look at the reconstructed tracks
if ((Track3D.Hits).size() == 0) return -999.;
if ((Track3D.Hits).size() == 0) return NAN;

double final_total = 0;
int max_n_nodes_used = 0;
Expand Down Expand Up @@ -1978,7 +1978,7 @@ std::vector<TMS_Hit> TMS_TrackFinder::RunHough(const std::vector<TMS_Hit> &TMS_H
}

// Calculate 'x'-point of hit with Hough line
double HoughPoint = -9999999999; //HoughLineOne->Eval(zhit);
double HoughPoint = NAN; //HoughLineOne->Eval(zhit);
if (hitgroup == 'U') {
HoughPoint = HoughLineU->Eval(zhit);
} else if (hitgroup == 'V') {
Expand Down
2 changes: 1 addition & 1 deletion src/TMS_Reco.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class aNode {
//aNode(double xval, double yval, double ywval):
aNode(double xval, double yval) :
x(xval), y(yval),
HeuristicCost(__LARGE_COST__), NodeID(-999),
HeuristicCost(__LARGE_COST__), NodeID(__TMS_BAD_INT__),
//Heuristic(kManhattan) { // what calculator
Heuristic(HeuristicType::kEuclidean) { // what calculator
};
Expand Down
14 changes: 7 additions & 7 deletions src/TMS_Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ class TMS_Track {
void Print();

int Charge;
double Start[3]; // Start point in x,y,z
double End[3]; // End point in x,y,z
double Start[3]; // Start point in x,y,z, in mm
double End[3]; // End point in x,y,z, in mm
double Direction[3]; // Unit vector in track direction
double Length;
double Length; // in mm
double Occupancy;
double EnergyDeposit;
double EnergyRange;
double EnergyDeposit;// MeV
double EnergyRange; // MeV
double Time; // TODO: Fill this in a sensible way

double GetEnergyDeposit(){return EnergyDeposit;};
double GetEnergyRange(){return EnergyRange;};
double GetEnergyDeposit(){return EnergyDeposit;}; // MeV
double GetEnergyRange(){return EnergyRange;}; // MeV

int nHits;
std::vector<TMS_Hit> Hits;
Expand Down
Loading