ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArG4
LArG4Barrel
src
LArStraightAbsorbers.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArStraightAbsorbers.h
"
6
#include "G4LogicalVolume.hh"
7
#include "G4VSolid.hh"
8
#include "G4Trap.hh"
9
#include "
LArG4Code/LArVG4DetectorParameters.h
"
10
11
const
LArStraightAbsorbers
*
LArStraightAbsorbers::GetInstance
(
const
std::string& strDetector)
12
{
13
static
const
LArStraightAbsorbers
instance
(strDetector);
14
return
&
instance
;
15
}
16
17
LArStraightAbsorbers::LArStraightAbsorbers
(
const
std::string& strDetector)
18
{
19
const
LArVG4DetectorParameters
* parameters =
LArVG4DetectorParameters::GetInstance
();
20
if
(parameters->GetValue(
"LArEMBPhiAtCurvature"
,0)>0.)
m_parity
=0;
// first wave goes up
21
else
m_parity
=1;
// first wave goes down
22
23
static
const
std::string prefix = strDetector.empty() ?
""
: strDetector+
"::"
;
24
static
const
PhysicalVolumeAccessor
pva(prefix+
"LAr::EMB::STAC"
,
25
prefix+
"LAr::EMB::ThinAbs::Straight"
);
26
27
for
(
int
stackid=0; stackid<14; stackid++) {
28
for
(
int
cellid=0; cellid<1024; cellid++) {
29
initXYCentAbs
(pva, stackid,cellid);
30
initHalfLength
(pva, stackid,cellid);
31
const
double
slant =
SlantAbs
(pva, stackid,cellid);
32
sincos(slant, &
m_sinu
[cellid][stackid], &
m_cosu
[cellid][stackid]);
33
}
34
}
35
}
36
37
void
LArStraightAbsorbers::initXYCentAbs
(
const
PhysicalVolumeAccessor
& theAbsorbers,
int
stackid,
int
cellid)
38
{
39
const
int
id
=cellid+stackid*10000;
40
const
G4VPhysicalVolume *pv=theAbsorbers.
GetPhysicalVolume
(
id
);
41
if
(!pv) {
42
m_xcent
[cellid][stackid] = 0;
43
m_ycent
[cellid][stackid] = 0;
44
return
;
45
}
46
const
G4ThreeVector& tv=pv->GetTranslation();
47
const
G4VPhysicalVolume *pv2=theAbsorbers.
GetPhysicalVolume
(1000000+
id
);
48
if
(!pv2) {
49
m_xcent
[cellid][stackid] = tv.x();
50
m_ycent
[cellid][stackid] = tv.y();
51
}
52
else
{
53
const
G4ThreeVector& tv2=pv2->GetTranslation();
54
const
G4LogicalVolume* lv = pv->GetLogicalVolume();
55
const
G4Trap* trap =
static_cast<
G4Trap*
>
(lv->GetSolid());
56
const
G4LogicalVolume* lv2 = pv2->GetLogicalVolume();
57
const
G4Trap* trap2 =
static_cast<
G4Trap*
>
(lv2->GetSolid());
58
const
double
xl1=trap->GetYHalfLength1();
59
const
double
xl2=trap2->GetYHalfLength1();
60
m_xcent
[cellid][stackid] = (tv.x()*xl1+tv2.x()*xl2)/(xl1+xl2);
61
m_ycent
[cellid][stackid] = (tv.y()*xl1+tv2.y()*xl2)/(xl1+xl2);
62
}
63
}
64
65
double
LArStraightAbsorbers::SlantAbs
(
const
PhysicalVolumeAccessor
& theAbsorbers,
int
stackid,
int
cellid)
const
66
{
67
// both stackid and cellid start from 0 in the following code
68
const
int
id
=cellid+stackid*10000;
69
const
G4VPhysicalVolume *pv=theAbsorbers.
GetPhysicalVolume
(
id
);
70
if
(!pv)
return
0.;
71
const
G4RotationMatrix *rm=pv->GetRotation();
72
double
Slant = (stackid%2 ==
m_parity
) ? 180*CLHEP::deg-(rm->thetaY()):(rm->thetaY())-180*CLHEP::deg;
73
if
((stackid%2 ==
m_parity
) && (rm->phiY() > 0)) Slant = 360.*CLHEP::deg - Slant;
74
if
((stackid%2 == (1-
m_parity
)) && (rm->phiY() < 0)) Slant = - Slant;
75
return
Slant;
76
}
77
78
void
LArStraightAbsorbers::initHalfLength
(
const
PhysicalVolumeAccessor
& theAbsorbers,
int
stackid,
int
cellid)
79
{
80
double
l = 0.;
81
const
int
id
=cellid+stackid*10000;
82
const
G4VPhysicalVolume *pv=theAbsorbers.
GetPhysicalVolume
(
id
);
83
if
(pv) {
84
const
G4LogicalVolume* lv = pv->GetLogicalVolume();
85
const
G4Trap* trap =
static_cast<
G4Trap*
>
(lv->GetSolid());
86
const
G4VPhysicalVolume *pv2=theAbsorbers.
GetPhysicalVolume
(1000000+
id
);
87
if
(!pv2) l = trap->GetYHalfLength1();
88
else
{
89
const
G4LogicalVolume* lv2 = pv2->GetLogicalVolume();
90
const
G4Trap* trap2 =
static_cast<
G4Trap*
>
(lv2->GetSolid());
91
l = trap->GetYHalfLength1()+trap2->GetYHalfLength1();
92
}
93
}
94
m_halflength
[cellid][stackid] = l;
95
}
96
LArStraightAbsorbers.h
LArVG4DetectorParameters.h
LArVG4DetectorParameters
LArGeo::VDetectorParameters LArVG4DetectorParameters
Definition
LArVG4DetectorParameters.h:19
instance
std::map< std::string, double > instance
Definition
Run_To_Get_Tags.h:8
LArGeo::VDetectorParameters::GetInstance
static const VDetectorParameters * GetInstance()
Definition
VDetectorParameters.cxx:29
LArStraightAbsorbers::SlantAbs
double SlantAbs(const PhysicalVolumeAccessor &theAbsorbers, int stackid, int cellid) const
Definition
LArStraightAbsorbers.cxx:65
LArStraightAbsorbers::m_parity
int m_parity
Definition
LArStraightAbsorbers.h:22
LArStraightAbsorbers::initXYCentAbs
void initXYCentAbs(const PhysicalVolumeAccessor &theAbsorbers, int stackid, int cellid)
Definition
LArStraightAbsorbers.cxx:37
LArStraightAbsorbers::LArStraightAbsorbers
LArStraightAbsorbers(const std::string &strDetector="")
Definition
LArStraightAbsorbers.cxx:17
LArStraightAbsorbers::initHalfLength
void initHalfLength(const PhysicalVolumeAccessor &theAbsorbers, int stackid, int cellid)
Definition
LArStraightAbsorbers.cxx:78
LArStraightAbsorbers::m_xcent
double m_xcent[1024][14]
Definition
LArStraightAbsorbers.h:17
LArStraightAbsorbers::m_halflength
double m_halflength[1024][14]
Definition
LArStraightAbsorbers.h:21
LArStraightAbsorbers::m_cosu
double m_cosu[1024][14]
Definition
LArStraightAbsorbers.h:19
LArStraightAbsorbers::m_ycent
double m_ycent[1024][14]
Definition
LArStraightAbsorbers.h:18
LArStraightAbsorbers::m_sinu
double m_sinu[1024][14]
Definition
LArStraightAbsorbers.h:20
LArStraightAbsorbers::GetInstance
static const LArStraightAbsorbers * GetInstance(const std::string &strDetector="")
Definition
LArStraightAbsorbers.cxx:11
PhysicalVolumeAccessor
Definition
PhysicalVolumeAccessor.h:18
PhysicalVolumeAccessor::GetPhysicalVolume
const G4VPhysicalVolume * GetPhysicalVolume(int) const
Definition
PhysicalVolumeAccessor.cxx:42
Generated on
for ATLAS Offline Software by
1.17.0