ATLAS Offline Software
PresamplerCalibrationCalculator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /********************************************************************
6 
7 NAME: PresamplerCalibrationCalculator.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 presampler of LAr calorimeter. This calculator is
15  called in calibration runs (see LArBarrelPresamplerSDConsultant)
16  for calibration hits in the presampler volume.
17 
18 UPDATES:
19 
20 ********************************************************************/
21 
22 // #define DEBUG_HITS
23 
25 
27 
29 
30 #include "G4Step.hh"
31 #include "globals.hh"
32 #include <algorithm>
33 
34 namespace LArG4 {
35 
36  namespace BarrelPresampler {
37 
38  CalibrationCalculator::CalibrationCalculator(const std::string& name, ISvcLocator *pSvcLocator)
39  : LArCalibCalculatorSvcImp(name, pSvcLocator)
40  , m_geometryCalculator("LArBarrelPresamplerGeometry", name)
41  {
42  declareProperty("GeometryCalculator", m_geometryCalculator);
43  }
44 
46  // Initialize the geometry calculator
47  ATH_CHECK(m_geometryCalculator.retrieve());
48  return StatusCode::SUCCESS;
49  }
50 
51  CalibrationCalculator::~CalibrationCalculator()
52  {
53  }
54 
55  G4bool CalibrationCalculator::Process(const G4Step* step, LArG4Identifier & identifier,
56  std::vector<G4double> & energies,
57  const eCalculatorProcessing process) const
58  {
59  // Use the calculators to determine the energies and the
60  // identifier associated with this G4Step. Note that the
61  // default is to process both the energy and the ID.
62 
63  if ( process == kEnergyAndID || process == kOnlyEnergy )
64  {
65 #ifdef DEBUG_HITS
66  std::cout << "LArG4::Barrel::CalibrationCalculator::Process"
67  << " calling SimulationEnergies" << std::endl;
68 #endif
69  m_energyCalculator.Energies( step, energies );
70 
71  // First, get the energy.
72  //m_energy = step->GetTotalEnergyDeposit();
73  }
74  else
75  for (unsigned int i=0; i != 4; i++) energies.push_back( 0. );
76 
77 
78  if ( process == kEnergyAndID || process == kOnlyID )
79  {
80  // Calculate the identifier.
81  identifier = m_geometryCalculator->CalculateIdentifier( step );
82  }
83  else
85 
86 
87 #ifdef DEBUG_HITS
88  G4double energy = accumulate(energies.begin(),energies.end(),0.);
89  std::cout << "LArG4::Barrel::CalibrationCalculator::Process"
90  << " ID=" << std::string(identifier)
91  << " energy=" << energy
92  << " energies=(" << energies[0]
93  << "," << energies[1]
94  << "," << energies[2]
95  << "," << energies[3] << ")"
96  << std::endl;
97 #endif
98 
99  // Check for bad result.
100  if ( identifier == LArG4Identifier() )
101  return false;
102 
103  return true;
104  }
105 
106  } // namespace Barrel
107 
108 } // namespace LAr
LArG4::BarrelPresampler::CalibrationCalculator::CalibrationCalculator
CalibrationCalculator(const std::string &name, ISvcLocator *pSvcLocator)
Definition: PresamplerCalibrationCalculator.cxx:68
LArG4Identifier
Definition: LArG4Identifier.h:121
LArCalibCalculatorSvcImp
Definition: LArCalibCalculatorSvcImp.h:12
initialize
void initialize()
Definition: run_EoverP.cxx:894
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
LArBarrelPresamplerGeometry.h
LArG4::kOnlyEnergy
@ kOnlyEnergy
Definition: LArG4EnumDefs.h:10
xAOD::identifier
identifier
Definition: UncalibratedMeasurement_v1.cxx:15
LArG4
Definition: LArWheelCalculatorEnums.h:8
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArG4::kOnlyID
@ kOnlyID
Definition: LArG4EnumDefs.h:10
LArG4Identifier.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
PresamplerCalibrationCalculator.h
LArCellBinning.step
step
Definition: LArCellBinning.py:158
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
LArG4::kEnergyAndID
@ kEnergyAndID
Definition: LArG4EnumDefs.h:10
LArG4::eCalculatorProcessing
eCalculatorProcessing
Definition: LArG4EnumDefs.h:10