ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArG4
LArG4Barrel
src
LArBarrelCalibrationCalculator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/********************************************************************
6
7
NAME: CalibrationCalculator.cxx
8
PACKAGE: offline/LArCalorimeter/LArG4/LArG4Barrel
9
10
AUTHORS: G. Unal, L. Carminati (on a template from Bill Selingman)
11
CREATED: September, 2004
12
13
PURPOSE: This class calculates the values needed for calibration hits
14
in the barrel LAr calorimeter. This calculator is called
15
in calibration runs (see LArBarrelSDConsultant) for calibration
16
hits in the accordion (no presampler).
17
18
UPDATES:
19
20
********************************************************************/
21
22
//#define DEBUG_HITS
23
24
#include "
LArBarrelCalibrationCalculator.h
"
25
26
#include "
LArG4Code/LArG4Identifier.h
"
27
28
#include "G4Step.hh"
29
#include "globals.hh"
30
#include <algorithm>
31
32
namespace
LArG4
{
33
34
namespace
Barrel
{
35
36
CalibrationCalculator::CalibrationCalculator
(
const
std::string& name, ISvcLocator *pSvcLocator)
37
:
LArCalibCalculatorSvcImp
(name, pSvcLocator)
38
{
39
}
40
41
StatusCode
CalibrationCalculator::initialize
() {
42
// Initialize the geometry calculator.
43
ATH_CHECK
(
m_geometryCalculator
.retrieve());
44
return
StatusCode::SUCCESS;
45
}
46
47
G4bool
CalibrationCalculator::Process
(
const
G4Step* step,
48
LArG4Identifier
& identifier,
49
LArG4Identifier
& identifier_sr,
50
std::vector<G4double> & energies,
51
const
eCalculatorProcessing
process
)
const
52
{
53
// Use the calculators to determine the energies and the
54
// identifier associated with this G4Step. Note that the
55
// default is to process both the energy and the ID.
56
57
if
(
process
==
kEnergyAndID
||
process
==
kOnlyEnergy
) {
58
#ifdef DEBUG_HITS
59
std::cout <<
"LArG4::Barrel::CalibrationCalculator::Process"
60
<<
" calling SimulationEnergies"
<< std::endl;
61
#endif
62
m_energyCalculator
.
Energies
( step, energies );
63
}
64
else
{
65
for
(
unsigned
int
i=0; i != 4; i++) energies.push_back( 0. );
66
}
67
68
69
if
(
process
==
kEnergyAndID
||
process
==
kOnlyID
)
70
{
71
// Calculate the identifier.
72
identifier =
m_geometryCalculator
->CalculateIdentifier( step );
73
if
(
m_calculateSuperResolutionIdentifier
)
74
{
75
identifier_sr =
m_geometryCalculator
->CalculateSuperResolutionIdentifier( step );
76
}
77
}
78
else
{
79
identifier
= LArG4Identifier();
80
identifier_sr = LArG4Identifier();
81
}
82
83
[[maybe_unused]]
unsigned
short
sr_value = 0;
84
if
(identifier_sr.
fields
() > 0) {
85
sr_value =
static_cast<
unsigned
short
>
(identifier_sr[0]);
// Get the first field as unsigned
86
}
87
88
else
{
89
sr_value = 0;
// Default value if no fields
90
}
91
#ifdef DEBUG_HITS
92
G4double
energy
=
accumulate
(energies.begin(),energies.end(),0.);
93
std::cout <<
"LArG4::Barrel::CalibrationCalculator::Process"
94
<<
" ID="
<< std::string(identifier)
95
<<
" energy="
<<
energy
96
<<
" energies=("
<< energies[0]
97
<<
","
<< energies[1]
98
<<
","
<< energies[2]
99
<<
","
<< energies[3] <<
")"
100
<< std::endl;
101
#endif
102
103
// Check for bad result.
104
return
( identifier != LArG4Identifier() && ( !
m_calculateSuperResolutionIdentifier
|| identifier_sr != LArG4Identifier() ) ) ;
105
}
106
107
}
// namespace Barrel
108
109
}
// namespace LAr
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition
FPGATrackSimMatrixAccumulator.cxx:22
LArBarrelCalibrationCalculator.h
LArG4Identifier.h
CaloG4::SimulationEnergies::Energies
void Energies(const G4Step *, std::vector< G4double > &) const
The simple method to call from a calibration calculator: Examine the G4Step and return the energies r...
LArCalibCalculatorSvcImp::LArCalibCalculatorSvcImp
LArCalibCalculatorSvcImp(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArCalibCalculatorSvcImp.cxx:7
LArG4Identifier
Definition
LArG4Identifier.h:121
LArG4Identifier::fields
size_type fields() const
LArG4::Barrel::CalibrationCalculator::m_geometryCalculator
ServiceHandle< ILArBarrelGeometry > m_geometryCalculator
Definition
LArBarrelCalibrationCalculator.h:60
LArG4::Barrel::CalibrationCalculator::m_calculateSuperResolutionIdentifier
Gaudi::Property< bool > m_calculateSuperResolutionIdentifier
Definition
LArBarrelCalibrationCalculator.h:61
LArG4::Barrel::CalibrationCalculator::initialize
StatusCode initialize() override final
Definition
LArBarrelCalibrationCalculator.cxx:41
LArG4::Barrel::CalibrationCalculator::Process
virtual G4bool Process(const G4Step *step, LArG4Identifier &identifier, LArG4Identifier &identifier_sr, std::vector< double > &energies, const LArG4::eCalculatorProcessing process) const override final
LArG4::Barrel::CalibrationCalculator::m_energyCalculator
CaloG4::SimulationEnergies m_energyCalculator
Definition
LArBarrelCalibrationCalculator.h:64
LArG4::Barrel::CalibrationCalculator::CalibrationCalculator
CalibrationCalculator(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArBarrelCalibrationCalculator.cxx:36
process
const std::string process
Definition
fbtTestBasics.cxx:76
LArG4::Barrel
Definition
ILArBarrelGeometry.h:23
LArG4
Definition
LArWheelCalculatorEnums.h:8
LArG4::eCalculatorProcessing
eCalculatorProcessing
Definition
LArG4EnumDefs.h:10
LArG4::kOnlyID
@ kOnlyID
Definition
LArG4EnumDefs.h:10
LArG4::kOnlyEnergy
@ kOnlyEnergy
Definition
LArG4EnumDefs.h:10
LArG4::kEnergyAndID
@ kEnergyAndID
Definition
LArG4EnumDefs.h:10
mc.energy
energy
Definition
mc.Ep4_simple_OO.py:8
xAOD::identifier
identifier
Definition
UncalibratedMeasurement_v1.cxx:15
Generated on
for ATLAS Offline Software by
1.17.0