Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nptool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
np
nptool
Commits
5a52c08f
Commit
5a52c08f
authored
11 years ago
by
Unknown
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
9dd785ed
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NPAnalysis/Template/src/Analysis.cc
+1
-1
1 addition, 1 deletion
NPAnalysis/Template/src/Analysis.cc
NPLib/Tools/NPReaction.cxx
+125
-98
125 additions, 98 deletions
NPLib/Tools/NPReaction.cxx
with
126 additions
and
99 deletions
NPAnalysis/Template/src/Analysis.cc
+
1
−
1
View file @
5a52c08f
...
@@ -26,7 +26,7 @@ int main(int argc,char** argv)
...
@@ -26,7 +26,7 @@ int main(int argc,char** argv)
NPL
::
Reaction
*
myReaction
=
new
Reaction
;
NPL
::
Reaction
*
myReaction
=
new
Reaction
;
myReaction
->
ReadConfigurationFile
(
reactionfileName
)
;
myReaction
->
ReadConfigurationFile
(
reactionfileName
)
;
// Instantiate the detector using a file
// Instantiate the detector using a file
DetectorManager
*
myDetector
=
new
DetectorManager
;
DetectorManager
*
myDetector
=
new
DetectorManager
;
myDetector
->
ReadConfigurationFile
(
detectorfileName
)
;
myDetector
->
ReadConfigurationFile
(
detectorfileName
)
;
...
...
This diff is collapsed.
Click to expand it.
NPLib/Tools/NPReaction.cxx
+
125
−
98
View file @
5a52c08f
...
@@ -60,12 +60,12 @@ void Reaction::SetEveryThing(string name1, string name2, string name3, string na
...
@@ -60,12 +60,12 @@ void Reaction::SetEveryThing(string name1, string name2, string name3, string na
string
GlobalPath
=
getenv
(
"NPTOOL"
);
string
GlobalPath
=
getenv
(
"NPTOOL"
);
Path
=
GlobalPath
+
"/Inputs/CrossSection/"
+
Path
;
Path
=
GlobalPath
+
"/Inputs/CrossSection/"
+
Path
;
ifstream
CSFile
;
ifstream
CSFile
;
CSFile
.
open
(
Path
.
c_str
());
CSFile
.
open
(
Path
.
c_str
()
);
double
CSBuffer
,
AngleBuffer
;
string
echo
;
if
(
CSFile
.
is_open
())
{
cout
<<
"Reading Cross Section File "
<<
Path
<<
endl
;}
if
(
CSFile
.
is_open
())
{
cout
<<
"Reading Cross Section File "
<<
Path
<<
endl
;}
else
{
cout
<<
"Cross Section File "
<<
Path
<<
" not found"
<<
endl
;
return
;}
else
{
cout
<<
"Cross Section File "
<<
Path
<<
" not found"
<<
endl
;
return
;}
double
CSBuffer
,
AngleBuffer
;
vector
<
double
>
CrossSectionBuffer
;
vector
<
double
>
CrossSectionBuffer
;
while
(
!
CSFile
.
eof
())
while
(
!
CSFile
.
eof
())
...
@@ -245,105 +245,132 @@ void Reaction::Print() const
...
@@ -245,105 +245,132 @@ void Reaction::Print() const
void
Reaction
::
ReadConfigurationFile
(
string
Path
)
void
Reaction
::
ReadConfigurationFile
(
string
Path
)
{
{
////////General Reading needs////////
string
LineBuffer
;
string
DataBuffer
;
////////Reaction Setting needs///////
string
Beam
,
Target
,
Heavy
,
Light
,
CrossSectionPath
;
double
BeamEnergy
=
0
,
ExcitationEnergy
=
0
;
bool
ReadingStatus
=
false
;
bool
check_Beam
=
false
;
bool
check_Target
=
false
;
bool
check_Light
=
false
;
bool
check_Heavy
=
false
;
bool
check_ExcitationEnergy
=
false
;
bool
check_BeamEnergy
=
false
;
bool
check_CrossSectionPath
=
false
;
//////////////////////////////////////////////////////////////////////////////////////////
ifstream
ReactionFile
;
string
GlobalPath
=
getenv
(
"NPTOOL"
);
Path
=
GlobalPath
+
"/Inputs/Reaction/"
+
Path
;
ReactionFile
.
open
(
Path
.
c_str
());
if
(
ReactionFile
.
is_open
())
{
cout
<<
"Reading Reaction File "
<<
Path
<<
endl
;}
else
{
cout
<<
"Reaction File "
<<
Path
<<
" not Found! "
<<
endl
;
return
;
}
while
(
!
ReactionFile
.
eof
())
{
//Pick-up next line
getline
(
ReactionFile
,
LineBuffer
);
if
(
LineBuffer
.
compare
(
0
,
9
,
"Transfert"
)
==
0
)
{
ReadingStatus
=
true
;}
while
(
ReadingStatus
){
ReactionFile
>>
DataBuffer
;
//Search for comment Symbol %
if
(
LineBuffer
.
compare
(
0
,
1
,
"%"
)
==
0
)
{
/* Do Nothing */
;}
else
if
(
DataBuffer
.
compare
(
0
,
5
,
"Beam="
)
==
0
)
{
check_Beam
=
true
;
ReactionFile
>>
DataBuffer
;
Beam
=
DataBuffer
;
cout
<<
"Beam "
<<
Beam
<<
endl
;
}
else
if
(
DataBuffer
.
compare
(
0
,
7
,
"Target="
)
==
0
)
{
check_Target
=
true
;
ReactionFile
>>
DataBuffer
;
Target
=
DataBuffer
;
cout
<<
"Target "
<<
Target
<<
endl
;
}
else
if
(
DataBuffer
.
compare
(
0
,
6
,
"Light="
)
==
0
)
{
check_Light
=
true
;
ReactionFile
>>
DataBuffer
;
Light
=
DataBuffer
;
cout
<<
"Light "
<<
Light
<<
endl
;
}
else
if
(
DataBuffer
.
compare
(
0
,
6
,
"Heavy="
)
==
0
)
{
check_Heavy
=
true
;
ReactionFile
>>
DataBuffer
;
Heavy
=
DataBuffer
;
cout
<<
"Heavy "
<<
Heavy
<<
endl
;
}
else
if
(
DataBuffer
.
compare
(
0
,
17
,
"ExcitationEnergy="
)
==
0
)
{
check_ExcitationEnergy
=
true
;
ReactionFile
>>
DataBuffer
;
ExcitationEnergy
=
atof
(
DataBuffer
.
c_str
())
*
MeV
;
cout
<<
"Excitation Energy "
<<
ExcitationEnergy
/
MeV
<<
" MeV"
<<
endl
;
}
else
if
(
DataBuffer
.
compare
(
0
,
11
,
"BeamEnergy="
)
==
0
)
{
check_BeamEnergy
=
true
;
ReactionFile
>>
DataBuffer
;
BeamEnergy
=
atof
(
DataBuffer
.
c_str
())
*
MeV
;
cout
<<
"Beam Energy "
<<
BeamEnergy
/
MeV
<<
" MeV"
<<
endl
;
}
else
if
(
DataBuffer
.
compare
(
0
,
17
,
"CrossSectionPath="
)
==
0
)
{
check_CrossSectionPath
=
true
;
ReactionFile
>>
CrossSectionPath
;
cout
<<
"Cross Section File: "
<<
CrossSectionPath
<<
endl
;
}
///////////////////////////////////////////////////
// If no Transfert Token and no comment, toggle out
else
{
/*Ignore Token used by G4*/
}
///////////////////////////////////////////////////
// If all Token found toggle out
if
(
check_Beam
&&
check_Target
&&
check_Light
&&
check_Heavy
&&
check_ExcitationEnergy
&&
check_BeamEnergy
&&
check_CrossSectionPath
)
ReadingStatus
=
false
;
}
}
SetEveryThing
(
Beam
,
Target
,
Light
,
Heavy
,
BeamEnergy
,
ExcitationEnergy
,
CrossSectionPath
);
ReactionFile
.
close
();
}
////////General Reading needs////////
string
LineBuffer
;
string
DataBuffer
;
////////Reaction Setting needs///////
string
Beam
,
Target
,
Heavy
,
Light
,
CrossSectionPath
;
double
BeamEnergy
,
ExcitationEnergy
;
Reaction
*
myReaction
;
//////////////////////////////////////////////////////////////////////////////////////////
ifstream
ReactionFile
;
string
GlobalPath
=
getenv
(
"NPTOOL"
);
Path
=
GlobalPath
+
"/Inputs/Reaction/"
+
Path
;
ReactionFile
.
open
(
Path
.
c_str
());
if
(
ReactionFile
.
is_open
()
)
cout
<<
" Reaction file "
<<
Path
<<
" loading "
<<
endl
;
else
{
cout
<<
" Error, no Reaction file"
<<
Path
<<
" found"
<<
endl
;
}
int
i
=
0
;
while
(
!
ReactionFile
.
eof
()
)
{
//Pick-up next line
getline
(
ReactionFile
,
LineBuffer
);
i
++
;
//Search for comment Symbol %
if
(
LineBuffer
.
compare
(
0
,
1
,
"%"
)
==
0
)
{;}
else
if
(
LineBuffer
.
compare
(
0
,
9
,
"Transfert"
)
==
0
)
{
ReactionFile
>>
DataBuffer
;
if
(
DataBuffer
.
compare
(
0
,
5
,
"Beam="
)
==
0
)
{
ReactionFile
>>
DataBuffer
;
Beam
=
DataBuffer
;
cout
<<
"Beam "
<<
Beam
<<
endl
;
}
ReactionFile
>>
DataBuffer
;
if
(
DataBuffer
.
compare
(
0
,
7
,
"Target="
)
==
0
)
{
ReactionFile
>>
DataBuffer
;
Target
=
DataBuffer
;
cout
<<
"Target "
<<
Target
<<
endl
;
}
ReactionFile
>>
DataBuffer
;
if
(
DataBuffer
.
compare
(
0
,
6
,
"Light="
)
==
0
)
{
ReactionFile
>>
DataBuffer
;
Light
=
DataBuffer
;
cout
<<
"Light "
<<
Light
<<
endl
;
}
ReactionFile
>>
DataBuffer
;
if
(
DataBuffer
.
compare
(
0
,
6
,
"Heavy="
)
==
0
)
{
ReactionFile
>>
DataBuffer
;
Heavy
=
DataBuffer
;
cout
<<
"Heavy "
<<
Heavy
<<
endl
;
}
ReactionFile
>>
DataBuffer
;
if
(
DataBuffer
.
compare
(
0
,
17
,
"ExcitationEnergy="
)
==
0
)
{
ReactionFile
>>
DataBuffer
;
ExcitationEnergy
=
atof
(
DataBuffer
.
c_str
());
cout
<<
"ExcitationEnergy "
<<
ExcitationEnergy
<<
" MeV"
<<
endl
;
}
ReactionFile
>>
DataBuffer
;
if
(
DataBuffer
.
compare
(
0
,
11
,
"BeamEnergy="
)
==
0
)
{
ReactionFile
>>
DataBuffer
;
BeamEnergy
=
atof
(
DataBuffer
.
c_str
());
cout
<<
"EnergyBeam "
<<
BeamEnergy
<<
" MeV"
<<
endl
;
}
ReactionFile
>>
DataBuffer
;
ReactionFile
>>
DataBuffer
;
ReactionFile
>>
DataBuffer
;
ReactionFile
>>
DataBuffer
;
ReactionFile
>>
DataBuffer
;
ReactionFile
>>
DataBuffer
;
ReactionFile
>>
DataBuffer
;
ReactionFile
>>
DataBuffer
;
ReactionFile
>>
DataBuffer
;
if
(
DataBuffer
.
compare
(
0
,
17
,
"CrossSectionPath="
)
==
0
)
{
ReactionFile
>>
CrossSectionPath
;
cout
<<
"CrossSectionPath "
<<
CrossSectionPath
<<
endl
;
}
}
}
SetEveryThing
(
Beam
,
Target
,
Light
,
Heavy
,
BeamEnergy
,
ExcitationEnergy
,
CrossSectionPath
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment