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

Re-add get1DVarHist back into samplePDFFDBase #172

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

dbarrow257
Copy link
Contributor

Pull request description

During the previous merge, get1DVarHist was dropped. This was likely because of getting interaction mode information back from the ReturnKinematicVariable[ByReference] as it returns a double and mode was defined as an integer. Add this function back in whilst also defining the getNSamples and getNMCEvent functions.

Changes or fixes

Examples

Copy link

Hi @dbarrow257, thank you for contributing to MaCh3! Please wait for MaCh3 developers to review your PR. If no one answers within a week, please message people from this list: https://github.com/orgs/mach3-software/teams/mach3admin . While waiting, please enjoy this

meme

Use this action on your projects. Use jokes on issues instead.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This is your first PR, thank you for contributing to MaCh3!

@@ -7,7 +7,8 @@ struct fdmc_base {
int nupdg;
int nupdgUnosc;
bool signal; // true if signue
int nEvents; // how many MC events are there
int nEvents; // how many MC events are there
double ChannelIndex;
Copy link
Member

Choose a reason for hiding this comment

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

What is ChannelIndex?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In FD code, there is the concept of oscillation channels. Each oscillation channel has an associated FDMCStruct object. These channels' indexing depends entirely on the ordering defined in the sample YAML.

If you want to loop over each oscillation channel and make an event rate breakdown by oscChan, you need some way to select events in oscillationChannel j (j=6, for example). To do this from ReturnKinematicParameter, we need to store the index of the oscillation channel somewhere in it's memory, thus ChannelIndex.

You can get name of the j'th oscillationChannel index from FDMCStruct.flavourName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In DUNE code for example:

const double* samplePDFDUNEAtm::GetPointerToKinematicParameter(KinematicTypes KinPar, int iSample, int iEvent) {
  double* KinematicValue;


  switch (KinPar) {
  case kTrueNeutrinoEnergy:
    KinematicValue = &(dunemcSamples[iSample].rw_etru[iEvent]);
    break;
  case kRecoNeutrinoEnergy:
    KinematicValue = &(dunemcSamples[iSample].rw_erec[iEvent]);
    break;
  case kTrueCosZ:
    KinematicValue = &(dunemcSamples[iSample].rw_truecz[iEvent]);
    break;
  case kRecoCosZ:
    KinematicValue = &(dunemcSamples[iSample].rw_theta[iEvent]);
    break;
  case kOscChannel:
    KinematicValue = &(MCSamples[iSample].ChannelIndex);
    break;
  case kMode:
    KinematicValue = MCSamples[iSample].mode[iEvent];
    break;
  default:
    MACH3LOG_ERROR("Unknown KinPar: {}",KinPar);
    throw MaCh3Exception(__FILE__, __LINE__);
  }
  
  return KinematicValue;
}

@dbarrow257 dbarrow257 marked this pull request as ready for review October 22, 2024 12:44
@dbarrow257 dbarrow257 requested a review from EdAtkin as a code owner October 22, 2024 12:44
@dbarrow257 dbarrow257 merged commit daa631e into develop Oct 22, 2024
10 checks passed
@dbarrow257 dbarrow257 deleted the feature_FDVariablePlotting branch October 22, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants