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

Add some checks in SimpleGBLTrajAliDriver etc #1038

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ private void setupPlots() {
aidaGBL.histogram1D(trkpFolder+"p_slot"+vol+charge,nbins_p,0.,pmax);

aidaGBL.histogram1D(trkpFolder+"Chi2"+vol+charge,nbins_t*2,0,200);
aidaGBL.histogram1D(trkpFolder+"Chi2oNDF"+vol+charge,nbins_t*2,0,50);
aidaGBL.histogram1D(trkpFolder+"Chi2oNDF"+vol+charge,nbins_t*2,0,20);
aidaGBL.histogram1D(trkpFolder+"nHits"+vol+charge,15,0,15);
aidaGBL.histogram1D(trkpFolder+"trk_extr_or_x"+vol+charge,nbins_t,-3,3);
aidaGBL.histogram1D(trkpFolder+"trk_extr_or_y"+vol+charge,nbins_t,-3,3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,13 @@ else if (trackSide == 1 && !TrackUtils.isHoleTrack(track))

List<GBLStripClusterData> trackGblStripClusterData = computeGBLStripClusterData(track,TrackType,
temp,gblStripClusterDataRelations,event);

//Printout the Cluster Data:



if(trackGblStripClusterData == null){
System.out.println("SimpleGBLTrajAliDriver::trackGblStripClusterData is null, skipping track");
continue;
}

//Printout the Cluster Data:
if (debugAlignmentDs) {
for (GBLStripClusterData strip : trackGblStripClusterData) {
System.out.format("SimpleGBLTrajAliDriver: TrackType="+TrackType);
Expand Down Expand Up @@ -809,17 +812,25 @@ else if (trackSide == 1 && !TrackUtils.isHoleTrack(track))
if (compositeAlign) {

//For the moment I form the global derivatives here, but in principle I should create them when I run the trajectory creator.

boolean isGood=true;
for ( GblPointJna gblpoint : points_on_traj) {


if (!doCOMAlignment)
ComputeStructureDerivatives(gblpoint);
else
ComputeCOMDerivatives(gblpoint);

}//point loop

if (!doCOMAlignment){
isGood=ComputeStructureDerivatives(gblpoint);
if(!isGood){
System.out.println("SimpleGBLTrajAli::ComputeStructureDerivatives globals derivatives probably have NaN");
break;
}
}
else{
isGood=ComputeCOMDerivatives(gblpoint);
if(!isGood){
System.out.println("SimpleGBLTrajAli::ComputeCOMDerivatives globals derivatives probably have NaN");
break;
}
}
}//point loop
if(!isGood)
continue; //skip Track if global derivatives are whack
}// composite Alignment

//Make a gblTrajectory with the points with all the composite derivatives + seed and write the record
Expand Down Expand Up @@ -1606,15 +1617,16 @@ public int compare(GBLStripClusterData strip1, GBLStripClusterData strip2) {
};


private void ComputeCOMDerivatives(GblPointJna gblpoint) {
private boolean ComputeCOMDerivatives(GblPointJna gblpoint) {
if (gblpoint.getNumMeasurements() == 0)
return;
return true;

List<Integer> labels = new ArrayList<Integer>();
Matrix g_ders = gblpoint.getGlobalLabelsAndDerivatives(labels);

if(g_ders.hasNaNs())
return false;
if (labels.size() < 1)
return;
return true;

//The MPII ID + Volume is used to get the correct composite structure
// 1 for top 2 for bottom
Expand Down Expand Up @@ -1662,7 +1674,7 @@ private void ComputeCOMDerivatives(GblPointJna gblpoint) {

if (alignable_sensor == null) {
System.out.println("Alignable Sensor " + mysensor.getName()+"_AV Not found in the alignment tree");
return;
return true;
}

//if (debugAlignmentDs) {
Expand Down Expand Up @@ -1729,7 +1741,7 @@ private void ComputeCOMDerivatives(GblPointJna gblpoint) {
}

gblpoint.addGlobals(all_labels,allDer);
return true;

}

Expand All @@ -1755,15 +1767,17 @@ private double getEoPCorrection(double xpar) {


//This will compute and add to the buffers the derivatives
private void ComputeStructureDerivatives(GblPointJna gblpoint) {
private boolean ComputeStructureDerivatives(GblPointJna gblpoint) {
if (gblpoint.getNumMeasurements() == 0)
return;
return true;

List<Integer> labels = new ArrayList<Integer>();
Matrix g_ders = gblpoint.getGlobalLabelsAndDerivatives(labels);

if(g_ders.hasNaNs())
return false;

if (labels.size() < 1)
return;
return true;

//The MPII ID + Volume is used to get the correct composite structure
// 1 for top 2 for bottom
Expand Down Expand Up @@ -1877,7 +1891,8 @@ private void ComputeStructureDerivatives(GblPointJna gblpoint) {
}

gblpoint.addGlobals(all_labels,allDer);

return true;
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,18 @@ public String toString() {
return tmp.toString();
}


public boolean hasNaNs(){
for (int i = 0; i < m; ++i) {
for (int j = 0; j < n; ++j) {
if( Double.isNaN(A[i][j]))
return true;
}
}
return false;
}


// /**
// * Read a matrix from a stream. The format is the same the print method, so
// * printed matrices can be read back in (provided they were printed using US
Expand Down Expand Up @@ -1433,6 +1445,7 @@ public Vector times(Vector b) {
return v;
}


// public void setToIdentity()
// {
// for (int i = 0; i < m; i++)
Expand Down
Loading