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
13bca0df
Commit
13bca0df
authored
Jun 23, 2021
by
Rachid Mazini
Browse files
Merge branch 'write_clusters' into '21.0'
Write clusters for the FCS_NTUP See merge request
!44588
parents
142c57c3
d59e9223
Changes
7
Hide whitespace changes
Inline
Side-by-side
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/CMakeLists.txt
View file @
13bca0df
...
...
@@ -32,6 +32,7 @@ atlas_depends_on_subdirs( PUBLIC
DetectorDescription/GeoModel/GeoModelInterfaces
Event/EventInfo
Event/NavFourMom
Event/xAOD/xAODCaloEvent
Generators/GeneratorObjects
LArCalorimeter/LArSimEvent
Simulation/ISF/ISF_Core/ISF_Event
...
...
@@ -73,13 +74,13 @@ atlas_add_library( ISF_FastCaloSimParametrizationLib
PRIVATE_INCLUDE_DIRS
${
XERCESC_INCLUDE_DIRS
}
${
CLHEP_INCLUDE_DIRS
}
${
GEANT4_INCLUDE_DIRS
}
PRIVATE_DEFINITIONS
${
CLHEP_DEFINITIONS
}
LINK_LIBRARIES
${
ROOT_LIBRARIES
}
${
HEPPDT_LIBRARIES
}
${
HEPMC_LIBRARIES
}
CaloGeoHelpers AthenaBaseComps AthenaKernel Identifier GaudiKernel ISF_Interfaces TrkEventPrimitives TrkParameters TrkExInterfaces CaloDetDescrLib StoreGateLib SGtests TileConditionsLib
PRIVATE_LINK_LIBRARIES
${
XERCESC_LIBRARIES
}
${
CLHEP_LIBRARIES
}
${
GEANT4_LIBRARIES
}
CaloEvent CaloIdentifier AthenaPoolUtilities GeoAdaptors EventInfo NavFourMom GeneratorObjects LArSimEvent ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces TileDetDescr TileSimEvent TrkGeometry TrkSurfaces TrkMaterialOnTrack
)
PRIVATE_LINK_LIBRARIES
${
XERCESC_LIBRARIES
}
${
CLHEP_LIBRARIES
}
${
GEANT4_LIBRARIES
}
CaloEvent CaloIdentifier AthenaPoolUtilities GeoAdaptors EventInfo NavFourMom GeneratorObjects LArSimEvent ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces TileDetDescr TileSimEvent TrkGeometry TrkSurfaces TrkMaterialOnTrack
xAODCaloEvent
)
atlas_add_component
(
ISF_FastCaloSimParametrization
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS
${
ROOT_INCLUDE_DIRS
}
${
HEPPDT_INCLUDE_DIRS
}
${
XERCESC_INCLUDE_DIRS
}
${
CLHEP_INCLUDE_DIRS
}
${
HEPMC_INCLUDE_DIRS
}
${
GEANT4_INCLUDE_DIRS
}
LINK_LIBRARIES
${
ROOT_LIBRARIES
}
${
HEPPDT_LIBRARIES
}
${
XERCESC_LIBRARIES
}
${
CLHEP_LIBRARIES
}
${
HEPMC_LIBRARIES
}
${
GEANT4_LIBRARIES
}
CaloDetDescrLib CaloGeoHelpers AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier GaudiKernel ISF_Interfaces TrkEventPrimitives TrkParameters TrkExInterfaces CaloEvent CaloIdentifier AthenaPoolUtilities GeoAdaptors EventInfo NavFourMom GeneratorObjects LArSimEvent ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces TileConditionsLib TileDetDescr TileSimEvent TrkGeometry TrkSurfaces TrkMaterialOnTrack ISF_FastCaloSimParametrizationLib
)
LINK_LIBRARIES
${
ROOT_LIBRARIES
}
${
HEPPDT_LIBRARIES
}
${
XERCESC_LIBRARIES
}
${
CLHEP_LIBRARIES
}
${
HEPMC_LIBRARIES
}
${
GEANT4_LIBRARIES
}
CaloDetDescrLib CaloGeoHelpers AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier GaudiKernel ISF_Interfaces TrkEventPrimitives TrkParameters TrkExInterfaces CaloEvent CaloIdentifier AthenaPoolUtilities GeoAdaptors EventInfo NavFourMom GeneratorObjects LArSimEvent ISF_Event ISF_FastCaloSimEvent ISF_FastCaloSimInterfaces TileConditionsLib TileDetDescr TileSimEvent TrkGeometry TrkSurfaces TrkMaterialOnTrack ISF_FastCaloSimParametrizationLib
xAODCaloEvent
)
# Install files from the package:
atlas_install_python_modules
(
python/*.py
)
...
...
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/ISF_HitAnalysis.h
View file @
13bca0df
...
...
@@ -125,6 +125,13 @@ class ISF_HitAnalysis : public AthAlgorithm {
std
::
vector
<
int
>*
m_truth_barcode
;
std
::
vector
<
int
>*
m_truth_vtxbarcode
;
//production vertex barcode
std
::
vector
<
float
>*
m_cluster_energy
;
std
::
vector
<
float
>*
m_cluster_eta
;
std
::
vector
<
float
>*
m_cluster_phi
;
std
::
vector
<
unsigned
>*
m_cluster_size
;
std
::
vector
<
std
::
vector
<
Long64_t
>>*
m_cluster_cellID
;
std
::
vector
<
Long64_t
>*
m_cell_identifier
;
std
::
vector
<
float
>*
m_cell_energy
;
std
::
vector
<
int
>*
m_cell_sampling
;
...
...
@@ -274,6 +281,7 @@ class ISF_HitAnalysis : public AthAlgorithm {
double
m_calomargin
;
bool
m_saveAllBranches
;
bool
m_doAllCells
;
bool
m_doClusterInfo
;
bool
m_doLayers
;
bool
m_doLayerSums
;
bool
m_doG4Hits
;
...
...
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/Root/LinkDef.h
View file @
13bca0df
...
...
@@ -17,6 +17,7 @@
#pragma link C++ struct FCS_matchedcellvector+;
#pragma link C++ class std::vector<Float_t>+;
#pragma link C++ class std::vector<std::vector<float> >+;
#pragma link C++ class std::vector<std::vector<Long64_t> >+;
#ifndef CaloGeometryFromFile_h
#pragma link C++ class CaloGeometryLookup;
#pragma link C++ class CaloGeometry;
...
...
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/python/fcsTrfArgs.py
View file @
13bca0df
...
...
@@ -26,6 +26,9 @@ def addFCS_NtupArgs(parser):
parser
.
add_argument
(
'--saveAllBranches'
,
type
=
argFactory
(
argBool
),
help
=
'Flag to turn on extra branches for Hits and G4hits'
,
group
=
'FCS_Ntup_tf'
)
parser
.
add_argument
(
'--doClusterInfo'
,
type
=
argFactory
(
argBool
),
help
=
'Flag to turn on extra branches for clusters'
,
group
=
'FCS_Ntup_tf'
)
parser
.
add_argument
(
'--NTruthParticles'
,
type
=
argFactory
(
argInt
),
help
=
'Option to select number of truth particles copied to ntuples'
,
group
=
'FCS_Ntup_tf'
)
help
=
'Option to select number of truth particles copied to ntuples'
,
group
=
'FCS_Ntup_tf'
)
\ No newline at end of file
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_ntuple_core.py
View file @
13bca0df
...
...
@@ -84,6 +84,7 @@ ISF_HitAnalysis.DoAllCells = False
ISF_HitAnalysis
.
DoLayers
=
True
ISF_HitAnalysis
.
DoLayerSums
=
True
ISF_HitAnalysis
.
DoG4Hits
=
doG4Hits
ISF_HitAnalysis
.
DoClusterInfo
=
doClusterInfo
ISF_HitAnalysis
.
TimingCut
=
999999
ISF_HitAnalysis
.
OutputLevel
=
ERROR
...
...
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/skeleton.ESDtoNTUP_FCS.py
View file @
13bca0df
...
...
@@ -53,6 +53,12 @@ if hasattr(runArgs,"doG4Hits"):
else
:
doG4Hits
=
False
## Flag for doClusterInfo
if
hasattr
(
runArgs
,
"doClusterInfo"
):
doClusterInfo
=
runArgs
.
doClusterInfo
else
:
doClusterInfo
=
False
## Flag for saveAllBranches
if
hasattr
(
runArgs
,
"saveAllBranches"
):
saveAllBranches
=
runArgs
.
saveAllBranches
...
...
Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/src/ISF_HitAnalysis.cxx
View file @
13bca0df
...
...
@@ -31,6 +31,9 @@
//CaloCell
#include
"CaloEvent/CaloCellContainer.h"
#include
"CaloEvent/CaloClusterCellLinkContainer.h"
#include
"xAODCaloEvent/CaloClusterContainer.h"
#include
"xAODCaloEvent/CaloCluster.h"
#include
"GaudiKernel/MsgStream.h"
#include
"GaudiKernel/AlgFactory.h"
...
...
@@ -108,6 +111,11 @@ ISF_HitAnalysis::ISF_HitAnalysis(const std::string& name, ISvcLocator* pSvcLocat
,
m_truth_pdg
(
0
)
,
m_truth_barcode
(
0
)
,
m_truth_vtxbarcode
(
0
)
,
m_cluster_energy
(
0
)
,
m_cluster_eta
(
0
)
,
m_cluster_phi
(
0
)
,
m_cluster_size
(
0
)
,
m_cluster_cellID
(
0
)
,
m_cell_identifier
(
0
)
,
m_cell_energy
(
0
)
,
m_cell_sampling
(
0
)
...
...
@@ -220,6 +228,7 @@ ISF_HitAnalysis::ISF_HitAnalysis(const std::string& name, ISvcLocator* pSvcLocat
declareProperty
(
"SaveAllBranches"
,
m_saveAllBranches
=
false
);
declareProperty
(
"DoAllCells"
,
m_doAllCells
=
false
);
declareProperty
(
"DoClusterInfo"
,
m_doClusterInfo
=
false
);
declareProperty
(
"DoLayers"
,
m_doLayers
=
true
);
declareProperty
(
"DoLayerSums"
,
m_doLayerSums
=
true
);
declareProperty
(
"DoG4Hits"
,
m_doG4Hits
=
false
);
...
...
@@ -514,6 +523,13 @@ StatusCode ISF_HitAnalysis::initialize()
m_truth_barcode
=
new
std
::
vector
<
int
>
;
m_truth_vtxbarcode
=
new
std
::
vector
<
int
>
;
m_cluster_energy
=
new
std
::
vector
<
float
>
;
m_cluster_eta
=
new
std
::
vector
<
float
>
;
m_cluster_phi
=
new
std
::
vector
<
float
>
;
m_cluster_size
=
new
std
::
vector
<
unsigned
>
;
m_cluster_cellID
=
new
std
::
vector
<
std
::
vector
<
Long64_t
>
>
;
m_cell_identifier
=
new
std
::
vector
<
Long64_t
>
;
m_cell_energy
=
new
std
::
vector
<
float
>
;
m_cell_sampling
=
new
std
::
vector
<
int
>
;
...
...
@@ -606,6 +622,13 @@ StatusCode ISF_HitAnalysis::initialize()
m_tree
->
Branch
(
"TruthBarcode"
,
&
m_truth_barcode
);
m_tree
->
Branch
(
"TruthVtxBarcode"
,
&
m_truth_vtxbarcode
);
if
(
m_doClusterInfo
){
m_tree
->
Branch
(
"ClusterE"
,
&
m_cluster_energy
);
m_tree
->
Branch
(
"ClusterEta"
,
&
m_cluster_eta
);
m_tree
->
Branch
(
"ClusterPhi"
,
&
m_cluster_phi
);
m_tree
->
Branch
(
"ClusterSize"
,
&
m_cluster_size
);
m_tree
->
Branch
(
"ClusterCellID"
,
&
m_cluster_cellID
);
}
m_oneeventcells
=
new
FCS_matchedcellvector
;
if
(
m_doAllCells
){
m_tree
->
Branch
(
"AllCells"
,
&
m_oneeventcells
);
...
...
@@ -814,6 +837,11 @@ StatusCode ISF_HitAnalysis::execute()
m_truth_pdg
->
clear
();
m_truth_barcode
->
clear
();
m_truth_vtxbarcode
->
clear
();
m_cluster_energy
->
clear
();
m_cluster_eta
->
clear
();
m_cluster_phi
->
clear
();
m_cluster_size
->
clear
();
m_cluster_cellID
->
clear
();
m_cell_identifier
->
clear
();
m_cell_energy
->
clear
();
m_cell_sampling
->
clear
();
...
...
@@ -911,7 +939,7 @@ StatusCode ISF_HitAnalysis::execute()
sampling
=
layer
;
//use CaloCell layer immediately
}
else
{
ATH_MSG_WARNING
(
"Warning no sampling info for "
<<
id
.
getString
());
}
}
if
(
m_larEmID
->
is_lar_em
(
id
)
||
m_larHecID
->
is_lar_hec
(
id
)
||
m_larFcalID
->
is_lar_fcal
(
id
))
sampfrac
=
m_dd_fSampl
->
FSAMPL
(
id
);
...
...
@@ -943,7 +971,7 @@ StatusCode ISF_HitAnalysis::execute()
if
(
tile_sampling
!=
-
1
)
sampling
=
tile_sampling
;
//m_calo_dd_man needs to be called with cell_id not pmt_id!!
}
else
{
ATH_MSG_WARNING
(
"This hit is somewhere. Please check!"
);
}
}
m_hit_identifier
->
push_back
(
id
.
get_compact
());
m_hit_cellidentifier
->
push_back
(
cell_id
.
get_compact
());
...
...
@@ -1127,6 +1155,49 @@ StatusCode ISF_HitAnalysis::execute()
}
//mcEvent
}
//truth event
// Get the reco clusters if available
// retreiving cluster container
const
DataHandle
<
xAOD
::
CaloClusterContainer
>
theClusters
;
std
::
string
clusterContainerName
=
"CaloCalTopoClusters"
;
sc
=
evtStore
()
->
retrieve
(
theClusters
,
clusterContainerName
);
if
(
sc
.
isFailure
())
{
ATH_MSG_WARNING
(
" Couldn't get cluster container '"
<<
clusterContainerName
<<
"'"
);
return
0
;
}
xAOD
::
CaloClusterContainer
::
const_iterator
itrClus
=
theClusters
->
begin
();
xAOD
::
CaloClusterContainer
::
const_iterator
itrLastClus
=
theClusters
->
end
();
for
(
;
itrClus
!=
itrLastClus
;
++
itrClus
){
const
xAOD
::
CaloCluster
*
cluster
=
(
*
itrClus
);
m_cluster_energy
->
push_back
(
cluster
->
e
());
m_cluster_eta
->
push_back
(
cluster
->
eta
());
m_cluster_phi
->
push_back
(
cluster
->
phi
());
ATH_MSG_VERBOSE
(
"Cluster energy: "
<<
cluster
->
e
()
<<
" cells: "
<<
" links: "
<<
cluster
->
getCellLinks
());
//cluster->getCellLinks();
const
CaloClusterCellLink
*
cellLinks
=
cluster
->
getCellLinks
();
if
(
!
cellLinks
)
{
ATH_MSG_DEBUG
(
"No cell links for this cluster"
);
continue
;
}
const
CaloCellContainer
*
cellCont
=
cellLinks
->
getCellContainer
();
if
(
!
cellCont
)
{
ATH_MSG_DEBUG
(
"DataLink to cell container is broken"
);
continue
;
}
unsigned
cellcount
=
0
;
std
::
vector
<
Long64_t
>
cellIDs_in_cluster
;
xAOD
::
CaloCluster
::
const_cell_iterator
cellIter
=
cluster
->
cell_begin
();
xAOD
::
CaloCluster
::
const_cell_iterator
cellIterEnd
=
cluster
->
cell_end
();
for
(
;
cellIter
!=
cellIterEnd
;
cellIter
++
)
{
++
cellcount
;
const
CaloCell
*
cell
=
(
*
cellIter
);
cellIDs_in_cluster
.
push_back
(
cell
->
ID
().
get_compact
());
float
EnergyCell
=
cell
->
energy
();
//ID, time, phi, eta
ATH_MSG_DEBUG
(
" Cell energy: "
<<
EnergyCell
);
}
// end of cells inside cluster loop
m_cluster_size
->
push_back
(
cellcount
);
m_cluster_cellID
->
push_back
(
cellIDs_in_cluster
);
}
//Retrieve and save MuonEntryLayer information
...
...
@@ -1150,7 +1221,6 @@ StatusCode ISF_HitAnalysis::execute()
}
}
//Get reco cells if available
const
CaloCellContainer
*
cellColl
=
0
;
sc
=
evtStore
()
->
retrieve
(
cellColl
,
"AllCalo"
);
...
...
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