mirror of
https://github.com/gwm17/Specter.git
synced 2024-11-22 18:28:52 -05:00
Clean out old NavProject directory
This commit is contained in:
parent
aaf2cc325f
commit
1a280858cc
File diff suppressed because it is too large
Load Diff
|
@ -1,34 +0,0 @@
|
|||
Font Awesome Free License
|
||||
-------------------------
|
||||
|
||||
Font Awesome Free is free, open source, and GPL friendly. You can use it for
|
||||
commercial projects, open source projects, or really almost whatever you want.
|
||||
Full Font Awesome Free license: https://fontawesome.com/license/free.
|
||||
|
||||
# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
|
||||
In the Font Awesome Free download, the CC BY 4.0 license applies to all icons
|
||||
packaged as SVG and JS file types.
|
||||
|
||||
# Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL)
|
||||
In the Font Awesome Free download, the SIL OFL license applies to all icons
|
||||
packaged as web and desktop font files.
|
||||
|
||||
# Code: MIT License (https://opensource.org/licenses/MIT)
|
||||
In the Font Awesome Free download, the MIT license applies to all non-font and
|
||||
non-icon files.
|
||||
|
||||
# Attribution
|
||||
Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
|
||||
Awesome Free files already contain embedded comments with sufficient
|
||||
attribution, so you shouldn't need to do anything additional when using these
|
||||
files normally.
|
||||
|
||||
We've kept attribution comments terse, so we ask that you do not actively work
|
||||
to remove them from files, especially code. They're a great way for folks to
|
||||
learn about Font Awesome.
|
||||
|
||||
# Brand Icons
|
||||
All brand icons are trademarks of their respective owners. The use of these
|
||||
trademarks does not indicate endorsement of the trademark holder by Font
|
||||
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
|
||||
to represent the company, product, or service to which they refer.**
|
|
@ -1,202 +0,0 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
MassMap.h
|
||||
A represnetation of the AMDC mass table. We provide capability to retrieve the mass of an isotope
|
||||
as well as the isotopic symbol. This sort of code is pretty ubiquitous in flexible nuclear physics
|
||||
analysis.
|
||||
|
||||
GWM -- Feb 2022
|
||||
*/
|
||||
#include "MassMap.h"
|
||||
|
||||
/*
|
||||
Read in AMDC mass file, preformated to remove excess info. Here assumes that by default
|
||||
the file is in a local directory Resources. Navigator build process handles this.
|
||||
*/
|
||||
MassMap::MassMap()
|
||||
{
|
||||
NAV_PROFILE_FUNCTION();
|
||||
std::ifstream massfile("Assets/amdc2016_mass.txt");
|
||||
if (massfile.is_open())
|
||||
{
|
||||
std::string junk, A, element;
|
||||
int Z;
|
||||
double atomicMassBig, atomicMassSmall, isotopicMass;
|
||||
getline(massfile, junk);
|
||||
getline(massfile, junk);
|
||||
while (massfile >> junk)
|
||||
{
|
||||
massfile >> Z >> A >> element >> atomicMassBig >> atomicMassSmall;
|
||||
isotopicMass = (atomicMassBig + atomicMassSmall * 1e-6 - Z * electron_mass) * u_to_mev;
|
||||
std::string key = "(" + std::to_string(Z) + "," + A + ")";
|
||||
massTable[key] = isotopicMass;
|
||||
elementTable[Z] = element;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NAV_ERROR("Unable to load mass file! Make sure that the Resources folder exists!");
|
||||
}
|
||||
}
|
||||
|
||||
MassMap::~MassMap() {}
|
||||
|
||||
//Returns nuclear mass in MeV
|
||||
double MassMap::FindMass(int Z, int A)
|
||||
{
|
||||
NAV_PROFILE_FUNCTION();
|
||||
std::string key = "(" + std::to_string(Z) + "," + std::to_string(A) + ")";
|
||||
auto data = massTable.find(key);
|
||||
if (data == massTable.end())
|
||||
{
|
||||
NAV_ERROR("Invalid nucleus at MassMap::FindMass()! Z: {0} A: {1}", Z, A);
|
||||
return 0.0;
|
||||
}
|
||||
return data->second;
|
||||
}
|
||||
|
||||
//returns element symbol
|
||||
std::string MassMap::FindSymbol(int Z, int A)
|
||||
{
|
||||
NAV_PROFILE_FUNCTION();
|
||||
auto data = elementTable.find(Z);
|
||||
if (data == elementTable.end())
|
||||
{
|
||||
NAV_ERROR("Invalid nucleus at MassMap::FindSymbol()! Z: {0} A: {1}", Z, A);
|
||||
return "";
|
||||
}
|
||||
std::string fullsymbol = std::to_string(A) + data->second;
|
||||
return fullsymbol;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
MassMap.h
|
||||
A represnetation of the AMDC mass table. We provide capability to retrieve the mass of an isotope
|
||||
as well as the isotopic symbol. This sort of code is pretty ubiquitous in flexible nuclear physics
|
||||
analysis.
|
||||
|
||||
GWM -- Feb 2022
|
||||
*/
|
||||
#ifndef MASS_MAP_H
|
||||
#define MASS_MAP_H
|
||||
|
||||
#include "Navigator.h"
|
||||
|
||||
class MassMap
|
||||
{
|
||||
public:
|
||||
MassMap();
|
||||
~MassMap();
|
||||
double FindMass(int Z, int A);
|
||||
std::string FindSymbol(int Z, int A);
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, double> massTable;
|
||||
std::unordered_map<int, std::string> elementTable;
|
||||
|
||||
//constants
|
||||
static constexpr double u_to_mev = 931.4940954;
|
||||
static constexpr double electron_mass = 0.000548579909;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,135 +0,0 @@
|
|||
/*
|
||||
SPSAnalysisStage.cpp
|
||||
Example of a user AnalysisStage. This one is based around the SE-SPS detector system in FoxLab at FSU.
|
||||
|
||||
GWM -- Feb 2022
|
||||
*/
|
||||
#include "SPSAnalysisStage.h"
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
//Construct each NavParameter with their unique name. Then bind them to the SpectrumManager.
|
||||
SPSAnalysisStage::SPSAnalysisStage() :
|
||||
AnalysisStage("SPSAnalysis"), delayFLTime("delayFLTime"), delayFRTime("delayFRTime"), delayBLTime("delayBLTime"), delayBRTime("delayBRTime"), x1("x1"), x2("x2"), xavg("xavg"),
|
||||
scintLeft("scintLeft"), anodeBack("anodeBack"), anodeFront("anodeFront"), cathode("cathode"), xavg_sabreCoinc("xavg_sabreCoinc"), x1_weight("x1_weight"), x2_weight("x2_weight")
|
||||
{
|
||||
NAV_PROFILE_FUNCTION();
|
||||
SpectrumManager& manager = SpectrumManager::GetInstance();
|
||||
manager.BindParameter(delayFLTime);
|
||||
manager.BindParameter(delayFRTime);
|
||||
manager.BindParameter(delayBLTime);
|
||||
manager.BindParameter(delayBRTime);
|
||||
//Bind parameters with some default histograms. Saves us the effort of making them in the UI.
|
||||
manager.BindParameter(x1, 600, -300.0, 300.0);
|
||||
manager.BindParameter(x2, 600, -300.0, 300.0);
|
||||
manager.BindParameter(xavg, 600, -300.0, 300.0);
|
||||
manager.BindParameter(scintLeft, 4096, 0.0, 4096.0);
|
||||
manager.BindParameter(anodeBack, 4096, 0.0, 4096.0);
|
||||
manager.BindParameter(anodeFront, 4096, 0.0, 4096.0);
|
||||
manager.BindParameter(cathode, 4096, 0.0, 4096);
|
||||
manager.BindParameter(xavg_sabreCoinc, 600, -300.0, 300.0);
|
||||
|
||||
std::vector<std::string> sabre_list;
|
||||
for (int i = 0; i < 127; i++)
|
||||
{
|
||||
sabre_list.push_back("sabre_" + std::to_string(i));
|
||||
sabre.emplace_back(sabre_list[i]);
|
||||
manager.BindParameter(sabre[i]);
|
||||
}
|
||||
|
||||
//If you want to make a histogram default available, you can add one like this.
|
||||
manager.AddHistogramSummary(HistogramArgs("sabre_summary", "", 512, 0.0, 16384), sabre_list);
|
||||
//Note that if you save a config, the config rep of this histogram will supercede this version.
|
||||
|
||||
manager.BindVariable(x1_weight);
|
||||
manager.BindVariable(x2_weight);
|
||||
}
|
||||
|
||||
SPSAnalysisStage::~SPSAnalysisStage() {}
|
||||
|
||||
//Do some physics!
|
||||
void SPSAnalysisStage::AnalyzePhysicsEvent(const NavEvent& event)
|
||||
{
|
||||
|
||||
NAV_PROFILE_FUNCTION();
|
||||
//Most analysis stages will start kinda like this. Take the raw event data and
|
||||
//put it into NavParameters using the hit id. Switches are perfect for this. Can also
|
||||
//create mapping classes to use text-file-based id association (commonly called channel maps).
|
||||
bool sabreFlag = false;
|
||||
for(auto& hit : event)
|
||||
{
|
||||
if (hit.id < 127)
|
||||
{
|
||||
sabreFlag = true;
|
||||
if (hit.longEnergy > sabre[hit.id].GetValue())
|
||||
sabre[hit.id].SetValue(hit.longEnergy);
|
||||
}
|
||||
switch (hit.id)
|
||||
{
|
||||
case 129:
|
||||
{
|
||||
if (hit.longEnergy > scintLeft.GetValue())
|
||||
scintLeft.SetValue(hit.longEnergy);
|
||||
break;
|
||||
}
|
||||
case 135:
|
||||
{
|
||||
if (hit.longEnergy > cathode.GetValue())
|
||||
cathode.SetValue(hit.longEnergy);
|
||||
break;
|
||||
}
|
||||
case 136:
|
||||
{
|
||||
if (!delayFLTime.IsValid())
|
||||
delayFLTime.SetValue(hit.timestamp / 1.0e3);
|
||||
break;
|
||||
}
|
||||
case 137:
|
||||
{
|
||||
if (!delayFRTime.IsValid())
|
||||
delayFRTime.SetValue(hit.timestamp / 1.0e3);
|
||||
break;
|
||||
}
|
||||
case 138:
|
||||
{
|
||||
if (!delayBLTime.IsValid())
|
||||
delayBLTime.SetValue(hit.timestamp / 1.0e3);
|
||||
break;
|
||||
}
|
||||
case 139:
|
||||
{
|
||||
if (!delayBRTime.IsValid())
|
||||
delayBRTime.SetValue(hit.timestamp / 1.0e3);
|
||||
break;
|
||||
}
|
||||
case 141:
|
||||
{
|
||||
if (hit.longEnergy > anodeFront.GetValue())
|
||||
anodeFront.SetValue(hit.longEnergy);
|
||||
break;
|
||||
}
|
||||
case 143:
|
||||
{
|
||||
if (hit.longEnergy > anodeBack.GetValue())
|
||||
anodeBack.SetValue(hit.longEnergy);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If you want to use parameters to calculate another parameter, you
|
||||
//need to check that the parameter is valid (set in this event)!
|
||||
if(delayFLTime.IsValid() && delayFRTime.IsValid())
|
||||
x1.SetValue((delayFLTime.GetValue() - delayFRTime.GetValue())*0.5*0.4762);
|
||||
|
||||
if(delayBLTime.IsValid() && delayBRTime.IsValid())
|
||||
x2.SetValue((delayBLTime.GetValue() - delayBRTime.GetValue())*0.5*0.5051);
|
||||
|
||||
if (x1.IsValid() && x2.IsValid())
|
||||
{
|
||||
xavg.SetValue(x1_weight.GetValue() * x1.GetValue() + x2_weight.GetValue() * x2.GetValue());
|
||||
if (sabreFlag)
|
||||
xavg_sabreCoinc.SetValue(xavg.GetValue());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
SPSAnalysisStage.h
|
||||
Example of a user AnalysisStage. This one is based around the SE-SPS detector system in FoxLab at FSU.
|
||||
|
||||
GWM -- Feb 2022
|
||||
*/
|
||||
#include "Navigator.h"
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
class SPSAnalysisStage : public AnalysisStage
|
||||
{
|
||||
public:
|
||||
SPSAnalysisStage();
|
||||
virtual ~SPSAnalysisStage();
|
||||
|
||||
virtual void AnalyzePhysicsEvent(const NavEvent& event) override;
|
||||
|
||||
private:
|
||||
//Create a bunch of parameters
|
||||
Parameter delayFLTime;
|
||||
Parameter delayFRTime;
|
||||
Parameter delayBLTime;
|
||||
Parameter delayBRTime;
|
||||
Parameter x1;
|
||||
Parameter x2;
|
||||
Parameter xavg;
|
||||
Parameter scintLeft;
|
||||
Parameter anodeBack;
|
||||
Parameter anodeFront;
|
||||
Parameter cathode;
|
||||
Parameter xavg_sabreCoinc;
|
||||
|
||||
std::vector<Parameter> sabre;
|
||||
|
||||
//Create a few variables
|
||||
Variable x1_weight;
|
||||
Variable x2_weight;
|
||||
};
|
||||
|
||||
}
|
|
@ -1,140 +0,0 @@
|
|||
/*
|
||||
SPSInputLayer.cpp
|
||||
An example of what a user created layer might look like. This is how one would extend the base editor to have more
|
||||
functionality, specific to their experiment/setup. In this case, we provide inputs for reaction information so that
|
||||
the kinematic shift of the SE-SPS focal plane can be calculated, and weights for tracing particle trajectories are
|
||||
produced for use in analysis (as NavVariables).
|
||||
|
||||
A reminder that these layers should not be that intense. The more work that is shoved into the UI, the less responsive
|
||||
and more sluggish overall the UI will become. The vast bulk of the analysis work should be left to the PhysicsLayer which has its own
|
||||
thread to work upon.
|
||||
|
||||
GWM -- Feb 2022
|
||||
*/
|
||||
#include "SPSInputLayer.h"
|
||||
#include "imgui.h"
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
SPSInputLayer::SPSInputLayer() :
|
||||
Layer("SPSInputLayer"), x1_weight("x1_weight"), x2_weight("x2_weight"), m_bfield(0.0), m_theta(0.0), m_beamKE(0.0),
|
||||
m_rxnEqn("")
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
m_targNums[i] = 0;
|
||||
m_projNums[i] = 0;
|
||||
m_ejectNums[i] = 0;
|
||||
m_residNums[i] = 0;
|
||||
}
|
||||
|
||||
SpectrumManager& manager = SpectrumManager::GetInstance();
|
||||
manager.BindVariable(x1_weight);
|
||||
manager.BindVariable(x2_weight);
|
||||
}
|
||||
|
||||
SPSInputLayer::~SPSInputLayer() {}
|
||||
|
||||
void SPSInputLayer::OnAttach() {}
|
||||
|
||||
void SPSInputLayer::OnDetach() {}
|
||||
|
||||
void SPSInputLayer::OnUpdate(Timestep& step) {}
|
||||
|
||||
void SPSInputLayer::OnEvent(Event& event) {}
|
||||
|
||||
void SPSInputLayer::OnImGuiRender()
|
||||
{
|
||||
NAV_PROFILE_FUNCTION();
|
||||
if (ImGui::Begin("SPS Input"))
|
||||
{
|
||||
//Create widgets for all of our inputs
|
||||
ImGui::InputDouble("Bfield(kG)", &m_bfield, 0.01, 0.1);
|
||||
ImGui::InputDouble("Theta(deg)", &m_theta, 0.1, 1.0);
|
||||
ImGui::InputDouble("BeamKE(MeV)", &m_beamKE, 0.1, 1.0);
|
||||
ImGui::InputInt2("Target Z,A", m_targNums);
|
||||
ImGui::InputInt2("Projectile Z,A", m_projNums);
|
||||
ImGui::InputInt2("Ejectile Z,A", m_ejectNums);
|
||||
if (ImGui::Button("Set"))
|
||||
{
|
||||
//We dont want to calculate the weights every frame, so
|
||||
//we lock that calculation behind a button.
|
||||
UpdateWeights();
|
||||
}
|
||||
//Display some info about the internal state
|
||||
ImGui::Text("-------Current Settings-------");
|
||||
ImGui::Text("Reaction Equation: ");
|
||||
ImGui::SameLine();
|
||||
ImGui::Text(m_rxnEqn.c_str());
|
||||
ImGui::Text("X1 Weight: %f", x1_weight.GetValue());
|
||||
ImGui::Text("X2 Weight: %f", x2_weight.GetValue());
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void SPSInputLayer::UpdateWeights()
|
||||
{
|
||||
NAV_PROFILE_FUNCTION();
|
||||
m_rxnEqn = ""; //reset
|
||||
|
||||
//Calculate residual nucleus from reaction
|
||||
for (int i = 0; i < 2; i++)
|
||||
m_residNums[i] = m_targNums[i] + m_projNums[i] - m_ejectNums[i];
|
||||
if (m_residNums[0] < 0 || m_residNums[1] <= 0)
|
||||
{
|
||||
NAV_ERROR("Invalid residual nucleus at SPSInputLayer::UpdateMasses()! ZR: {0} AR: {1}", m_residNums[0], m_residNums[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_bfield == 0.0 || m_beamKE == 0.0)
|
||||
{
|
||||
NAV_ERROR("Invaild kinematic settings at SPSInputLayer::UpdateWeights()! BeamKE: {0} Bfield: {1}", m_beamKE, m_bfield);
|
||||
return;
|
||||
}
|
||||
|
||||
//Obtain masses from the AMDC table
|
||||
double targMass = m_masses.FindMass(m_targNums[0], m_targNums[1]);
|
||||
double projMass = m_masses.FindMass(m_projNums[0], m_projNums[1]);
|
||||
double ejectMass = m_masses.FindMass(m_ejectNums[0], m_ejectNums[1]);
|
||||
double residMass = m_masses.FindMass(m_residNums[0], m_residNums[1]);
|
||||
if (targMass == 0.0 || projMass == 0.0 || ejectMass == 0.0 || residMass == 0.0)
|
||||
return;
|
||||
|
||||
std::string temp;
|
||||
temp = m_masses.FindSymbol(m_targNums[0], m_targNums[1]);
|
||||
m_rxnEqn += temp + "(";
|
||||
temp = m_masses.FindSymbol(m_projNums[0], m_projNums[1]);
|
||||
m_rxnEqn += temp + ",";
|
||||
temp = m_masses.FindSymbol(m_ejectNums[0], m_ejectNums[1]);
|
||||
m_rxnEqn += temp + ")";
|
||||
temp = m_masses.FindSymbol(m_residNums[0], m_residNums[1]);
|
||||
m_rxnEqn += temp;
|
||||
|
||||
double theta_rad = m_theta * c_deg2rad; //convert to radians
|
||||
double bfield_t = m_bfield * 0.1; //convert to tesla
|
||||
double Q = targMass + projMass - ejectMass - residMass;
|
||||
//kinematics a la Iliadis p.590
|
||||
double term1 = std::sqrt(projMass * ejectMass * m_beamKE) / (ejectMass + residMass) * std::cos(theta_rad);
|
||||
double term2 = (m_beamKE * (residMass - projMass) + residMass * Q) / (ejectMass + residMass);
|
||||
|
||||
double ejectKE = term1 + std::sqrt(term1 * term1 + term2);
|
||||
ejectKE *= ejectKE;
|
||||
|
||||
//momentum
|
||||
double ejectP = std::sqrt(ejectKE * (ejectKE + 2.0 * ejectMass));
|
||||
|
||||
//calculate rho from B a la B*rho = (proj. momentum)/(proj. charge)
|
||||
double rho = (ejectP * c_mev2j) / (m_ejectNums[0] * c_e * c_C * bfield_t) * 100.0; //in cm
|
||||
|
||||
double K;
|
||||
K = sqrt(projMass * ejectMass * m_beamKE / ejectKE);
|
||||
K *= std::sin(theta_rad);
|
||||
|
||||
double denom = ejectMass + residMass - std::sqrt(projMass * ejectMass * m_beamKE / ejectKE) * std::cos(theta_rad);
|
||||
|
||||
K /= denom;
|
||||
double zshift = -1 * rho * c_spsDisp * c_spsMag * K; //delta-Z in cm
|
||||
x1_weight.SetValue((0.5 - zshift / c_wireDist));
|
||||
x2_weight.SetValue((1.0 - x1_weight.GetValue()));
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
SPSInputLayer.h
|
||||
An example of what a user created layer might look like. This is how one would extend the base editor to have more
|
||||
functionality, specific to their experiment/setup. In this case, we provide inputs for reaction information so that
|
||||
the kinematic shift of the SE-SPS focal plane can be calculated, and weights for tracing particle trajectories are
|
||||
produced for use in analysis (as Variables).
|
||||
|
||||
A reminder that these layers should not be that intense. The more work that is shoved into the UI, the less responsive
|
||||
and more sluggish overall the UI will become. The vast bulk of the analysis work should be left to the PhysicsLayer which has its own
|
||||
thread to work upon.
|
||||
|
||||
GWM -- Feb 2022
|
||||
*/
|
||||
#ifndef SPS_INPUT_LAYER_H
|
||||
#define SPS_INPUT_LAYER_H
|
||||
|
||||
#include "Navigator.h"
|
||||
#include "MassMap.h"
|
||||
|
||||
namespace Navigator {
|
||||
|
||||
class SPSInputLayer : public Layer
|
||||
{
|
||||
public:
|
||||
SPSInputLayer();
|
||||
~SPSInputLayer();
|
||||
|
||||
virtual void OnAttach() override;
|
||||
virtual void OnDetach() override;
|
||||
virtual void OnUpdate(Timestep& step) override;
|
||||
virtual void OnEvent(Event& event) override; //If you want to respond to events
|
||||
virtual void OnImGuiRender() override; //"Main" function
|
||||
|
||||
private:
|
||||
void UpdateWeights();
|
||||
|
||||
//Variables for use in analysis
|
||||
Variable x1_weight;
|
||||
Variable x2_weight;
|
||||
|
||||
//UI facing inputs
|
||||
double m_bfield; //kG
|
||||
double m_theta; //deg
|
||||
double m_beamKE; //MeV
|
||||
//Z, A inputs for reaction nuclei
|
||||
int m_targNums[2];
|
||||
int m_projNums[2];
|
||||
int m_ejectNums[2];
|
||||
int m_residNums[2];
|
||||
|
||||
//Text for UI
|
||||
std::string m_rxnEqn;
|
||||
|
||||
//Map for mass table
|
||||
MassMap m_masses;
|
||||
|
||||
static constexpr double c_mev2j = 1.60218E-13; //J per MeV
|
||||
static constexpr double c_e = 1.602E-19; //unit charge Coulombs
|
||||
static constexpr double c_C = 2.9979E8; //speed of light m/s
|
||||
static constexpr double c_spsDisp = 1.96; //dispersion (x/rho)
|
||||
static constexpr double c_spsMag = 0.39; //magnification in x
|
||||
static constexpr double c_wireDist = 4.28625; //FPD anode wire separation in cm
|
||||
static constexpr double c_deg2rad = 3.14159265358979323846 / 180.0; //pi/180
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
main.cpp
|
||||
Entry point for the example NavProject. Also contains example of a simple user Navigator::Application.
|
||||
|
||||
GWM -- Feb 2022
|
||||
*/
|
||||
#include "Navigator.h"
|
||||
#include "SPSAnalysisStage.h"
|
||||
#include "SPSInputLayer.h"
|
||||
|
||||
//User application class. Pushes user analysis stages.
|
||||
class SPSApp : public Navigator::Application
|
||||
{
|
||||
public:
|
||||
SPSApp() :
|
||||
Navigator::Application()
|
||||
{
|
||||
PushLayer(new Navigator::SPSInputLayer());
|
||||
//PushLayer(new Navigator::TestServerLayer());
|
||||
PushAnalysisStage(new Navigator::SPSAnalysisStage());
|
||||
}
|
||||
};
|
||||
|
||||
//Define the creation function to make our user application
|
||||
Navigator::Application* Navigator::CreateApplication() { return new SPSApp(); }
|
||||
|
||||
//Make sure to initialize log BEFORE creating application.
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
Navigator::Logger::Init();
|
||||
NAV_TRACE("Logger Initialized!");
|
||||
|
||||
NAV_PROFILE_BEGIN_SESSION("Startup", "navprofile_startup.json");
|
||||
auto app = Navigator::CreateApplication();
|
||||
NAV_PROFILE_END_SESSION();
|
||||
|
||||
NAV_PROFILE_BEGIN_SESSION("Runtime", "navprofile_runtime.json");
|
||||
app->Run();
|
||||
NAV_PROFILE_END_SESSION();
|
||||
|
||||
NAV_PROFILE_BEGIN_SESSION("Shutdown", "navprofile_shutdown.json");
|
||||
delete app;
|
||||
NAV_PROFILE_END_SESSION();
|
||||
}
|
Loading…
Reference in New Issue
Block a user