ATLAS Offline Software
Loading...
Searching...
No Matches
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
7NAME: CalibrationCalculator.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 LAr calorimeter. This calculator is called
15 in calibration runs (see LArBarrelSDConsultant) for calibration
16 hits in the accordion (no presampler).
17
18UPDATES:
19
20********************************************************************/
21
22//#define DEBUG_HITS
23
25
27
28#include "G4Step.hh"
29#include "globals.hh"
30#include <algorithm>
31
32namespace LArG4 {
33
34 namespace Barrel {
35
36 CalibrationCalculator::CalibrationCalculator(const std::string& name, ISvcLocator *pSvcLocator)
37 : LArCalibCalculatorSvcImp(name, pSvcLocator)
38 {
39 }
40
42 // Initialize the geometry calculator.
44 return StatusCode::SUCCESS;
45 }
46
47 G4bool CalibrationCalculator::Process(const G4Step* step, LArG4Identifier & identifier,
48 std::vector<G4double> & energies,
50 {
51 // Use the calculators to determine the energies and the
52 // identifier associated with this G4Step. Note that the
53 // default is to process both the energy and the ID.
54
55 if ( process == kEnergyAndID || process == kOnlyEnergy ) {
56#ifdef DEBUG_HITS
57 std::cout << "LArG4::Barrel::CalibrationCalculator::Process"
58 << " calling SimulationEnergies" << std::endl;
59#endif
60 m_energyCalculator.Energies( step, energies );
61 }
62 else {
63 for (unsigned int i=0; i != 4; i++) energies.push_back( 0. );
64 }
65
66
67 if ( process == kEnergyAndID || process == kOnlyID ) {
68 // Calculate the identifier.
69 identifier = m_geometryCalculator->CalculateIdentifier( step );
70 }
71 else {
72 identifier = LArG4Identifier();
73 }
74
75
76#ifdef DEBUG_HITS
77 G4double energy = accumulate(energies.begin(),energies.end(),0.);
78 std::cout << "LArG4::Barrel::CalibrationCalculator::Process"
79 << " ID=" << std::string(identifier)
80 << " energy=" << energy
81 << " energies=(" << energies[0]
82 << "," << energies[1]
83 << "," << energies[2]
84 << "," << energies[3] << ")"
85 << std::endl;
86#endif
87
88 // Check for bad result.
89 return ( identifier != LArG4Identifier() );
90 }
91
92 } // namespace Barrel
93
94} // 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)
ServiceHandle< ILArBarrelGeometry > m_geometryCalculator
virtual G4bool Process(const G4Step *step, LArG4Identifier &identifier, std::vector< G4double > &energies, const eCalculatorProcessing process=kEnergyAndID) const override final
CalibrationCalculator(const std::string &name, ISvcLocator *pSvcLocator)
const std::string process
eCalculatorProcessing
@ kOnlyEnergy
@ kEnergyAndID