ATLAS Offline Software
FCALFastSimDedicatedSD.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "LArSimEvent/LArHit.h"
10 #include "LArG4Code/EnergySpot.h"
11 #include "GeoModelKernel/GeoTubs.h"
12 #include "StoreGate/StoreGateSvc.h"
13 #include "CLHEP/Geometry/Transform3D.h"
14 #include "CLHEP/Geometry/Point3D.h"
16 
18 using HepGeom::Point3D;
19 
20 // Constructor:
22  : IFastSimDedicatedSD("FCALFastSimDedicatedSD", detStore)
23  , m_fcalManager(nullptr)
24 {
25  if (verbose) { G4cout << GetName() << "::initialize()" << G4endl; }
26  if ( detStore->retrieve(m_fcalManager).isFailure() ){
27  throw std::runtime_error("Could not retrieve FCAL manager");
28  }
29 }
30 
31 // ProcessHitsMethod
33  // Fill the identifier.
34 
35  static const Transform3D xfNeg[3] = {
39 
40  static const Transform3D xfPos[3] = {
44 
45  static const GeoTubs * const fcalTubs[3] = {
46  (const GeoTubs *) m_fcalManager->getFCAL(FCALModule::Module(1),FCALModule::Endcap(0))->getMaterialGeom()->getLogVol()->getShape(),
47  (const GeoTubs *) m_fcalManager->getFCAL(FCALModule::Module(2),FCALModule::Endcap(0))->getMaterialGeom()->getLogVol()->getShape(),
48  (const GeoTubs *) m_fcalManager->getFCAL(FCALModule::Module(3),FCALModule::Endcap(0))->getMaterialGeom()->getLogVol()->getShape()};
49 
50 
51  // Fill the identifier.
52  Point3D<double> globalPosition=spot.GetPosition();
53 
54  // Figure out if it is in the positive endcap or the netative endcap:
55  bool iAmPositive=globalPosition.z()>0.;
56  int module=1;
57  Point3D<double> localPosition= iAmPositive ? (xfPos[0]*globalPosition) : (xfNeg[0]*globalPosition);
58  if (fabs(localPosition.z()) > fcalTubs[0]->getZHalfLength()) {
59  module=2;
60  localPosition= iAmPositive ? (xfPos[1]*globalPosition) : (xfNeg[1]*globalPosition);
61  if (fabs(localPosition.z()) > fcalTubs[1]->getZHalfLength()) {
62  module=3;
63  localPosition= iAmPositive ? (xfPos[2]*globalPosition) : (xfNeg[2]*globalPosition);
64  if (fabs(localPosition.z()) > fcalTubs[2]->getZHalfLength()) {
65  module=0;
66  }
67  }
68  }
69 
70  if (!module) {
71  // std::cout << "Warning in FCALFastSimDedicatedSD: Cannot locate module" << std::endl;
72  return;
73  }
74 
76  int sampling=module;
77  int etaIndex=0, phiIndex=0;
78  bool ok = cmap->getTileID(sampling,
79  localPosition.x(),
80  localPosition.y(),
81  etaIndex,
82  phiIndex);
83 
84 
85  // zSide is negative if z<0.
86  int zSide = iAmPositive ? 2:-2;
87  //static LArG4Identifier id;
88  m_larID.clear();
89  if (ok){
90  m_larID << 4 // LArCalorimeter
91  << 3 // LArFCAL
92  << zSide // EndCap
93  << sampling // FCal Module #
94  << etaIndex
95  << phiIndex;
96  } else {
97  return;
98  }
99 
100  // call process to add this to the collection
101  SimpleHit(m_larID, spot.GetTime(), spot.GetEnergy());
102  return;
103 }
FCALFastSimDedicatedSD::ProcessSpot
virtual void ProcessSpot(const EnergySpot &spot) override final
ProcessHitsMethod.
Definition: FCALFastSimDedicatedSD.cxx:32
EnergySpot
Definition: EnergySpot.h:18
FCAL_ChannelMap
This class contains the tube and tile maps for the FCAL A tile is of a set of FCAL tubes.
Definition: LArCalorimeter/LArGeoModel/LArReadoutGeometry/LArReadoutGeometry/FCAL_ChannelMap.h:34
FCALDetectorManager.h
FCALModule::getAbsoluteTransform
const Amg::Transform3D & getAbsoluteTransform(const GeoAlignmentStore *alignStore=nullptr) const
Returns the absolute transform of this element.
Definition: FCALModule.cxx:94
FCALDetectorManager::getFCAL
const FCALModule * getFCAL(FCALModule::Module module, FCALModule::Endcap endcap) const
Retreive a specific FCAL Module.
Definition: FCALDetectorManager.cxx:59
FCALFastSimDedicatedSD::m_larID
LArG4Identifier m_larID
My LAr identifier.
Definition: FCALFastSimDedicatedSD.h:39
LArG4Identifier::clear
void clear()
IFastSimDedicatedSD
This is the interface for the fast simulation dedicated sensitive detector.
Definition: IFastSimDedicatedSD.h:13
FCALFastSimDedicatedSD::FCALFastSimDedicatedSD
FCALFastSimDedicatedSD(StoreGateSvc *, bool verbose)
Definition: FCALFastSimDedicatedSD.cxx:21
FCALFastSimDedicatedSD::m_fcalManager
FCALDetectorManager * m_fcalManager
Definition: FCALFastSimDedicatedSD.h:36
python.PyAthena.module
module
Definition: PyAthena.py:131
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
EnergySpot::GetEnergy
G4double GetEnergy() const
Definition: EnergySpot.h:37
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
FCAL_ChannelMap::getTileID
bool getTileID(int isam, float x, float y, int &eta, int &phi) const
-— For the new LArFCAL_ID Identifier
Definition: LArCalorimeter/LArGeoModel/LArReadoutGeometry/src/FCAL_ChannelMap.cxx:212
EnergySpot::GetTime
G4double GetTime() const
Definition: EnergySpot.h:43
CLHEPtoEigenConverter.h
LArG4SimpleSD::SimpleHit
G4bool SimpleHit(const LArG4Identifier &lar_id, G4double time, G4double energy)
First method translates to this - also for fast sims.
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
FCALModule::Endcap
Endcap
Definition: FCALModule.h:38
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
EnergySpot.h
FCALFastSimDedicatedSD.h
LArHit.h
FCALDetectorManager::getChannelMap
const FCAL_ChannelMap * getChannelMap() const
Returns the Channel Map.
Definition: FCALDetectorManager.h:126
LArHitContainer.h
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
Amg::EigenTransformToCLHEP
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
Definition: CLHEPtoEigenConverter.h:120
EnergySpot::GetPosition
G4ThreeVector GetPosition() const
Definition: EnergySpot.h:40
FCALModule::Module
Module
Definition: FCALModule.h:37
StoreGateSvc.h
FCALModule.h