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

Feature/howard v09370103p01 nuid features #236

Merged
merged 12 commits into from
Mar 24, 2022

Conversation

brucehoward-physics
Copy link
Contributor

Updated PR that uses v09_37 series as the base. Requires changes in larpandoracontent to be useful.

@cjbackhouse is this basically what you had in mind for the helper function?

Comment on lines 762 to 767
//......................................................................
template<class T, class U>
void CopyPropertyIfSet( const std::map<std::string, T> map, const std::string search, U &value )
{
if (map.count(search)) value = map.at(search);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

search should definitely be a const reference. I think map (bad name because it clashes with the type, maybe props?) should be too, but I think you will need to change the implementation to not use at(). You can use find() to get an iterator and dereference that.

Something like this

Suggested change
//......................................................................
template<class T, class U>
void CopyPropertyIfSet( const std::map<std::string, T> map, const std::string search, U &value )
{
if (map.count(search)) value = map.at(search);
}
//......................................................................
template<class T, class U>
void CopyPropertyIfSet( const std::map<std::string, T>& props, const std::string& search, U& value )
{
auto it = props.find(search);
if(it != props.end()) value = *it;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The map iterator returns a pair, so I think I want it->second instead of *it right? Update to method and removing the include noted below now committed. Does this seem better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this is what happens when I freestyle code... Looks good now, thanks.

@@ -35,6 +35,7 @@
#include "nusimdata/SimulationBase/MCTruth.h"

#include "sbnanaobj/StandardRecord/SRSlice.h"
#include "sbnanaobj/StandardRecord/SRNuID.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this include?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess SRSlice.h should bring in NuID.h in any case. I'll remove when I test the above suggestion on an event.

…h and change the CopyPropertyIfSet function a bit.
Copy link
Member

@PetrilloAtWork PetrilloAtWork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment about duplication of values in the code.
But in general good to go (although I would still like to see the names camel-cased).

Comment on lines 258 to 267
srslice.nuid.nufspfos = -9999.f;
srslice.nuid.nutothits = -1;
srslice.nuid.nuvtxy = -9999.f;
srslice.nuid.nuwgtdirz = -9999.f;
srslice.nuid.nusps = -9999.f;
srslice.nuid.nueigen = -9999.f;
srslice.nuid.crlongtrkdiry =-9999.f;
srslice.nuid.crlongtrkdef = -9999.f;
srslice.nuid.crlongtrkhitfrac = -9999.f;
srslice.nuid.crmaxhits = -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this what srslice.nuid.setDefault() is for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I suppose I could just run setDefault() here 😅 I can make this change when I make the Standard Record changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@henrylay97 henrylay97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for me. I appreciate the non-physical default values as requested in the previous iteration of this PR :D

@miquelnebot miquelnebot linked an issue Feb 23, 2022 that may be closed by this pull request
@jzennamo jzennamo removed the request for review from FernandaPsihas March 16, 2022 15:16
@miquelnebot miquelnebot changed the base branch from release/SBN2021C to release/SBN2022A March 23, 2022 12:18
@miquelnebot miquelnebot merged commit 991e3cf into release/SBN2022A Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting (Pandora) Nu Score BDT inputs from Pandora into CAF files
5 participants