BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnFHCalGeo.h
Go to the documentation of this file.
1
#ifndef BMNFHCALGEO_H
2
#define BMNFHCALGEO_H
3
4
#include "
BmnFHCalAddress.h
"
5
#include "
BmnFHCalGeoPar.h
"
6
#include "
BmnGeoTemplate.h
"
7
8
#include <regex>
9
10
static
const
std::regex
kFHCalRegex
{
BmnFHCalGeoPar::fElementPattern
};
11
12
class
BmnFHCalGeo
13
:
public
FairGeoSet
14
,
public
BmnGeoTemplate
<BmnFHCalGeo>
15
{
16
public
:
17
BmnFHCalGeo
()
18
:
FairGeoSet
()
19
{
20
SetName(
"BmnFHCalGeo"
);
21
}
22
23
static
bool
CheckIfSensitive
(
const
std::string& vol) {
return
BmnFHCalGeoPar::CheckIfSensitive
(vol); }
24
static
const
char
*
PathBeforeLocalSystem
() {
return
BmnFHCalGeoPar::fPathBeforeLocalSystem
; }
25
static
const
char
*
DetectorVolumeName
() {
return
BmnFHCalGeoPar::fDetectorVolumeName
; }
26
static
const
char
*
TopVolumeName
() {
return
BmnFHCalGeoPar::fTopVolumeName
; }
27
28
uint32_t
GetAddressFromPath
(
const
std::string& spath)
29
{
30
std::smatch
m
;
31
if
(std::regex_search(spath,
m
,
kFHCalRegex
) &&
m
.size() == 3) {
32
int
mod = std::stoi(
m
[1]);
33
int
tyv = std::stoi(
m
[2]);
34
int
sec = ((tyv - 1) / 6) + 1;
// calculate section number
35
int
sc = ((tyv - 1) % 6) + 1;
// calculate scintillator number (in section)
36
int
type = (spath.find(
BmnFHCalGeoPar::NICA_pattern
) == std::string::npos ? 2 : 1);
37
return
BmnFHCalAddress::GetAddress
(type, mod, sec, sc);
38
}
39
LOG(error) << GetName() <<
" : No address for path "
<< spath;
40
return
0;
41
}
42
43
// --- override only the traversal/averaging logic ---
44
void
ListNodesImpl
()
45
{
46
// getting position of 1st scintillator
47
fPositionMap
.clear();
48
49
int
N =
gGeoManager
->CountNodes();
50
for
(
int
i
= 0;
i
< N; ++
i
) {
51
gGeoManager
->CdNode(
i
);
52
auto
* node =
gGeoManager
->GetCurrentNode();
53
if
(!node)
54
continue
;
55
if
(!
BmnFHCalGeoPar::CheckIfSensitive
(node->GetVolume()->GetName()))
56
continue
;
57
58
uint32_t fullAddr =
GetAddressFromPath
(
gGeoManager
->GetPath());
59
if
(
BmnFHCalAddress::GetScintillatorId
(fullAddr) != 1)
60
continue
;
61
62
uint32_t physAddr =
BmnFHCalAddress::GetPhysicalAddress
(fullAddr);
63
double
loc[3] = {0}, glb[3];
64
gGeoManager
->LocalToMaster(loc, glb);
65
TVector3
pos(glb[0], glb[1], glb[2]);
66
TVector3
err =
GetPosError
(node);
// Grab the default half–size error (from the TGeoBBox)
67
err.
SetZ
(err.
Z
() * 2 * 5 * 6);
// Scale eZ. 2 sides. 1:4 scintillator:lead sampling. 6 layers;
68
fPositionMap
[physAddr] = std::make_pair(pos, err);
69
}
70
}
71
72
int
GetMaxModuleId
()
const
73
{
74
uint32_t mx = 0;
75
for
(
auto
& kv :
fPositionMap
) {
76
mx = std::max(mx,
BmnFHCalAddress::GetModuleId
(kv.first));
77
}
78
return
mx;
79
}
80
81
ClassDef
(
BmnFHCalGeo
, 4)
82
};
83
84
#endif
// BMNFHCALGEO_H
i
int i
Definition
P4_F32vec4.h:22
m
__m128 m
Definition
P4_F32vec4.h:27
ClassDef
#define ClassDef(name, id)
gGeoManager
R__EXTERN TGeoManager * gGeoManager
BmnFHCalAddress::GetModuleId
static uint32_t GetModuleId(uint32_t address)
Return Module id from address.
Definition
BmnFHCalAddress.h:89
BmnFHCalAddress::GetPhysicalAddress
static uint32_t GetPhysicalAddress(uint32_t address)
Return Physical address (w/o scintillator id) from address.
Definition
BmnFHCalAddress.h:119
BmnFHCalAddress::GetAddress
static uint32_t GetAddress(uint32_t ModuleType, uint32_t ModuleId, uint32_t SectionId, uint32_t ScintillatorId=0)
Return address from system ID, Module type, Module ID, Section ID, Scintillator ID (optional).
Definition
BmnFHCalAddress.h:39
BmnFHCalAddress::GetScintillatorId
static uint32_t GetScintillatorId(uint32_t address)
Return Scintillator id from address.
Definition
BmnFHCalAddress.h:109
BmnFHCalGeoPar::fElementPattern
static const std::regex fElementPattern
Definition
BmnFHCalGeoPar.h:53
BmnFHCalGeoPar::fPathBeforeLocalSystem
static const TString fPathBeforeLocalSystem
Definition
BmnFHCalGeoPar.h:51
BmnFHCalGeoPar::fTopVolumeName
static const TString fTopVolumeName
Definition
BmnFHCalGeoPar.h:32
BmnFHCalGeoPar::CheckIfSensitive
static bool CheckIfSensitive(std::string name)
Definition
BmnFHCalGeoPar.cxx:56
BmnFHCalGeoPar::fDetectorVolumeName
static const TString fDetectorVolumeName
Definition
BmnFHCalGeoPar.h:34
BmnFHCalGeoPar::NICA_pattern
static const TString NICA_pattern
Definition
BmnFHCalGeoPar.h:54
BmnFHCalGeo
Definition
BmnFHCalGeo.h:15
BmnFHCalGeo::CheckIfSensitive
static bool CheckIfSensitive(const std::string &vol)
Definition
BmnFHCalGeo.h:23
BmnFHCalGeo::GetMaxModuleId
int GetMaxModuleId() const
Definition
BmnFHCalGeo.h:72
BmnFHCalGeo::PathBeforeLocalSystem
static const char * PathBeforeLocalSystem()
Definition
BmnFHCalGeo.h:24
BmnFHCalGeo::DetectorVolumeName
static const char * DetectorVolumeName()
Definition
BmnFHCalGeo.h:25
BmnFHCalGeo::BmnFHCalGeo
BmnFHCalGeo()
Definition
BmnFHCalGeo.h:17
BmnFHCalGeo::TopVolumeName
static const char * TopVolumeName()
Definition
BmnFHCalGeo.h:26
BmnFHCalGeo::GetAddressFromPath
uint32_t GetAddressFromPath(const std::string &spath)
Definition
BmnFHCalGeo.h:28
BmnFHCalGeo::ListNodesImpl
void ListNodesImpl()
Definition
BmnFHCalGeo.h:44
BmnGeoTemplate
Definition
BmnGeoTemplate.h:26
BmnGeoTemplate< BmnFHCalGeo >::GetPosError
TVector3 GetPosError(TGeoNode *node) const
Definition
BmnGeoTemplate.h:149
BmnGeoTemplate< BmnFHCalGeo >::fPositionMap
std::map< uint32_t, std::pair< TVector3, TVector3 > > fPositionMap
Definition
BmnGeoTemplate.h:157
FairGeoSet
TVector3
TVector3::Z
Double_t Z() const
TVector3::SetZ
void SetZ(Double_t)
kFHCalRegex
static const std::regex kFHCalRegex
Definition
BmnFHCalGeo.h:10
BmnFHCalAddress.h
BmnFHCalGeoPar.h
kFHCalRegex
static const std::regex kFHCalRegex
Definition
BmnFHCalGeo.h:10
BmnGeoTemplate.h
install
include
BmnFHCalGeo.h
Generated on
for BmnRoot by
1.17.0