ATLAS Offline Software
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 <utility>
18 
19 #include "TileFCS_StepInfoSD.h"
21 #include "G4Step.hh"
22 #include "G4ThreeVector.hh"
23 #include "G4TouchableHistory.hh"
24 
28 
30  : FCS_StepInfoSD(std::move(name), config)
31  , m_calculator(config.m_TileCalculator)
32 {
33 }
34 
35 G4bool TileFCS_StepInfoSD::ProcessHits(G4Step* a_step, 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.) { return result; }
42 
43  if (m_calculator) {
44  //calculation of MicroHit with a_step
45  TileHitData hitData;
46  TileMicroHit micHit = m_calculator->GetTileMicroHit(a_step, hitData);
47  Identifier invalid_id;
48 
49  //Check if MicroHit is not in scintillator
50  if ((micHit.pmt_up == invalid_id) && (micHit.pmt_down == invalid_id)) {
51  G4cout <<this->GetName()<<" WARNING ProcessHits: Invalid hit in Tile??"<<G4endl;
52  return result;
53  }
54  else {
55  // Some cells is the gap scintillator are only read out by one
56  // PMT, so only print warnings if this is not the case.
57  if ((micHit.pmt_up == invalid_id) && !(cellReadOutByOnePMT(micHit.pmt_down))) {
58  G4cout <<this->GetName()<<" WARNING ProcessHits: Something wrong in identifier: tile pmt_up: "<<micHit.pmt_up<<std::endl;
59  G4cout <<this->GetName()<<" WARNING ProcessHits: tile pmt_down : "<<micHit.pmt_down<<" "<<m_tileID->to_string(micHit.pmt_down,-1)<<std::endl;
60  G4cout <<this->GetName()<<" WARNING ProcessHits: E up: "<<micHit.e_up<<" E down: "<<micHit.e_down<<" T up: "<<micHit.time_up<<" T down: "<<micHit.time_down<<std::endl;
61  }
62  if ((micHit.pmt_down == invalid_id) && !(cellReadOutByOnePMT(micHit.pmt_up))) {
63  G4cout <<this->GetName()<<" WARNING ProcessHits: Something wrong in identifier: tile pmt_down: "<<micHit.pmt_down<<std::endl;
64  G4cout <<this->GetName()<<" WARNING ProcessHits: tile pmt_up: "<<micHit.pmt_up<<" "<<m_tileID->to_string(micHit.pmt_up,-1)<<std::endl;
65  G4cout <<this->GetName()<<" WARNING ProcessHits: E up: "<<micHit.e_up<<" E down: "<<micHit.e_down<<" T up: "<<micHit.time_up<<" T down: "<<micHit.time_down<<std::endl;
66  }
67  // Store TileHits Information
68  const G4ThreeVector pos = 0.5*(a_step->GetPreStepPoint()->GetPosition()+a_step->GetPostStepPoint()->GetPosition());
69  const int numberOfProcessedHits(1);
70  const double timeWindow(m_config.m_maxTimeTile);
71  const double distanceWindow(m_config.m_maxRadiusTile);
72  if(!m_calo_dd_man.get()) {
74  }
75  this->update_map(pos, micHit.pmt_up, micHit.e_up, micHit.time_up, true, numberOfProcessedHits, timeWindow, distanceWindow);
76  this->update_map(pos, micHit.pmt_down, micHit.e_down,micHit.time_down, true, numberOfProcessedHits, timeWindow, distanceWindow);
77  }
78  }
79  return true;
80 }
TileFCS_StepInfoSD::cellReadOutByOnePMT
bool cellReadOutByOnePMT(const Identifier &id) const
Some Tile Cells are only read out by one PMT rather than two.
Definition: TileFCS_StepInfoSD.h:65
FCS_StepInfoSD::update_map
void update_map(const CLHEP::Hep3Vector &l_vec, const Identifier &l_identifier, double l_energy, double l_time, bool l_valid, int l_detector, double timeWindow, double distanceWindow)
Definition: FCS_StepInfoSD.cxx:158
TileMicroHit::pmt_up
Identifier pmt_up
Definition: ITileCalculator.h:35
get_generator_info.result
result
Definition: get_generator_info.py:21
TileFCS_StepInfoSD.h
FCS_StepInfoSD::getCaloDDManager
void getCaloDDManager()
Keep a map instead of trying to keep the full vector.
Definition: FCS_StepInfoSD.cxx:145
TileMicroHit::e_up
G4double e_up
Definition: ITileCalculator.h:37
TileMicroHit::time_down
double time_down
Definition: ITileCalculator.h:40
FCS_StepInfoSD::m_calo_dd_man
CxxUtils::CachedPointer< const CaloDetDescrManager > m_calo_dd_man
Definition: FCS_StepInfoSD.h:128
TileMicroHit
Definition: ITileCalculator.h:34
TileFCS_StepInfoSD::ProcessHits
G4bool ProcessHits(G4Step *, G4TouchableHistory *) override final
Main processing method.
Definition: TileFCS_StepInfoSD.cxx:35
TileHitData
Variables to identify Hit objects.
Definition: ITileCalculator.h:45
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
ITileCalculator::GetTileMicroHit
virtual TileMicroHit GetTileMicroHit(const G4Step *, TileHitData &hitData) const =0
Used by FastCaloSimParamAction.
TileMicroHit::pmt_down
Identifier pmt_down
Definition: ITileCalculator.h:36
FCS_Param::Config::m_maxTimeTile
double m_maxTimeTile
Definition: FCS_StepInfoSD.h:61
FCS_StepInfoSD::m_tileID
const TileID * m_tileID
Definition: FCS_StepInfoSD.h:127
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
FCS_Param::Config::m_maxRadiusTile
double m_maxRadiusTile
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:55
Tile_Base_ID::to_string
std::string to_string(const Identifier &id, int level=0) const
Definition: Tile_Base_ID.cxx:52
ITileCalculator.h
CxxUtils::CachedPointer::get
pointer_t get() const
Return the current value of the element.
FCS_StepInfoSD
Common sensitive detector class for LAr systems.
Definition: FCS_StepInfoSD.h:93
TileMicroHit::e_down
G4double e_down
Definition: ITileCalculator.h:38
TileFCS_StepInfoSD::m_calculator
ITileCalculator * m_calculator
Definition: TileFCS_StepInfoSD.h:45
FCS_StepInfoSD::m_config
FCS_Param::Config m_config
Definition: FCS_StepInfoSD.h:122
FCS_Param::Config
Definition: FCS_StepInfoSD.h:42
TileMicroHit::time_up
double time_up
Definition: ITileCalculator.h:39
TileFCS_StepInfoSD::TileFCS_StepInfoSD
TileFCS_StepInfoSD(G4String name, const FCS_Param::Config &config)
Geant4 headers.
Definition: TileFCS_StepInfoSD.cxx:29
Identifier
Definition: IdentifierFieldParser.cxx:14