-
Notifications
You must be signed in to change notification settings - Fork 2
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
Kleykamp additional truth changes #116
Conversation
…so add various vars related to whether interaction started in TMS, etc
…le info if primary or deposited energy in TMS
Ran larger sample on grid and many jobs got held due to memory limits. Either from saving all particles, or there's a memory leak. Investigating |
For the averaging of TrackLengthU and TrackLengthV you mean the reco tracks or the truth ones? For the reco this shouldn't be necessary, as that is basically already done by using RecoX instead of the x position of the hits which averages the position of hit pairs when calculating the track length |
At last Friday's meeting we discussed merging this as the new variables seem to be (at least mostly) working correctly. |
Unfortunately there are no good answers. The idea behind the variable was to measure the start and stop points of the particle. The best solution is probably to find the exact point it enters the front of the TMS and make that the point you save, not base it on the z of the reco track. Otherwise you're always within 1 plane of the right answer. So we'd probably want to update the function to look for start and end points inside the TMS. If it can't find those, then find the point that we enter/exit the TMS, interpolating from the last point outside and the first point inside (and vice versa for exiting particles). So it's basically what you said, but based on the fiducial volume z (and x/y for side-entering particles) instead of reco z. And then there's the issue of reco tracks that are made from a particle that scatters and makes a continuing track. While technically two particles, we can treat that as a single track for the purposes of energy reconstruction. But currently we'd get the wrong starting or ending position for the track. Maybe our studies should simply add a cut to remove those for now, instead of trying to fix our definition. One could detect them by looking at the primary particle responsible for the front/back of a reco track and noticing that they're different. For now, we could try removing any reco track that has a substantial amount of energy from a secondary particle I don't see myself having any cycles to finish this in the near future so if you can pick up the mantle, that would be greatly appreciated! I also added |
Thanks for the detailed reply. I'm fairly sure I understand what's going on for these variables now (and know mostly where we're failing). For tweaking the variables to match the truth closer, this wasn't a significant issue in X and Y (for physics/geometry reasons) and the Z can be easily fixed. If @AsaNehm needs more than the Z fix it likely won't be until after the PDR. One thing I did want to bring up for discussion was whether a generic RecoTrackTrueVar should live in the Reco_Tree or in Truth_Info. My T2K brain says they should go in the Reco_Tree, as these are still reconstruction dependent quantities to some degree. |
Well they do have truth info, so that's why they're in truth_info. When we have real data, the truth tree can be turned off. If we have it in the reco tree, then we'd need to turn off those specific branches. And it increases the chance that someone might use them as reco quantities, not knowing that it's truth info. I think that's why we originally had the two separate trees |
setup.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully this is not to be confused with the existing setup file for the new OS on the fermilab machines. Did someone check this in detail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was to make it backwards compatible with ProcessND.py, which expects setup.sh for when it's running on sl7. We should actually have setup.sh check its os and then run either os-specific script and then we'll have the best of both worlds
|
||
//std::cout<<"N total: "<<nTotal<<", N Primary: "<<nPrimary<<", N Interesting: "<<nInteresting<<", N charged: "<<nCharged<<", N high P: "<<nHighMomentum<<", N charged and low P: "<<nChargedAndLowMomentum<<", n TMS_TruePrimaryParticles: "<<TMS_TruePrimaryParticles.size()<<std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed if not necessary or transformed into a #ifdef debug ... #endif
double GetTrackLength(std::vector<TVector3> nodes, bool ignore_y = false) { | ||
//std::cout<<"Getting track length for "<<nodes.size()<<" nodes"<<std::endl; | ||
double out = 0; | ||
if (nodes.size() != 19) return out; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is oddly specific. Why 19? Add comment at end of line?
for (size_t i = 0; i < GetPositionPoints().size(); i++) { | ||
double distance = abs(GetPositionPoints()[i].Z() - z); | ||
if (distance <= max_z_dist) { | ||
//std::cout << "pos: " << GetPositionPoints()[i].X() << ", "<< GetPositionPoints()[i].Y() << ", "<< GetPositionPoints()[i].Z() << " " << GetPositionPoints()[i].Z() - prev_z << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take out or transform into #ifdef debug ... #endif
@@ -1074,7 +1202,7 @@ void TMS_TreeWriter::Fill(TMS_Event &event) { | |||
nHitsIn3DTrack[itTrack] = (int) RecoTrack->Hits.size(); // Do we need to cast it? idk | |||
// std::cout << "TreeWriter number of hits: " << nHitsIn3DTrack[itTrack] << std::endl; | |||
RecoTrackEnergyRange[itTrack] = RecoTrack->EnergyRange; | |||
RecoTrackLength[itTrack] = RecoTrack->Length; | |||
RecoTrackLength[itTrack] = 0.5 * (TrackLengthU[itTrack] + TrackLengthV[itTrack]); // RecoTrack->Length;, 2d is better estimate than 3d because of y jumps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a TODO for later after the Kalman filter works?
if (particle_info.energies.size() > 1) { | ||
true_secondary_visible_energy = particle_info.energies[1]; | ||
true_secondary_particle_index = particle_info.indices[1]; | ||
//std::cout<<"checking for primary particle trackid"<<std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which part? It's saving the secondary particle info. The cout can be deleted though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's about the cout
@@ -1135,8 +1267,87 @@ void TMS_TreeWriter::Fill(TMS_Event &event) { | |||
if (itTrack < __TMS_MAX_LINES__) { | |||
setMomentum(RecoTrackPrimaryParticleTrueMomentumTrackStart[itTrack], tp.GetMomentumAtZ(start_z, max_z_distance)); | |||
setPosition(RecoTrackPrimaryParticleTruePositionTrackStart[itTrack], tp.GetPositionAtZ(start_z, max_z_distance)); | |||
//std::cout << "Setting tp shite: " << tp.GetPositionAtZ(start_z, max_z_distance).X() << " " << tp.GetPositionAtZ(start_z, max_z_distance).Y() << " " << tp.GetPositionAtZ(start_z, max_z_distance).Z() << ",\t" << start_z << " " << max_z_distance << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like @LiamOS's stash made it in based on the blame
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Builds and runs fine from my checks, I've also been using some of this code on the Kalman branch so I trust it.
Approving now, will begin merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from some cosmetics I also approve
Summary
Things still missing
Primary adjustments
Bugs:
Improvements:
Scripts: