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
574e2cb6
Commit
574e2cb6
authored
9 years ago
by
de Séréville Nicolas
Browse files
Options
Downloads
Patches
Plain Diff
+ Fix bug when moving files to NPLib/Detectors/newDetDirectory
parent
26a54835
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NPLib/Utility/nptool-wizard.cxx
+40
-33
40 additions, 33 deletions
NPLib/Utility/nptool-wizard.cxx
with
40 additions
and
33 deletions
NPLib/Utility/nptool-wizard.cxx
+
40
−
33
View file @
574e2cb6
#include
<iostream>
// C++ headers
#include
<sstream>
#include
<iostream>
#include
<sstream>
#include
<stdlib.h>
#include
<stdlib.h>
#include
<ctime>
#include
<ctime>
#include
"NPVDetector.h"
int
main
(
int
argc
,
char
**
argv
){
// NPTool header
// Find the different path
#include
"NPVDetector.h"
std
::
string
path
=
getenv
(
"NPTOOL"
);
std
::
string
pathNPL
=
path
+
"/NPLib/Detectors/"
;
std
::
string
pathNPS
=
path
+
"/NPSimulation/"
;
int
main
(
int
argc
,
char
**
argv
)
std
::
string
pwd
=
getenv
(
"PWD"
);
{
// Find the different paths
std
::
string
path
=
getenv
(
"NPTOOL"
);
std
::
string
pathNPL
=
path
+
"/NPLib/Detectors/"
;
std
::
string
pathNPS
=
path
+
"/NPSimulation/"
;
std
::
string
pwd
=
getenv
(
"PWD"
);
int
return_value
=
-
1
;
int
return_value
=
-
1
;
std
::
string
command
;
std
::
string
command
;
...
@@ -47,9 +52,9 @@ int main(int argc , char** argv){
...
@@ -47,9 +52,9 @@ int main(int argc , char** argv){
case
12
:
case
12
:
month
=
"December"
;
month
=
"December"
;
}
}
std
::
string
year
=
NPL
::
itoa
(
now
->
tm_year
+
1900
);
std
::
string
year
=
NPL
::
itoa
(
now
->
tm_year
+
1900
);
//////////
// start nptool-wizard
bool
check
=
true
;
bool
check
=
true
;
std
::
cout
<<
"
\r\033
[1;32m"
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
"
\r\033
[1;32m"
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
"********************************************************************************"
<<
std
::
endl
;
std
::
cout
<<
"********************************************************************************"
<<
std
::
endl
;
...
@@ -57,16 +62,15 @@ int main(int argc , char** argv){
...
@@ -57,16 +62,15 @@ int main(int argc , char** argv){
std
::
cout
<<
"********************************************************************************"
<<
std
::
endl
;
std
::
cout
<<
"********************************************************************************"
<<
std
::
endl
;
std
::
cout
<<
" This utility will create a new detector skeleton"
<<
std
::
endl
;
std
::
cout
<<
" This utility will create a new detector skeleton"
<<
std
::
endl
;
std
::
cout
<<
"
\033
[1;36m-> What is the detector name ?
\033
[0m"
;
std
::
cout
<<
"
\033
[1;36m-> What is the detector name ?
\033
[0m"
;
std
::
cin
>>
answer
;
std
::
cin
>>
answer
;
std
::
cout
<<
"
\033
[1;36m-> What is your name (firstname and surname)?
\033
[0m"
;
std
::
cout
<<
"
\033
[1;36m-> What is your name (firstname and surname)?
\033
[0m"
;
std
::
cin
>>
author
;
std
::
cin
>>
author
;
getline
(
cin
,
buffer
);
getline
(
cin
,
buffer
);
istringstream
oss
(
buffer
);
istringstream
oss
(
buffer
);
while
(
oss
>>
buffer
)
while
(
oss
>>
buffer
)
author
+=
" "
+
buffer
;
author
+=
" "
+
buffer
;
std
::
cout
<<
"
\033
[1;36m-> What is your email?
\033
[0m"
;
std
::
cout
<<
"
\033
[1;36m-> What is your email?
\033
[0m"
;
std
::
cin
>>
email
;
std
::
cin
>>
email
;
std
::
cout
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
std
::
endl
;
...
@@ -74,23 +78,23 @@ int main(int argc , char** argv){
...
@@ -74,23 +78,23 @@ int main(int argc , char** argv){
// TODO //
// TODO //
//////////
//////////
// Creating the detector file name
// Creating the detector file
s
name
std
::
string
DataFile_h
=
"T"
+
answer
+
"Data.h"
;
std
::
string
DataFile_h
=
"T"
+
answer
+
"Data.h"
;
std
::
string
DataFile_cxx
=
"T"
+
answer
+
"Data.cxx"
;
std
::
string
DataFile_cxx
=
"T"
+
answer
+
"Data.cxx"
;
std
::
string
PhysicsFile_h
=
"T"
+
answer
+
"Physics.h"
;
std
::
string
PhysicsFile_h
=
"T"
+
answer
+
"Physics.h"
;
std
::
string
PhysicsFile_cxx
=
"T"
+
answer
+
"Physics.cxx"
;
std
::
string
PhysicsFile_cxx
=
"T"
+
answer
+
"Physics.cxx"
;
std
::
string
SpectraFile_h
=
"T"
+
answer
+
"Spectra.h"
;
std
::
string
SpectraFile_h
=
"T"
+
answer
+
"Spectra.h"
;
std
::
string
SpectraFile_cxx
=
"T"
+
answer
+
"Spectra.cxx"
;
std
::
string
SpectraFile_cxx
=
"T"
+
answer
+
"Spectra.cxx"
;
std
::
string
SimFile_h
=
answer
+
".hh"
;
std
::
string
SimFile_h
=
answer
+
".hh"
;
std
::
string
SimFile_cxx
=
answer
+
".cc"
;
std
::
string
SimFile_cxx
=
answer
+
".cc"
;
std
::
string
InputFile
=
answer
+
".detector"
;
std
::
string
InputFile
=
answer
+
".detector"
;
// Create npl folder
// Create npl folder
for new detector
command
=
"mkdir "
+
pathNPL
+
answer
+
" > /dev/null 2> /dev/null"
;
command
=
"mkdir "
+
pathNPL
+
answer
+
" > /dev/null 2> /dev/null"
;
return_value
=
system
(
command
.
c_str
());
return_value
=
system
(
command
.
c_str
());
//
Add npl file
//
Copy template files to new detector directory
command
=
"cp "
+
pathNPL
+
"
ressources/DetectorSkeleton/NPLib/* "
command
=
"cp "
+
pathNPL
+
"
../
ressources/DetectorSkeleton/NPLib/* "
+
pathNPL
+
answer
+
"/ > /dev/null 2> /dev/null"
;
+
pathNPL
+
answer
+
"/ > /dev/null 2> /dev/null"
;
return_value
=
system
(
command
.
c_str
());
return_value
=
system
(
command
.
c_str
());
...
@@ -115,7 +119,7 @@ int main(int argc , char** argv){
...
@@ -115,7 +119,7 @@ int main(int argc , char** argv){
+
pathNPL
+
answer
+
"/* > /dev/null 2> /dev/null"
;
+
pathNPL
+
answer
+
"/* > /dev/null 2> /dev/null"
;
return_value
=
system
(
command
.
c_str
());
return_value
=
system
(
command
.
c_str
());
// change files name
command
=
"mv "
+
pathNPL
+
answer
+
"/TDETECTORNAMEData.h "
command
=
"mv "
+
pathNPL
+
answer
+
"/TDETECTORNAMEData.h "
+
pathNPL
+
answer
+
"/"
+
DataFile_h
;
+
pathNPL
+
answer
+
"/"
+
DataFile_h
;
return_value
=
system
(
command
.
c_str
());
return_value
=
system
(
command
.
c_str
());
...
@@ -137,7 +141,10 @@ int main(int argc , char** argv){
...
@@ -137,7 +141,10 @@ int main(int argc , char** argv){
+
pathNPL
+
answer
+
"/"
+
SpectraFile_cxx
;
+
pathNPL
+
answer
+
"/"
+
SpectraFile_cxx
;
return_value
=
system
(
command
.
c_str
());
return_value
=
system
(
command
.
c_str
());
// Create nps folder
// Create nps folder
command
=
"mkdir "
+
pathNPS
+
"/Detectors/"
+
answer
+
" > /dev/null 2> /dev/null"
;
return_value
=
system
(
command
.
c_str
());
// Add nps file
// Add nps file
...
...
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