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
Admin message
Gitlab has been updated. More info
here
and
there
.
Show more breadcrumbs
np
nptool
Commits
74cd5b9a
Commit
74cd5b9a
authored
10 years ago
by
adrien-matta
Browse files
Options
Downloads
Patches
Plain Diff
* Putting back missing file
parent
2c223594
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NPSimulation/src/PrimaryGeneratorAction.cc
+177
-0
177 additions, 0 deletions
NPSimulation/src/PrimaryGeneratorAction.cc
NPSimulation/src/VDetector.cc
+54
-0
54 additions, 0 deletions
NPSimulation/src/VDetector.cc
with
231 additions
and
0 deletions
NPSimulation/src/PrimaryGeneratorAction.cc
0 → 100644
+
177
−
0
View file @
74cd5b9a
/*****************************************************************************
* Copyright (C) 2009-2013 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Adrien MATTA contact address: matta@ipno.in2p3.fr *
* *
* Creation Date : January 2009 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* This class manage the event Generator used in simulation *
* Every time you had a new kind of event generator, you need to add a few *
* line in the ReadConfiguration method to detect the associate Token *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
*****************************************************************************/
// STL
#include
"math.h"
#include
<cstdlib>
// G4
#include
"G4ParticleTable.hh"
#include
"G4ParticleDefinition.hh"
// NPL
#include
"NPOptionManager.h"
// CLHEP
#include
"CLHEP/Random/RandGauss.h"
#include
"CLHEP/Random/RandGeneral.h"
#include
"PrimaryGeneratorAction.hh"
#include
"PhysicsList.hh"
#include
"Randomize.hh"
#include
"ParticleStack.hh"
// Event Generator Class
#include
"EventGeneratorTwoBodyReaction.hh"
#include
"EventGeneratorIsotropic.hh"
#include
"EventGeneratorBeam.hh"
#include
"EventGeneratorGammaDecay.hh"
#include
"EventGeneratorParticleDecay.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction
::~
PrimaryGeneratorAction
(){
for
(
unsigned
int
i
=
0
;
i
<
m_EventGenerator
.
size
();
i
++
)
{
delete
m_EventGenerator
[
i
];
}
m_EventGenerator
.
clear
();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction
::
PrimaryGeneratorAction
(
DetectorConstruction
*
det
)
:
m_detector
(
det
){
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
PrimaryGeneratorAction
::
GeneratePrimaries
(
G4Event
*
anEvent
)
{
for
(
unsigned
int
i
=
0
;
i
<
m_EventGenerator
.
size
();
i
++
)
{
m_EventGenerator
[
i
]
->
GenerateEvent
(
anEvent
);
}
ParticleStack
::
getInstance
()
->
ShootAllParticle
(
anEvent
);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
PrimaryGeneratorAction
::
ReadEventGeneratorFile
(
string
Path
){
bool
check_Isotropic
=
false
;
bool
check_TwoBodyReaction
=
false
;
bool
check_Beam
=
false
;
// You can have more than one of those
int
alreadyiInstantiate_GammaDecay
=
0
;
int
seenToken_GammaDecay
=
0
;
int
alreadyiInstantiate_ParticleDecay
=
0
;
int
seenToken_ParticleDecay
=
0
;
if
(
NPOptionManager
::
getInstance
()
->
GetVerboseLevel
()
==
1
)
cout
<<
"/////////////////////////////////////////////////// "
<<
endl
;
string
LineBuffer
;
ifstream
EventGeneratorFile
;
EventGeneratorFile
.
open
(
Path
.
c_str
());
if
(
EventGeneratorFile
.
is_open
())
{
// should always be true
cout
<<
"Event Generator file "
<<
Path
<<
" loading "
<<
endl
;
}
else
{
cout
<<
"Error, Event Generator file "
<<
Path
<<
" found"
<<
endl
;
}
while
(
!
EventGeneratorFile
.
eof
())
{
//Pick-up next line
getline
(
EventGeneratorFile
,
LineBuffer
);
//Search for comment Symbol %
if
(
LineBuffer
.
compare
(
0
,
1
,
"%"
)
==
0
)
{
/*do nothing*/
;
}
//Search for Isotropic source
else
if
(
LineBuffer
.
compare
(
0
,
9
,
"Isotropic"
)
==
0
&&
!
check_Isotropic
)
{
check_Isotropic
=
true
;
VEventGenerator
*
myEventGenerator
=
new
EventGeneratorIsotropic
();
EventGeneratorFile
.
close
();
myEventGenerator
->
ReadConfiguration
(
Path
);
EventGeneratorFile
.
open
(
Path
.
c_str
());
myEventGenerator
->
InitializeRootOutput
();
m_EventGenerator
.
push_back
(
myEventGenerator
);
}
//Search for Beam
else
if
(
LineBuffer
.
compare
(
0
,
4
,
"Beam"
)
==
0
&&
!
check_Beam
)
{
check_Beam
=
true
;
VEventGenerator
*
myEventGenerator
=
new
EventGeneratorBeam
();
EventGeneratorFile
.
close
();
myEventGenerator
->
ReadConfiguration
(
Path
);
EventGeneratorFile
.
open
(
Path
.
c_str
());
myEventGenerator
->
InitializeRootOutput
();
myEventGenerator
->
SetTarget
(
m_detector
->
GetTarget
());
m_EventGenerator
.
push_back
(
myEventGenerator
);
}
//Search for Two body reaction
else
if
(
LineBuffer
.
compare
(
0
,
15
,
"TwoBodyReaction"
)
==
0
&&
!
check_TwoBodyReaction
)
{
check_TwoBodyReaction
=
true
;
VEventGenerator
*
myEventGenerator
=
new
EventGeneratorTwoBodyReaction
();
EventGeneratorFile
.
close
();
myEventGenerator
->
ReadConfiguration
(
Path
);
EventGeneratorFile
.
open
(
Path
.
c_str
());
myEventGenerator
->
InitializeRootOutput
();
myEventGenerator
->
SetTarget
(
m_detector
->
GetTarget
());
m_EventGenerator
.
push_back
(
myEventGenerator
);
}
//Search for GammaDecay
else
if
(
LineBuffer
.
compare
(
0
,
10
,
"GammaDecay"
)
==
0
)
{
seenToken_GammaDecay
++
;
if
(
seenToken_GammaDecay
>
alreadyiInstantiate_GammaDecay
)
{
alreadyiInstantiate_GammaDecay
++
;
VEventGenerator
*
myEventGenerator
=
new
EventGeneratorGammaDecay
();
EventGeneratorFile
.
close
();
myEventGenerator
->
ReadConfiguration
(
Path
,
alreadyiInstantiate_GammaDecay
);
EventGeneratorFile
.
open
(
Path
.
c_str
());
myEventGenerator
->
InitializeRootOutput
();
myEventGenerator
->
SetTarget
(
m_detector
->
GetTarget
());
m_EventGenerator
.
push_back
(
myEventGenerator
);
seenToken_GammaDecay
=
0
;
}
}
//Search for ParticleDecay
else
if
(
LineBuffer
.
compare
(
0
,
13
,
"ParticleDecay"
)
==
0
)
{
seenToken_ParticleDecay
++
;
if
(
seenToken_ParticleDecay
>
alreadyiInstantiate_ParticleDecay
){
alreadyiInstantiate_ParticleDecay
++
;
VEventGenerator
*
myEventGenerator
=
new
EventGeneratorParticleDecay
();
EventGeneratorFile
.
close
();
myEventGenerator
->
ReadConfiguration
(
Path
,
alreadyiInstantiate_ParticleDecay
);
EventGeneratorFile
.
open
(
Path
.
c_str
());
myEventGenerator
->
InitializeRootOutput
();
myEventGenerator
->
SetTarget
(
m_detector
->
GetTarget
());
m_EventGenerator
.
push_back
(
myEventGenerator
);
seenToken_ParticleDecay
=
0
;
}
}
}
EventGeneratorFile
.
close
();
}
This diff is collapsed.
Click to expand it.
NPSimulation/src/VDetector.cc
0 → 100644
+
54
−
0
View file @
74cd5b9a
/*****************************************************************************
* Copyright (C) 2009-2013 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
*****************************************************************************/
/*****************************************************************************
* Original Author: Adrien MATTA contact address: matta@ipno.in2p3.fr *
* *
* Creation Date : January 2009 *
* Last update : *
*---------------------------------------------------------------------------*
* Decription: *
* All detector added in the project should derive from this virtual class *
* A vector of VDetector object is manage in the DetectorConstruction class *
* and call the virtual method of this class implemented in the daughter *
* class object. *
* This inheritance insure homogeneity and modularity of the code *
* *
*---------------------------------------------------------------------------*
* Comment: *
* *
*****************************************************************************/
#include
"VDetector.hh"
#include
"RootOutput.h"
TInteractionCoordinates
*
VDetector
::
ms_InterCoord
=
0
;
// Constructor
VDetector
::
VDetector
()
{
if
(
ms_InterCoord
==
0
)
ms_InterCoord
=
new
TInteractionCoordinates
();
InitializeRootOutput
();
}
// Destructor
VDetector
::~
VDetector
()
{
}
void
VDetector
::
InitializeRootOutput
()
{
RootOutput
*
pAnalysis
=
RootOutput
::
getInstance
();
TTree
*
pTree
=
pAnalysis
->
GetTree
();
// if the branch does not exist yet, create it
if
(
!
pTree
->
GetBranch
(
"InteractionCoordinates"
))
pTree
->
Branch
(
"InteractionCoordinates"
,
"TInteractionCoordinates"
,
&
ms_InterCoord
);
}
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