Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
atlas
athena
Commits
0decae88
Commit
0decae88
authored
Sep 04, 2014
by
Zach Marshall
Committed by
Graeme Stewart
Sep 19, 2014
Browse files
Exposing macros for base class to use; using macros in FadsSD (FadsSensitiveDetector-00-01-08)
parent
3de25f66
Changes
10
Hide whitespace changes
Inline
Side-by-side
Simulation/G4Sim/FADS/FadsSensitiveDetector/FadsSensitiveDetector/FadsSensitiveDetector.h
0 → 100755
View file @
0decae88
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FadsSensitiveDetector_H
#define FadsSensitiveDetector_H
#include
<string>
#include
"globals.hh"
#include
"G4VSensitiveDetector.hh"
#include
"AthenaKernel/MsgStreamMember.h"
// To expose all the inheriting classes to the macros
#include
"AthenaBaseComps/AthMsgStreamMacros.h"
class
G4Step
;
class
G4HCofThisEvent
;
class
G4TouchableHistory
;
class
G4VPhysicalVolume
;
#include
"G4Transform3D.hh"
#include
<deque>
#include
<string>
namespace
FADS
{
class
FadsSensitiveDetector
:
public
G4VSensitiveDetector
{
private:
std
::
string
name
;
std
::
string
detName
;
// name of the detector an instance of this SD will be associated with
G4Step
*
currentStep
;
std
::
deque
<
int
>
volumeIdentifiers
;
std
::
deque
<
std
::
string
>
volumeNames
;
void
RetrieveVolumeTree
();
protected:
/// Log a message using the Athena controlled logging system
MsgStream
&
msg
(
MSG
::
Level
lvl
)
const
{
return
m_msg
.
get
()
<<
lvl
;
}
/// Check whether the logging system is active at the provided verbosity level
bool
msgLvl
(
MSG
::
Level
lvl
)
{
return
m_msg
.
get
().
level
()
<=
lvl
;
}
/// Private message stream member
mutable
Athena
::
MsgStreamMember
m_msg
;
bool
m_allowMods
;
public:
void
Register
();
std
::
string
GetName
();
std
::
string
GetDetectorName
()
{
return
detName
;}
void
SetDetectorName
(
std
::
string
n
)
{
detName
=
n
;}
FadsSensitiveDetector
(
std
::
string
n
);
virtual
~
FadsSensitiveDetector
();
virtual
void
Initialize
(
G4HCofThisEvent
*
)
=
0
;
// We do provide an implementation of ProcessHits to transfer responsibility
// onto ProcessStep. Still declare it virtual to ensure backwards compat. ADA
virtual
G4bool
ProcessHits
(
G4Step
*
,
G4TouchableHistory
*
);
virtual
void
EndOfEvent
(
G4HCofThisEvent
*
)
=
0
;
virtual
void
ProcessStep
()
{}
virtual
void
InitializeATLASEvent
()
{}
virtual
void
EndOfATLASEvent
()
{}
enum
coordinates
{
WorldCoordinates
,
LocalCoordinates
};
G4ThreeVector
InitialStepPosition
(
coordinates
);
G4ThreeVector
FinalStepPosition
(
coordinates
);
void
setAllowMods
(
bool
allowMods
)
{
m_allowMods
=
allowMods
;
}
};
}
// end namespace
#endif // FadsSensitiveDetector
Simulation/G4Sim/FADS/FadsSensitiveDetector/FadsSensitiveDetector/SensitiveDetectorCatalog.h
0 → 100755
View file @
0decae88
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SensitiveDetectorCatalog_H
#define SensitiveDetectorCatalog_H
#include
<map>
#include
<string>
#include
"FadsSensitiveDetector/SensitiveDetectorEntry.h"
#include
"FadsSensitiveDetector/FadsSensitiveDetector.h"
namespace
FADS
{
//class SensitiveDetectorMessenger;
typedef
std
::
map
<
std
::
string
,
SensitiveDetectorEntry
*
,
std
::
less
<
std
::
string
>
>
SDCatalog
;
typedef
std
::
map
<
std
::
string
,
FadsSensitiveDetector
*
,
std
::
less
<
std
::
string
>
>
SDStore
;
class
SensitiveDetectorCatalog
{
private:
SDCatalog
theCatalog
;
SDStore
theStore
;
static
SensitiveDetectorCatalog
*
thePointer
;
inline
SensitiveDetectorCatalog
();
// SensitiveDetectorMessenger *theMessenger;
public:
static
SensitiveDetectorCatalog
*
GetSensitiveDetectorCatalog
();
void
RegisterEntry
(
SensitiveDetectorEntry
*
d
);
void
RegisterSensitiveDetector
(
FadsSensitiveDetector
*
d
);
SensitiveDetectorEntry
*
GetSensitiveDetectorEntry
(
std
::
string
name
);
FadsSensitiveDetector
*
GetSensitiveDetector
(
std
::
string
name
);
void
PrintEntries
();
void
PrintSensitiveDetectorList
();
SDStore
*
sdStore
()
{
return
&
theStore
;
}
};
}
// end namespace
#endif // SensitiveDetectorCatalog
Simulation/G4Sim/FADS/FadsSensitiveDetector/FadsSensitiveDetector/SensitiveDetectorEntry.h
0 → 100755
View file @
0decae88
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SensitiveDetectorEntry_H
#define SensitiveDetectorEntry_H
#include
<string>
namespace
FADS
{
class
SensitiveDetectorEntry
{
private:
std
::
string
name
;
public:
SensitiveDetectorEntry
(
std
::
string
n
);
virtual
~
SensitiveDetectorEntry
()
{}
std
::
string
GetName
();
virtual
void
Construct
(
std
::
string
,
bool
)
{;}
};
}
// end namespace
#endif // SensitiveDetectorEntry
Simulation/G4Sim/FADS/FadsSensitiveDetector/FadsSensitiveDetector/SensitiveDetectorEntryT.h
0 → 100755
View file @
0decae88
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SensitiveDetectorEntryT_H
#define SensitiveDetectorEntryT_H
#include
"FadsSensitiveDetector/SensitiveDetectorEntry.h"
#include
"FadsSensitiveDetector/FadsSensitiveDetector.h"
#include
<string>
namespace
FADS
{
template
<
class
T
>
class
SensitiveDetectorEntryT
:
public
SensitiveDetectorEntry
{
private:
FadsSensitiveDetector
*
theSensitiveDetector
;
public:
SensitiveDetectorEntryT
<
T
>
(
std
::
string
n
)
:
SensitiveDetectorEntry
(
n
)
{
// std::cout<<" this is the templated c-tor"<<std::endl;
theSensitiveDetector
=
0
;
}
void
Construct
(
std
::
string
n
,
bool
allowMods
=
false
)
{
if
(
!
theSensitiveDetector
)
{
theSensitiveDetector
=
new
T
(
n
);
theSensitiveDetector
->
Register
();
theSensitiveDetector
->
setAllowMods
(
allowMods
);
}
// std::cout<<"this is construct "<<n<<std::endl;
}
};
}
// end namespace
#endif // SensitiveDetectorEntryT
Simulation/G4Sim/FADS/FadsSensitiveDetector/cmt/Makefile
0 → 100755
View file @
0decae88
include
$(CMTROOT)/src/Makefile.header
include
$(CMTROOT)/src/constituents.make
Simulation/G4Sim/FADS/FadsSensitiveDetector/cmt/requirements
0 → 100755
View file @
0decae88
package
FadsSensitiveDetector
author
ADA
branches
src
cmt
use
AtlasPolicy
AtlasPolicy
-*
use
Geant4
Geant4
-*
External
use
AthenaKernel
AthenaKernel
-*
Control
use
AthenaBaseComps
AthenaBaseComps
-*
Control
private
use
GaudiInterface
GaudiInterface
-*
External
end_private
include_dirs
"$(FadsSensitiveDetector_root)"
"$(FadsSensitiveDetector_root)/FadsSensitiveDetector"
library
FadsSensitiveDetector
../
src
/*.
cxx
apply_pattern
installed_library
#=======================================================
private
macro_remove
CLHEP_pp_cppflags
"-DCLHEP_SQR_DEFINED "
macro_remove
CLHEP_pp_cppflags
"-DCLHEP_MAX_MIN_DEFINED "
Simulation/G4Sim/FADS/FadsSensitiveDetector/doc/mainpage.h
0 → 100755
View file @
0decae88
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage
@ref used_FadsSensitiveDetector
@ref requirements_FadsSensitiveDetector
*/
/**
@page used_FadsSensitiveDetector Used Packages
@htmlinclude used_packages.html
*/
/**
@page requirements_FadsSensitiveDetector Requirements
@include requirements
*/
Simulation/G4Sim/FADS/FadsSensitiveDetector/src/FadsSensitiveDetector.cxx
0 → 100755
View file @
0decae88
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include
"FadsSensitiveDetector/FadsSensitiveDetector.h"
#include
"FadsSensitiveDetector/SensitiveDetectorCatalog.h"
#include
"G4SDManager.hh"
#include
"G4Step.hh"
#include
"G4StepPoint.hh"
#include
"G4TouchableHistory.hh"
#include
"GaudiKernel/IMessageSvc.h"
#include
"GaudiKernel/ISvcLocator.h"
#include
"GaudiKernel/Bootstrap.h"
namespace
FADS
{
std
::
string
FadsSensitiveDetector
::
GetName
()
{
return
name
;
}
void
FadsSensitiveDetector
::
Register
()
{
G4SDManager
*
SDman
=
G4SDManager
::
GetSDMpointer
();
SDman
->
AddNewDetector
(
this
);
}
FadsSensitiveDetector
::
FadsSensitiveDetector
(
std
::
string
n
)
:
G4VSensitiveDetector
(
n
),
name
(
n
),
currentStep
(
0
),
m_msg
(
n
),
m_allowMods
(
false
)
{
ATH_MSG_DEBUG
(
"c-tor called for "
<<
name
);
SensitiveDetectorCatalog
*
sdc
=
SensitiveDetectorCatalog
::
GetSensitiveDetectorCatalog
();
ATH_MSG_DEBUG
(
"Registering sensitive detector list "
<<
n
);
sdc
->
RegisterSensitiveDetector
(
this
);
}
FadsSensitiveDetector
::~
FadsSensitiveDetector
()
{
}
G4bool
FadsSensitiveDetector
::
ProcessHits
(
G4Step
*
step
,
G4TouchableHistory
*
)
{
currentStep
=
step
;
RetrieveVolumeTree
();
ProcessStep
();
return
true
;
}
void
FadsSensitiveDetector
::
RetrieveVolumeTree
()
{
G4TouchableHistory
*
th
=
(
G4TouchableHistory
*
)
currentStep
->
GetPreStepPoint
()
->
GetTouchable
();
for
(
int
i
=
0
;
i
<
th
->
GetHistoryDepth
();
i
++
)
{
int
id
=
th
->
GetVolume
(
i
)
->
GetCopyNo
();
if
(
id
!=
INT_MIN
)
{
volumeIdentifiers
.
push_front
(
th
->
GetVolume
(
i
)
->
GetCopyNo
());
volumeNames
.
push_front
(
th
->
GetVolume
(
i
)
->
GetName
());
}
}
}
G4ThreeVector
FadsSensitiveDetector
::
InitialStepPosition
(
coordinates
c
)
{
G4StepPoint
*
preStepPoint
=
currentStep
->
GetPreStepPoint
();
G4ThreeVector
globalCoordinates
=
preStepPoint
->
GetPosition
();
if
(
c
==
WorldCoordinates
)
return
globalCoordinates
;
G4TouchableHistory
*
theTouchable
=
(
G4TouchableHistory
*
)
(
preStepPoint
->
GetTouchable
());
G4ThreeVector
localCoordinates
=
theTouchable
->
GetHistory
()
->
GetTopTransform
().
TransformPoint
(
globalCoordinates
);
return
localCoordinates
;
}
G4ThreeVector
FadsSensitiveDetector
::
FinalStepPosition
(
coordinates
c
)
{
G4StepPoint
*
postStepPoint
=
currentStep
->
GetPostStepPoint
();
G4ThreeVector
globalCoordinates
=
postStepPoint
->
GetPosition
();
if
(
c
==
WorldCoordinates
)
return
globalCoordinates
;
G4TouchableHistory
*
theTouchable
=
(
G4TouchableHistory
*
)
(
postStepPoint
->
GetTouchable
());
G4ThreeVector
localCoordinates
=
theTouchable
->
GetHistory
()
->
GetTopTransform
().
TransformPoint
(
globalCoordinates
);
return
localCoordinates
;
}
}
// end namespace
Simulation/G4Sim/FADS/FadsSensitiveDetector/src/SensitiveDetectorCatalog.cxx
0 → 100755
View file @
0decae88
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include
"FadsSensitiveDetector/SensitiveDetectorCatalog.h"
//#include "FadsSensitiveDetector/SensitiveDetectorMessenger.h"
namespace
FADS
{
SensitiveDetectorCatalog
*
SensitiveDetectorCatalog
::
thePointer
=
SensitiveDetectorCatalog
::
GetSensitiveDetectorCatalog
();
SensitiveDetectorCatalog
::
SensitiveDetectorCatalog
()
{
// std::cout<<"Sensitive Detector catalog being built now!!"<<std::endl;
// theMessenger=new SensitiveDetectorMessenger(this);
}
SensitiveDetectorCatalog
*
SensitiveDetectorCatalog
::
GetSensitiveDetectorCatalog
()
{
if
(
!
thePointer
)
thePointer
=
new
SensitiveDetectorCatalog
;
return
thePointer
;
}
void
SensitiveDetectorCatalog
::
RegisterEntry
(
SensitiveDetectorEntry
*
d
)
{
// cout<<"registering sensitive detector entry"<<d->GetName()<<endl;
if
(
theCatalog
.
find
(
d
->
GetName
())
!=
theCatalog
.
end
())
std
::
cout
<<
"Redefining SensitiveDetectors list "
<<
d
->
GetName
()
<<
std
::
endl
;
else
theCatalog
[
d
->
GetName
()]
=
d
;
}
void
SensitiveDetectorCatalog
::
RegisterSensitiveDetector
(
FadsSensitiveDetector
*
d
)
{
// cout<<"registering sensitive detector "<<d->GetName()<<endl;
if
(
theStore
.
find
(
d
->
GetName
())
!=
theStore
.
end
())
std
::
cout
<<
"Redefining SensitiveDetector "
<<
d
->
GetName
()
<<
std
::
endl
;
else
theStore
[
d
->
GetName
()]
=
d
;
}
SensitiveDetectorEntry
*
SensitiveDetectorCatalog
::
GetSensitiveDetectorEntry
(
std
::
string
name
)
{
if
(
theCatalog
.
find
(
name
)
==
theCatalog
.
end
())
{
std
::
cout
<<
"Sensitive Detector entry "
<<
name
<<
"notfound!"
<<
std
::
endl
;
return
0
;
}
else
{
SensitiveDetectorEntry
*
ds
=
theCatalog
[
name
];
return
ds
;
}
}
FadsSensitiveDetector
*
SensitiveDetectorCatalog
::
GetSensitiveDetector
(
std
::
string
name
)
{
if
(
theStore
.
find
(
name
)
==
theStore
.
end
())
{
std
::
cout
<<
"Sensitive Detector "
<<
name
<<
"notfound!"
<<
std
::
endl
;
return
0
;
}
else
{
FadsSensitiveDetector
*
ds
=
theStore
[
name
];
return
ds
;
}
}
void
SensitiveDetectorCatalog
::
PrintEntries
()
{
std
::
cout
<<
"Printing the list of pre-defined Sensitive Detector entries:"
<<
std
::
endl
;
std
::
cout
<<
theCatalog
.
size
()
<<
std
::
endl
;
SDCatalog
::
const_iterator
it
;
for
(
it
=
theCatalog
.
begin
();
it
!=
theCatalog
.
end
();
it
++
)
{
std
::
cout
<<
" --- Sensitive Detector entry "
<<
(
*
it
).
first
<<
std
::
endl
;
}
}
void
SensitiveDetectorCatalog
::
PrintSensitiveDetectorList
()
{
std
::
cout
<<
"Printing the list of Sensitive Detectors:"
<<
std
::
endl
;
std
::
cout
<<
theStore
.
size
()
<<
std
::
endl
;
SDStore
::
const_iterator
it
;
for
(
it
=
theStore
.
begin
();
it
!=
theStore
.
end
();
it
++
)
{
std
::
cout
<<
" --- Sensitive Detector: "
<<
(
*
it
).
first
<<
std
::
endl
;
}
}
}
// end namespace
Simulation/G4Sim/FADS/FadsSensitiveDetector/src/SensitiveDetectorEntry.cxx
0 → 100755
View file @
0decae88
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include
"FadsSensitiveDetector/SensitiveDetectorEntry.h"
#include
"FadsSensitiveDetector/SensitiveDetectorCatalog.h"
namespace
FADS
{
std
::
string
SensitiveDetectorEntry
::
GetName
()
{
return
name
;
}
SensitiveDetectorEntry
::
SensitiveDetectorEntry
(
std
::
string
n
)
:
name
(
n
)
{
SensitiveDetectorCatalog
*
c
=
SensitiveDetectorCatalog
::
GetSensitiveDetectorCatalog
();
c
->
RegisterEntry
(
this
);
}
}
// end namespace
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment