ATLAS Offline Software
Loading...
Searching...
No Matches
TileFCS_StepInfoSD.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5//************************************************************
6//
7// Class TileFCS_StepInfoSD
8// Sensitive detector for TileCal G4 simulations with TileGeoModel
9//
10// Author: Vakho Tsulaia <Vakhtang.Tsulaia@cern.ch>
11//
12// Major updates: July, 2013 (Sergey)
13//
14//************************************************************
15
16// class header
17#include "TileFCS_StepInfoSD.h"
18
19#include <utility>
21#include "G4Step.hh"
22#include "G4ThreeVector.hh"
23#include "G4TouchableHistory.hh"
24
28
31 : FCS_StepInfoSD(std::move(name), config),
32 m_calculator(config.m_TileCalculator) {}
33
34G4bool TileFCS_StepInfoSD::ProcessHits(G4Step* a_step,
35 G4TouchableHistory* /*ROhist*/) {
36 G4bool result(false);
37 // If there's no energy, there's no hit. (Aside: Isn't this energy
38 // the same as the energy from the calculator? Not necessarily.
39 // The calculator may include detector effects such as
40 // charge-collection which are not modeled by Geant4.)
41 if (a_step->GetTotalEnergyDeposit() <= 0.) {
42 return result;
43 }
44
45 if (m_calculator) {
46 // calculation of MicroHit with a_step
47 TileHitData hitData;
48 TileMicroHit micHit = m_calculator->GetTileMicroHit(a_step, hitData);
49 Identifier invalid_id;
50
51 // Check if MicroHit is not in scintillator
52 if ((micHit.pmt_up == invalid_id) && (micHit.pmt_down == invalid_id)) {
53 G4cout << this->GetName() << " WARNING ProcessHits: Invalid hit in Tile??"
54 << G4endl;
55 return result;
56 } else {
57 // Some cells is the gap scintillator are only read out by one
58 // PMT, so only print warnings if this is not the case.
59 if ((micHit.pmt_up == invalid_id) &&
60 !(cellReadOutByOnePMT(micHit.pmt_down))) {
61 G4cout << this->GetName()
62 << " WARNING ProcessHits: Something wrong in identifier: tile "
63 "pmt_up: "
64 << micHit.pmt_up << std::endl;
65 G4cout << this->GetName()
66 << " WARNING ProcessHits: tile pmt_down : " << micHit.pmt_down
67 << " " << m_tileID->to_string(micHit.pmt_down, -1) << std::endl;
68 G4cout << this->GetName()
69 << " WARNING ProcessHits: E up: " << micHit.e_up
70 << " E down: " << micHit.e_down << " T up: " << micHit.time_up
71 << " T down: " << micHit.time_down << std::endl;
72 }
73 if ((micHit.pmt_down == invalid_id) &&
74 !(cellReadOutByOnePMT(micHit.pmt_up))) {
75 G4cout << this->GetName()
76 << " WARNING ProcessHits: Something wrong in identifier: tile "
77 "pmt_down: "
78 << micHit.pmt_down << std::endl;
79 G4cout << this->GetName()
80 << " WARNING ProcessHits: tile pmt_up: " << micHit.pmt_up << " "
81 << m_tileID->to_string(micHit.pmt_up, -1) << std::endl;
82 G4cout << this->GetName()
83 << " WARNING ProcessHits: E up: " << micHit.e_up
84 << " E down: " << micHit.e_down << " T up: " << micHit.time_up
85 << " T down: " << micHit.time_down << std::endl;
86 }
87 // Store TileHits Information
88 const G4ThreeVector pos =
89 0.5 * (a_step->GetPreStepPoint()->GetPosition() +
90 a_step->GetPostStepPoint()->GetPosition());
91 const int numberOfProcessedHits(1);
92 if (!m_calo_dd_man.get()) {
94 }
95 this->update_map(pos, micHit.pmt_up, micHit.e_up, micHit.time_up, true,
96 numberOfProcessedHits);
97 this->update_map(pos, micHit.pmt_down, micHit.e_down, micHit.time_down,
98 true, numberOfProcessedHits);
99 }
100 }
101 return true;
102}
Definition of CaloDetDescrManager.
void update_map(const CLHEP::Hep3Vector &l_vec, const Identifier &l_identifier, double l_energy, double l_time, bool l_valid, int l_detector)
CxxUtils::CachedPointer< const CaloDetDescrManager > m_calo_dd_man
FCS_StepInfoSD(G4String a_name, const FCS_Param::Config &config)
Constructor.
void getCaloDDManager()
Keep a map instead of trying to keep the full vector.
const TileID * m_tileID
ITileCalculator * m_calculator
bool cellReadOutByOnePMT(const Identifier &id) const
Some Tile Cells are only read out by one PMT rather than two.
G4bool ProcessHits(G4Step *, G4TouchableHistory *) override final
Main processing method.
TileFCS_StepInfoSD(G4String name, const FCS_Param::Config &config)
Geant4 headers.
STL namespace.
Variables to identify Hit objects.
Identifier pmt_down
Identifier pmt_up