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

Add variables to set region of photon emission #143

Closed
wants to merge 9 commits into from

Conversation

szhang17phys
Copy link

User can invoke the new variables directly at the fhicl file. Then region of photon emission can be determined based on the interest of the user, which is more flexible than the initial module, where photon emission vertices can only be spread in the whole space.

User can set values of these new variables directly, in which way the region of photon emissions can be set, based on the interest of the user.
@FNALbuild
Copy link
Contributor

A new Pull Request was created by @szhang17phys (Shuaixiang) for develop.

It involves the following packages:

larsim

@LArSoft/level-2-managers, @LArSoft/level-1-managers can you please review it and eventually sign? Thanks.

cms-bot commands are listed here

@FNALbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@FNALbuild
Copy link
Contributor

+code-checks (skipped because base branch is not develop)

@lgarren
Copy link
Member

lgarren commented Dec 9, 2024

code-checks

@FNALbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@FNALbuild
Copy link
Contributor

-code-checks
Pull request failed code-formatting checks. Please ensure that cetmodules has been setup and execute the following command from the top-level directory of your repository:

format-code \
  larsim/EventGenerator/PhotonGen_module.cc

Then commit the changes and push them to your PR branch.

@lgarren
Copy link
Member

lgarren commented Dec 9, 2024

@szhang17phys please run clang format as noted

@FNALbuild
Copy link
Contributor

Pull request #143 was updated. @LArSoft/level-1-managers, @LArSoft/level-2-managers can you please check and sign again.

@FNALbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@FNALbuild
Copy link
Contributor

-code-checks
Pull request failed code-formatting checks. Please ensure that cetmodules has been setup and execute the following command from the top-level directory of your repository:

format-code \
  larsim/EventGenerator/PhotonGen_module.cc

Then commit the changes and push them to your PR branch.

@FNALbuild
Copy link
Contributor

Pull request #143 was updated. @LArSoft/level-2-managers, @LArSoft/level-1-managers can you please check and sign again.

@FNALbuild
Copy link
Contributor

+code-checks

Copy link
Member

@knoepfel knoepfel left a comment

Choose a reason for hiding this comment

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

@szhang17phys, thank you for the PR. Please see the comments below.

Comment on lines 121 to 127
, fBminX{pset.get<double>("BminX")}
, fBmaxX{pset.get<double>("BmaxX")}
, fBminY{pset.get<double>("BminY")}
, fBmaxY{pset.get<double>("BmaxY")}
, fBminZ{pset.get<double>("BminZ")}
, fBmaxZ{pset.get<double>("BmaxZ")}

Copy link
Member

Choose a reason for hiding this comment

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

Two things:

  1. I'd rename the configuration parameters (e.g.) Xmin instead of BminX.
  2. Also, this change would require all users to specify "Bmin*" and "Bmax*" parameters in their configurations, and that is not always desired. It would be better to make it an option--i.e. if the parameter Ymin is provided, then it should override the value of fYmin.

Comment on lines 178 to 183
fXmin = fBminX;
fXmax = fBmaxX;
fYmin = fBminY;
fYmax = fBmaxY;
fZmin = fBminZ;
fZmax = fBmaxZ;
Copy link
Member

Choose a reason for hiding this comment

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

See above comment. These assignments should only be made when the configuration parameter is provided. Otherwise, the values of fXmin, fXmax, etc. should be set to CryoBounds.MinX(), etc.

@szhang17phys
Copy link
Author

Thanks for above nice comments! I will modify accordingly!

Copy link
Author

@szhang17phys szhang17phys left a comment

Choose a reason for hiding this comment

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

Names of new variables modified.

@FNALbuild
Copy link
Contributor

Pull request #143 was updated. @LArSoft/level-1-managers, @LArSoft/level-2-managers can you please check and sign again.

@FNALbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

The function of UserD is to determine whether applying user-defined region or not. The default value of UserD is false. Also, default values of all user-defined boundary variables, ex: BminX, BmaxX, are all set as 0; Only when UserD is set as true, can users  set the region of their own interests. When UserD is not mentioned in fhicl script, the default region is just the boundary of whole cryostat.
@FNALbuild
Copy link
Contributor

Pull request #143 was updated. @LArSoft/level-2-managers, @LArSoft/level-1-managers can you please check and sign again.

@FNALbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@FNALbuild
Copy link
Contributor

-code-checks
Pull request failed code-formatting checks. Please ensure that cetmodules has been setup and execute the following command from the top-level directory of your repository:

format-code \
  larsim/EventGenerator/PhotonGen_module.cc

Then commit the changes and push them to your PR branch.

@lgarren
Copy link
Member

lgarren commented Jan 10, 2025

@szhang17phys please run the code formatting #143 (comment)

Copy link
Member

@knoepfel knoepfel 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 the updates @szhang17phys --we're getting closer. I was thinking of something like this:

PhotonGen::PhotonGen(fhicl::ParameterSet const& pset)
  : ...
{
  if (auto boundaries = pset.get_if_present<fhicl::ParameterSet>("boundaries")) {
    fXmin = boundaries->get<double>("Xmin");
    fXmax = boundaries->get<double>("Xmax");
    fYmin = boundaries->get<double>("Ymin");
    fYmax = boundaries->get<double>("Ymax");
    fZmin = boundaries->get<double>("Zmin");
    fZmax = boundaries->get<double>("Zmax");
  }
  else {
    art::ServiceHandle<geo::Geometry const> geo;
    auto const CryoBounds = geo->Cryostat().Boundaries();
    fXmin = CryoBounds.MinX();
    fXmax = CryoBounds.MaxX();
    fYmin = CryoBounds.MinY();
    fYmax = CryoBounds.MaxY();
    fZmin = CryoBounds.MinZ();
    fZmax = CryoBounds.MaxZ();
  }
}

where boundaries would be a nested table in the configuration:

photonGen: {
  module_type: PhotonGen
  boundaries: {
    Xmin: ...
  }
}

If the boundaries parameter is in the configuration, then the module will take the parameters from the configuration; otherwise they will be provided by the geometry system. This involves the following changes:

  1. Removing the fUserD, fBmin*, and fBmax* variables, and
  2. Moving the setting of the fXmin (etc.) variables to the constructor.

Let me know if you have any questions.

@szhang17phys
Copy link
Author

Hello! Kyle. I think I got your idea: You do not want to introduce too many variables. fXmin* will replace my fBminX* in PhotonGen::PhotonGen(fhicl::ParameterSet const& pset). If fXmin, fXmax, ... are not pointed to certain values by user, they will get values from cryoBounds automatically. I agree that your proposal is more neat! I will modify again recently!

@FNALbuild
Copy link
Contributor

Pull request #143 was updated. @LArSoft/level-1-managers, @LArSoft/level-2-managers can you please check and sign again.

@FNALbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@FNALbuild
Copy link
Contributor

-code-checks
Pull request failed code-formatting checks. Please ensure that cetmodules has been setup and execute the following command from the top-level directory of your repository:

format-code \
  larsim/EventGenerator/PhotonGen_module.cc

Then commit the changes and push them to your PR branch.

@szhang17phys szhang17phys closed this by deleting the head repository Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Under discussion
Development

Successfully merging this pull request may close these issues.

4 participants