Skip to content

Add a summary SpectrumConfig object to generator outputs#1845

Open
michaelmackenzie wants to merge 7 commits into
Mu2e:mainfrom
michaelmackenzie:SpectrumConfig
Open

Add a summary SpectrumConfig object to generator outputs#1845
michaelmackenzie wants to merge 7 commits into
Mu2e:mainfrom
michaelmackenzie:SpectrumConfig

Conversation

@michaelmackenzie
Copy link
Copy Markdown
Contributor

The goal of this data product is to simplify downstream workflows that need to know information about a dataset's primary generator configuration. This includes samples with restricted energy and cos(theta_z) regions. I've added default output of this product to all generators, even where the information is trivial, so downstream workflows will always find it and it can be updated to add more information if restrictions change.

@FNALbuild
Copy link
Copy Markdown
Collaborator

Hi @michaelmackenzie,
You have proposed changes to files in these packages:

  • MCDataProducts
  • EventGenerator

which require these tests: build.

@Mu2e/write, @Mu2e/fnalbuild-users have access to CI actions on main.

⌛ The following tests have been triggered for 4a17888: build (Build queue - API unavailable)

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild
Copy link
Copy Markdown
Collaborator

☔ The build tests failed for 4a17888.

Test Result Details
test with Command did not list any other PRs to include
merge Merged 4a17888 at 3d6f2fe
build (prof) Log file. Build time: 08 min 33 sec
ceSimReco Log file.
g4test_03MT Log file. Return Code 1.
transportOnly Log file. Return Code 1.
POT Log file.
g4study Log file. Return Code 1.
cosmicSimReco Log file. Return Code 1.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file. Return Code 9.
ceMix Log file. Return Code 1.
rootOverlaps Log file.
g4surfaceCheck Log file.
trigger Log file.
check_cmake Log file.
FIXME, TODO ➡️ TODO (0) FIXME (1) in 48 files
clang-tidy ➡️ 92 errors 709 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 4a17888 after being merged into the base branch at 3d6f2fe.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@michaelmackenzie
Copy link
Copy Markdown
Contributor Author

@FNALbuild run build test

@FNALbuild
Copy link
Copy Markdown
Collaborator

⌛ The following tests have been triggered for 8e2fd2d: build (Build queue - API unavailable)

@FNALbuild
Copy link
Copy Markdown
Collaborator

☔ The build tests failed for 8e2fd2d.

Test Result Details
test with Command did not list any other PRs to include
merge Merged 8e2fd2d at 3d6f2fe
build (prof) Log file. Build time: 04 min 39 sec
ceSimReco Log file.
g4test_03MT Log file. Return Code 1.
transportOnly Log file. Return Code 1.
POT Log file.
g4study Log file. Return Code 1.
cosmicSimReco Log file. Return Code 1.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file. Return Code 9.
ceMix Log file. Return Code 1.
rootOverlaps Log file.
g4surfaceCheck Log file.
trigger Log file.
check_cmake Log file.
FIXME, TODO ➡️ TODO (0) FIXME (1) in 48 files
clang-tidy ➡️ 92 errors 709 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 8e2fd2d after being merged into the base branch at 3d6f2fe.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@michaelmackenzie
Copy link
Copy Markdown
Contributor Author

@FNALbuild run build test

@FNALbuild
Copy link
Copy Markdown
Collaborator

⌛ The following tests have been triggered for 1ba6baf: build (Build queue - API unavailable)

@FNALbuild
Copy link
Copy Markdown
Collaborator

☔ The build tests failed for 1ba6baf.

Test Result Details
test with Command did not list any other PRs to include
merge Merged 1ba6baf at 83b5e2f
build (prof) Log file. Build time: 08 min 33 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file. Return Code 9.
ceMix Log file. Return Code 1.
rootOverlaps Log file.
g4surfaceCheck Log file.
trigger Log file.
check_cmake Log file.
FIXME, TODO ➡️ TODO (0) FIXME (1) in 48 files
clang-tidy ➡️ 92 errors 709 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 1ba6baf after being merged into the base branch at 83b5e2f.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@michaelmackenzie
Copy link
Copy Markdown
Contributor Author

@FNALbuild run build test

@FNALbuild
Copy link
Copy Markdown
Collaborator

⌛ The following tests have been triggered for 00a3573: build (Build queue - API unavailable)

@FNALbuild
Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at 00a3573.

Test Result Details
test with Command did not list any other PRs to include
merge Merged 00a3573 at 83b5e2f
build (prof) Log file. Build time: 04 min 26 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
trigger Log file.
check_cmake Log file.
FIXME, TODO ➡️ TODO (0) FIXME (1) in 48 files
clang-tidy ➡️ 92 errors 709 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 00a3573 after being merged into the base branch at 83b5e2f.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

Copy link
Copy Markdown
Collaborator

@brownd1978 brownd1978 left a comment

Choose a reason for hiding this comment

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

Thanks for introducing this Michael, it's an important addition to our simulation bookkeeping.

As defined, SpectrumConfig is a passive record of what the generators actually do. A stronger design is to also use the object to make selections in the generator, tying together implementation and recording. I believe this could be done reasonably efficiently using a map to associate values with variables, perhaps even inside ParticleGeneratorTool, which would simplify and standardize the individual generator implementation.

If the PDF associated with each restricted variable is known you could actually compute the fraction in SpectrumConfig. Please consider adding a constructor taking the PDF as a function as input for that case, to again standardize and simplify downstream code, either here or as a future upgrade.

The current design depends on the the input variables being independent, that should be clearly stated. I can think of counter examples. It might be possible to generalize SpectrumConfig to handle that, but it's not needed for this first implementation.

'type' makes more sense as an attribute of the variable, not the spectrum config. Then you can get rid of the 'other' type value, which is currently used to describe mixed flat and non-flat variable. If you provide the PDF function you could also have a value to describe that.

xmax_(xmax) {}

std::string name_ ;
double fraction_ ;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I suggest adding comments to describe these variables

if(verbose) printf(" Total fraction: %.4e\n", fraction);
return fraction;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I suggest adding a function to test a collection of values against the limits and return true/false if the values are in range, to be used downstream in a filter or other mechanism. To be proof against ordering errors I suggest to provide these as a map, with values keyed to the variable name, with the function requiring the names all match.

class SpectrumConfig {
public:
// Indicate the broad class of primary simulations this falls under
enum Type {kPhysical = 0, kFlat, kOther};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this enum associated with the composite object and not the individual variable? I could imagine a config restricting the range of flat and non-flat variables (say phi and theta) in a single object.


public: // allow direct access/manipulation of the fields
std::vector<RestrictedVar> vars_;
int type_;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why isn't this data member strongly typed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants