ATLAS Offline Software
Loading...
Searching...
No Matches
PresamplerCalibrationCalculator.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
7NAME: PresamplerCalibrationCalculator.cxx
8PACKAGE: offline/LArCalorimeter/LArG4/LArG4Barrel
9
10AUTHORS: G. Unal, L. Carminati (on a template from Bill Selingman)
11CREATED: September, 2004
12
13PURPOSE: This class calculates the values needed for calibration hits
14 in the barrel presampler of LAr calorimeter. This calculator is
15 called in calibration runs (see LArBarrelPresamplerSDConsultant)
16 for calibration hits in the presampler volume.
17
18UPDATES:
19
20********************************************************************/
21
22// #define DEBUG_HITS
23
25
27
29
30#include "G4Step.hh"
31#include "globals.hh"
32#include <algorithm>
33
34namespace LArG4 {
35
36 namespace BarrelPresampler {
37
38 CalibrationCalculator::CalibrationCalculator(const std::string& name, ISvcLocator *pSvcLocator)
39 : LArCalibCalculatorSvcImp(name, pSvcLocator)
40 {
41 }
42
44 // Initialize the geometry calculator
46 return StatusCode::SUCCESS;
47 }
48
49 G4bool CalibrationCalculator::Process(const G4Step* step, LArG4Identifier & identifier,
50 std::vector<G4double> & energies,
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 // Calculate the identifier.
71 identifier = m_geometryCalculator->CalculateIdentifier( step );
72 }
73 else {
74 identifier = LArG4Identifier();
75 }
76
77#ifdef DEBUG_HITS
78 G4double energy = accumulate(energies.begin(),energies.end(),0.);
79 std::cout << "LArG4::Barrel::CalibrationCalculator::Process"
80 << " ID=" << std::string(identifier)
81 << " energy=" << energy
82 << " energies=(" << energies[0]
83 << "," << energies[1]
84 << "," << energies[2]
85 << "," << energies[3] << ")"
86 << std::endl;
87#endif
88
89 // Check for bad result.
90 return ( identifier != LArG4Identifier() );
91 }
92
93 } // namespace Barrel
94
95} // namespace LAr
#define ATH_CHECK
Evaluate an expression and check for errors.
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
LArCalibCalculatorSvcImp(const std::string &name, ISvcLocator *pSvcLocator)
CalibrationCalculator(const std::string &name, ISvcLocator *pSvcLocator)
virtual G4bool Process(const G4Step *step, LArG4Identifier &identifier, std::vector< G4double > &energies, const eCalculatorProcessing process=kEnergyAndID) const override final
const std::string process
eCalculatorProcessing
@ kOnlyEnergy
@ kEnergyAndID