BmnRoot
Loading...
Searching...
No Matches
BmnNdetGeo.h
Go to the documentation of this file.
1// BmnNdetGeo.h
2#ifndef BMNNDETGEO_H
3#define BMNNDETGEO_H
4
5#include "BmnGeoTemplate.h"
6#include "BmnNdetAddress.h"
7#include "BmnNdetGeoPar.h"
8
9#include <regex>
10
11static const std::regex kNdetRegex{BmnNdetGeoPar::fElementPattern};
12static const std::regex kArmRegex{BmnNdetGeoPar::fArmPattern};
13
14class BmnNdetGeo
15 : public FairGeoSet
16 , public BmnGeoTemplate<BmnNdetGeo>
17{
18 public:
20 : FairGeoSet()
21 {
22 SetName("BmnNdetGeo");
23 }
24
25 enum class BoxFace
26 {
27 Unknown,
28 Xminus,
29 Xplus,
30 Yminus,
31 Yplus,
32 Zminus,
33 Zplus
34 };
35 enum class Direction
36 {
37 Unknown,
40 };
41 static std::pair<BoxFace, Direction> GetEnteredFace(const TVector3& globalPos, const TVector3& globalMom);
42
43 static bool CheckIfSensitive(const std::string& vol) { return BmnNdetGeoPar::CheckIfSensitive(vol); }
46 static const char* TopVolumeName() { return BmnNdetGeoPar::fTopVolumeName; }
47
48 uint32_t GetAddressFromPath(const std::string& spath) const
49 {
50 LOG(debug4) << GetName() << ": address from path " << spath;
51 std::smatch m;
52 if (std::regex_search(spath, m, kNdetRegex) && m.size() == 5) {
53 int det = std::stoi(m[1]);
54 int row = std::stoi(m[2]);
55 int col = std::stoi(m[3]);
56 int layer = std::stoi(m[4]);
57 return BmnNdetAddress::GetAddress(det, row, col, layer);
58 }
59
60 LOG(error) << GetName() << ": no address for " << spath;
61 return 0;
62 }
63
64 uint8_t GetArmFromPath(const std::string& spath) const
65 {
66 LOG(debug4) << GetName() << ": address from path " << spath;
67 std::smatch m;
68 if (std::regex_search(spath, m, kArmRegex) && m.size() == 2) {
69 return static_cast<uint32_t>(std::stoi(m[1].str()));
70 }
71
72 LOG(error) << GetName() << ": no address for " << spath;
73 return 0;
74 }
75
76 ClassDef(BmnNdetGeo, 4)
77};
78
79#endif // BMNNDETGEO_H
__m128 m
Definition P4_F32vec4.h:27
static uint32_t GetAddress(uint32_t ArmId, uint32_t RowId, uint32_t ColumnId, uint32_t LayerId)
Return address.
static const TString fDetectorVolumeName
static const TString fPathBeforeLocalSystem
static const std::regex fArmPattern
static bool CheckIfSensitive(std::string name)
static const std::regex fElementPattern
static const TString fTopVolumeName
uint8_t GetArmFromPath(const std::string &spath) const
Definition BmnNdetGeo.h:64
static bool CheckIfSensitive(const std::string &vol)
Definition BmnNdetGeo.h:43
static const char * PathBeforeLocalSystem()
Definition BmnNdetGeo.h:44
static const char * TopVolumeName()
Definition BmnNdetGeo.h:46
uint32_t GetAddressFromPath(const std::string &spath) const
Definition BmnNdetGeo.h:48
static std::pair< BoxFace, Direction > GetEnteredFace(const TVector3 &globalPos, const TVector3 &globalMom)
static const char * DetectorVolumeName()
Definition BmnNdetGeo.h:45