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

Fix multi-period asymmetry calculation in MuonAnalysis interface #13102

Closed
raquelalvarezbanos opened this issue Jul 15, 2015 · 1 comment
Closed
Assignees
Labels
Muon Issues and pull requests related to muons
Milestone

Comments

@raquelalvarezbanos
Copy link
Contributor

James Lord reported:

When adding two periods before analysis, it should add the counts and then calculate the asymmetry. At present it appears to calculate asymmetries for each period and then add them. That makes it difficult to compare data when there are two Off periods and one On, for example.

The MuonAnalysis interface executes MuonCalculateAsymmetry as a child algorithm to perform this computation, therefore, the latter should be fixed.

As far as I can see MuonCalculateAsymmetry is used by:

  • MuonLoad
  • The muon analysis interface

Will have to review and possibly update MuonLoadTest. The fix may also break MuonLoadTest system test. The MuonAnalysis interface has no tests.

@raquelalvarezbanos raquelalvarezbanos added the Muon Issues and pull requests related to muons label Jul 15, 2015
@raquelalvarezbanos raquelalvarezbanos self-assigned this Jul 15, 2015
@raquelalvarezbanos raquelalvarezbanos added this to the Release 3.5 milestone Jul 15, 2015
@raquelalvarezbanos
Copy link
Contributor Author

I think James is right about the calculation. In the MuonAnalysis interface, this is done by executing MuonCalculateAsymmetry as a child algorithm. Looking deeper into this algorithm's code, I see:

void MuonCalculateAsymmetry::exec() {
  MatrixWorkspace_sptr firstPeriodWS = getProperty("FirstPeriodWorkspace");
  MatrixWorkspace_sptr secondPeriodWS = getProperty("SecondPeriodWorkspace");

  MatrixWorkspace_sptr firstConverted = convertWorkspace(firstPeriodWS);

  if (secondPeriodWS) {
    // Two periods
    MatrixWorkspace_sptr secondConverted = convertWorkspace(secondPeriodWS);

    setProperty("OutputWorkspace",
                mergePeriods(firstConverted, secondConverted));
  } else {
    // Single period only

    setProperty("OutputWorkspace", firstConverted);
  }
}

convertWorkspace() is a method that returns the asymmetry. Therefore, as it can be seen from the code, we first compute the asymmetries (one per input ws, in case two ws are provided) and then "merge" the results to finally store the output ws in the ADS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Muon Issues and pull requests related to muons
Projects
None yet
Development

No branches or pull requests

1 participant