-
Notifications
You must be signed in to change notification settings - Fork 2
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
Generic optics #13
Merged
Merged
Generic optics #13
Changes from 21 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
9d632c5
Add files via upload
jovoy 26e963f
adding optics properies
jovoy 1136cb5
Generic optics file added
jovoy e17e983
Repaired typo
jovoy 00da28e
TRestAxionOptics. Added new virtual methods
jgalan 455a9d5
TRestAxionGenericOptics. Fixed compilation errors
jgalan 42cbbd6
Merge branch 'generic_optics' of github.com:jgalan/axionlib into gene…
jgalan 6e9fa8b
TRestAxionGenericOptics. Adding missing Initialize method implementation
jgalan 7de5b12
TRestAxionOptics. Implementing spider metadata members, and documenting
jgalan 9323358
pipeline/optics/basic.rml added to define basic TRestAxionOptics tests
jgalan 6fd3c4b
TRestAxionGenericOptics. Recovered documentation examples from editte…
jgalan 876d2c2
TRestAxionOptics::HitsSpider method implemented
jgalan 1a4e0c5
basic.rml updating verbose output level
jgalan 9724737
TRestAxionOptics::InitFromConfigFile. Simplifying basic parameter ret…
jgalan 906028d
TRestAxionOptics. Setting default spider start radius to 20mm
jgalan 291a084
TRestAxionGenericOptics added interaction point method
jovoy fab9d7b
TRestAxionOptics fLength just length of one mirror
jovoy b093ab9
TRestAxionOptics added approx of optics length back in
jovoy 68c6639
TRestAxionGenericOptics start method to get interaction point
jovoy 2920f0a
TRestAxionOptics made shell radii protected
jovoy d2a5827
TRestAxionGenericOptics. Fixed returning value data type.
jgalan dceda4d
TRestAxionOptics::GetMaxRingRadius method added
jgalan bb62704
TRestAxionOptics::HitsSpider fixed errors
jgalan 766d3a9
TRestAxionOptics. Systematic replacement of Shell by Ring
jgalan b8c1daf
TRestAxionOptics. Minor documentation update
jgalan f5a9d4c
pipeline/optics/basic.rml now defines two optics setups
jgalan e5bfd42
pipeline/optics/basic.py added
jgalan 1591db1
Adding new optics pipeline script
jgalan d1aec64
TRestAxionGenericOptics. Updating according to changes at TRestAxionO…
jgalan 6d86d7d
pipeline/optics.py fixing renamed method
jgalan d899323
setups.rml fixing pipeline
jgalan 2cfeeed
Merge branch 'master' into generic_optics
jgalan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/************************************************************************* | ||
* This file is part of the REST software framework. * | ||
* * | ||
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) * | ||
* For more information see http://gifna.unizar.es/trex * | ||
* * | ||
* REST is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* REST is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have a copy of the GNU General Public License along with * | ||
* REST in $REST_PATH/LICENSE. * | ||
* If not, see http://www.gnu.org/licenses/. * | ||
* For the list of contributors see $REST_PATH/CREDITS. * | ||
*************************************************************************/ | ||
|
||
#ifndef _TRestAxionGenericOptics | ||
#define _TRestAxionGenericOptics | ||
#include <TRestAxionOptics.h> | ||
#include <iostream> | ||
/// A class calculate the reflection path and probability of X-rays through a Wolter 1 telescope | ||
class TRestAxionGenericOptics : public TRestAxionOptics { | ||
private: | ||
/// A vector containing the shells seperations between the two stacks. First element is the lowest radius. | ||
std::vector<Double_t> fShellsSep; //< | ||
|
||
/// A vector containing the shells angles. First element is the lowest radius. Note that the second stack | ||
/// has the tripple of this angle. | ||
std::vector<Double_t> fShellsAngle; //< | ||
|
||
/// coating materials and surface roughness or better yet: direction to a file that gives the reflectivity | ||
std::string fReflectivityFileName; //< | ||
|
||
void Initialize(); | ||
|
||
public: | ||
void PrintMetadata(); | ||
void InitFromConfigFile(); | ||
|
||
/// It returns the position at the optics exit plane for the incoming particle | ||
TVector3 GetPositionAtExit(const TVector3& pos, const TVector3& dir) { return TVector3(0, 0, 0); } | ||
|
||
/// It returns the direction at the optics exit plane for the incoming particle | ||
TVector3 GetDirectionAtExit(const TVector3& pos, const TVector3& dir) { return TVector3(0, 0, 0); } | ||
|
||
/// It returns the efficiency for particle with position `pos` and direction `dir`. | ||
Double_t GetEfficiency(const TVector3& pos, const TVector3& dir) { return 0.0; } | ||
|
||
TRestAxionGenericOptics(); | ||
TRestAxionGenericOptics(const char* cfgFileName, std::string name = ""); | ||
~TRestAxionGenericOptics(); | ||
|
||
/// get the interaction point of the photon with the mirror | ||
TVector3 GetInteractionPoint(const TVector3& pos, const TVector3& dir); | ||
ClassDef(TRestAxionGenericOptics, 1); | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<xml> | ||
|
||
<globals> | ||
<constant name="R0" value="3" /> | ||
<constant name="pi" value="3.1415927" /> | ||
</globals> | ||
|
||
<!-- Turn verbose level to "debug" to see additional output --> | ||
<TRestAxionOptics name="basic1" verboseLevel="info" > | ||
<parameter name="center" value="(0,0,200)mm" /> | ||
<parameter name="axis" value="(0,0.02,0.98)" /> | ||
<parameter name="length" value="22cm" /> | ||
|
||
<!-- We build mirror shells with 0.1mm thickness --> | ||
<parameter name="shellMinRadii" value="0,7,10,15,20,25" /> | ||
<parameter name="shellMaxRadii" value="R0,9.9,14.9,19.9,24.9,29.9" /> | ||
|
||
<parameter name="spiderArmsSeparationAngle" value="pi*30./180." /> | ||
<parameter name="spiderOffsetAngle" value="0.0" /> | ||
<parameter name="spiderWidth" value="pi*2.5/180." /> | ||
<parameter name="spiderStartRadius" value="R0" units="cm" /> | ||
</TRestAxionOptics> | ||
</xml> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
/******************** REST disclaimer *********************************** | ||
* This file is part of the REST software framework. * | ||
* * | ||
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) * | ||
* For more information see http://gifna.unizar.es/trex * | ||
* * | ||
* REST is free software: you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation, either version 3 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* REST is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU General Public License for more details. * | ||
* * | ||
* You should have a copy of the GNU General Public License along with * | ||
* REST in $REST_PATH/LICENSE. * | ||
* If not, see http://www.gnu.org/licenses/. * | ||
* For the list of contributors see $REST_PATH/CREDITS. * | ||
*************************************************************************/ | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
/// TRestAxionGenericOptics is a class that inherits from TRestAxionOptics. | ||
/// | ||
/// ToDO: Write what happens here | ||
/// | ||
/// | ||
/// ### RML definition | ||
/// | ||
/// Example 1: | ||
/// \code | ||
/// <TRestAxionGenericOptics name="dummy"> | ||
/// <parameter name="center" value="(0,0,200)mm" /> | ||
/// <parameter name="axis" value="(0,0.02,0.98)" /> | ||
/// <parameter name="length" value="22cm" /> | ||
/// | ||
/// <!-- We build mirror shells with 0.1mm thickness --> | ||
/// <parameter name="shellMinRadii" value="5,10,15,20,25" /> | ||
/// <parameter name="shellMaxRadii" value="9.9,14.9,19.9,24.9,29.9" /> | ||
/// <TRestAxionOptics/> | ||
/// \endcode | ||
/// | ||
/// Example 2: | ||
/// \code | ||
/// <TRestAxionGenericOptics center="(0,0,950)mm" axis="(0,0,1)" /> | ||
/// \endcode | ||
/// | ||
/// Example 3: | ||
/// \code | ||
/// <TRestAxionGenericOptics center="(0,0,95)" units="cm" /> | ||
/// \endcode | ||
/// | ||
///-------------------------------------------------------------------------- | ||
/// | ||
/// RESTsoft - Software for Rare Event Searches with TPCs | ||
/// | ||
/// History of developments: | ||
/// | ||
/// 2022-February: First concept and implementation of TRestAxionGenericOptics class. | ||
/// Johanna von Oy | ||
/// | ||
/// \class TRestAxionGenericOptics | ||
/// \author Johanna von Oy <vonoy@physik.uni-bonn.de> | ||
/// | ||
/// <hr> | ||
/// | ||
|
||
#include "TRestAxionGenericOptics.h" | ||
|
||
using namespace std; | ||
#include <cmath> | ||
#include "TRestPhysics.h" | ||
using namespace REST_Physics; | ||
ClassImp(TRestAxionGenericOptics); | ||
|
||
/////////////////////////////////////////////// | ||
/// \brief Default constructor | ||
/// | ||
TRestAxionGenericOptics::TRestAxionGenericOptics() : TRestAxionOptics() { Initialize(); } | ||
|
||
/////////////////////////////////////////////// | ||
/// \brief Default destructor | ||
/// | ||
TRestAxionGenericOptics::~TRestAxionGenericOptics() {} | ||
|
||
/////////////////////////////////////////////// | ||
/// \brief Constructor loading data from a config file | ||
/// | ||
/// If no configuration path is defined using TRestMetadata::SetConfigFilePath | ||
/// the path to the config file must be specified using full path, absolute or | ||
/// relative. | ||
/// | ||
/// The default behaviour is that the config file must be specified with | ||
/// full path, absolute or relative. | ||
/// | ||
/// \param cfgFileName A const char* giving the path to an RML file. | ||
/// \param name The name of the specific metadata. It will be used to find the | ||
/// corresponding TRestAxionMagneticField section inside the RML. | ||
/// | ||
TRestAxionGenericOptics::TRestAxionGenericOptics(const char* cfgFileName, string name) | ||
: TRestAxionOptics(cfgFileName) { | ||
debug << "Entering TRestAxionGenericOptics constructor( cfgFileName, name )" << endl; | ||
|
||
Initialize(); | ||
|
||
LoadConfigFromFile(fConfigFileName, name); | ||
|
||
if (GetVerboseLevel() >= REST_Info) PrintMetadata(); | ||
} | ||
|
||
/////////////////////////////////////////////// | ||
/// \brief Initialization of TRestAxionGenericOptics members | ||
/// | ||
void TRestAxionGenericOptics::Initialize() { | ||
TRestAxionOptics::Initialize(); | ||
|
||
SetSectionName(this->ClassName()); | ||
SetLibraryVersion(LIBRARY_VERSION); | ||
|
||
// Call any initialization methods here | ||
} | ||
|
||
/////////////////////////////////////////////// | ||
/// \brief Initialization of TRestAxionGenericOptics field members through a RML file | ||
/// | ||
void TRestAxionGenericOptics::InitFromConfigFile() { | ||
TRestAxionOptics::InitFromConfigFile(); | ||
|
||
/// TODO Initialize metadata members of this class here | ||
|
||
// If we recover the metadata class from ROOT file we will need to call Initialize ourselves | ||
this->Initialize(); | ||
} | ||
|
||
/////////////////////////////////////////////// | ||
/// \brief This calculates the interaction Point between the X-Ray photons path and a mirror in the | ||
/// predetermined layer | ||
/// | ||
TVector3 TRestAxionGenericOptics::GetInteractionPoint(const TVector3& pos, const TVector3& dir) { | ||
Int_t layer = TRestAxionOptics::GetEntranceShell(pos, dir); | ||
Double_t r1 = fShellsRadii[layer].second; | ||
Double_t angle = fShellsAngle[layer]; | ||
Double_t xSep = fShellsSep[layer]; | ||
Double_t fLength = TRestAxionOptics::GetMirrLength(); | ||
// Double_t distMirrors = 0 for first stack and (fLength + xSep) * cos(angle) for the second // distance | ||
// of the mirror should be added in for second stack | ||
Double_t r2 = r1 - fLength * sin(angle); | ||
// r1 = sqrt((pos[0] + s * dir[0]) * (pos[0] + s * dir[0]) + | ||
// (pos[1] + s * dir[1]) * (pos[1] + s * dir[1])) - | ||
// ((r2 - r1) * (pos[2] + s * dir[2] - distMirrors) / (cos(angle) * fLength)) //needs to be solved for | ||
// s, maybe by incresing s for some value and comparing this to r1 | ||
return TVector3(0, 0, 0); | ||
} | ||
|
||
/////////////////////////////////////////////// | ||
/// \brief Prints on screen the information about the metadata members of TRestAxionGenericOptics | ||
/// | ||
void TRestAxionGenericOptics::PrintMetadata() { | ||
TRestAxionOptics::PrintMetadata(); | ||
|
||
metadata << "---------" << endl; | ||
/// Print here metadata members | ||
/// metadata << "xxx : " < fXXX << endl; | ||
metadata << "+++++++++++++++++++++++++++++++++++++++++++++++++" << endl; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 141 looks strange. There is no need to call specifying the base class, mainly because the method
GetEntranceShell
is not virtual, and it is not re-implemented insideTRestAxionGenericOptics
. Therefore, just callingGetEntranceShell
will have the same effect. When the method might be existing on both, base and inherited, then we need to specify, and therefore, as it is written now, to me it looks as ifGetEntranceShell
is on both classes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, I understand, thanks!