Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
CLASS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
BaM
CLASS
Commits
f1022911
Commit
f1022911
authored
7 years ago
by
Nico
Committed by
BaM
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Test with generic ROOT2ROOT method...
parent
e7d09fd8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Utils/ROOT2ROOT/GENERIC/CLASS_ROOT2ROOT.cxx
+164
-409
164 additions, 409 deletions
Utils/ROOT2ROOT/GENERIC/CLASS_ROOT2ROOT.cxx
with
164 additions
and
409 deletions
Utils/ROOT2ROOT/GENERIC/CLASS_ROOT2ROOT.cxx
+
164
−
409
View file @
f1022911
/*
Simple code used to convert
multi
root output file
in one root
file
Simple code used to convert root output file
produced by CLASS to simple data
file
Need
s :
Remain
s :
Select some element of interest given a Z list
If you are interested in a specific observable you will need to implement the method in Scenar_t.hxx
There is no need to recompile the BIG root file
First Cycle Time
Authors:
...
...
@@ -27,16 +24,11 @@ ZaK
#include
<memory>
#include
<stdexcept>
#include
<string>
#include
"TROOT.h"
//
#include
"SSENAR/Scenar_t.hxx"
using
namespace
std
;
// Get the output of a linux command...
string
exec
(
string
s_
cmd
)
string
exec
(
const
char
*
cmd
)
{
char
*
cmd
=
new
char
[
s_cmd
.
length
()
+
1
];
strcpy
(
cmd
,
s_cmd
.
c_str
());
char
buffer
[
128
];
string
result
=
""
;
shared_ptr
<
FILE
>
pipe
(
popen
(
cmd
,
"r"
),
pclose
);
...
...
@@ -48,274 +40,166 @@ string exec(string s_cmd)
return
result
;
}
// Show a progress bar ...
template
<
class
T
>
void
exec_progress
(
T
i
,
T
Ni
)
int
main
(
int
argc
,
char
**
argv
)
{
cout
<<
"
\r
=====> "
<<
(
T
)((
double
)
i
/
Ni
*
100.
+
1
)
<<
" % "
<<
flush
;
}
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------TO ADAPT----------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
//
// Retrieve quantities of interest
//
// // Obtain inventories from facilities or from a isotopic vector pointer
// double GetInvOfTime (CLASSFacility *object, IsotopicVector isovec)
// {
// return object->GetInsideIV().GetThisComposition(isovec).GetTotalMass();
// }
// //
// double GetInvOfTime (IsotopicVector *object, IsotopicVector isovec)
// {
// return object->GetThisComposition(isovec).GetTotalMass();
// }
// //
double
GetInvAtBOC
(
Reactor
*
object
,
IsotopicVector
isovec
)
{
return
double
(
object
->
GetIVBeginCycle
().
GetThisComposition
(
isovec
).
GetTotalMass
());
}
// //
// double GetInvAtEOC (Reactor *object, IsotopicVector isovec)
// {
// return object->GetIVOutCycle().GetThisComposition(isovec).GetTotalMass();
// }
//
// //
// double GetDiffFlux (CLASSFacility *object, IsotopicVector isovec)
// {
// double cinflux, coutflux;
//
// cinflux = object->GetCumulativeIVIn().GetThisComposition(isovec).GetTotalMass();
// coutflux = object->GetCumulativeIVOut().GetThisComposition(isovec).GetTotalMass();
//
// return (cinflux - coutflux);
// }
// //
//
// Size limits for crashed and correct jobs
string
s_SizeLimit
=
"14M"
;
int
main
(
int
argc
,
char
**
argv
)
{
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------VARIABLES---------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
string
s_tmp
;
Long64_t
TimeSecond
=
0
;
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------INIT---------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
IsotopicVector
v_Pu
;
v_Pu
.
Add
(
94
,
238
,
0
,
1
);
v_Pu
.
Add
(
94
,
239
,
0
,
1
);
v_Pu
.
Add
(
94
,
240
,
0
,
1
);
v_Pu
.
Add
(
94
,
241
,
0
,
1
);
v_Pu
.
Add
(
94
,
242
,
0
,
1
);
v_Pu
.
Add
(
95
,
241
,
0
,
1
);
if
(
argc
!=
2
){
cout
<<
" Usage : ./ex ROOTFILESDIR "
<<
endl
;
return
EXIT_FAILURE
;
}
//
string
s_ROOTDIR
=
argv
[
1
];
string
s_dirtag
=
s_ROOTDIR
+
"/OUT_"
;
size_t
dirtagsize
=
s_dirtag
.
length
();
size_t
numformat
=
9
;
// nber of bytes used to print the values in the full root files dir names
IsotopicVector
v_U
;
v_U
.
Add
(
92
,
238
,
0
,
1
);
v_U
.
Add
(
92
,
235
,
0
,
1
);
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------
VARIABL
ES---------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------
BRANCH
ES
---------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
// Time and Power will Get dumped from original OUT.root files : respect the TYPE
Long64_t
TimeSecond
=
0
;
double
ParcPower
=
0.0
;
//
// Z list of interest : Only these elements will be dumped in the root file
vector
<
unsigned
short
>
ZLIST
;
//{92,94,95,96};
ZLIST
.
push_back
(
92
);
ZLIST
.
push_back
(
94
);
ZLIST
.
push_back
(
95
);
ZLIST
.
push_back
(
96
);
// Isotopes of Interest
//
vector
<
IsotopicVector
>
ILIST
;
//{U,Pu,Am,Cm};
//
IsotopicVector
v_U
,
v_U5
,
v_U8
;
ZAI
U8
=
ZAI
(
92
,
238
,
0
);
ZAI
U5
=
ZAI
(
92
,
235
,
0
);
v_U
=
1
*
U8
+
1
*
U5
;
ILIST
.
push_back
(
v_U
);
//
v_U5
=
1
*
U5
;
v_U8
=
1
*
U8
;
IsotopicVector
v_Pu
,
v_Pu_Fis
,
v_Pu8
,
v_Pu9
,
v_Pu0
,
v_Pu1
,
v_Pu2
;
ZAI
Pu8
=
ZAI
(
94
,
238
,
0
);
ZAI
Pu9
=
ZAI
(
94
,
239
,
0
);
ZAI
Pu0
=
ZAI
(
94
,
240
,
0
);
ZAI
Pu1
=
ZAI
(
94
,
241
,
0
);
ZAI
Pu2
=
ZAI
(
94
,
242
,
0
);
v_Pu
=
1
*
Pu8
+
1
*
Pu9
+
1
*
Pu0
+
1
*
Pu1
+
1
*
Pu2
;
ILIST
.
push_back
(
v_Pu
);
//
v_Pu_Fis
=
1
*
Pu9
+
1
*
Pu1
;
v_Pu8
=
1
*
Pu8
;
v_Pu9
=
1
*
Pu9
;
v_Pu0
=
1
*
Pu0
;
v_Pu1
=
1
*
Pu1
;
v_Pu2
=
1
*
Pu2
;
IsotopicVector
v_Am
,
v_Am1
,
v_Am3
;
ZAI
Am1
=
ZAI
(
95
,
241
,
0
);
ZAI
Am2x
=
ZAI
(
95
,
242
,
1
);
ZAI
Am3
=
ZAI
(
95
,
243
,
0
);
v_Am
=
1
*
Am1
+
1
*
Am2x
+
1
*
Am3
;
ILIST
.
push_back
(
v_Am
);
//
v_Am1
=
1
*
Am1
;
v_Am3
=
1
*
Am3
;
IsotopicVector
v_Cm
,
v_Cm2
,
v_Cm4
;
ZAI
Cm2
=
ZAI
(
96
,
242
,
0
);
ZAI
Cm3
=
ZAI
(
96
,
243
,
0
);
ZAI
Cm4
=
ZAI
(
96
,
244
,
0
);
v_Cm
=
1
*
Cm2
+
1
*
Cm3
+
1
*
Cm4
;
ILIST
.
push_back
(
v_Cm
);
//
v_Cm2
=
1
*
Cm2
;
v_Cm4
=
1
*
Cm4
;
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------OUTPUT -----------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
TFile
*
FileScenario
=
new
TFile
(
"SSenario.root"
,
"RECREATE"
);
TTree
*
TreeScenario
=
new
TTree
(
"TreeScenario"
,
"TreeScenario"
);
//
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------INPUT ------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
// Names of ROOT Files
string
s_Elements
=
"find "
+
s_ROOTDIR
+
" -type f -name
\"
*.root
\"
"
;
string
s_Candidates
=
"find "
+
s_ROOTDIR
+
" -type f ! -size -20M -name
\"
*.root
\"
"
;
string
s_Crashed
=
"find "
+
s_ROOTDIR
+
" -type f -size -20M -name
\"
*.root
\"
"
;
// Number and Names of ROOT Files
string
s_NumberOfElements
=
exec
(
s_Elements
+
" | wc -l"
);
string
s_NumberOfCandidates
=
exec
(
s_Candidates
+
" | wc -l"
);
string
s_NumberOfCrashed
=
exec
(
s_Crashed
+
" | wc -l"
);
// Writing in corresponding files
s_Elements
+=
" > ROOTFileList.txt"
;
s_Candidates
+=
" > ROOTFileCandidates.txt"
;
s_Crashed
+=
" > ROOTFileCrashed.txt"
;
system
(
s_Elements
.
c_str
()
);
system
(
s_Candidates
.
c_str
());
system
(
s_Crashed
.
c_str
()
);
unsigned
short
NumberOfElements
=
atoi
(
s_NumberOfElements
.
c_str
());
unsigned
short
NumberOfCandidates
=
atoi
(
s_NumberOfCandidates
.
c_str
());
unsigned
short
NumberOfCrashed
=
atoi
(
s_NumberOfCrashed
.
c_str
());
// Only candidates root files will be analysed
string
s_OneFileForBranches
=
exec
(
"sed -n 1p ROOTFileCandidates.txt | tr -d '
\040\011\012\015
'"
);
TFile
*
FileScenario
=
new
TFile
(
"Scenario.root"
,
"RECREATE"
);
TTree
*
TreeScenario
=
new
TTree
(
"TreeScenario"
,
"TreeScenario"
);
double
BU_UOX
=
0
;
TreeScenario
->
Branch
(
"BU_UOX"
,
&
BU_UOX
,
"BU_UOX/D"
);
double
BU_MOX
=
0
;
TreeScenario
->
Branch
(
"BU_MOX"
,
&
BU_MOX
,
"BU_MOX/D"
);
double
BU_SFR
=
0
;
TreeScenario
->
Branch
(
"BU_SFR"
,
&
BU_SFR
,
"BU_SFR/D"
);
double
Fr_UOX
=
0
;
TreeScenario
->
Branch
(
"Fr_UOX"
,
&
Fr_UOX
,
"Fr_UOX/D"
);
double
Fr_MOX
=
0
;
TreeScenario
->
Branch
(
"Fr_MOX"
,
&
Fr_MOX
,
"Fr_MOX/D"
);
double
Fr_SFR
=
0
;
TreeScenario
->
Branch
(
"Fr_SFR"
,
&
Fr_SFR
,
"Fr_SFR/D"
);
double
CT_UOX
=
0
;
TreeScenario
->
Branch
(
"CT_UOX"
,
&
CT_UOX
,
"CT_UOX/D"
);
double
CT_MOX
=
0
;
TreeScenario
->
Branch
(
"CT_MOX"
,
&
CT_MOX
,
"CT_MOX/D"
);
double
CT_SFR
=
0
;
TreeScenario
->
Branch
(
"CT_SFR"
,
&
CT_SFR
,
"CT_SFR/D"
);
int
SM_MOX
=
0
;
TreeScenario
->
Branch
(
"SM_MOX"
,
&
SM_MOX
,
"SM_MOX/I"
);
double
Fr_SPu
=
0
;
TreeScenario
->
Branch
(
"Fr_SPu"
,
&
Fr_SPu
,
"Fr_SPu/D"
);
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------INPUT ------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
string
PathToROOTFiles
=
string
(
argv
[
1
]);
// Number and Names of correct ROOT Files
string
CMD
=
string
(
"find -L "
)
+
PathToROOTFiles
+
string
(
" -type f -size +"
)
+
s_SizeLimit
+
string
(
" -name
\"
OUT.root
\"
"
);
string
s_NumberOfElements
=
exec
((
CMD
+
string
(
" | wc -l"
)).
c_str
());
int
NumberOfElements
=
atoi
(
s_NumberOfElements
.
c_str
());
system
((
CMD
+
string
(
" > ROOTFileList.txt"
)).
c_str
());
// Number and Names of crashed ROOT Files
CMD
=
string
(
"find -L "
)
+
PathToROOTFiles
+
string
(
" -type f -size -"
)
+
s_SizeLimit
+
string
(
" -name
\"
OUT.root
\"
"
);
string
s_NumberOfElementsCrashed
=
exec
((
CMD
+
string
(
" | wc -l"
)).
c_str
());
int
NumberOfElementsCrashed
=
atoi
(
s_NumberOfElementsCrashed
.
c_str
());
system
((
CMD
+
string
(
" > ROOTFileListCrashed.txt"
)).
c_str
());
//Get first line for root file example
string
s_OneFileForBranches
=
exec
(
"sed -n 1p ROOTFileList.txt | tr -d '
\040\011\012\015
'"
);
// Load ROOT file number f and load TTree
TFile
*
TFileName
=
new
TFile
(
s_OneFileForBranches
.
c_str
());
TTree
*
fData
=
new
TTree
();
TTree
*
fData
=
new
TTree
();
fData
=
(
TTree
*
)
gDirectory
->
Get
(
TFileName
->
GetListOfKeys
()
->
At
(
TFileName
->
GetNkeys
()
-
1
)
->
GetName
());
//Time Steps
Long64_t
NTime
=
fData
->
GetEntries
();
TFileName
->
Close
();
// Branching to Tree
//Scenar_t* Scen = new Scenar_t(NTime -1);
Scenar_t
*
Scen
=
new
Scenar_t
();
TreeScenario
->
Branch
(
"ssenar"
,
"Scenar_t"
,
&
Scen
);
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------LOAD BRANCHES-----------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
cout
<<
endl
<<
"#########################"
<<
endl
;
cout
<<
"Number Of ROOT Files : "
<<
NumberOfElements
<<
endl
;
cout
<<
"Number Of ROOT Candidates Files : "
<<
NumberOfCandidates
<<
endl
;
cout
<<
"Number Of ROOT Crashed Files : "
<<
NumberOfCrashed
<<
endl
;
cout
<<
"Number Of Time Step / Files : "
<<
NTime
<<
endl
<<
endl
;
cout
<<
"Progression : "
<<
endl
;
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------WRITING ----------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
cout
<<
endl
;
cout
<<
"--------------------------------------------------------"
<<
endl
;
cout
<<
"--------- EXPERIMENT INFORMATIONS ----------------------"
<<
endl
;
cout
<<
"--------------------------------------------------------"
<<
endl
;
cout
<<
endl
;
cout
<<
" Number of Good ROOT files : "
<<
NumberOfElements
<<
endl
;
cout
<<
" Number of Crashed ROOT Files : "
<<
NumberOfElementsCrashed
<<
endl
;
cout
<<
" Number of Time Steps / Simulation : "
<<
NTime
<<
endl
;
cout
<<
endl
;
cout
<<
"--------------------------------------------------------"
<<
endl
;
cout
<<
"--------------------------------------------------------"
<<
endl
;
cout
<<
"--------------------------------------------------------"
<<
endl
;
cout
<<
endl
;
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------LOAD BRANCHES-----------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
cout
<<
endl
<<
"#########################"
<<
endl
;
cout
<<
"Number Of ROOT Files : "
<<
NumberOfElements
<<
endl
;
cout
<<
"Number Of Time Step / Files : "
<<
NTime
<<
endl
<<
endl
;
cout
<<
"Progression : "
<<
endl
;
string
s_ROOTFileName
;
// Failed simulations are dealt by a null score in the observables
// the Tree is filled by default value which are set to zero
ifstream
f_ROOTFileCrashed
(
"ROOTFileCrashed.txt"
);
for
(
int
f
=
1
;
f
<=
NumberOfCrashed
;
f
++
)
// Store Bad Scenarios
ifstream
f_ROOTFileListCrashed
(
"ROOTFileListCrashed.txt"
);
for
(
int
f
=
1
;
f
<=
NumberOfElementsCrashed
;
f
++
)
{
// Get input arguments
getline
(
f_ROOTFileCrashed
,
s_ROOTFileName
);
Scen
->
BU_UOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
,
numformat
).
c_str
());
Scen
->
TC_UOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
1
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
BU_MOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
2
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
TC_MOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
3
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
TF_MOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
4
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
IsMOxAm
=
atoi
(
s_ROOTFileName
.
substr
(
dirtagsize
+
5
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
Fr_MOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
6
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
NB_Fuel
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
7
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
Ks_Fuel
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
8
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
LF_Fuel
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
9
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
StMMOx
=
atoi
(
s_ROOTFileName
.
substr
(
dirtagsize
+
10
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
TimeStep
=
1.0
/
12.0
;
// each month
// Get input arguments
getline
(
f_ROOTFileListCrashed
,
s_ROOTFileName
);
BU_UOX
=
atof
(
s_ROOTFileName
.
substr
(
6
,
9
).
c_str
());
BU_MOX
=
atof
(
s_ROOTFileName
.
substr
(
16
,
9
).
c_str
());
BU_SFR
=
atof
(
s_ROOTFileName
.
substr
(
26
,
9
).
c_str
());
Fr_UOX
=
atof
(
s_ROOTFileName
.
substr
(
36
,
9
).
c_str
());
Fr_MOX
=
atof
(
s_ROOTFileName
.
substr
(
46
,
9
).
c_str
());
Fr_SFR
=
atof
(
s_ROOTFileName
.
substr
(
56
,
9
).
c_str
());
CT_UOX
=
atof
(
s_ROOTFileName
.
substr
(
66
,
9
).
c_str
());
CT_MOX
=
atof
(
s_ROOTFileName
.
substr
(
76
,
9
).
c_str
());
CT_SFR
=
atof
(
s_ROOTFileName
.
substr
(
86
,
9
).
c_str
());
SM_MOX
=
atof
(
s_ROOTFileName
.
substr
(
96
,
9
).
c_str
());
Fr_SPu
=
atof
(
s_ROOTFileName
.
substr
(
106
,
9
).
c_str
());
SIOK
=
0
;
TreeScenario
->
Fill
();
Scen
->
Clear
();
}
f_ROOTFileCrashed
.
close
();
}
f_ROOTFile
List
Crashed
.
close
();
//
ifstream
f_ROOTFileCandidates
(
"ROOTFileCandidates.txt"
);
ofstream
f_ROOTFileSelected
(
"ROOTFileSelected.txt"
);
//
Scen
->
NTimeStep
=
(
unsigned
short
)
(
NTime
-
1
);
// total nber of time step, just a caution: should be set by ctor
Scen
->
TimeStep
=
1.0
/
12.0
;
// each month
//
NumberOfCandidates
=
1001
;
for
(
unsigned
short
f
=
1
;
f
<=
NumberOfCandidates
;
f
++
)
// Store Bad Scenarios
ifstream
f_ROOTFileList
(
"ROOTFileList.txt"
);
for
(
int
f
=
1
;
f
<=
NumberOfElements
;
f
++
)
{
unsigned
short
UOx_NLOAD_Theoric
=
0
,
MOx_NLOAD_Theoric
=
0
;
Scen
->
UOx_NLOAD
=
0
;
Scen
->
MOx_NLOAD
=
0
;
Scen
->
MOx_MLOAD
=
0
;
int
UOX_NLOAD_Theoric
=
0
;
int
MOX_NLOAD_Theoric
=
0
;
int
SFR_NLOAD_Theoric
=
0
;
UOX_NLOAD
=
0
;
MOX_NLOAD
=
0
;
MOX_MLOAD
=
0
;
UNAT
=
0
;
// Get input arguments
getline
(
f_ROOTFileCandidates
,
s_ROOTFileName
);
Scen
->
BU_UOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
,
numformat
).
c_str
());
Scen
->
TC_UOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
1
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
BU_MOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
2
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
TC_MOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
3
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
TF_MOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
4
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
IsMOxAm
=
atoi
(
s_ROOTFileName
.
substr
(
dirtagsize
+
5
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
Fr_MOx
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
6
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
NB_Fuel
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
7
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
Ks_Fuel
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
8
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
LF_Fuel
=
atof
(
s_ROOTFileName
.
substr
(
dirtagsize
+
9
*
(
numformat
+
1
),
numformat
).
c_str
());
Scen
->
StMMOx
=
atoi
(
s_ROOTFileName
.
substr
(
dirtagsize
+
10
*
(
numformat
+
1
),
numformat
).
c_str
());
//
Scen
->
S_IsOk
=
true
;
getline
(
f_ROOTFileList
,
s_ROOTFileName
);
BU_UOX
=
atof
(
s_ROOTFileName
.
substr
(
6
,
9
).
c_str
());
BU_MOX
=
atof
(
s_ROOTFileName
.
substr
(
16
,
9
).
c_str
());
BU_SFR
=
atof
(
s_ROOTFileName
.
substr
(
26
,
9
).
c_str
());
Fr_UOX
=
atof
(
s_ROOTFileName
.
substr
(
36
,
9
).
c_str
());
Fr_MOX
=
atof
(
s_ROOTFileName
.
substr
(
46
,
9
).
c_str
());
Fr_SFR
=
atof
(
s_ROOTFileName
.
substr
(
56
,
9
).
c_str
());
CT_UOX
=
atof
(
s_ROOTFileName
.
substr
(
66
,
9
).
c_str
());
CT_MOX
=
atof
(
s_ROOTFileName
.
substr
(
76
,
9
).
c_str
());
CT_SFR
=
atof
(
s_ROOTFileName
.
substr
(
86
,
9
).
c_str
());
SM_MOX
=
atof
(
s_ROOTFileName
.
substr
(
96
,
9
).
c_str
());
Fr_SPu
=
atof
(
s_ROOTFileName
.
substr
(
106
,
9
).
c_str
());
SIOK
=
1
;
// Load ROOT file number f and load TTree
cout
<<
s_ROOTFileName
.
c_str
()
<<
endl
;
TFile
*
TFileName
=
new
TFile
(
s_ROOTFileName
.
c_str
());
// avoid corrupted files
if
(
TFileName
->
IsZombie
())
{
TFileName
->
Close
();
Scen
->
S_IsOk
=
false
;
NumberOfCrashed
++
;
continue
;}
if
(
!
TFileName
->
IsOpen
())
{
Scen
->
S_IsOk
=
false
;
NumberOfCrashed
++
;
continue
;}
// Record Selected root files
f_ROOTFileSelected
<<
s_ROOTFileName
<<
endl
;
//
TTree
*
fData
=
new
TTree
();
if
(
TFileName
->
IsZombie
())
{
TFileName
->
Close
();
continue
;}
if
(
!
TFileName
->
IsOpen
())
{
continue
;}
TTree
*
fData
=
new
TTree
();
fData
=
(
TTree
*
)
gDirectory
->
Get
(
TFileName
->
GetListOfKeys
()
->
At
(
TFileName
->
GetNkeys
()
-
1
)
->
GetName
());
//fData->Print();
fData
->
SetBranchStatus
(
"*"
,
0
);
// All branches are unbranched
...
...
@@ -323,199 +207,70 @@ int main(int argc, char** argv)
// CONNECT BRANCHES
string
Branchname
,
ActiveBranchName
;
fData
->
SetBranchStatus
(
"AbsTime"
,
1
);
fData
->
SetBranchAddress
(
"AbsTime"
,
&
TimeSecond
);
fData
->
SetBranchStatus
(
"ParcPower"
,
1
);
fData
->
SetBranchAddress
(
"ParcPower"
,
&
Parc
Power
);
fData
->
SetBranchStatus
(
"AbsTime"
,
1
);
fData
->
SetBranchAddress
(
"AbsTime"
,
&
TimeSecond
);
fData
->
SetBranchStatus
(
"ParcPower"
,
1
);
fData
->
SetBranchAddress
(
"ParcPower"
,
&
Power
);
// TOTAL IV
IsotopicVector
*
IV_TOTAL
=
0
;
Branchname
=
"TOTAL"
;
fData
->
SetBranchStatus
((
Branchname
+
"*"
).
c_str
(),
1
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
IV_TOTAL
);
// WASTE IV
IsotopicVector
*
IV_WASTE
=
0
;
Branchname
=
"WASTE"
;
fData
->
SetBranchStatus
((
Branchname
+
"*"
).
c_str
(),
1
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
IV_WASTE
);
// INCYCLE IV
IsotopicVector
*
IV_INCYCLE
=
0
;
Branchname
=
"INCYCLE"
;
fData
->
SetBranchStatus
((
Branchname
+
"*"
).
c_str
(),
1
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
IV_INCYCLE
);
// FACILITIES
Reactor
*
PWR_UOx
=
new
Reactor
();
Reactor
*
PWR_UOX
=
new
Reactor
();
Branchname
=
"R_PWR_UOx"
;
ActiveBranchName
=
Branchname
+
"*"
;
fData
->
SetBranchStatus
(
ActiveBranchName
.
c_str
(),
1
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
PWR_UO
x
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
PWR_UO
X
);
Reactor
*
PWR_MO
x
=
new
Reactor
();
Branchname
=
"R_PWR_MO
x
"
;
Reactor
*
PWR_MO
X
=
new
Reactor
();
Branchname
=
"R_PWR_MO
X
"
;
ActiveBranchName
=
Branchname
+
"*"
;
fData
->
SetBranchStatus
(
ActiveBranchName
.
c_str
(),
1
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
PWR_MO
x
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
PWR_MO
X
);
Storage
*
StockUOx
=
new
Storage
();
Reactor
*
SFR_MOX
=
new
Reactor
();
Branchname
=
"R_SFR_MOX"
;
ActiveBranchName
=
Branchname
+
"*"
;
fData
->
SetBranchStatus
(
ActiveBranchName
.
c_str
(),
1
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
SFR_MOX
);
Storage
*
Stock_UOX
=
new
Storage
();
Branchname
=
"S_StockUOx"
;
ActiveBranchName
=
Branchname
+
"*"
;
fData
->
SetBranchStatus
(
ActiveBranchName
.
c_str
(),
1
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
StockUO
x
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
Stock
_
UO
X
);
Storage
*
StockMO
x
=
new
Storage
();
Storage
*
Stock
_
MO
X
=
new
Storage
();
Branchname
=
"S_StockMOx"
;
ActiveBranchName
=
Branchname
+
"*"
;
fData
->
SetBranchStatus
(
ActiveBranchName
.
c_str
(),
1
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
StockMOx
);
fData
->
SetBranchAddress
((
Branchname
+
"."
).
c_str
(),
&
Stock_MOX
);
//---------------------------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------LOOP ON EVENTS AND FILE WRITING-----------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------------------------
exec_progress
(
f
,
NumberOfCandidates
)
;
cout
<<
"
\r
=====> "
<<
(
int
)((
double
)
f
/
NumberOfElements
*
100.
+
1
)
<<
" % "
<<
flush
;
// PROCEEDING
for
(
Long64_t
t
=
1
;
t
<
NTime
;
t
++
)
//loop over scenario time
for
(
Long64_t
t
=
1
;
t
<
NTime
;
t
++
)
//loop over scenario time
{
fData
->
GetEntry
(
t
);
//Update all branched object to the new CLASS time step t
double
tTime
=
double
(
TimeSecond
)
/
double
(
cYear
);
Scen
->
Time
.
push_back
(
tTime
);
//The time (in year) at this time step
Scen
->
Power
.
push_back
((
double
)
ParcPower
);
//
Scen
->
UOx_CT
=
double
(
PWR_UOx
->
GetCycleTime
())
/
double
(
cYear
);
Scen
->
MOx_CT
=
double
(
PWR_MOx
->
GetCycleTime
())
/
double
(
cYear
);
//
// Cumulated Number of Load
//
// New Reactor load - UOx
if
(
tTime
>=
double
(
PWR_UOx
->
GetCreationTime
())
/
double
(
cYear
)
+
Scen
->
UOx_CT
*
(
UOx_NLOAD_Theoric
))
{
UOx_NLOAD_Theoric
++
;
if
(
GetInvAtBOC
(
PWR_UOx
,
v_U5
)
>
0
)
{
Scen
->
UOx_NLOAD
+=
1
;
}
}
// New Reactor load - MOx
if
(
tTime
>=
double
(
PWR_MOx
->
GetCreationTime
())
/
double
(
cYear
)
+
Scen
->
MOx_CT
*
(
MOx_NLOAD_Theoric
))
{
MOx_NLOAD_Theoric
++
;
if
(
GetInvAtBOC
(
PWR_MOx
,
v_Pu
)
>
0
)
Scen
->
MOx_NLOAD
+=
1
;
else
Scen
->
MOx_MLOAD
+=
1
;
}
//
//
//
IsotopicVector
*
PWR_UOx_BOC
=
new
IsotopicVector
();
IsotopicVector
*
PWR_MOx_BOC
=
new
IsotopicVector
();
IsotopicVector
*
PWR_UOx_EOC
=
new
IsotopicVector
();
IsotopicVector
*
PWR_MOx_EOC
=
new
IsotopicVector
();
IsotopicVector
*
StockUOx_CIN
=
new
IsotopicVector
();
IsotopicVector
*
StockUOx_COU
=
new
IsotopicVector
();
IsotopicVector
*
StockUOx_INV
=
new
IsotopicVector
();
IsotopicVector
*
StockMOx_CIN
=
new
IsotopicVector
();
IsotopicVector
*
StockMOx_COU
=
new
IsotopicVector
();
IsotopicVector
*
StockMOx_INV
=
new
IsotopicVector
();
IsotopicVector
*
TOTAL_INV
=
new
IsotopicVector
();
IsotopicVector
*
WASTE_INV
=
new
IsotopicVector
();
IsotopicVector
*
INCYCLE_INV
=
new
IsotopicVector
();
//// By ZLIST
//for (unsigned short i = 0; i < ZLIST.size(); i++){
// PWR_UOx_BOC->Add(PWR_UOx->GetIVBeginCycle().GetSpeciesComposition(ZLIST[i]));
// PWR_MOx_BOC->Add(PWR_MOx->GetIVBeginCycle().GetSpeciesComposition(ZLIST[i]));
// PWR_UOx_EOC->Add(PWR_UOx->GetIVOutCycle().GetSpeciesComposition(ZLIST[i]));
// PWR_MOx_EOC->Add(PWR_MOx->GetIVOutCycle().GetSpeciesComposition(ZLIST[i]));
fData
->
GetEntry
(
t
);
//Update all branched object to the new CLASS time step j
// StockUOx_CIN->Add(StockUOx->GetCumulativeIVIn().GetSpeciesComposition(ZLIST[i]));
// StockUOx_COU->Add(StockUOx->GetCumulativeIVOut().GetSpeciesComposition(ZLIST[i]));
// StockUOx_INV->Add(StockUOx->GetInsideIV().GetSpeciesComposition(ZLIST[i]));
Time
=
double
(
TimeSecond
)
/
double
(
cYear
);
//The time (in year) at this time step
// StockMOx_CIN->Add(StockMOx->GetCumulativeIVIn().GetSpeciesComposition(ZLIST[i]));
// StockMOx_COU->Add(StockMOx->GetCumulativeIVOut().GetSpeciesComposition(ZLIST[i]));
// StockMOx_INV->Add(StockMOx->GetInsideIV().GetSpeciesComposition(ZLIST[i]));
// TOTAL_INV->Add(IV_TOTAL->GetSpeciesComposition(ZLIST[i]));
// WASTE_INV->Add(IV_WASTE->GetSpeciesComposition(ZLIST[i]));
// INCYCLE_INV->Add(IV_INCYCLE->GetSpeciesComposition(ZLIST[i]));
//}
// By ILIST
for
(
unsigned
short
i
=
0
;
i
<
ILIST
.
size
();
i
++
){
PWR_UOx_BOC
->
Add
(
PWR_UOx
->
GetIVBeginCycle
().
GetThisComposition
(
ILIST
[
i
]));
PWR_MOx_BOC
->
Add
(
PWR_MOx
->
GetIVBeginCycle
().
GetThisComposition
(
ILIST
[
i
]));
PWR_UOx_EOC
->
Add
(
PWR_UOx
->
GetIVOutCycle
().
GetThisComposition
(
ILIST
[
i
]));
PWR_MOx_EOC
->
Add
(
PWR_MOx
->
GetIVOutCycle
().
GetThisComposition
(
ILIST
[
i
]));
StockUOx_CIN
->
Add
(
StockUOx
->
GetCumulativeIVIn
().
GetThisComposition
(
ILIST
[
i
]));
StockUOx_COU
->
Add
(
StockUOx
->
GetCumulativeIVOut
().
GetThisComposition
(
ILIST
[
i
]));
StockUOx_INV
->
Add
(
StockUOx
->
GetInsideIV
().
GetThisComposition
(
ILIST
[
i
]));
StockMOx_CIN
->
Add
(
StockMOx
->
GetCumulativeIVIn
().
GetThisComposition
(
ILIST
[
i
]));
StockMOx_COU
->
Add
(
StockMOx
->
GetCumulativeIVOut
().
GetThisComposition
(
ILIST
[
i
]));
StockMOx_INV
->
Add
(
StockMOx
->
GetInsideIV
().
GetThisComposition
(
ILIST
[
i
]));
TOTAL_INV
->
Add
(
IV_TOTAL
->
GetThisComposition
(
ILIST
[
i
]));
WASTE_INV
->
Add
(
IV_WASTE
->
GetThisComposition
(
ILIST
[
i
]));
INCYCLE_INV
->
Add
(
IV_INCYCLE
->
GetThisComposition
(
ILIST
[
i
]));
}
//
Scen
->
v_PWR_UOx_BOC
.
push_back
(
PWR_UOx_BOC
);
Scen
->
v_PWR_MOx_BOC
.
push_back
(
PWR_MOx_BOC
);
Scen
->
v_PWR_UOx_EOC
.
push_back
(
PWR_UOx_EOC
);
Scen
->
v_PWR_MOx_EOC
.
push_back
(
PWR_MOx_EOC
);
Scen
->
v_StockUOx_CIN
.
push_back
(
StockUOx_CIN
);
Scen
->
v_StockUOx_COU
.
push_back
(
StockUOx_COU
);
Scen
->
v_StockUOx
.
push_back
(
StockUOx_INV
);
Scen
->
v_StockMOx_CIN
.
push_back
(
StockMOx_CIN
);
Scen
->
v_StockMOx_COU
.
push_back
(
StockMOx_COU
);
Scen
->
v_StockMOx
.
push_back
(
StockMOx_INV
);
Scen
->
v_IVTOTAL
.
push_back
(
TOTAL_INV
);
Scen
->
v_IVINCYCLE
.
push_back
(
WASTE_INV
);
Scen
->
v_IVWASTE
.
push_back
(
INCYCLE_INV
);
//
//
TreeScenario
->
Fill
();
}
TreeScenario
->
Fill
();
Scen
->
Clear
();
TFileName
->
Close
();
}
f_ROOTFileCandidates
.
close
();
f_ROOTFileSelected
.
close
();
//
cout
<<
"ROOT Crashed Files Updated : "
<<
NumberOfCrashed
<<
endl
;
f_ROOTFileList
.
close
();
cout
<<
endl
<<
"END OF ..."
<<
endl
<<
"#########################"
<<
endl
;
//
system("rm -f ROOTFileList.txt");
//
system("rm -f ROOTFileListCrashed.txt");
system
(
"rm -f ROOTFileList.txt"
);
system
(
"rm -f ROOTFileListCrashed.txt"
);
FileScenario
->
Write
();
FileScenario
->
Close
();
}
/*
g++ -std=c++11 -o CLASS_R
OOT2ROOT.ex
CLASS_ROOT2
ROO
T.cxx -I $CLASS_include -L $CLASS_lib -
L SCENAR -lCLASSpkg -lScenar
`root-config --cflags` `root-config --libs` -fopenmp -lgomp -Wunused-result
*/
g++ -std=c++11 -o CLASS_R
2D
CLASS_ROOT2
DA
T.cxx -I $CLASS_include -L $CLASS_lib -
lCLASSpkg
`root-config --cflags` `root-config --libs` -fopenmp -lgomp -Wunused-result
*/
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