Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gpietrzy/Rec
  • nbehling/Rec
  • rrabadan/Rec
  • hyeung/Rec
  • smokhnen/Rec
  • padeken/Rec
  • peilian/Rec
  • lambda-hse/Rec
  • mstahl/Rec
  • kklimasz/Rec
  • mimazure/Rec
  • aszabels/Rec
  • wkrzemie/Rec
  • aalvesju/Rec
  • fkeizer/Rec
  • valassi/Rec
  • raaij/Rec
  • sstahl/Rec
  • jonrob/Rec
  • dcampora/Rec
  • graven/Rec
  • lhcb/Rec
22 results
Show changes
Commits on Source (1996)
Showing
with 616 additions and 1146 deletions
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 60
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: true
Standard: Cpp11
TabWidth: 8
UseTab: Never
---
Language: Json
IndentWidth: 4
ColumnLimit: 120
---
Language: JavaScript
ColumnLimit: 120
---
Language: ObjC
# Don't format Objective-C, Objective-C++ files.
DisableFormat: true
...
......@@ -6,7 +6,6 @@
InstallArea/
# Centrally managed files and helpers
.clang-format
toolchain.cmake
Makefile
cache_preload.cmake
......
......@@ -17,25 +17,8 @@ check-copyright:
- curl -o lb-check-copyright "https://gitlab.cern.ch/lhcb-core/LbDevTools/raw/master/LbDevTools/SourceTools.py?inline=false"
- python lb-check-copyright origin/${TARGET_BRANCH} --exclude lhcbproject.yml
check-formatting:
tags:
- cvmfs
image: gitlab-registry.cern.ch/ci-tools/ci-worker:cc7
script:
- . /cvmfs/lhcb.cern.ch/lib/LbEnv.sh
- if [ ! -e .clang-format ] ; then
- curl -o .clang-format "https://gitlab.cern.ch/lhcb-core/LbDevTools/raw/master/LbDevTools/data/default.clang-format?inline=false"
- echo '.clang-format' >> .gitignore
- git add .gitignore
- fi
- curl -o lb-format "https://gitlab.cern.ch/lhcb-core/LbDevTools/raw/master/LbDevTools/SourceTools.py?inline=false"
- python lb-format --format-patch apply-formatting.patch origin/${TARGET_BRANCH}
artifacts:
paths:
- apply-formatting.patch
when: on_failure
expire_in: 1 week
include:
- project: 'lhcb-rta/reference-update-bot'
file: 'templates/ref-bot-ci-trigger-template.yml'
- project: 'lhcb-core/dev-tools/ci-utils'
file: 'gitlab-ci-fragments/pre-commit-checks.yaml'
repos:
- repo: local
hooks:
- id: test-inputs-use-testfiledb
name: test inputs use TestFileDB
description: make sure all inputs to test options files are going through FileTestDB
language: pygrep
types_or: [python, yaml]
exclude: ".pre-commit-config.yaml"
entry: 'eoslhcb.cern.ch//eos/lhcb/.*$(?<!fillingscheme.txt")'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
exclude: "\\.clang-format$"
- id: check-added-large-files
exclude: "^.*/refs/.*$"
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format
- id: clang-format
name: clang-format (non-standard extensions)
types_or: [file]
files: \.(icc|icpp)$
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.1
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
......@@ -11,8 +11,8 @@
cmake_minimum_required(VERSION 3.15)
project(Rec VERSION 35.3
LANGUAGES CXX)
project(Rec VERSION 37.3
LANGUAGES CXX)
# Enable testing with CTest/CDash
include(CTest)
......@@ -42,11 +42,8 @@ lhcb_add_subdirectories(
CaloFuture/CaloFutureReco
CaloFuture/CaloFutureTools
FT/FTMonitors
FT/FTAnalysis
MicroDST/MicroDSTAlgorithm
MicroDST/MicroDSTBase
MicroDST/MicroDSTConf
MicroDST/MicroDSTInterfaces
MicroDST/MicroDSTTools
Muon/MuonInterfaces
Muon/MuonTrackRec
Muon/MuonID
......@@ -64,7 +61,6 @@ lhcb_add_subdirectories(
Tr/TrackTools
Phys/SelKernel
Tr/TrackUtils
Tf/TrackSys
Muon/MuonTrackMonitor
Phys/SelTools
Phys/FunctorCore
......@@ -76,49 +72,43 @@ lhcb_add_subdirectories(
Phys/DaVinciNeutralTools
Phys/DaVinciOverlapsAndClones
Phys/DaVinciPVTools
Phys/DaVinciMCTools
Phys/DaVinciTools
Phys/DaVinciTransporter
Phys/DaVinciTypes
Phys/DecayTreeFitter
Phys/ExtraInfoTools
Phys/FlavourTagging
Phys/FunctionalFlavourTagging
Phys/GenericVertexFinder
Phys/HighPtJets
Phys/JetAccessories
Phys/KalmanFilter
Phys/keras
Phys/LoKi
Phys/LoKiAlgo
Phys/LoKiArrayFunctors
Phys/LoKiFitters
Phys/LoKiPhys
Phys/LoKiPhysMC
Phys/LoKiProtoParticles
Phys/LoKiUtils
Phys/Luminosity
Phys/lwtnnParser
Phys/MCAssociation
Phys/MVADictTools
Phys/ParticleCombiners
Phys/ParticleConverters
Phys/ParticleMaker
Phys/PhysConf
Phys/ParticleMatching
Phys/ProtoParticleFilter
Phys/RelatedInfoTools
Phys/SelPy
Phys/TisTosTobbing
Phys/VertexFit
PhysSel/PhysSelPython
Phys/TrackRefitting
Pr/PrAlgorithms
Pr/PrFilters
Pr/PrConverters
Pr/PrFitParams
Pr/PrMCTools
Pr/PrPixel
Pr/PrVPRetina
Pr/PrVeloUT
Pr/SciFiTrackForwarding
Rec/RecInterfaces
Rec/ChargedProtoANNPID
Rec/GlobalPID
Rec/GlobalReco
Rec/GlobalRecoMCTools
Rec/RecAlgs
......@@ -130,11 +120,11 @@ lhcb_add_subdirectories(
Rich/RichFutureRecPhotonAlgorithms
Rich/RichFutureRecAlgorithms
Rich/RichFutureRecInterfaces
Rich/RichFutureRecTools
Rich/RichFutureGlobalPID
Rich/RichFutureRecSys
Rich/RichFutureRecMonitors
Rich/RichFutureRecCheckers
Rich/RichFutureRecMCAlgorithms
Tr/PatChecker
Tr/PatFitParams
Tr/PatPV
......@@ -142,10 +132,10 @@ lhcb_add_subdirectories(
Tf/FastPV
Tr/ParameterizedKalman
Tr/PrKalmanFilter
Tr/TrackAssociators
Plume/PlumeReco
Rich/RichRecTests
Phys/FunctorCache
Utils/CatboostStandaloneEvaluator
Vis/PhoenixAlgs
)
......
......@@ -6,22 +6,22 @@ This helps with the validation of code prior to making it available in the offic
## Available supported branches
- `master` branch: new developments and updates targeting run 3. Builds on current supported platforms against latest version of Gaudi
- `master` branch: long-term developments for run 3 , not meant for immediate inclusion in the data taking (e.g., for end-of-year Sprucing). Builds on current supported platforms against latest version of Gaudi.
- `2024-patches` branch: fixes and additions for the 2024 data-taking. By default, it is understood that a MR targeting this branch should also be included in `master`, so the `master` branch is regularly synchronised with this one. If you are putting in a temporary fix that is not meant as a long-term solution and should not be included in `master`, please state it clearly in the MR description. Builds on current supported platforms against latest version of Gaudi.
- `run2-patches` branch: new developments and updates targeting runs 1+2 analysis and/or reprocessing. Builds on current supported platfroms against latest version of Gaudi
- `2018-patches` branch: for 2018 incremental stripping (`S34r0pX`, `S35r0pX`, `S35r1pX`), 2015 and 2016 restripping (`S24r2`, `S28r2`) and patches to Moore, Brunel (`Reco18`) and stripping in 2015, 2016 and 2018 simulation workflows. Builds with gcc62 centos7
- `2018-patches` branch: for 2018 incremental stripping (`S34r0pX`, `S35r0pX`, `S35r1pX`), 2015 and 2016 restripping (`S24r2`, `S28r2`) and patches to Moore, Brunel (`Reco18`) and stripping in 2015, 2016 and 2018 simulation workflows. Builds with gcc62 on centos7.
- `2017-patches` branch: for 2017 incremental stripping (`S29r2pX` (pp), `S32r0pX` (pp 5 Tev)) and patches to Moore, Brunel (`Reco17`) and stripping (S29r2, S29r2p1, S29r2p2, S32) in 2017 simulation workflows. Builds with gcc62 on centos7
- `2016-patches` branch: for 2016 incremental stripping (`S28r1pX`, `S30r2pX`, `S30r3pX`) and patches to Brunel (`Reco16`) and stripping in 2016 simulation workflows. Builds with gcc49 on slc6
- `2016-patches` branch: for patches to Brunel (`Reco16`) and Tesla in 2016 simulation workflows (and Tesla for 2015 simulation). Builds with gcc49 on slc6
- `hlt2016-patches` branch: for patches to Moore in 2016 simulation workflows. Builds with gcc49 on slc6
- `reco15-patches` branch: for patches to Brunel (`Reco15`) in 2015 simulation workflows. Builds with gcc49 on slc6
- `stripping24-patches` branch: for 2015 incremental stripping and patches to stripping in 2015 simulation workflows. Builds with gcc49 on slc6
- `reco14-patches` branch: for patches to Brunel (`Reco14`) in run 1 simulation workflows. Builds with gcc46 on slc5. Requires CMT
- `stripping21-patches` branch: for run 1 incremental stripping (`S21r0pX`, `S21r1pX`) and patches to stripping in run 1 simulation workflows. Builds with gcc49 on slc6
......@@ -36,11 +36,8 @@ This helps with the validation of code prior to making it available in the offic
- Bug fixes specific to a given processing should be committed to the corresponding `XXX-patches` branch.
- Any changes or fixes for Run 1 and Run 2 analysis (or re-reconstruction, re-stripping) should go to the `run2-patches` branch.
They will then be propagated to `master` (if relevant also for Upgrade) by the applications managers.
Fixes also relevant to specific `XXX-patches` branches should be flagged as such, they will be propagated by the applications managers.
Fixes also relevant to specific `XXX-patches` branches should be flagged as such, they will be propagated by the applications managers.
- Any changes specific to Upgrade should *only* got to `master`. When making a MR to `master`, please make it initially as WIP and add
a comment when it is ready to be tested. The release manager will then test it initially in one nightly slot and, if successful,
remove the WIP for general testing.
- Any changes specific to Run 3 should go to `master` or `2024-patches`. See above for when using one or the other.
In doubt, please get in touch before creating a MR.
......@@ -15,15 +15,16 @@ CaloFuture/CaloFutureMoniDst
gaudi_add_module(CaloFutureMoniDst
SOURCES
src/CaloFutureClusterMonitor.cpp
src/CaloFutureDigitMonitor.cpp
src/CaloFutureMoniAlg.cpp
src/CaloFutureTimeAlignment.cpp
src/CaloClusterMonitor.cpp
src/CaloDigitMonitor.cpp
src/CaloLEDMonitor.cpp
src/CaloTimeAlignment.cpp
src/CaloTAEData.cpp
src/ChargedPIDsChecker.cpp
src/ChargedPIDsMonitor.cpp
src/CaloFuturePedestal.cpp
src/CaloPedestal.cpp
src/FutureCounterLevel.cpp
src/CaloHistogramSink.cpp
LINK
AIDA::aida
Boost::headers
......
! -----------------------------------------------------------------------------
! Package : CaloFuture/CaloFutureMoniDst
! Responsible : Olivier Deschamps odescham@in2p3.fr
! Purpose : CaloFuture monitoring of Dst tape
! Purpose : CaloFuture monitoring of Dst tape
! -----------------------------------------------------------------------------
! 2016-08-16 - Olivier Deschamps
- implement counter() switch based on FutureCounterLevel tool
- implement counter() switch based on FutureCounterLevel tool
! 2016-06-11 - Deschamps Olivier for J.-F. Marchand
- ResolvedPi0Monitor : add 2d histo for pi0 mass versus cell index
......@@ -22,13 +22,13 @@
-fix clang warnings
! 2015-10-22 - O. Deschamps
-initialize base-class (CaloFutureMoniAlg) everywhere
-initialize base-class (CaloFutureMoniAlg) everywhere
!========================= CaloFutureMoniDst v5r19 2015-10-13 =========================
! 2015-08-30 - Gerhard Raven
- remove DECLARE_ALGORITHM_FACTORY( CaloFutureMoniAlg ) and DECLARE_ALGORITHM_FACTORY( CaloFutureNtpBase )
as these are not 'concrete' algorithms, but base classes from which one first must inherit
and implement execute before they are useful.
and implement execute before they are useful.
! 2015-08-12 - Gerhard Raven
- remove #include of obsolete Gaudi headers
......@@ -41,7 +41,7 @@
!========================= CaloFutureMoniDst v5r17 2014-05-13 =======================
! 2014-05-06 - Marco Cattaneo
- CaloFutureMoniAlg.cpp: use setHistoTopDir in initialize() instead of
setProperty("HistoTopDir") in constructor. Removes need for debug() in
setProperty("HistoTopDir") in constructor. Removes need for debug() in
constructor
- CaloFutureEFlowAlg.cpp: remove unnecessary debug() in constructor
- Above two changes fix unprotected debug() warnings
......@@ -88,7 +88,7 @@
!========================= CaloFutureMoniDst v5r10 2012-04-13 =======================
! 2012-04-05 - Olivier Deschamps
- Add eta->gg monitoring (re-use resolvedPi0 algorithm)
- SpdMonitor : set splitArea=true as the default for CaloFuture2Dview histos
- SpdMonitor : set splitArea=true as the default for CaloFuture2Dview histos
!========================= CaloFutureMoniDst v5r9 2011-09-06 ========================
! 2011-09-03 - Olivier Deschamps
......@@ -118,14 +118,14 @@
- Fix windows warning, converting double to int
! 2010-09-30 - Marco Cattaneo
- Undo part of previous fix, which was causing a relations table to not be
- Undo part of previous fix, which was causing a relations table to not be
loaded, causing the algorithm to throw ane exception. This was masking the
finalization crash, that is still there....
! 2010-09-30 - Olivier Deschamps
! 2010-09-30 - Olivier Deschamps
- CaloFuturePhotonChecker : fix finalization crash
! 2010-09-30 - Olivier Deschamps
! 2010-09-30 - Olivier Deschamps
- Improve CaloFuturePi0Ntp & CaloFutureElectronNtp
- add new ntp algorithm : CaloFutureAlignmentNtp
......@@ -165,7 +165,7 @@
! 2010-04-12 - Dmitry GOLUBKOV
- doc/release.notes : corrected the place of the second comment from 2010-04-12
- Monitor.py : check if properties were already set before setting them
- cmt/requirements: version incremented to v5r1
- cmt/requirements: version incremented to v5r1
!========================== CaloFutureMoniDst v5r0 2010-04-12 =======================
! 2010-04-12 - Dmitry GOLUBKOV
......@@ -175,7 +175,7 @@
- Fixed windows warnings in CaloFutureEMuPIDMon.cpp and CaloFuturePi0Checker.cpp
! 2010-04-02 - Dmitry Golubkov
- CaloFutureEMuPIDMon.cpp: fixed an SLC5 warning: type qualifiers ignored on function return type
- CaloFutureEMuPIDMon.cpp: fixed an SLC5 warning: type qualifiers ignored on function return type
! 2010-03-31 - Dmitry Golubkov
- following Vanya's suggestion remove completely CaloFutureEMuMonitor, CaloFutureEMuChecker
......@@ -201,16 +201,16 @@
! 2010-03-08 - Olivier Deschamps
- adapt CaloFuturePhotonChecker to change in CaloFuturePIDs
@TODO : review checkers (use CaloFutureMCTools ...)
! 2010-03-08 - Olivier Deschamps
- make use of CaloFutureAlgUtils to define context-dependent TES inputs
- add control counters
- CaloFutureMoniDstConf
- CaloFutureMoniDstConf
- add missing ProtoElectronMonitor
- delegate the TES I/O to CaloFutureAlgUtils
- Usage :
......@@ -251,22 +251,22 @@
! 2009-12-11 - Olivier Deschamps
- CaloFutureProtoElectronMonitor : make use of proto->info(PrsE) instead of CaloFutureHypo2CaloFuture tool.
! 2009-12-11 - Olivier Deschamps
! 2009-12-11 - Olivier Deschamps
- CaloFutureMoniAlg : remove verbose line
- new algorithm CaloFutureProtoElectronMonitor
- CaloFuturePi0Monitor : add pi0 mass peak with Y-selection of clusters.
!========================== CaloFutureMoniDst v4r2 2009-12-11 =======================
! 2009-12-01 - Olivier Deschamps
! 2009-12-01 - Olivier Deschamps
- CaloFutureMoniAlg : protection against non booked histograms in hfillX methods
! 2009-11-30 - Olivier Deschamps
! 2009-11-30 - Olivier Deschamps
- CaloFutureMoniAlg : add saturation bin(s) by default for 1D histograms
!========================== CaloFutureMoniDst v4r1 2009-10-20 =======================
! 2009-10-16 - Olivier Deschamps for Aurelien Martens
! 2009-10-16 - Olivier Deschamps for Aurelien Martens
- Update in CaloFutureEFlowAlg
! 2009-10-06 - Marco Cattaneo
......@@ -274,13 +274,13 @@
! 2009-10-01 - Vanya BELYAEV
- CaloFutureMoniAlg.h :
minor fix for the recent modification in CaloFutureCellCode functions
minor fix for the recent modification in CaloFutureCellCode functions
! 2009-09-14 - Olivier Deschamps
- CaloFuturePi0Monitor :
- CaloFuturePi0Monitor :
- selection of non-converted photons
- isolation criteria
- Add background subtracted histo
- Add background subtracted histo
! 2009-09-08 - Olivier Deschamps
- Add background histo in resolved pi0 monitor
......@@ -292,20 +292,20 @@
- CaloFuturePIDsChecker.cpp : fix division by zero in divide()
! 2009-09-01 - Vanya BELYAEV
- fix warnings in configurables
- fix warnings in configurables
! 2009-08-31 - Olivier Deschamps
- fix bug in CaloFutureMoniAlg (SplitAreas/m_split property/member already exists in inherited CaloFuture2DView)
! 2009-08-11 - Vanya BELYAEV
- futher polishing of configurables
- futher polishing of configurables
! 2009-08-05 - Vanya BELYAEV
- add proepr configurable
version incremen to v4r0
- add proepr configurable
version incremen to v4r0
! 2009-07-30 - Dmitry GOLUBKOV
- CaloFutureEMuMonitor.cpp add protection when no charged ProtoParticle
......@@ -318,7 +318,7 @@
- Clean up dependencies in requirements
! 2009-07-24 - Chris Jones
- change std::map< std::string, XXX * > to
- change std::map< std::string, XXX * > to
GaudiUtils::HashMap< const std::string, XXX * > for faster lookups.
!========================== CaloFutureMoniDst v3r8 2009-06-17 =======================
......@@ -329,32 +329,32 @@
! 2009-06-03 - Marco Cattaneo
- Fix for windows, do not use fabs with int argument, use abs
- Use _snprintf, not snprintf on windows
! 2009-05-22 - Marco Cattaneo
- Fix invalid matrix indices in computation of "shape" in CaloFuturePhotonChecker.cpp
!========================== CaloFutureMoniDst v3r6 2009-05-08 =======================
! 2009-05-05 - Olivier Deschamps for Aurelien Martens
- CaloFutureEFlowAlg.cpp : add protection
- CaloFutureEFlowAlg.opts : change default setting
- CaloFutureEFlowAlg.cpp : add protection
- CaloFutureEFlowAlg.opts : change default setting
! 2009-04-24 - Marco Cattaneo
- Fix compilation warning for gcc43
- Replace endreq by endmsg (obsolescent in Gaudi v21)
! 2009-04-21 - Olivier Deschamps for Dmitry Goloubkov
- CaloFutureEMuMonitor/Checker.{cpp,h} : produce histogram (+analysis) of CaloFuturePID
- CaloFutureEMuMonitor/Checker.{cpp,h} : produce histogram (+analysis) of CaloFuturePID
! 2009-04-20 - Olivier Deschamps for Aurelien Martens
- CaloFutureEFlowAlg.{cpp,h,opts} : produce histogram for 'Energy-Flow' calibration
method (Aurelien Martens)
!========================== CaloFutureMoniDst v3r5 2009-03-10 =======================
! 2009-03-06 - Olivier Deschamps
! 2009-03-06 - Olivier Deschamps
- set CaloFutureDQ.opt histo selection as default in CaloFutureMonitor.opts for Brunel
- new options : CaloFutureFullMonitoring.opts (to be added to produce the whole histo set)
! 2009-02-20 - Olivier Deschamps
! 2009-02-20 - Olivier Deschamps
- Clean monitoring algorithms
- add protection against missing data inputs here and there
- new options : CaloFutureDQ.opts : selection of relevant monitoring histo for Data Quality stuff
......@@ -409,15 +409,15 @@
- add dependency on DaVinciMCKernel in requirements
! 2007-08-24 - Olivier Deschamps
- fix unchecked StatusCodes
- fix unchecked StatusCodes
! 2007-08-22 - Albert Puig & Olivier Deschamps
- new SpdMonitor algorithm
! 2007-07-25 - Konstantin Beloous & Olivier Deschamps
- Major release
- Major release
- package updated for DC06
- First step toward an online usage of the Monitoring part
- First step toward an online usage of the Monitoring part
- histograms production reviewed and improved
- some algorithm names have changed
- 2 types of algorithms : Monitor's (relying on data only) and Checker's (relying on MC)
......@@ -428,23 +428,23 @@
!========================== CaloFutureMoniDst v2r1 2005-12-08 ===================
! 2005-12-08 - Olivier Deschamps
- CaloFuturePIDsMonitor.cpp use Track::History == 'Cnv' Tracks only
- CaloFuturePIDsMonitor.cpp use Track::History == 'Cnv' Tracks only
!========================== CaloFutureMoniDst v2r0 2005-11-04 ===================
! 2005-11-04 - Olivier Deschamps
- Adapt to new Track Event Model (TrackEvent v1r4)
modified file :
modified file :
src/CaloFuturePIDsMonitor.cpp
src/CaloFuturePhotonMonitor.h/cpp
src/CaloFutureHypoMatchMonitor.cpp
src/CaloFutureClusterMatchMonitor.cpp
- cmt/requirements
- cmt/requirements
version increment to v2r0
!======================== CaloFutureMoniDst v1r2 2005-06-02 =========================
! 2005-06-02 - Marco Cattaneo
- Adapt job options to change in phase name from BrunelMoni to Moni (for
- Adapt job options to change in phase name from BrunelMoni to Moni (for
monitoring without MC truth) and Check (for checking with MC truth)
========================= CaloFutureMoniDst v1r1 2005-05-13 =========================
......@@ -452,19 +452,19 @@
- Fix ambiguous call to overloaded log10 function, for Windows
! 2005-05-08 - Vanya BELYAEV
- eliminate all associators
- a lot of minor cosmetic changes
- cmt/requirements
version increment to v1r1
- eliminate all associators
- a lot of minor cosmetic changes
- cmt/requirements
version increment to v1r1
========================= CaloFutureMoniDst v1r0 2004-10-27 =========================
! 2004-10-27 - Vanya BELYAEV
- tiny improvements in algorithms
- tiny improvements in algorithms
! 2004-10-25 - Vanya BELYAEV
- the new package: the code is imported from CaloFuture/CaloFutureMonitor package
- the new package: the code is imported from CaloFuture/CaloFutureMonitor package
! -----------------------------------------------------------------------------
! The END
! The END
! -----------------------------------------------------------------------------
// Define the monitoring sequence
#include "$CALOFUTUREMONIDSTOPTS/CaloFutureMonitor.opts"
// force the complete histo set production
// force the complete histo set production
EcalDigitMon.histoList += { "All" };
HcalDigitMon.histoList += { "All" };
PrsDigitMon.histoList += { "All" };
SpdDigitMon.histoList += { "All" };
EcalClusterMon.histoList += { "All" };
ElectronMon.histoList += { "All" };
PhotonMon.histoList += { "All" };
SpdDigitMon.histoList += { "All" };
EcalClusterMon.histoList += { "All" };
ElectronMon.histoList += { "All" };
PhotonMon.histoList += { "All" };
SplitPhotonMon.histoList += { "All" };
MergedPi0Mon.histoList += { "All" };
MergedPi0Mon.histoList += { "All" };
ResolvedPi0Mon.histoList += { "All" };
......@@ -2,7 +2,7 @@
// - type = TrackType
// - Acceptance == TrackAcceptance
// - DLL<input> > Cut
// - Associated MC-type = Particle, 0 (Ghost) and non-Particle
// - Associated MC-type = Particle, 0 (Ghost) and non-Particle
PIDeEcalChecker.Particle = 11 ;
......
CaloFutureProtoPMon.Members += { "CaloFutureProtoElectronMonitor/EcalProtoElectronMon"};
CaloFutureProtoPMon.Members += { "CaloFutureProtoElectronMonitor/EcalProtoElectronMon"};
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#include "CaloFutureUtils/CaloFutureAlgUtils.h"
#include "CaloFutureUtils/CellIDHistogram.h"
#include "DetDesc/GenericConditionAccessorHolder.h"
#include "Event/CaloClusters_v2.h"
#include "LHCbAlgs/Consumer.h"
#include <Gaudi/Accumulators/Histogram.h>
namespace LHCb::Calo {
/**
* The algorithm for trivial monitoring of "CaloFutureCluster" containers.
* The algorithm produces 8 histograms:
*
* <ol>
* <li> @p CaloCluster multiplicity </li>
* <li> @p CaloCluster size (number of cells) </li>
* <li> @p CaloCluster energy distribution </li>
* <li> @p CaloCluster transverse energy distribution </li>
* <li> @p CaloCluster x-distribution </li>
* <li> @p CaloCluster y-distribution </li>
* <li> @p CaloCluster x vs y-distribution </li>
* </ol>
*
* Histograms reside in the directory @p /stat/"Name" , where
* @ "Name" is the name of the algorithm
*
* @author Vanya Belyaev Ivan.Belyaev@itep.ru
* @date 02/11/2001
*/
using Input = Event::Calo::v2::Clusters;
template <Detector::Calo::CellCode::Index calo>
class ClusterMonitor final : public Algorithm::Consumer<void( const Input& )> {
public:
StatusCode initialize() override;
void operator()( const Input& ) const override;
ClusterMonitor( const std::string& name, ISvcLocator* pSvcLocator )
: Consumer( name, pSvcLocator,
{ KeyValue{ "Input", CaloFutureAlgUtils::CaloFutureClusterLocation( name ) } } ) {}
private:
mutable Gaudi::Accumulators::Histogram<1> m_histoNClusters{ this, "nClusters" };
mutable Gaudi::Accumulators::Histogram<1> m_histoNDigits{ this, "nDigits" };
mutable Gaudi::Accumulators::Histogram<1> m_histoNDigits_forE{ this, "nDigits_forE" };
mutable Gaudi::Accumulators::Histogram<1> m_histoEnergy{ this, "energy" };
mutable Gaudi::Accumulators::Histogram<1> m_histoET{ this, "ET" };
mutable Gaudi::Accumulators::Histogram<1> m_histoX{ this, "x" };
mutable Gaudi::Accumulators::Histogram<1> m_histoY{ this, "y" };
mutable Gaudi::Accumulators::Histogram<2> m_histoXY{ this, "x-y" };
mutable Gaudi::Accumulators::WeightedHistogram<2> m_histoXY_eW{ this, "x-y-eW" };
mutable CellIDHistogram<calo> m_position2D{ this, "position2D" };
mutable WeightedCellIDHistogram<calo> m_position2D_eW{ this, "position2D-eW" };
mutable Gaudi::Accumulators::StatCounter<> m_clusters{ this, "# clusters over threshold" };
private:
Gaudi::Property<Gaudi::Histo1DDef> m_multHist{ this, "HistoMultiplicity", Gaudi::Histo1DDef( 0., 2000., 100 ) };
Gaudi::Property<Gaudi::Histo1DDef> m_sizeHist{ this, "HistoSize", Gaudi::Histo1DDef( 0., 25., 25 ) };
Gaudi::Property<Gaudi::Histo1DDef> m_energyHist{
this, "HistoEnergy", Gaudi::Histo1DDef( 0. * Gaudi::Units::GeV, 250. * Gaudi::Units::GeV, 100 ) };
Gaudi::Property<Gaudi::Histo1DDef> m_etHist{
this, "HistoEt", Gaudi::Histo1DDef( 0. * Gaudi::Units::GeV, 15. * Gaudi::Units::GeV, 100 ) };
Gaudi::Property<Gaudi::Histo1DDef> m_xHist{
this, "HistoX", Gaudi::Histo1DDef( -4 * Gaudi::Units::meter, +4 * Gaudi::Units::meter, 50 ) };
Gaudi::Property<Gaudi::Histo1DDef> m_yHist{
this, "HistoY", Gaudi::Histo1DDef( -4 * Gaudi::Units::meter, +4 * Gaudi::Units::meter, 50 ) };
Gaudi::Property<float> m_eFilter{ this, "EnergyFilter", -100. };
Gaudi::Property<float> m_etFilter{ this, "EtFilter", -100. };
};
DECLARE_COMPONENT_WITH_ID( ClusterMonitor<Detector::Calo::CellCode::Index::EcalCalo>, "CaloClusterECALMonitor" )
DECLARE_COMPONENT_WITH_ID( ClusterMonitor<Detector::Calo::CellCode::Index::HcalCalo>, "CaloClusterHCALMonitor" )
} // namespace LHCb::Calo
template <LHCb::Detector::Calo::CellCode::Index calo>
StatusCode LHCb::Calo::ClusterMonitor<calo>::initialize() {
return Consumer::initialize().andThen( [&] {
// define range of new histograms from properties
using Axis1D = Gaudi::Accumulators::Axis<double>;
m_histoNClusters.setTitle( "# of Clusters " + inputLocation() );
m_histoNClusters.setAxis<0>( Axis1D{ m_multHist } );
m_histoNDigits.setTitle( "Cluster digit multiplicity " + inputLocation() );
m_histoNDigits.setAxis<0>( Axis1D{ m_sizeHist } );
m_histoNDigits_forE.setTitle( "Cluster digit used for Energy multiplicity " + inputLocation() );
m_histoNDigits_forE.setAxis<0>( Axis1D{ m_sizeHist } );
m_histoEnergy.setTitle( "Cluster Energy " + inputLocation() );
m_histoEnergy.setAxis<0>( Axis1D{ m_energyHist } );
m_histoET.setTitle( "Cluster Et " + inputLocation() );
m_histoET.setAxis<0>( Axis1D{ m_etHist } );
m_histoX.setTitle( "Cluster x " + inputLocation() );
m_histoX.setAxis<0>( Axis1D{ m_xHist } );
m_histoY.setTitle( "Cluster y " + inputLocation() );
m_histoY.setAxis<0>( Axis1D{ m_yHist } );
m_histoXY.setTitle( "Cluster barycenter position x vs y " + inputLocation() );
m_histoXY.setAxis<0>( Axis1D{ m_xHist } );
m_histoXY.setAxis<1>( Axis1D{ m_yHist } );
m_histoXY_eW.setTitle( "Energy-weighted cluster barycenter position x vs y " + inputLocation() );
m_histoXY_eW.setAxis<0>( Axis1D{ m_xHist } );
m_histoXY_eW.setAxis<1>( Axis1D{ m_yHist } );
m_position2D.setTitle( "Cluster position 2Dview " + inputLocation() );
m_position2D_eW.setTitle( "Cluster position 2Dview " + inputLocation() );
} );
}
template <LHCb::Detector::Calo::CellCode::Index calo>
void LHCb::Calo::ClusterMonitor<calo>::operator()( const Input& clusters ) const {
if ( clusters.empty() ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Found empty cluster in " << inputLocation() << endmsg;
return;
}
// for multiplicity histogram
uint nClusters = 0;
for ( const auto& cluster : clusters.scalar() ) {
const double e = cluster.energy();
const double x = cluster.position().x();
const double y = cluster.position().y();
const double z = cluster.position().z();
const double et = e * sqrt( x * x + y * y ) / sqrt( x * x + y * y + z * z );
if ( e < m_eFilter ) continue;
if ( et < m_etFilter ) continue;
++nClusters;
const auto id = cluster.cellID();
const auto& entries = cluster.entries();
++m_histoNDigits[entries.size().cast()];
++m_histoEnergy[e];
++m_histoET[et];
++m_histoX[x];
++m_histoY[y];
++m_histoXY[{ x, y }];
m_histoXY_eW[{ x, y }] += e;
int iuse = std::count_if( entries.begin(), entries.end(),
[]( const auto& e ) { return e.status().test( CaloDigitStatus::Mask::UseForEnergy ); } );
++m_histoNDigits_forE[iuse];
// TODO: use thread-safe histos. Need variable binning.
++m_position2D[id];
m_position2D_eW[id] += e;
}
++m_histoNClusters[nClusters];
m_clusters += nClusters;
}
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#include "CaloDet/DeCalorimeter.h"
#include "CaloFutureUtils/CaloFutureAlgUtils.h"
#include "CaloFutureUtils/CellIDHistogram.h"
#include "DetDesc/GenericConditionAccessorHolder.h"
#include "Event/CaloDigits_v2.h"
#include "Event/ODIN.h"
#include "LHCbAlgs/Consumer.h"
#include <Gaudi/Accumulators/Histogram.h>
#include <mutex>
namespace LHCb::Calo {
/**
* The algorithm for trivial monitoring of "CaloDigit" containers.
* The algorithm produces the following histograms:
* 1. CaloDigit multiplicity
* 2. CaloDigit ocupancy 2D plot per area
* 3. CaloDigit energy 2D plot per area
* The same set of histograms, but with cut on Et (or E), is produced if specified
*
* Histograms reside in the directory @p /stat/"Name" , where
* @p "Name" is the name of the algorithm
*
* @author Konstantin Belous Konstantin.Beloous@itep.ru
* @date 21/06/2007
*/
using Input = Event::Calo::Digits;
template <Detector::Calo::CellCode::Index calo>
class DigitMonitor final
: public LHCb::Algorithm::Consumer<void( const Input&, const LHCb::ODIN&, const DeCalorimeter& ),
DetDesc::usesConditions<DeCalorimeter>> {
public:
StatusCode initialize() override;
void operator()( const Input&, const LHCb::ODIN&, const DeCalorimeter& ) const override;
DigitMonitor( const std::string& name, ISvcLocator* pSvcLocator );
private:
std::string m_detData{};
mutable Gaudi::Accumulators::Histogram<1> m_histoMultiplicity{ this, "Multiplicity" };
mutable Gaudi::Accumulators::Histogram<1> m_histoDigitX{ this, "DigitX" };
mutable Gaudi::Accumulators::Histogram<1> m_histoDigitY{ this, "DigitY" };
mutable Gaudi::Accumulators::Histogram<2> m_histoDigitXY{ this, "DigitXY" };
mutable Gaudi::Accumulators::Histogram<1> m_histoET{ this, "ET" };
mutable Gaudi::Accumulators::Histogram<1> m_histoADC{ this, "ADC" };
mutable Gaudi::Accumulators::StatCounter<> m_digits{ this, "# digits over threshold" };
mutable WeightedCellIDHistogram<calo> m_histoAccEnergy{ this, "_7" };
mutable CellIDHistogram<calo> m_histoAccDigits{ this, "_8" };
mutable WeightedCellIDHistogram<calo> m_histoAccADCs{ this, "_9" };
Gaudi::Property<std::vector<int>> m_Calib_BXIDsA{ this, "Calib_BXIDsA" };
Gaudi::Property<std::vector<int>> m_Calib_BXIDsB{ this, "Calib_BXIDsB" };
Gaudi::Property<Gaudi::Histo1DDef> m_multHist{ this, "HistoMultiplicity", Gaudi::Histo1DDef( 0., 2000., 100 ) };
Gaudi::Property<Gaudi::Histo1DDef> m_etHist{
this, "HistoEt", Gaudi::Histo1DDef( 0. * Gaudi::Units::GeV, 15. * Gaudi::Units::GeV, 100 ) };
Gaudi::Property<Gaudi::Histo1DDef> m_xHist{
this, "HistoX", Gaudi::Histo1DDef( -4 * Gaudi::Units::meter, +4 * Gaudi::Units::meter, 50 ) };
Gaudi::Property<Gaudi::Histo1DDef> m_yHist{
this, "HistoY", Gaudi::Histo1DDef( -4 * Gaudi::Units::meter, +4 * Gaudi::Units::meter, 50 ) };
Gaudi::Property<Gaudi::Histo1DDef> m_adcHist{ this, "HistoAdc", Gaudi::Histo1DDef( 0., 4096., 4096 ) };
Gaudi::Property<float> m_eFilter{ this, "EnergyFilter", -100. };
Gaudi::Property<float> m_etFilter{ this, "EtFilter", -100. };
Gaudi::Property<float> m_adcFilter{ this, "ADCFilter", -100. };
};
DECLARE_COMPONENT_WITH_ID( DigitMonitor<Detector::Calo::CellCode::Index::EcalCalo>, "CaloDigitECALMonitor" )
DECLARE_COMPONENT_WITH_ID( DigitMonitor<Detector::Calo::CellCode::Index::HcalCalo>, "CaloDigitHCALMonitor" )
} // namespace LHCb::Calo
template <LHCb::Detector::Calo::CellCode::Index calo>
LHCb::Calo::DigitMonitor<calo>::DigitMonitor( const std::string& name, ISvcLocator* pSvcLocator )
: Consumer( name, pSvcLocator,
{ KeyValue{ "Input", CaloFutureAlgUtils::CaloFutureDigitLocation( toString( calo ) ) },
KeyValue{ "ODINLocation", ODINLocation::Default },
KeyValue{ "Detector", Calo::Utilities::DeCaloFutureLocation( toString( calo ) ) } } )
, m_detData{ toString( calo ) } {}
template <LHCb::Detector::Calo::CellCode::Index calo>
StatusCode LHCb::Calo::DigitMonitor<calo>::initialize() {
return Consumer::initialize().andThen( [&] {
info() << m_detData << " digits from " << inputLocation() << endmsg;
// book physics histograms so they are always created and found by Monet
m_histoAccEnergy.setTitle( fmt::format( "{} Accumulated Energy", m_detData ) );
m_histoAccDigits.setTitle( fmt::format( "{} Accumulated Digits filled", m_detData ) );
m_histoAccADCs.setTitle( fmt::format( "{} Accumulated ADCs", m_detData ) );
// define range of new histograms from properties
using Axis1D = Gaudi::Accumulators::Axis<double>;
m_histoMultiplicity.setTitle( "Number of digits" );
m_histoMultiplicity.setAxis<0>( Axis1D{ m_multHist } );
m_histoDigitX.setTitle( "Digit X" );
m_histoDigitX.setAxis<0>( Axis1D{ m_xHist } );
m_histoDigitY.setTitle( "Digit Y" );
m_histoDigitY.setAxis<0>( Axis1D{ m_yHist } );
m_histoDigitXY.setTitle( "Digit position x vs y" );
m_histoDigitXY.setAxis<0>( Axis1D{ m_xHist } );
m_histoDigitXY.setAxis<1>( Axis1D{ m_yHist } );
m_histoET.setTitle( "ET" );
m_histoET.setAxis<0>( Axis1D{ m_etHist } );
m_histoADC.setTitle( "ADC" );
m_histoADC.setAxis<0>( Axis1D{ m_adcHist } );
} );
}
template <LHCb::Detector::Calo::CellCode::Index calo>
void LHCb::Calo::DigitMonitor<calo>::operator()( const Input& digits, const LHCb::ODIN& odin,
const DeCalorimeter& caloDet ) const {
if ( digits.empty() ) {
if ( msgLevel( MSG::DEBUG ) ) { debug() << "Found empty container in " << inputLocation() << endmsg; }
return;
}
// count digits NB: digits.size() has a fixed value no matter the state of the detector
uint ndigits = 0;
for ( const auto& digit : digits ) {
const auto id = digit.cellID();
const auto e = digit.energy();
const auto adc = digit.adc();
const auto et = e * caloDet.cellSine( id );
if ( e < m_eFilter ) continue;
if ( et < m_etFilter ) continue;
if ( adc < m_adcFilter ) continue;
const double x = caloDet.cellCenter( id ).X();
const double y = caloDet.cellCenter( id ).Y();
if ( odin.bunchCrossingType() == LHCb::ODINImplementation::v7::ODIN::BXTypes::BeamCrossing ) {
++ndigits;
++m_histoDigitX[x];
++m_histoDigitY[y];
++m_histoDigitXY[{ x, y }];
}
m_histoAccEnergy[id] += e;
++m_histoAccDigits[id];
m_histoAccADCs[id] += adc;
++m_histoET[et];
++m_histoADC[adc];
}
m_digits += ndigits;
if ( odin.bunchCrossingType() == LHCb::ODINImplementation::v7::ODIN::BXTypes::BeamCrossing )
++m_histoMultiplicity[ndigits];
return;
}
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#include "CaloDet/DeCalorimeter.h"
#include "CaloFutureMoniAlg.h"
#include "DetDesc/GenericConditionAccessorHolder.h"
#include "Event/CaloClusters_v2.h"
#include "LHCbAlgs/Consumer.h"
#include <Gaudi/Accumulators/Histogram.h>
/** @class CaloFutureClusterMonitor CaloFutureClusterMonitor.cpp
*
* The algorithm for trivial monitoring of "CaloFutureCluster" containers.
* The algorithm produces 8 histograms:
*
* <ol>
* <li> @p CaloCluster multiplicity </li>
* <li> @p CaloCluster size (number of cells) </li>
* <li> @p CaloCluster energy distribution </li>
* <li> @p CaloCluster transverse energy distribution </li>
* <li> @p CaloCluster x-distribution </li>
* <li> @p CaloCluster y-distribution </li>
* <li> @p CaloCluster x vs y-distribution </li>
* </ol>
*
* Histograms reside in the directory @p /stat/"Name" , where
* @ "Name" is the name of the algorithm
*
* @see CaloFutureMoniAlg
* @see GaudiHistoAlg
* @see GaudiAlgorithm
* @see Algorithm
* @see IAlgorithm
*
* @author Vanya Belyaev Ivan.Belyaev@itep.ru
* @date 02/11/2001
*/
using Input = LHCb::Event::Calo::v2::Clusters;
class CaloFutureClusterMonitor final
: public LHCb::Algorithm::Consumer<void( const Input&, const DeCalorimeter& ),
LHCb::DetDesc::usesBaseAndConditions<CaloFutureMoniAlg, DeCalorimeter>> {
public:
StatusCode initialize() override;
void operator()( const Input&, const DeCalorimeter& ) const override;
CaloFutureClusterMonitor( const std::string& name, ISvcLocator* pSvcLocator );
private:
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoNClusters;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoNDigits;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoNDigits_forE;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoEnergy;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoET;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoX;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoY;
mutable std::optional<Gaudi::Accumulators::Histogram<2>> m_histoXY;
mutable std::optional<Gaudi::Accumulators::WeightedHistogram<2>> m_histoXY_eW;
mutable Gaudi::Accumulators::StatCounter<> m_clusters{this, "# clusters over threshold"};
};
DECLARE_COMPONENT( CaloFutureClusterMonitor )
CaloFutureClusterMonitor::CaloFutureClusterMonitor( const std::string& name, ISvcLocator* pSvcLocator )
: Consumer( name, pSvcLocator,
{KeyValue{"Input", LHCb::CaloFutureAlgUtils::CaloFutureClusterLocation( name )},
KeyValue{"Detector", LHCb::Calo::Utilities::DeCaloFutureLocation( name )}} ) {}
StatusCode CaloFutureClusterMonitor::initialize() {
return Consumer::initialize().andThen( [&] {
// define range of new histograms from properties
using axis1D = Gaudi::Accumulators::Axis<decltype( m_histoNClusters )::value_type::AxisArithmeticType>;
m_histoNClusters.emplace( this, "nClusters", "# of Clusters " + inputLocation(),
axis1D{m_multBin, m_multMin, m_multMax} );
m_histoNDigits.emplace( this, "nDigits", "Cluster digit multiplicity " + inputLocation(),
axis1D{m_sizeBin, m_sizeMin, m_sizeMax} );
m_histoNDigits_forE.emplace( this, "nDigits_forE", "Cluster digit used for Energy multiplicity " + inputLocation(),
axis1D{m_sizeBin, m_sizeMin, m_sizeMax} );
m_histoEnergy.emplace( this, "energy", "Cluster Energy " + inputLocation(),
axis1D{m_energyBin, m_energyMin, m_energyMax} );
m_histoET.emplace( this, "ET", "Cluster Et " + inputLocation(), axis1D{m_etBin, m_etMin, m_etMax} );
m_histoX.emplace( this, "x", "Cluster x " + inputLocation(), axis1D{m_xBin, m_xMin, m_xMax} );
m_histoY.emplace( this, "y", "Cluster y " + inputLocation(), axis1D{m_yBin, m_yMin, m_yMax} );
m_histoXY.emplace( this, "x-y", "Cluster barycenter position x vs y " + inputLocation(),
axis1D{m_xBin, m_xMin, m_xMax}, axis1D{m_yBin, m_yMin, m_yMax} );
m_histoXY_eW.emplace( this, "x-y-eW", "Energy-weighted cluster barycenter position x vs y " + inputLocation(),
axis1D{m_xBin, m_xMin, m_xMax}, axis1D{m_yBin, m_yMin, m_yMax} );
} );
}
void CaloFutureClusterMonitor::operator()( const Input& clusters, const DeCalorimeter& calo ) const {
if ( msgLevel( MSG::DEBUG ) ) debug() << " Producing histo " << produceHistos() << endmsg;
// produce histos ?
if ( !produceHistos() ) return;
if ( clusters.empty() ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Found empty cluster in " << inputLocation() << endmsg;
return;
}
// for multiplicity histogram
uint nClusters = 0;
for ( const auto& cluster : clusters.scalar() ) {
const double e = cluster.energy();
const double x = cluster.position().x();
const double y = cluster.position().y();
const double z = cluster.position().z();
const double et = e * sqrt( x * x + y * y ) / sqrt( x * x + y * y + z * z );
if ( e < m_eFilter ) continue;
if ( et < m_etFilter ) continue;
++nClusters;
const auto id = cluster.cellID();
const auto& entries = cluster.entries();
++m_histoNDigits.value()[entries.size().cast()];
++m_histoEnergy.value()[e];
++m_histoET.value()[et];
++m_histoX.value()[x];
++m_histoY.value()[y];
++m_histoXY.value()[{x, y}];
m_histoXY_eW.value()[{x, y}] += e;
int iuse = std::count_if( entries.begin(), entries.end(), []( const auto& e ) {
return e.status().test( LHCb::CaloDigitStatus::Mask::UseForEnergy );
} );
++m_histoNDigits_forE.value()[iuse];
// TODO: use thread-safe histos. Need variable binning.
if ( doHisto( "position2D" ) )
fillCaloFuture2D( "position2D", id, 1., calo, "Cluster position 2Dview " + inputLocation() );
if ( doHisto( "position2D-eW" ) )
fillCaloFuture2D( "position2D-eW", id, e, calo, "Cluster Energy 2Dview " + inputLocation() );
}
++m_histoNClusters.value()[nClusters];
m_clusters += nClusters;
}
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
// Includes
#include "CaloDet/DeCalorimeter.h"
#include "CaloFutureMoniAlg.h"
#include "CaloFutureUtils/CaloFutureAlgUtils.h"
#include "DetDesc/GenericConditionAccessorHolder.h"
#include "Event/CaloDigits_v2.h"
#include "Event/ODIN.h"
#include "LHCbAlgs/Consumer.h"
#include <Gaudi/Accumulators/Histogram.h>
// =============================================================================
/** @class CaloFutureDigitMonitor CaloFutureDigitMonitor.cpp
*
* The algorithm for trivial monitoring of "CaloDigit" containers.
* The algorithm produces the following histograms:
* 1. CaloDigit multiplicity
* 2. CaloDigit ocupancy 2D plot per area
* 3. CaloDigit energy 2D plot per area
* The same set of histograms, but with cut on Et (or E), is produced if specified
*
* Histograms reside in the directory @p /stat/"Name" , where
* @p "Name" is the name of the algorithm
*
* @see CaloFutureMoniAlg
* @see GaudiHistoAlg
* @see GaudiAlgorithm
* @see Algorithm
* @see IAlgorithm
*
* @author Konstantin Belous Konstantin.Beloous@itep.ru
* @date 21/06/2007
*/
using Input = LHCb::Event::Calo::Digits;
class CaloFutureDigitMonitor final
: public LHCb::Algorithm::Consumer<void( const Input&, const LHCb::ODIN&, const DeCalorimeter& ),
LHCb::DetDesc::usesBaseAndConditions<CaloFutureMoniAlg, DeCalorimeter>> {
public:
StatusCode initialize() override;
void operator()( const Input&, const LHCb::ODIN&, const DeCalorimeter& ) const override;
CaloFutureDigitMonitor( const std::string& name, ISvcLocator* pSvcLocator );
private:
Gaudi::Property<bool> m_spectrum{this, "Spectrum", false, "activate spectrum per channel histogramming"};
Gaudi::Property<bool> m_SeparateCalib{this, "SeparateCalib", true, "separate Calib BXIDs/Triger type to Calib plots"};
Gaudi::Property<std::vector<int>> m_Calib_BXIDsA{this, "Calib_BXIDsA"};
Gaudi::Property<std::vector<int>> m_Calib_BXIDsB{this, "Calib_BXIDsB"};
Gaudi::Property<std::vector<int>> m_perBXIDlist{this, "perBXIDlist"};
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoMultiplicity;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoDigitX;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoDigitY;
mutable std::optional<Gaudi::Accumulators::Histogram<2>> m_histoDigitXY;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoET;
mutable std::optional<Gaudi::Accumulators::Histogram<1>> m_histoADC;
mutable Gaudi::Accumulators::StatCounter<> m_digits{this, "# digits over threshold"};
};
// =============================================================================
DECLARE_COMPONENT_WITH_ID( CaloFutureDigitMonitor, "CaloFutureDigitMonitor" )
// =============================================================================
CaloFutureDigitMonitor::CaloFutureDigitMonitor( const std::string& name, ISvcLocator* pSvcLocator )
: Consumer( name, pSvcLocator,
{KeyValue{"Input", LHCb::CaloFutureAlgUtils::CaloFutureDigitLocation( name )},
KeyValue{"ODINLocation", LHCb::ODINLocation::Default},
KeyValue{"Detector", LHCb::Calo::Utilities::DeCaloFutureLocation( name )}} ) {}
// =============================================================================
// standard initialize method
// =============================================================================
StatusCode CaloFutureDigitMonitor::initialize() {
return Consumer::initialize().andThen( [&] {
info() << detData() << " digits from " << inputLocation() << endmsg;
// book physics histograms so they are always created and found by Monet
bookCaloFuture2D( "7", fmt::format( "{} Accumulated Energy", detData() ), detData(), -1 );
bookCaloFuture2D( "8", fmt::format( "{} Accumulated Digits filled", detData() ), detData() );
bookCaloFuture2D( "9", fmt::format( "{} Accumulated ADCs", detData() ), detData() );
// define range of new histograms from properties
using axis1D = Gaudi::Accumulators::Axis<decltype( m_histoMultiplicity )::value_type::AxisArithmeticType>;
m_histoMultiplicity.emplace( this, "Multiplicity", "Number of digits", axis1D{m_multBin, m_multMin, m_multMax} );
m_histoDigitX.emplace( this, "DigitX", "Digit X", axis1D{m_xBin, m_xMin, m_xMax} );
m_histoDigitY.emplace( this, "DigitY", "Digit Y", axis1D{m_yBin, m_yMin, m_yMax} );
m_histoDigitXY.emplace( this, "DigitXY", "Digit position x vs y", axis1D{m_xBin, m_xMin, m_xMax},
axis1D{m_yBin, m_yMin, m_yMax} );
m_histoET.emplace( this, "ET", "ET", axis1D{m_etBin, m_etMin, m_etMax} );
m_histoADC.emplace( this, "ADC", "ADC", axis1D{m_adcBin, m_adcMin, m_adcMax} );
} );
}
// ============================================================================
// standard execution method
// ============================================================================
void CaloFutureDigitMonitor::operator()( const Input& digits, const LHCb::ODIN& odin,
const DeCalorimeter& calo ) const {
if ( msgLevel( MSG::DEBUG ) ) debug() << name() << " execute " << endmsg;
// produce histos ?
if ( msgLevel( MSG::DEBUG ) ) debug() << " Producing histo " << produceHistos() << endmsg;
if ( !produceHistos() ) return; // StatusCode::SUCCESS;
if ( digits.empty() ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Found empty container in " << inputLocation() << endmsg;
return;
}
std::string Suff = "_Other";
std::string Suff_BXID = "";
if ( m_SeparateCalib ) {
if ( odin.bunchCrossingType() == LHCb::ODINImplementation::v7::ODIN::BXTypes::BeamCrossing ) {
Suff = "";
} else if ( odin.calibrationType() > 0 ) {
Suff = fmt::format( "_Calib{}", odin.calibrationType() );
}
if ( std::find( m_Calib_BXIDsA.begin(), m_Calib_BXIDsA.end(), odin.bunchId() ) != m_Calib_BXIDsA.end() ) {
Suff = std::string( "_Calib1" );
}
if ( std::find( m_Calib_BXIDsB.begin(), m_Calib_BXIDsB.end(), odin.bunchId() ) != m_Calib_BXIDsB.end() ) {
Suff = std::string( "_Calib2" );
}
}
if ( std::find( m_perBXIDlist.begin(), m_perBXIDlist.end(), odin.bunchId() ) != m_perBXIDlist.end() ) {
Suff_BXID = fmt::format( "_BXID_{}", odin.bunchId() );
}
// count digits NB: digits.size() has a fixed value no matter the state of the detector
uint ndigits = 0;
for ( const auto& digit : digits ) {
const auto id = digit.cellID();
const auto e = digit.energy();
const auto adc = digit.adc();
const auto et = e * calo.cellSine( id );
if ( e < m_eFilter ) continue;
if ( et < m_etFilter ) continue;
if ( adc < m_adcFilter ) continue;
const double x = calo.cellCenter( id ).X();
const double y = calo.cellCenter( id ).Y();
if ( odin.bunchCrossingType() == LHCb::ODINImplementation::v7::ODIN::BXTypes::BeamCrossing ) {
++ndigits;
++m_histoDigitX.value()[x];
++m_histoDigitY.value()[y];
++m_histoDigitXY.value()[{x, y}];
}
fillCaloFuture2D( fmt::format( "7{}", Suff ), id, e, calo,
fmt::format( "{} Accumulated Energy {}", detData(), Suff ) );
fillCaloFuture2D( fmt::format( "8{}", Suff ), id, 1., calo,
fmt::format( "{} Accumulated Digits filled {}", detData(), Suff ) );
fillCaloFuture2D( fmt::format( "9{}", Suff ), id, adc, calo,
fmt::format( "{} Accumulated ADCs {}", detData(), Suff ) );
if ( Suff_BXID != "" ) {
fillCaloFuture2D( fmt::format( "ADC{}", Suff_BXID ), id, adc, calo,
fmt::format( "{} Accumulated ADCs {}", detData(), Suff_BXID ) );
fillCaloFuture2D( fmt::format( "Occupancy{}", Suff_BXID ), id, 1, calo,
fmt::format( "{} Accumulated ADCs {}", detData(), Suff_BXID ) );
}
if ( m_spectrum ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Filling cell by cell histograms" << endmsg;
const int col = id.col();
const int row = id.row();
std::ostringstream tit;
tit << detData() << " channel : " << id;
const auto unit_adc = detData() + "Cells/" + id.areaName() + "/" + Gaudi::Utils::toString( row ) + ";" +
Gaudi::Utils::toString( col ) + "_adc";
const auto unit_et = detData() + "Cells/" + id.areaName() + "/" + Gaudi::Utils::toString( row ) + ";" +
Gaudi::Utils::toString( col ) + "_et";
if ( msgLevel( MSG::VERBOSE ) ) {
verbose() << " et " << et << " cell " << unit_et << endmsg;
verbose() << " adc " << adc << " cell " << unit_adc << endmsg;
} else {
++m_histoET.value()[et];
++m_histoADC.value()[adc];
}
}
}
if ( msgLevel( MSG::VERBOSE ) ) verbose() << "# digits: " << ndigits << endmsg;
m_digits += ndigits;
if ( odin.bunchCrossingType() == LHCb::ODINImplementation::v7::ODIN::BXTypes::BeamCrossing )
++m_histoMultiplicity.value()[ndigits];
return;
}
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
// Includes
#include "CaloFutureMoniAlg.h"
//------------------------------------------------------------------------------
// Implementation file for class : CaloFutureMoniAlg
//
// 2008-09-03 : Olivier Deschamps
//------------------------------------------------------------------------------
CaloFutureMoniAlg::CaloFutureMoniAlg( const std::string& name, ISvcLocator* pSvcLocator )
: CaloFuture2Dview( name, pSvcLocator ) {
// Areas
m_mcount.reserve( m_nAreas );
m_scount.reserve( 2 );
// set default detectorName
auto det = LHCb::CaloFutureAlgUtils::CaloIndexFromAlg( name );
m_detData = toString( det );
}
StatusCode CaloFutureMoniAlg::initialize() {
StatusCode sc = CaloFuture2Dview::initialize();
if ( sc.isFailure() ) return sc;
if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Initialize" << endmsg;
m_counterStat.retrieve().ignore();
if ( "" == histoTopDir() ) setHistoTopDir( "CaloFutureMoniDst/" );
if ( m_split && m_splitSides ) {
warning() << "Cannot split simultaneously the calo sides and areas, so far - Area splitting wins" << endmsg;
m_splitSides = false;
}
return StatusCode::SUCCESS;
}
void CaloFutureMoniAlg::initCounters() const {
m_count = 0;
for ( unsigned int i = 0; i != m_nAreas; ++i ) { m_mcount[i] = 0; }
for ( unsigned int i = 0; i < 2; ++i ) { m_scount[i] = 0; }
}
void CaloFutureMoniAlg::count( LHCb::Detector::Calo::CellID id ) const {
m_count++;
if ( !( id == LHCb::Detector::Calo::CellID() ) ) {
int area = id.area();
m_mcount[area]++;
int col = id.col();
int side = 1;
if ( id.calo() == LHCb::Detector::Calo::CellCode::Index::HcalCalo ) {
if ( col < 16 ) side = 0;
} else if ( col < 32 ) {
side = 0;
}
m_scount[side]++;
}
}
void CaloFutureMoniAlg::fillFutureCounters( std::string unit ) const {
fill( m_h1[unit], m_count, 1 );
// Source monitor. Fetch from "Input" field if existed.
// This required consistent naming across its functional children.
std::string cname{"Monitor"};
if ( hasProperty( "Input" ) ) cname += " " + getProperty( "Input" ).toString();
if ( m_counterStat->isQuiet() ) counter( cname ) += m_count;
// Split monitor
if ( m_splitSides ) {
for ( unsigned int i = 0; i < 2; ++i ) {
std::string side = ( i == 0 ) ? "C-side" : "A-side";
if ( m_scount[i] == 0 ) continue;
GaudiAlg::HistoID id( side + "/" + unit );
fill( m_h1[id], m_scount[i], 1 );
if ( m_counterStat->isQuiet() ) counter( "Monitor (" + side + ")" ) += m_scount[i];
}
} else if ( m_split ) {
for ( unsigned int i = 0; i != m_nAreas; ++i ) {
// std::string area = CaloFutureCellCode::CaloFutureAreaFromNum( CaloFutureCellCode::CaloFutureNumFromName(
// m_detData ), i );
std::string area =
LHCb::Detector::Calo::CellCode::caloArea( LHCb::Detector::Calo::CellCode::caloNum( m_detData ), i );
if ( !validArea( area ) || m_mcount[i] == 0 ) continue;
GaudiAlg::HistoID id( area + "/" + unit );
fill( m_h1[id], m_mcount[i], 1 );
if ( m_counterStat->isQuiet() ) counter( "Monitored (" + area + ")" ) += m_mcount[i];
}
}
}
//==============================================================================
// BOOKINGS
//==============================================================================
void CaloFutureMoniAlg::hBook1( const std::string hid, const std::string titl, const double low, const double high,
const unsigned long bins ) {
if ( !doHisto( hid ) ) return;
if ( m_splitSides ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Booking histogram1D per calo side" << endmsg;
for ( unsigned int i = 0; i < 2; ++i ) {
std::string side = ( i == 0 ) ? "C-side" : "A-side";
GaudiAlg::HistoID id( side + "/" + hid );
std::string tit = titl + " (" + side + ")";
m_h1[id] = book1D( id, tit, low, high, bins );
}
} else if ( m_split ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Booking histogram1D per calo area" << endmsg;
for ( unsigned int i = 0; i != m_nAreas; ++i ) {
// std::string area = CaloFutureCellCode::CaloFutureAreaFromNum( CaloFutureCellCode::CaloFutureNumFromName(
// m_detData ), i );
std::string area =
LHCb::Detector::Calo::CellCode::caloArea( LHCb::Detector::Calo::CellCode::caloNum( m_detData ), i );
if ( !validArea( area ) ) continue;
GaudiAlg::HistoID id( area + "/" + hid );
std::string tit = titl + " (" + area + ")";
m_h1[id] = book1D( id, tit, low, high, bins );
}
}
if ( msgLevel( MSG::DEBUG ) ) debug() << "Booking histogram1D for whole calo" << endmsg;
m_h1[hid] = book1D( hid, titl, low, high, bins );
}
//==============================================================================
void CaloFutureMoniAlg::h1binLabel( const std::string hid, int bin, std::string label ) const {
if ( !doHisto( hid ) ) return;
if ( m_splitSides ) {
for ( unsigned int i = 0; i < 2; ++i ) {
std::string side = ( i == 0 ) ? "C-side" : "A-side";
GaudiAlg::HistoID id( side + "/" + hid );
const auto th = Gaudi::Utils::Aida2ROOT::aida2root( m_h1[id] );
th->GetXaxis()->SetBinLabel( bin, label.c_str() );
}
} else if ( m_split ) {
for ( unsigned int i = 0; i != m_nAreas; ++i ) {
// std::string area = CaloFutureCellCode::CaloFutureAreaFromNum( CaloFutureCellCode::CaloFutureNumFromName(
// m_detData ), i );
std::string area =
LHCb::Detector::Calo::CellCode::caloArea( LHCb::Detector::Calo::CellCode::caloNum( m_detData ), i );
if ( !validArea( area ) ) continue;
GaudiAlg::HistoID id( area + "/" + hid );
const auto th = Gaudi::Utils::Aida2ROOT::aida2root( m_h1[id] );
th->GetXaxis()->SetBinLabel( bin, label.c_str() );
}
}
const auto th = Gaudi::Utils::Aida2ROOT::aida2root( m_h1[hid] );
th->GetXaxis()->SetBinLabel( bin, label.c_str() );
}
//==============================================================================
void CaloFutureMoniAlg::hBook2( const std::string hid, const std::string titl, const double lowx, const double highx,
const unsigned long binsx, const double lowy, const double highy,
const unsigned long binsy ) {
if ( !doHisto( hid ) ) return;
if ( m_splitSides ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Booking histogram2D per calo side" << endmsg;
for ( unsigned int i = 0; i < 2; ++i ) {
std::string side = ( i == 0 ) ? "C-side" : "A-side";
GaudiAlg::HistoID id( side + "/" + hid );
std::string tit = titl + " (" + side + ")";
m_h2[id] = book2D( id, tit, lowx, highx, binsx, lowy, highy, binsy );
}
} else if ( m_split ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Booking histogram2D per calo region" << endmsg;
for ( unsigned int i = 0; i != m_nAreas; ++i ) {
std::string area =
LHCb::Detector::Calo::CellCode::caloArea( LHCb::Detector::Calo::CellCode::caloNum( m_detData ), i );
if ( !validArea( area ) ) continue;
GaudiAlg::HistoID id( area + "/" + hid );
std::string tit = titl + " (" + area + ")";
m_h2[id] = book2D( id, tit, lowx, highx, binsx, lowy, highy, binsy );
}
}
if ( msgLevel( MSG::DEBUG ) ) debug() << "Booking histogram2D for whole calo" << endmsg;
m_h2[hid] = book2D( hid, titl, lowx, highx, binsx, lowy, highy, binsy );
}
//==============================================================================
// FILLING
//==============================================================================
void CaloFutureMoniAlg::hFill1( std::string hid, double value, double w ) const {
if ( !doHisto( hid ) ) return;
const auto h = m_h1[hid];
if ( h == nullptr ) return;
double bins = (double)h->axis().bins();
double step = h->axis().upperEdge() - h->axis().lowerEdge();
step = ( bins == 0 ) ? 0 : step / bins / 2.;
if ( m_sat ) {
if ( value < h->axis().lowerEdge() ) value = h->axis().lowerEdge() + step;
if ( value > h->axis().upperEdge() ) value = h->axis().upperEdge() - step;
}
fill( h, value, w );
}
void CaloFutureMoniAlg::hFill2( std::string hid, double x, double y, double w ) const {
if ( !doHisto( hid ) ) return;
const auto h = m_h2[hid];
if ( h == nullptr ) return;
double xbins = (double)h->xAxis().bins();
double xstep = h->xAxis().upperEdge() - h->xAxis().lowerEdge();
xstep = ( xbins == 0 ) ? 0 : xstep / xbins / 2.;
double ybins = (double)h->yAxis().bins();
double ystep = h->yAxis().upperEdge() - h->yAxis().lowerEdge();
ystep = ( ybins == 0 ) ? 0 : ystep / ybins / 2.;
if ( m_sat2D ) {
if ( x < h->xAxis().lowerEdge() ) x = h->xAxis().lowerEdge() + xstep;
if ( x > h->xAxis().upperEdge() ) x = h->xAxis().upperEdge() - xstep;
if ( y < h->yAxis().lowerEdge() ) y = h->yAxis().lowerEdge() + ystep;
if ( y > h->yAxis().upperEdge() ) y = h->yAxis().upperEdge() - ystep;
}
fill( h, x, y, w );
}
void CaloFutureMoniAlg::hFill1( LHCb::Detector::Calo::CellID cellID, std::string hid, double value, double w ) const {
if ( !doHisto( hid ) ) return;
const auto h = m_h1[hid];
if ( !h ) return;
double bins = (double)h->axis().bins();
double step = h->axis().upperEdge() - h->axis().lowerEdge();
step = ( bins == 0 ) ? 0 : step / bins / 2.;
if ( m_sat ) {
if ( value < h->axis().lowerEdge() ) value = h->axis().lowerEdge() + step;
if ( value > h->axis().upperEdge() ) value = h->axis().upperEdge() - step;
}
if ( m_splitSides && !( cellID == LHCb::Detector::Calo::CellID() ) ) {
int col = cellID.col();
auto cal = cellID.calo();
std::string side = "A-side";
if ( cal == LHCb::Detector::Calo::CellCode::Index::HcalCalo ) {
if ( col < 16 ) side = "C-side";
} else if ( col < 32 ) {
side = "C-side";
}
GaudiAlg::HistoID id( side + "/" + hid );
const auto hh = m_h1[id];
if ( !hh ) return;
fill( hh, value, w );
} else if ( m_split && !( cellID == LHCb::Detector::Calo::CellID() ) ) {
std::string area =
LHCb::Detector::Calo::CellCode::caloArea( LHCb::Detector::Calo::CellCode::caloNum( m_detData ), cellID.area() );
if ( msgLevel( MSG::DEBUG ) ) debug() << "Filling histogram2D per calo region " << cellID << endmsg;
if ( validArea( area ) ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "valid area " << area << endmsg;
GaudiAlg::HistoID id( area + "/" + hid );
const auto hh = m_h1[id];
if ( !hh ) return;
fill( hh, value, w );
}
}
fill( h, value, w );
}
void CaloFutureMoniAlg::hFill2( LHCb::Detector::Calo::CellID cellID, std::string hid, double x, double y,
double w ) const {
if ( !doHisto( hid ) ) return;
const auto h = m_h2[hid];
if ( h == nullptr ) return;
double xbins = (double)h->xAxis().bins();
double xstep = h->xAxis().upperEdge() - h->xAxis().lowerEdge();
xstep = ( xbins == 0 ) ? 0 : xstep / xbins / 2.;
double ybins = (double)h->yAxis().bins();
double ystep = h->yAxis().upperEdge() - h->yAxis().lowerEdge();
ystep = ( ybins == 0 ) ? 0 : ystep / ybins / 2.;
if ( m_sat2D ) {
if ( x < h->xAxis().lowerEdge() ) x = h->xAxis().lowerEdge() + xstep;
if ( x > h->xAxis().upperEdge() ) x = h->xAxis().upperEdge() - xstep;
if ( y < h->yAxis().lowerEdge() ) y = h->yAxis().lowerEdge() + ystep;
if ( y > h->yAxis().upperEdge() ) y = h->yAxis().upperEdge() - ystep;
}
if ( m_splitSides && !( cellID == LHCb::Detector::Calo::CellID() ) ) {
int col = cellID.col();
auto cal = cellID.calo();
std::string side = "A-side";
if ( cal == LHCb::Detector::Calo::CellCode::Index::HcalCalo ) {
if ( col < 16 ) side = "C-side";
} else if ( col < 32 ) {
side = "C-side";
}
GaudiAlg::HistoID id( side + "/" + hid );
const auto hh = m_h2[id];
fill( hh, x, y, w );
} else if ( m_split && !( cellID == LHCb::Detector::Calo::CellID() ) ) {
// std::string area = CaloFutureCellCode::CaloFutureAreaFromNum( CaloFutureCellCode::CaloFutureNumFromName(
// m_detData ), cellID.area() );
std::string area =
LHCb::Detector::Calo::CellCode::caloArea( LHCb::Detector::Calo::CellCode::caloNum( m_detData ), cellID.area() );
if ( validArea( area ) ) {
GaudiAlg::HistoID id( area + "/" + hid );
const auto hh = m_h2[id];
fill( hh, x, y, w );
}
fill( h, x, y, w );
} else {
fill( h, x, y, w );
}
}
//==============================================================================
// MISC
//==============================================================================
bool CaloFutureMoniAlg::doHisto( const std::string histo ) const {
// Followup by whitelist, "ALL"
return std::any_of( m_histoList.begin(), m_histoList.end(),
[histo]( std::string h ) { return histo == h || "All" == h; } );
}
bool CaloFutureMoniAlg::validArea( const std::string area ) const {
return std::any_of( m_areas.begin(), m_areas.end(), [area]( auto s ) { return s == area; } );
}
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#pragma once
#include "AIDA/IAxis.h"
#include "AIDA/IHistogram1D.h"
#include "AIDA/IHistogram2D.h"
#include "CaloFutureUtils/CaloFuture2Dview.h"
#include "CaloFutureUtils/CaloFutureAlgUtils.h"
#include "Detector/Calo/CaloCellID.h"
#include "GaudiAlg/GaudiHistoAlg.h"
#include "GaudiKernel/HashMap.h"
#include "GaudiUtils/Aida2ROOT.h"
#include "IFutureCounterLevel.h"
#include "TROOT.h"
#include "AIDA/IHistogram1D.h"
class CaloFutureMoniAlg : public CaloFuture2Dview {
public:
/**
* constructor
* @param name algorithm name
* @param pSvcLocator pointer to service locator
*/
CaloFutureMoniAlg( const std::string& name, ISvcLocator* pSvcLocator );
StatusCode initialize() override;
// address/location/name in Transient Store of detector data
const std::string& detData() const { return m_detData; }
// booking histogram
void initCounters() const;
void count( LHCb::Detector::Calo::CellID id = LHCb::Detector::Calo::CellID() ) const;
void fillFutureCounters( std::string ) const;
void hBook1( const std::string, const std::string, const double low = 0, const double high = 100,
const unsigned long bins = 100 );
void h1binLabel( const std::string hid, int bin, std::string label ) const;
void hBook2( const std::string hid, const std::string titl, const double lowx = 0, const double highx = 100,
const unsigned long binsx = 100, const double lowy = 0, const double highy = 100,
const unsigned long binsy = 100 );
// fill histogram
void hFill1( std::string hid, double value, double w = 1. ) const;
void hFill2( std::string hid, double x, double y, double w = 1. ) const;
void hFill1( LHCb::Detector::Calo::CellID cellID, std::string hid, double value, double w = 1. ) const;
void hFill2( LHCb::Detector::Calo::CellID cellID, std::string hid, double x, double y, double w = 1. ) const;
private:
std::string m_detData; // filled in constructor from algo name
protected:
ToolHandle<IFutureCounterLevel> m_counterStat{"FutureCounterLevel"};
// Histogram Map
GaudiUtils::HashMap<std::string, AIDA::IHistogram1D*> m_h1;
GaudiUtils::HashMap<std::string, AIDA::IHistogram2D*> m_h2;
// Properties
Gaudi::Property<float> m_energyMin{this, "HistoEnergyMin", 0.};
Gaudi::Property<float> m_etMin{this, "HistoEtMin", 0.};
Gaudi::Property<float> m_adcMin{this, "HistoAdcMin", 0.};
Gaudi::Property<float> m_massMin{this, "HistoMassMin", 0.};
Gaudi::Property<float> m_xMin{this, "HistoXMin", -4 * Gaudi::Units::meter};
Gaudi::Property<float> m_yMin{this, "HistoYMin", -4 * Gaudi::Units::meter};
Gaudi::Property<float> m_multMin{this, "HistoMultiplicityMin", 0.};
Gaudi::Property<float> m_sizeMin{this, "HistoSizeMin", 0.};
Gaudi::Property<float> m_energyMax{this, "HistoEnergyMax", 250. * Gaudi::Units::GeV};
Gaudi::Property<float> m_etMax{this, "HistoEtMax", 15. * Gaudi::Units::GeV};
Gaudi::Property<float> m_adcMax{this, "HistoAdcMax", 4096.};
Gaudi::Property<float> m_massMax{this, "HistoMassMax", 250. * Gaudi::Units::MeV};
Gaudi::Property<float> m_xMax{this, "HistoXMax", +4 * Gaudi::Units::meter};
Gaudi::Property<float> m_yMax{this, "HistoYMax", +4 * Gaudi::Units::meter};
Gaudi::Property<float> m_multMax{this, "HistoMultiplicityMax", 2000.};
Gaudi::Property<float> m_sizeMax{this, "HistoSizeMax", 25.};
Gaudi::Property<unsigned int> m_energyBin{this, "HistoEnergyBin", 100};
Gaudi::Property<unsigned int> m_etBin{this, "HistoEtBin", 100};
Gaudi::Property<unsigned int> m_adcBin{this, "HistoAdcBin", 4096};
Gaudi::Property<unsigned int> m_massBin{this, "HistoMassBin", 100};
Gaudi::Property<unsigned int> m_xBin{this, "HistoXBin", 50};
Gaudi::Property<unsigned int> m_yBin{this, "HistoYBin", 50};
Gaudi::Property<unsigned int> m_yBinTA{this, "TAHistoYBin", 124};
Gaudi::Property<unsigned int> m_multBin{this, "HistoMultiplicityBin", 100};
Gaudi::Property<unsigned int> m_sizeBin{this, "HistoSizeBin", 25};
Gaudi::Property<float> m_eFilter{this, "EnergyFilter", -100.};
Gaudi::Property<float> m_etFilter{this, "EtFilter", -100.};
Gaudi::Property<float> m_adcFilter{this, "ADCFilter", -100.};
Gaudi::Property<float> m_massFilterMin{this, "MassWindowMin", -9999999.};
Gaudi::Property<float> m_massFilterMax{this, "MassWindowMax", +9999999.};
Gaudi::Property<bool> m_sat{this, "SaturationBin1D", true};
Gaudi::Property<bool> m_sat2D{this, "SaturationBin2D", false};
Gaudi::Property<bool> m_print{this, "PrintOut", false};
Gaudi::Property<bool> m_splitSides{this, "SplitSides", false};
Gaudi::Property<std::vector<std::string>> m_histoList{this, "histoList", {"All"}};
Gaudi::Property<std::vector<std::string>> m_areas{
this, "listOfAreas", {"Outer", "Middle", "Inner"}, "list of areas to be split"};
const unsigned int m_nAreas = 1 << ( LHCb::Detector::Calo::CellCode::BitsArea + 1 );
// For const operator()
mutable unsigned int m_count = 0;
mutable std::vector<unsigned int> m_mcount;
mutable std::vector<unsigned int> m_scount;
bool doHisto( const std::string histo ) const;
bool validArea( const std::string area ) const;
};
/*****************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
#include "CaloDet/DeCalorimeter.h"
#include "CaloFutureMoniAlg.h"
#include "DetDesc/GenericConditionAccessorHolder.h"
#include "Event/CaloDigits_v2.h"
#include "Event/ODIN.h"
#include "GaudiAlg/GaudiHistoTool.h"
#include "GaudiAlg/IHistoTool.h"
#include "LHCbAlgs/Consumer.h"
#include "TH2.h"
#include "TProfile2D.h"
#include "fmt/format.h"
namespace LHCb {
using Input = Event::Calo::Digits;
class CaloFuturePedestal final
: public Algorithm::Consumer<void( const Input&, const LHCb::ODIN&, const DeCalorimeter& ),
LHCb::DetDesc::usesBaseAndConditions<CaloFutureMoniAlg, DeCalorimeter>> {
public:
StatusCode initialize() override;
void operator()( const Input&, const LHCb::ODIN&, const DeCalorimeter& ) const override;
StatusCode finalize() override;
CaloFuturePedestal( const std::string& name, ISvcLocator* pSvcLocator );
private:
Gaudi::Property<bool> m_spectrum{this, "Spectrum", false, "activate spectrum per channel histogramming"};
// HISTO IDS / TITLES
GaudiAlg::HistoID m_ADCprofile1ID = GaudiAlg::HistoID( fmt::format( "{}_ADC_profile2D_subch1", detData() ) );
std::string m_ADCprofile1Title = fmt::format( "{} Mean of ADCs, Subchannel 1", detData() );
GaudiAlg::HistoID m_calorms1ID = GaudiAlg::HistoID( fmt::format( "{}_ADC_RMS_2D_subch1", detData() ) );
std::string m_calorms1Title = fmt::format( "{} RMS of ADCs, Subchannel 1", detData() );
GaudiAlg::HistoID m_ADCprofile2ID = GaudiAlg::HistoID( fmt::format( "{}_ADC_profile2D_subch2", detData() ) );
std::string m_ADCprofile2Title = fmt::format( "{} Mean of ADCs, Subchannel 2", detData() );
GaudiAlg::HistoID m_calorms2ID = GaudiAlg::HistoID( fmt::format( "{}_ADC_RMS_2D_subch2", detData() ) );
std::string m_calorms2Title = fmt::format( "{} RMS of ADCs, Subchannel 2", detData() );
};
DECLARE_COMPONENT_WITH_ID( CaloFuturePedestal, "CaloFuturePedestal" )
} // namespace LHCb
LHCb::CaloFuturePedestal::CaloFuturePedestal( const std::string& name, ISvcLocator* pSvcLocator )
: Consumer( name, pSvcLocator,
{KeyValue{"Input", LHCb::CaloFutureAlgUtils::CaloFutureDigitLocation( name )},
KeyValue{"ODINLocation", LHCb::ODINLocation::Default},
KeyValue{"Detector", LHCb::Calo::Utilities::DeCaloFutureLocation( name )}} ) {}
StatusCode LHCb::CaloFuturePedestal::initialize() {
return Consumer::initialize().andThen( [&] {
info() << " digits from " << inputLocation() << endmsg;
bool old_m_profile = m_profile;
m_profile = true;
bookCaloFuture2D( m_ADCprofile1ID, m_ADCprofile1Title, detData(), -1 );
bookCaloFuture2D( m_ADCprofile2ID, m_ADCprofile2Title, detData(), -1 );
m_profile = false;
bookCaloFuture2D( m_calorms1ID, m_calorms1Title, detData(), -1 );
bookCaloFuture2D( m_calorms2ID, m_calorms2Title, detData(), -1 );
m_profile = old_m_profile;
} );
}
void LHCb::CaloFuturePedestal::operator()( const Input& digits, const LHCb::ODIN& odin,
const DeCalorimeter& calo ) const {
if ( msgLevel( MSG::DEBUG ) ) debug() << name() << " execute " << endmsg;
if ( digits.empty() ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Found empty container in " << inputLocation() << endmsg;
return;
}
const auto bcID = odin.bunchId();
for ( const auto& digit : digits ) {
const auto id = digit.cellID();
const auto adc = digit.adc();
if ( digit.adc() < m_adcFilter ) continue;
if ( bcID % 2 == 0 ) {
fillCaloFuture2D( m_ADCprofile1ID, id, adc, calo, m_ADCprofile1Title );
if ( m_spectrum ) {
plot1D( adc, fmt::format( "{}Cells/subch1/{}/{}_{}_adc", detData(), id.areaName(), id.row(), id.col() ),
fmt::format( "{} channel : {}", detData(), Gaudi::Utils::toString( id ) ), m_adcMin, m_adcMax,
m_adcBin );
}
} else {
fillCaloFuture2D( m_ADCprofile2ID, id, adc, calo, m_ADCprofile2Title );
if ( m_spectrum ) {
plot1D( adc, fmt::format( "{}Cells/subch2/{}/{}_{}_adc", detData(), id.areaName(), id.row(), id.col() ),
fmt::format( "{} channel : {}", detData(), Gaudi::Utils::toString( id ) ), m_adcMin, m_adcMax,
m_adcBin );
}
}
}
return;
}
StatusCode LHCb::CaloFuturePedestal::finalize() {
TProfile2D* m_profile_root_rms1 = Gaudi::Utils::Aida2ROOT::aida2root( profile2D( m_ADCprofile1ID ) );
TProfile2D* m_profile_root_rms2 = Gaudi::Utils::Aida2ROOT::aida2root( profile2D( m_ADCprofile2ID ) );
TH2D* m_histo_root_calorms1 = Gaudi::Utils::Aida2ROOT::aida2root( histo2D( m_calorms1ID ) );
TH2D* m_histo_root_calorms2 = Gaudi::Utils::Aida2ROOT::aida2root( histo2D( m_calorms2ID ) );
auto fillH_fromProf = [this]( TProfile2D* prof, TH2D* h, int nsubch ) {
if ( prof && h ) {
Int_t n = prof->GetNcells();
if ( msgLevel( MSG::DEBUG ) ) debug() << "Bins in profile of sub-channel " << nsubch << " : " << n << endmsg;
for ( Int_t i = 1; i < n; i++ ) {
if ( prof->GetBinError( i ) != 0. ) {
h->SetBinContent( i, prof->GetBinError( i ) * sqrt( prof->GetBinEntries( i ) ) );
// it would only be GetBinError(i) if option 's' could be set to the profile but AIDA 2D profile
// doesn't support it AFAIU
}
}
}
};
fillH_fromProf( m_profile_root_rms1, m_histo_root_calorms1, 1 );
fillH_fromProf( m_profile_root_rms2, m_histo_root_calorms2, 2 );
return Consumer::finalize();
}
/***************************************************************************\
* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration *
* *
* This software is distributed under the terms of the GNU General Public *
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\*****************************************************************************/
// Includes
#include "CaloDet/DeCalorimeter.h"
#include "CaloFutureMoniAlg.h"
#include "CaloFutureUtils/CaloFutureAlgUtils.h"
#include "DetDesc/GenericConditionAccessorHolder.h"
#include "Event/CaloDigits_v2.h"
#include "Event/ODIN.h"
#include "LHCbAlgs/Consumer.h"
/** @class CaloFutureDigitMonitor CaloFutureTimeAlignment.cpp
*
* The algorithm for trivial monitoring of the "CaloDigits" as a function of
* the bunch crossing ID.
* The algorithm produces the following histograms:
* 1. CaloDigit Energy per BXID
* 2. CaloDigit ADCs per BXID
* 3. One histogram per cell, accumulated adc deposits per TAE window,
* for the two subchannels of the cells, if flag Spectrum is True.
* 4. One histogram per crate, acumulating adc deposits per BXID, if flag
* PerCrate is True.
* The same set of histograms, but with cut on ADC is produced if specified.
*
* Histograms reside in the directory @p /stat/"Name" , where
* @p "Name" is the name of the algorithm
*
* @see CaloFutureMoniAlg
*
* @author Nuria Valls Canudas nuria.valls.canudas@cern.ch
* @date 25/11/2021
*/
using Input = LHCb::Event::Calo::Digits;
class CaloFutureTimeAlignment final
: public LHCb::Algorithm::Consumer<void( const Input&, const LHCb::ODIN&, const DeCalorimeter& ),
LHCb::DetDesc::usesBaseAndConditions<CaloFutureMoniAlg, DeCalorimeter>> {
public:
StatusCode initialize() override;
void operator()( const Input&, const LHCb::ODIN&, const DeCalorimeter& ) const override;
CaloFutureTimeAlignment( const std::string& name, ISvcLocator* pSvcLocator );
private:
Gaudi::Property<bool> m_spectrum{this, "Spectrum", false, "activate spectrum per channel histogramming"};
Gaudi::Property<bool> m_perCrate{this, "PerCrate", true, "activate spectrum per crate"};
Gaudi::Property<std::vector<int>> m_TAE_BXIDs{this, "TAE_BXIDs"};
};
DECLARE_COMPONENT( CaloFutureTimeAlignment )
CaloFutureTimeAlignment::CaloFutureTimeAlignment( const std::string& name, ISvcLocator* pSvcLocator )
: Consumer( name, pSvcLocator,
{KeyValue{"Input", LHCb::CaloFutureAlgUtils::CaloFutureDigitLocation( name )},
KeyValue{"ODINLocation", LHCb::ODINLocation::Default},
KeyValue{"Detector", LHCb::Calo::Utilities::DeCaloFutureLocation( name )}} ) {}
StatusCode CaloFutureTimeAlignment::initialize() {
return Consumer::initialize().andThen( [&] {
// Bunch crossing axis
m_xMin = 0;
m_xMax = 3600;
m_xBin = m_xMax - m_xMin;
hBook2( "TA_E", "Energy per BX " + inputLocation(), m_xMin, m_xMax, m_xBin, m_energyMin, m_energyMax, m_yBinTA );
hBook2( "TA_ADC", "ADC per BX " + inputLocation(), m_xMin, m_xMax, m_xBin, m_adcMin, m_adcMax, m_yBinTA );
info() << "Using digits from " << inputLocation() << endmsg;
return StatusCode::SUCCESS;
} );
}
void CaloFutureTimeAlignment::operator()( const Input& digits, const LHCb::ODIN& odin,
const DeCalorimeter& calo ) const {
if ( digits.empty() ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Found empty container in " << inputLocation() << endmsg;
return;
}
const auto bcID = odin.bunchId();
for ( const auto& digit : digits ) {
if ( digit.adc() < m_adcFilter ) continue;
hFill2( "TA_E", bcID, digit.energy() );
hFill2( "TA_ADC", bcID, digit.adc() );
// Fill per crate histograms (TAE mode)
if ( m_perCrate.value() ) {
const auto crate = calo.cardCrate( calo.cardNumber( digit.cellID() ) );
plot2D( bcID, digit.adc(), fmt::format( "TAE_crate{}", crate ), 0, 3600, m_adcMin, m_adcMax, 3600, m_yBinTA );
}
// Fill cell by cell histograms (TAE mode)
if ( m_spectrum.value() ) {
const auto id = digit.cellID();
int TAEwindow = -9999;
for ( auto TAEbx : m_TAE_BXIDs ) {
if ( ( bcID < TAEbx + 5 ) & ( bcID > TAEbx - 5 ) ) { TAEwindow = bcID - TAEbx; }
plot1D( TAEbx, "TAE BXIDs", "TAE BXIDs", 0, 4000, 4000, 1. ); // safety check on which BX we read on
}
if ( TAEwindow > -9999 ) {
std::string tit = fmt::format( "{} channel : {}", detData(), Gaudi::Utils::toString( id ) );
std::string name_tae = fmt::format( "{}Cells/{}/{}_{}_tae", detData(), id.areaName(), id.row(), id.col() );
plot1D( TAEwindow, name_tae, tit, -5, 6, 11, digit.adc() );
}
}
}
}
/***********************************************************************************\
* (c) Copyright 1998-2022 CERN for the benefit of the LHCb and ATLAS collaborations *
* *
* This software is distributed under the terms of the Apache version 2 licence, *
* copied verbatim in the file "LICENSE". *
* *
* In applying this licence, CERN does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
\***********************************************************************************/
#include <CaloFutureUtils/CellIDHistogramUtils.h>
#include <Gaudi/Histograming/Sink/Base.h>
#include <Gaudi/Histograming/Sink/Utils.h>
namespace GHSink = Gaudi::Histograming::Sink;
namespace LHCb::Calo::Histograming::Sink {
using namespace std::string_literals;
struct Root : public GHSink::Base {
using Base::Base;
template <int ND>
struct saveProfileRootHistoWrapper {
saveProfileRootHistoWrapper( Root& root ) : m_root( root ) {}
void operator()( TFile& file, std::string dir, std::string name, nlohmann::json const& j ) {
return saveProfileRootHisto<ND>( file, dir, name, j, m_root.m_convertProfiles.value() );
}
Root& m_root;
};
HistoRegistry const registry = {
{ { "histogram:CellIDHistogram"s, 1 }, &GHSink::saveRootHisto<Traits1D<HistoFlavour::Regular>> },
{ { "histogram:WeightedCellIDHistogram"s, 1 }, &GHSink::saveRootHisto<Traits1D<HistoFlavour::Regular>> },
{ { "histogram:ProfileCellIDHistogram"s, 1 }, saveProfileRootHistoWrapper<1>( *this ) },
{ { "histogram:WeightedProfileCellIDHistogram"s, 1 }, saveProfileRootHistoWrapper<1>( *this ) },
{ { "histogram:CellIDHistogram"s, 2 }, &GHSink::saveRootHisto<Traits2D<HistoFlavour::Regular>> },
{ { "histogram:WeightedCellIDHistogram"s, 2 }, &GHSink::saveRootHisto<Traits2D<HistoFlavour::Regular>> },
{ { "histogram:ProfileCellIDHistogram"s, 2 }, saveProfileRootHistoWrapper<2>( *this ) },
{ { "histogram:WeightedProfileCellIDHistogram"s, 2 }, saveProfileRootHistoWrapper<2>( *this ) } };
StatusCode initialize() override {
return Base::initialize().andThen( [&] {
for ( auto& [id, func] : registry ) { registerHandler( id, func ); }
} );
}
Gaudi::Property<bool> m_convertProfiles{
this, "ConvertProfileHistos", true,
"If true, no profile histos are saved. These are converted to a pair of regular histograms, one plotting the "
"mean and the other the rms of the original data" };
};
DECLARE_COMPONENT( Root )
} // namespace LHCb::Calo::Histograming::Sink