ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
TileFCS_StepInfoSD Class Reference

#include <TileFCS_StepInfoSD.h>

Inheritance diagram for TileFCS_StepInfoSD:
Collaboration diagram for TileFCS_StepInfoSD:

Public Member Functions

 TileFCS_StepInfoSD (G4String name, const FCS_Param::Config &config)
 Geant4 headers. More...
 
G4bool ProcessHits (G4Step *, G4TouchableHistory *) override final
 Main processing method. More...
 
 TileFCS_StepInfoSD (const TileFCS_StepInfoSD &)=delete
 
TileFCS_StepInfoSDoperator= (const TileFCS_StepInfoSD &)=delete
 
void EndOfAthenaEvent (ISF_FCS_Parametrization::FCS_StepInfoCollection *hitContnainer)
 End of athena event processing. More...
 
void setupHelpers (const LArEM_ID *EM, const LArFCAL_ID *FCAL, const LArHEC_ID *HEC, const TileID *tile)
 Sets the ID helper pointers. More...
 

Protected Member Functions

void getCaloDDManager ()
 Keep a map instead of trying to keep the full vector. More...
 
void update_map (const CLHEP::Hep3Vector &l_vec, const Identifier &l_identifier, double l_energy, double l_time, bool l_valid, int l_detector)
 

Protected Attributes

FCS_Param::Config m_config
 
const LArEM_IDm_larEmID {nullptr}
 Pointers to the identifier helpers. More...
 
const LArFCAL_IDm_larFcalID {nullptr}
 
const LArHEC_IDm_larHecID {nullptr}
 
const TileIDm_tileID {nullptr}
 
CxxUtils::CachedPointer< const CaloDetDescrManagerm_calo_dd_man
 
std::map< Identifier, std::vector< ISF_FCS_Parametrization::FCS_StepInfo * > * > m_hit_map
 

Private Member Functions

bool C10_connected (int module) const
 A copy of the method in TileCablingService.cxx. More...
 
bool cellReadOutByOnePMT (const Identifier &id) const
 Some Tile Cells are only read out by one PMT rather than two. More...
 
double getMaxTime (const CaloCell_ID::CaloSample &layer) const
 

Private Attributes

ITileCalculatorm_calculator
 

Detailed Description

Definition at line 29 of file TileFCS_StepInfoSD.h.

Constructor & Destructor Documentation

◆ TileFCS_StepInfoSD() [1/2]

TileFCS_StepInfoSD::TileFCS_StepInfoSD ( G4String  name,
const FCS_Param::Config config 
)

Geant4 headers.

Athena headers

Definition at line 29 of file TileFCS_StepInfoSD.cxx.

31  : FCS_StepInfoSD(std::move(name), config),
32  m_calculator(config.m_TileCalculator) {}

◆ TileFCS_StepInfoSD() [2/2]

TileFCS_StepInfoSD::TileFCS_StepInfoSD ( const TileFCS_StepInfoSD )
delete

Member Function Documentation

◆ C10_connected()

bool TileFCS_StepInfoSD::C10_connected ( int  module) const
inlineprivate

A copy of the method in TileCablingService.cxx.

Definition at line 48 of file TileFCS_StepInfoSD.h.

48  {
49  const bool C = true;
50  const bool NC = false;
51  const bool cell_present[64] = {
52  // counting from 1 in comments
53  C, C, C, C, C, C, C, C, // 1-8
54  C, C, C, C, C, C, C, C, // 9-16
55  C, C, C, C, C, C, C, C, // 17-24
56  C, C, C, C, C, C, C, C, // 25-32
57  C, C, C, C, C, C, NC, NC, // 33-40 39-40 do not exist
58  NC, NC, C, C, C, C, C, C, // 41-48 41-42 do not exist
59  C, C, C, C, C, C, NC, NC, // 49-56 55-56 do not exist
60  NC, NC, C, C, C, C, C, C // 57-64 57-58 do not exist
61  };
62  return cell_present[module];
63 }

◆ cellReadOutByOnePMT()

bool TileFCS_StepInfoSD::cellReadOutByOnePMT ( const Identifier id) const
inlineprivate

Some Tile Cells are only read out by one PMT rather than two.

Definition at line 65 of file TileFCS_StepInfoSD.h.

66  {
67  return m_tileID->is_tile_gapscin(id) || // gap/crack cells
68  ((m_tileID->section(id) == TileID::GAPDET &&
69  m_tileID->sample(id) == TileID::SAMP_C &&
70  !(this->C10_connected(m_tileID->module(id))))); // Special C10 cells
71 }

◆ EndOfAthenaEvent()

void FCS_StepInfoSD::EndOfAthenaEvent ( ISF_FCS_Parametrization::FCS_StepInfoCollection hitContnainer)
inherited

End of athena event processing.

Definition at line 146 of file FCS_StepInfoSD.cxx.

147  {
148  // Unpack map into vector
149  for (auto it : m_hit_map) {
150  for (auto* a_s : *it.second) {
151  // Giving away ownership of the objects!
152  hitContainer->push_back(a_s);
153  }
154  it.second->clear();
155  delete it.second;
156  } // Vector of IDs in the map
157  m_hit_map.clear();
158  if (m_config.verboseLevel > 4) {
159  G4cout << this->GetName()
160  << " DEBUG EndOfAthenaEvent: After initial cleanup, N="
161  << hitContainer->size() << G4endl;
162  }
163  return;
164 }

◆ getCaloDDManager()

void FCS_StepInfoSD::getCaloDDManager ( )
protectedinherited

Keep a map instead of trying to keep the full vector.

At the end of the event we'll push the map back into the FCS_StepInfoCollection in StoreGate.

Definition at line 49 of file FCS_StepInfoSD.cxx.

49  {
50  SG::ReadCondHandleKey<CaloDetDescrManager> caloMgrKey{"CaloDetDescrManager"};
51  if (caloMgrKey.initialize().isFailure()) {
52  G4ExceptionDescription description;
53  description << "Failed to get CaloDetDescrManager!";
54  G4Exception("FCS_StepInfoSD", "FCSBadCall", FatalException, description);
55  abort();
56  }
58  caloMgrKey, Gaudi::Hive::currentContext());
59  m_calo_dd_man.set(*caloMgr);
60 }

◆ getMaxTime()

double FCS_StepInfoSD::getMaxTime ( const CaloCell_ID::CaloSample layer) const
inlineprivateinherited

NB The result of this function should actually be constant for each SD

Definition at line 34 of file FCS_StepInfoSD.cxx.

35  {
38  return m_config.m_maxTimeLAr;
39  }
41  return m_config.m_maxTimeHEC;
42  }
44  return m_config.m_maxTimeFCAL;
45  }
46  return m_config.m_maxTime;
47 }

◆ operator=()

TileFCS_StepInfoSD& TileFCS_StepInfoSD::operator= ( const TileFCS_StepInfoSD )
delete

◆ ProcessHits()

G4bool TileFCS_StepInfoSD::ProcessHits ( G4Step *  a_step,
G4TouchableHistory *   
)
finaloverridevirtual

Main processing method.

Reimplemented from FCS_StepInfoSD.

Definition at line 34 of file TileFCS_StepInfoSD.cxx.

35  {
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 }

◆ setupHelpers()

void FCS_StepInfoSD::setupHelpers ( const LArEM_ID EM,
const LArFCAL_ID FCAL,
const LArHEC_ID HEC,
const TileID tile 
)
inlineinherited

Sets the ID helper pointers.

Definition at line 84 of file FCS_StepInfoSD.h.

85  {
86  m_larEmID = EM;
87  m_larFcalID = FCAL;
88  m_larHecID = HEC;
89  m_tileID = tile;
90  }

◆ update_map()

void FCS_StepInfoSD::update_map ( const CLHEP::Hep3Vector &  l_vec,
const Identifier l_identifier,
double  l_energy,
double  l_time,
bool  l_valid,
int  l_detector 
)
protectedinherited

Definition at line 62 of file FCS_StepInfoSD.cxx.

66 {
67  // NB l_identifier refers to:
68  // - the cell identifier for LAr
69  // - the PMT identifier for Tile
70 
71  // Drop any hits that don't have a good identifier attached
72  if (!m_calo_dd_man.get()->get_element(l_identifier)) {
73  if (m_config.verboseLevel > 4) {
74  G4cout << this->GetName() << " DEBUG update_map: bad identifier: "
75  << l_identifier.getString() << " skipping this hit." << G4endl;
76  }
77  return;
78  }
79 
80  auto map_item = m_hit_map.find(l_identifier);
81  if (map_item == m_hit_map.end()) {
82  m_hit_map[l_identifier] =
83  new std::vector<ISF_FCS_Parametrization::FCS_StepInfo*>;
84  m_hit_map[l_identifier]->reserve(200);
85  m_hit_map[l_identifier]->push_back(
86  new ISF_FCS_Parametrization::FCS_StepInfo(l_vec, l_identifier, l_energy,
87  l_time, l_valid, l_detector));
88  } else {
89 
90  // Get the appropriate merging limits
92  m_calo_dd_man.get()->get_element(l_identifier)->getSampling();
93 
94  double timeWindow = m_config.m_maxTime;
95  const double distWinLong = m_config.m_maxRadiusLongitudinal.at(layer);
96  const double distWinLat = m_config.m_maxRadiusLateral.at(layer);
97 
98  const double tsame(this->getMaxTime(layer));
99  bool match = false;
100  for (auto* map_it : *map_item->second) {
101  // Time check ... both a global flag and a check on the layer
102  const double delta_t = std::fabs(map_it->time() - l_time);
103  if (delta_t >= tsame) {
104  continue;
105  }
106  if (delta_t >= timeWindow) {
107  continue;
108  }
109 
110  // Distance check
111  const CLHEP::Hep3Vector& currentPosition = map_it->position();
112  const double currentPosition_mag = currentPosition.mag();
113  const double proj_longitudinal =
114  currentPosition.dot(l_vec) / currentPosition_mag;
115  const double delta_longitudinal = currentPosition_mag - proj_longitudinal;
116  if (std::fabs(delta_longitudinal) >= distWinLong) {
117  continue;
118  }
119 
120  // Lateral distance check
121  double delta_lateral_2 = l_vec.mag2() - proj_longitudinal * proj_longitudinal;
122  if (delta_lateral_2 < 0) {
123  delta_lateral_2 = 0; // Avoid negative square root
124  }
125  const double delta_lateral =
126  std::sqrt(delta_lateral_2);
127  if (delta_lateral >= distWinLat) {
128  continue;
129  }
130 
131  // Found a match. Make a temporary that will be deleted!
133  l_vec, l_identifier, l_energy, l_time, l_valid, l_detector);
134  *map_it += my_info;
135  match = true;
136  break;
137  } // End of search for match in time and space
138  if (!match) {
139  map_item->second->push_back(new ISF_FCS_Parametrization::FCS_StepInfo(
140  l_vec, l_identifier, l_energy, l_time, l_valid, l_detector));
141  } // Didn't match
142  } // ID already in the map
143  return;
144 } // That's it for updating the map!

Member Data Documentation

◆ m_calculator

ITileCalculator* TileFCS_StepInfoSD::m_calculator
private

Definition at line 45 of file TileFCS_StepInfoSD.h.

◆ m_calo_dd_man

CxxUtils::CachedPointer<const CaloDetDescrManager> FCS_StepInfoSD::m_calo_dd_man
protectedinherited

Definition at line 106 of file FCS_StepInfoSD.h.

◆ m_config

FCS_Param::Config FCS_StepInfoSD::m_config
protectedinherited

Definition at line 100 of file FCS_StepInfoSD.h.

◆ m_hit_map

std::map<Identifier, std::vector<ISF_FCS_Parametrization::FCS_StepInfo*>*> FCS_StepInfoSD::m_hit_map
protectedinherited

Definition at line 108 of file FCS_StepInfoSD.h.

◆ m_larEmID

const LArEM_ID* FCS_StepInfoSD::m_larEmID {nullptr}
protectedinherited

Pointers to the identifier helpers.

Definition at line 102 of file FCS_StepInfoSD.h.

◆ m_larFcalID

const LArFCAL_ID* FCS_StepInfoSD::m_larFcalID {nullptr}
protectedinherited

Definition at line 103 of file FCS_StepInfoSD.h.

◆ m_larHecID

const LArHEC_ID* FCS_StepInfoSD::m_larHecID {nullptr}
protectedinherited

Definition at line 104 of file FCS_StepInfoSD.h.

◆ m_tileID

const TileID* FCS_StepInfoSD::m_tileID {nullptr}
protectedinherited

Definition at line 105 of file FCS_StepInfoSD.h.


The documentation for this class was generated from the following files:
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
LArSamples::HEC
@ HEC
Definition: CaloId.h:26
TileMicroHit::pmt_up
Identifier pmt_up
Definition: ITileCalculator.h:35
get_generator_info.result
result
Definition: get_generator_info.py:21
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
FCS_Param::Config::m_maxRadiusLateral
std::vector< double > m_maxRadiusLateral
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:46
FCS_StepInfoSD::getCaloDDManager
void getCaloDDManager()
Keep a map instead of trying to keep the full vector.
Definition: FCS_StepInfoSD.cxx:49
TileMicroHit::e_up
G4double e_up
Definition: ITileCalculator.h:37
TileMicroHit::time_down
double time_down
Definition: ITileCalculator.h:40
DMTest::C
C_v1 C
Definition: C.h:26
skel.it
it
Definition: skel.GENtoEVGEN.py:407
Tile_Base_ID::sample
int sample(const Identifier &id) const
Definition: Tile_Base_ID.cxx:171
FCS_StepInfoSD::getMaxTime
double getMaxTime(const CaloCell_ID::CaloSample &layer) const
Definition: FCS_StepInfoSD.cxx:34
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)
Definition: FCS_StepInfoSD.cxx:62
TRT_PAI_gasdata::NC
const int NC
Number of levels for Carbon.
Definition: TRT_PAI_gasdata.h:237
FCS_StepInfoSD::m_calo_dd_man
CxxUtils::CachedPointer< const CaloDetDescrManager > m_calo_dd_man
Definition: FCS_StepInfoSD.h:106
TileMicroHit
Definition: ITileCalculator.h:34
Tile_Base_ID::GAPDET
@ GAPDET
Definition: Tile_Base_ID.h:47
TileHitData
Variables to identify Hit objects.
Definition: ITileCalculator.h:45
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
CxxUtils::CachedPointer::set
void set(pointer_t elt) const
Set the element, assuming it is currently null.
ReadCellNoiseFromCool.tile
tile
Definition: ReadCellNoiseFromCool.py:92
Tile_Base_ID::SAMP_C
@ SAMP_C
Definition: Tile_Base_ID.h:53
FCS_StepInfoSD::FCS_StepInfoSD
FCS_StepInfoSD(G4String a_name, const FCS_Param::Config &config)
Constructor.
Definition: FCS_StepInfoSD.cxx:21
ITileCalculator::GetTileMicroHit
virtual TileMicroHit GetTileMicroHit(const G4Step *, TileHitData &hitData) const =0
Used by FastCaloSimParamAction.
FCS_Param::Config::m_maxRadiusLongitudinal
std::vector< double > m_maxRadiusLongitudinal
property, see LArG4GenShowerLib::LArG4GenShowerLib
Definition: FCS_StepInfoSD.h:49
python.PyAthena.module
module
Definition: PyAthena.py:131
TileMicroHit::pmt_down
Identifier pmt_down
Definition: ITileCalculator.h:36
Tile_Base_ID::is_tile_gapscin
bool is_tile_gapscin(const Identifier &id) const
Definition: Tile_Base_ID.cxx:268
Ringer::EM
@ EM
Definition: CaloRingsDefs.h:19
Tile_Base_ID::module
int module(const Identifier &id) const
Definition: Tile_Base_ID.cxx:159
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
FCS_StepInfoSD::m_larHecID
const LArHEC_ID * m_larHecID
Definition: FCS_StepInfoSD.h:104
FCS_Param::Config::m_maxTime
double m_maxTime
Definition: FCS_StepInfoSD.h:53
FCS_StepInfoSD::m_tileID
const TileID * m_tileID
Definition: FCS_StepInfoSD.h:105
FCS_Param::Config::m_maxTimeFCAL
double m_maxTimeFCAL
Definition: FCS_StepInfoSD.h:56
FCS_StepInfoSD::m_larEmID
const LArEM_ID * m_larEmID
Pointers to the identifier helpers.
Definition: FCS_StepInfoSD.h:102
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
FCS_Param::Config::m_maxTimeHEC
double m_maxTimeHEC
Definition: FCS_StepInfoSD.h:55
ISF_FCS_Parametrization::FCS_StepInfo
Definition: FCS_StepInfo.h:45
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
CaloCell_ID_FCS::HEC0
@ HEC0
Definition: FastCaloSim_CaloCell_ID.h:27
SG::ReadCondHandleKey< CaloDetDescrManager >
LArSamples::FCAL
@ FCAL
Definition: CaloId.h:26
Identifier::getString
std::string getString() const
Provide a string form of the identifier - hexadecimal.
Definition: Identifier.cxx:25
FCS_Param::Config::m_maxTimeLAr
double m_maxTimeLAr
Definition: FCS_StepInfoSD.h:54
Tile_Base_ID::to_string
std::string to_string(const Identifier &id, int level=0) const
Definition: Tile_Base_ID.cxx:52
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
CxxUtils::CachedPointer::get
pointer_t get() const
Return the current value of the element.
TileMicroHit::e_down
G4double e_down
Definition: ITileCalculator.h:38
CaloCell_ID_FCS::FCAL2
@ FCAL2
Definition: FastCaloSim_CaloCell_ID.h:42
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:100
Tile_Base_ID::section
int section(const Identifier &id) const
Definition: Tile_Base_ID.cxx:147
TileFCS_StepInfoSD::C10_connected
bool C10_connected(int module) const
A copy of the method in TileCablingService.cxx.
Definition: TileFCS_StepInfoSD.h:48
CaloCell_ID_FCS::HEC3
@ HEC3
Definition: FastCaloSim_CaloCell_ID.h:30
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
FCS_Param::Config::verboseLevel
int verboseLevel
Helper to keep the same verbosity everywhere.
Definition: FCS_StepInfoSD.h:39
TileMicroHit::time_up
double time_up
Definition: ITileCalculator.h:39
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356
FCS_StepInfoSD::m_hit_map
std::map< Identifier, std::vector< ISF_FCS_Parametrization::FCS_StepInfo * > * > m_hit_map
Definition: FCS_StepInfoSD.h:108
description
std::string description
glabal timer - how long have I taken so far?
Definition: hcg.cxx:88
FCS_StepInfoSD::m_larFcalID
const LArFCAL_ID * m_larFcalID
Definition: FCS_StepInfoSD.h:103
Identifier
Definition: IdentifierFieldParser.cxx:14