ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArG4
LArG4FastSimulation
src
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
5
#include "
FCALFastSimDedicatedSD.h
"
6
#include "
LArSimEvent/LArHit.h
"
7
#include "
LArSimEvent/LArHitContainer.h
"
8
#include "
LArReadoutGeometry/FCALDetectorManager.h
"
9
#include "
LArReadoutGeometry/FCALModule.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"
15
#include "
GeoPrimitives/CLHEPtoEigenConverter.h
"
16
17
#include <utility>
18
19
using
HepGeom::Transform3D;
20
using
HepGeom::Point3D;
21
22
// Constructor:
23
FCALFastSimDedicatedSD::FCALFastSimDedicatedSD
(
StoreGateSvc
* detStore,
24
std::string hitCollectionName,
25
bool
verbose
)
26
:
IFastSimDedicatedSD
(
"FCALFastSimDedicatedSD"
, detStore,
27
std
::move(hitCollectionName))
28
,
m_fcalManager
(nullptr)
29
{
30
if
(
verbose
) { G4cout << GetName() <<
"::initialize()"
<< G4endl; }
31
if
( detStore->
retrieve
(
m_fcalManager
).isFailure() ){
32
throw std::runtime_error(
"Could not retrieve FCAL manager"
);
33
}
34
}
35
36
// ProcessHitsMethod
37
void
FCALFastSimDedicatedSD::ProcessSpot
(
const
EnergySpot
& spot,
double
weight){
38
// Fill the identifier.
39
40
static
const
Transform3D
xfNeg[3] = {
41
Amg::EigenTransformToCLHEP
(
m_fcalManager
->getFCAL(
FCALModule::Module
(1),
FCALModule::Endcap
(0))->getAbsoluteTransform().inverse()),
42
Amg::EigenTransformToCLHEP
(
m_fcalManager
->getFCAL(
FCALModule::Module
(2),
FCALModule::Endcap
(0))->getAbsoluteTransform().inverse()),
43
Amg::EigenTransformToCLHEP
(
m_fcalManager
->getFCAL(
FCALModule::Module
(3),
FCALModule::Endcap
(0))->getAbsoluteTransform().inverse())};
44
45
static
const
Transform3D
xfPos[3] = {
46
Amg::EigenTransformToCLHEP
(
m_fcalManager
->getFCAL(
FCALModule::Module
(1),
FCALModule::Endcap
(1))->getAbsoluteTransform().inverse()),
47
Amg::EigenTransformToCLHEP
(
m_fcalManager
->getFCAL(
FCALModule::Module
(2),
FCALModule::Endcap
(1))->getAbsoluteTransform().inverse()),
48
Amg::EigenTransformToCLHEP
(
m_fcalManager
->getFCAL(
FCALModule::Module
(3),
FCALModule::Endcap
(1))->getAbsoluteTransform().inverse())};
49
50
static
const
GeoTubs *
const
fcalTubs[3] = {
51
(
const
GeoTubs *)
m_fcalManager
->getFCAL(
FCALModule::Module
(1),
FCALModule::Endcap
(0))->getMaterialGeom()->getLogVol()->getShape(),
52
(
const
GeoTubs *)
m_fcalManager
->getFCAL(
FCALModule::Module
(2),
FCALModule::Endcap
(0))->getMaterialGeom()->getLogVol()->getShape(),
53
(
const
GeoTubs *)
m_fcalManager
->getFCAL(
FCALModule::Module
(3),
FCALModule::Endcap
(0))->getMaterialGeom()->getLogVol()->getShape()};
54
55
56
// Fill the identifier.
57
Point3D<double> globalPosition=spot.
GetPosition
();
58
59
// Figure out if it is in the positive endcap or the netative endcap:
60
bool
iAmPositive=globalPosition.z()>0.;
61
int
module=1;
62
Point3D<double> localPosition= iAmPositive ? (xfPos[0]*globalPosition) : (xfNeg[0]*globalPosition);
63
if
(fabs(localPosition.z()) > fcalTubs[0]->getZHalfLength()) {
64
module
=2;
65
localPosition= iAmPositive ? (xfPos[1]*globalPosition) : (xfNeg[1]*globalPosition);
66
if
(fabs(localPosition.z()) > fcalTubs[1]->getZHalfLength()) {
67
module
=3;
68
localPosition= iAmPositive ? (xfPos[2]*globalPosition) : (xfNeg[2]*globalPosition);
69
if
(fabs(localPosition.z()) > fcalTubs[2]->getZHalfLength()) {
70
module
=0;
71
}
72
}
73
}
74
75
if
(!module) {
76
// std::cout << "Warning in FCALFastSimDedicatedSD: Cannot locate module" << std::endl;
77
return
;
78
}
79
80
const
FCAL_ChannelMap
*cmap =
m_fcalManager
->getChannelMap();
81
int
sampling=
module
;
82
int
etaIndex=0, phiIndex=0;
83
bool
ok = cmap->
getTileID
(sampling,
84
localPosition.x(),
85
localPosition.y(),
86
etaIndex,
87
phiIndex);
88
89
90
// zSide is negative if z<0.
91
int
zSide = iAmPositive ? 2:-2;
92
//static LArG4Identifier id;
93
m_larID
.clear();
94
if
(ok){
95
m_larID
<< 4
// LArCalorimeter
96
<< 3
// LArFCAL
97
<< zSide
// EndCap
98
<< sampling
// FCal Module #
99
<< etaIndex
100
<< phiIndex;
101
}
else
{
102
return
;
103
}
104
105
// call process to add this to the collection
106
SimpleHit
(
m_larID
, spot.
GetTime
(), spot.
GetEnergy
()*weight);
107
return
;
108
}
CLHEPtoEigenConverter.h
Transform3D
Eigen::Affine3d Transform3D
Definition
GeoPrimitives.h:46
EnergySpot.h
FCALDetectorManager.h
FCALFastSimDedicatedSD.h
FCALModule.h
LArHitContainer.h
LArHit.h
StoreGateSvc.h
EnergySpot
Definition
EnergySpot.h:18
EnergySpot::GetPosition
G4ThreeVector GetPosition() const
Definition
EnergySpot.h:40
EnergySpot::GetEnergy
G4double GetEnergy() const
Definition
EnergySpot.h:37
EnergySpot::GetTime
G4double GetTime() const
Definition
EnergySpot.h:43
FCALFastSimDedicatedSD::m_fcalManager
FCALDetectorManager * m_fcalManager
Definition
FCALFastSimDedicatedSD.h:37
FCALFastSimDedicatedSD::ProcessSpot
virtual void ProcessSpot(const EnergySpot &spot, double weight) override final
ProcessHitsMethod.
Definition
FCALFastSimDedicatedSD.cxx:37
FCALFastSimDedicatedSD::m_larID
LArG4Identifier m_larID
My LAr identifier.
Definition
FCALFastSimDedicatedSD.h:40
FCALFastSimDedicatedSD::FCALFastSimDedicatedSD
FCALFastSimDedicatedSD(StoreGateSvc *, std::string hitCollectionName, bool verbose)
Definition
FCALFastSimDedicatedSD.cxx:23
FCALModule::Module
Module
Definition
FCALModule.h:37
FCALModule::Endcap
Endcap
Definition
FCALModule.h:38
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
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
IFastSimDedicatedSD::IFastSimDedicatedSD
IFastSimDedicatedSD(const std::string &name, StoreGateSvc *detStore, std::string hitCollectionName)
Simple constructor and destructor.
Definition
IFastSimDedicatedSD.h:21
LArG4SimpleSD::SimpleHit
G4bool SimpleHit(const LArG4Identifier &lar_id, G4double time, G4double energy)
First method translates to this - also for fast sims.
StoreGateSvc
The Athena Transient Store API.
Definition
StoreGateSvc.h:120
StoreGateSvc::retrieve
StatusCode retrieve(const T *&ptr) const
Retrieve the default object into a const T*.
verbose
bool verbose
Definition
hcg.cxx:75
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
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0