BmnRoot
26.10.0-19-g6979a6c6
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnTof1GeoUtils.h
Go to the documentation of this file.
1
#ifndef __BMN_TOF1_HIT_GEOUTILS_H
2
#define __BMN_TOF1_HIT_GEOUTILS_H 1
3
4
#include <
TClonesArray.h
>
5
#include <
TH1D.h
>
6
#include <
TH2D.h
>
7
#include <
TList.h
>
8
#include <
TVector3.h
>
9
#include <iostream>
10
#include <map>
11
12
class
LRectangle1
:
public
TObject
// convex quadrangle
13
{
14
private
:
15
bool
IsInvalid
;
16
17
public
:
18
enum
Side_t
19
{
20
kRight
= 0,
21
kLeft
= 1,
22
kInvalid
= -1,
23
kUpper
= 0,
24
kLower
= 1
25
};
26
// enum Side701_t
27
// {
28
// kUpper = 0,
29
// kLower = 1
30
// };
31
32
Int_t
volumeUID
;
33
Double_t
length
,
width
;
34
35
TVector3
A
,
B
,
C
,
D
,
center
,
perp
;
// [cm]
36
37
LRectangle1
()
38
:
IsInvalid
(true)
39
,
volumeUID
(
kInvalid
)
40
{}
41
LRectangle1
(
Int_t
uid,
42
const
TVector3
& a,
43
const
TVector3
& b,
44
const
TVector3
& c,
45
const
TVector3
& d,
46
bool
check =
false
);
47
48
Double_t
GetLength
()
const
{
return
length
; }
49
Double_t
GetWidth
()
const
{
return
width
; }
50
void
GetInteriorAngle
(
int
vertexIndex)
const
{}
// FIXME
51
TVector3
GetCenter
()
const
{
return
(
A
+
B
+
C
+
D
) * 0.25; }
52
bool
isInvalid
()
const
{
return
IsInvalid
; }
53
54
Double_t
DistanceFromPointToLineSegment
(
const
TVector3
* pos,
const
TVector3
& P1,
const
TVector3
& P2)
const
;
55
Double_t
DistanceFromPointToLine
(
const
TVector3
* pos,
const
TVector3
& P1,
const
TVector3
& P2)
const
;
56
Double_t
MinDistanceToEdge
(
const
TVector3
* pos,
Side_t
& side)
const
;
57
Double_t
MinDistanceToEdge701
(
const
TVector3
* pos,
Side_t
& side)
const
;
58
59
void
Print
(std::ostream& out,
const
TVector3
& point,
const
char
* comment =
nullptr
)
const
;
60
void
Dump
(
const
char
* comment, std::ostream& out = std::cout)
const
;
61
62
void
Shift
(
const
TVector3
& shift)
63
{
64
A
+= shift;
65
B
+= shift;
66
C
+= shift;
67
D
+= shift;
68
};
69
70
inline
void
InitCenterPerp
()
71
{
72
center
= (
A
+
B
+
C
+
D
) * 0.25;
73
perp
= (
B
-
A
).
Cross
(
D
-
A
).Unit();
74
}
75
76
inline
void
CalculateLengthnWidth
()
77
{
78
length
=
TMath::Abs
(
B
.X() -
A
.X());
79
if
(
length
!= 16 &&
length
!= 56) {
80
if
(
length
== 15)
81
length
= 16;
82
else
if
(
length
== 55)
83
length
= 56;
84
}
85
width
=
TMath::Abs
(
C
.Y() -
B
.Y());
86
}
87
88
inline
void
CheckInValid
()
89
{
90
IsInvalid
=
false
;
91
92
// Convex Polygon Definition: A polygon that has all interior angles less than 180°
93
;
94
// Sum of Interior Angles, sum = 180*(n-2) degree, where n is the number of sides
95
// A square has 4 sides, so interior angles sum = 360°
96
;
97
// Rectangle check - all angles == 90 degree
98
TVector3
ab =
A
-
B
, bc =
B
-
C
, cd =
C
-
D
, da =
D
-
A
;
99
if
(ab.
Dot
(bc) != 0. || bc.Dot(cd) != 0. || cd.Dot(da) != 0. || da.Dot(ab) != 0.) {
100
std::cerr <<
"\n ---> ERROR: invalid Rectangle."
;
101
Dump
(
""
, std::cerr);
102
IsInvalid
=
true
;
103
}
104
}
105
// ClassDef(LRectangle1, 1);
106
};
107
108
class
LStrip1
:
public
LRectangle1
109
{
110
public
:
111
Bool_t
isKilled
=
false
;
112
Int_t
sectorID
,
boxID
,
detectorID
,
stripID
;
113
Int_t
neighboring
[2];
// dim same as Side_t enum
114
115
LStrip1
();
116
LStrip1
(
Int_t
uid,
Int_t
sector,
Int_t
box,
Int_t
detector
,
Int_t
strip);
117
118
void
SetIDs
(
Int_t
uid,
Int_t
sector,
Int_t
box,
Int_t
detector
,
Int_t
strip)
119
{
120
volumeUID
= uid;
121
sectorID
= sector;
122
boxID
= box;
123
detectorID
=
detector
;
124
stripID
= strip;
125
}
126
127
inline
void
SetIsKilled
(
bool
status) {
isKilled
= status; }
128
inline
bool
GetIsKilled
()
const
{
return
isKilled
; }
129
inline
bool
IsSameDetector
(
const
LStrip1
& strip)
const
130
{
131
return
(
sectorID
== strip.
sectorID
&&
boxID
== strip.
boxID
&&
detectorID
== strip.
detectorID
);
132
}
133
inline
bool
operator==
(
const
LStrip1
& rhs)
134
{
135
return
(
sectorID
== rhs.
sectorID
&&
boxID
== rhs.
boxID
&&
detectorID
== rhs.
detectorID
136
&&
stripID
== rhs.
stripID
);
137
}
138
inline
bool
operator!=
(
const
LStrip1
& rhs) {
return
!((*this) == rhs); }
139
140
void
Dump
(
const
char
* comment =
nullptr
, std::ostream& out = std::cout)
const
;
141
Double_t
Distance
(
Side_t
side,
const
LStrip1
& strip);
142
Double_t
Distance701
(
Side_t
side,
const
LStrip1
& strip);
143
144
// ClassDef(LStrip1, 1);
145
};
146
147
class
BmnTof1GeoUtils
:
public
TObject
148
{
149
typedef
std::map<Int_t, LStrip1>
MStripType
;
// pair<detectorUID, Strip parameters>
150
typedef
MStripType::const_iterator
MStripCIT
;
151
typedef
MStripType::iterator
MStripIT
;
152
153
MStripType
mStrips
;
//! indexing strips by detectorUID
154
155
public
:
156
BmnTof1GeoUtils
();
157
158
void
FindNeighborStrips
(
Int_t
verbose = 0);
159
void
FindNeighborStrips701
(
Int_t
verbose = 0);
160
Int_t
ParseTGeoManager
(
bool
useMCinput,
bool
forced =
false
,
Int_t
verbose = 0);
161
Int_t
ParseTGeoManager701
(
bool
useMCinput,
bool
forced =
false
,
Int_t
verbose = 0);
162
const
LStrip1
*
FindStrip
(
Int_t
UID);
163
const
LStrip1
*
FindStrip701
(
Int_t
UID);
164
165
// ClassDef(BmnTof1GeoUtils, 1);
166
};
167
168
#endif
detector
detector
Definition
BmnLambdaEmbeddingQa.h:47
Bool_t
bool Bool_t
Int_t
int Int_t
Double_t
double Double_t
TClonesArray.h
Cross
TGLVector3 Cross(const TGLVector3 &v1, const TGLVector3 &v2)
TH1D.h
TH2D.h
TList.h
TVector3.h
BmnTof1GeoUtils::FindStrip
const LStrip1 * FindStrip(Int_t UID)
Definition
BmnTof1GeoUtils.cxx:322
BmnTof1GeoUtils::FindNeighborStrips701
void FindNeighborStrips701(Int_t verbose=0)
Definition
BmnTof1GeoUtils.cxx:52
BmnTof1GeoUtils::MStripType
std::map< Int_t, LStrip1 > MStripType
Definition
BmnTof1GeoUtils.h:149
BmnTof1GeoUtils::MStripIT
MStripType::iterator MStripIT
Definition
BmnTof1GeoUtils.h:151
BmnTof1GeoUtils::FindStrip701
const LStrip1 * FindStrip701(Int_t UID)
Definition
BmnTof1GeoUtils.cxx:336
BmnTof1GeoUtils::ParseTGeoManager701
Int_t ParseTGeoManager701(bool useMCinput, bool forced=false, Int_t verbose=0)
Definition
BmnTof1GeoUtils.cxx:201
BmnTof1GeoUtils::mStrips
MStripType mStrips
Definition
BmnTof1GeoUtils.h:153
BmnTof1GeoUtils::BmnTof1GeoUtils
BmnTof1GeoUtils()
indexing strips by detectorUID
Definition
BmnTof1GeoUtils.cxx:15
BmnTof1GeoUtils::ParseTGeoManager
Int_t ParseTGeoManager(bool useMCinput, bool forced=false, Int_t verbose=0)
Definition
BmnTof1GeoUtils.cxx:93
BmnTof1GeoUtils::FindNeighborStrips
void FindNeighborStrips(Int_t verbose=0)
Definition
BmnTof1GeoUtils.cxx:17
BmnTof1GeoUtils::MStripCIT
MStripType::const_iterator MStripCIT
Definition
BmnTof1GeoUtils.h:150
LRectangle1::CheckInValid
void CheckInValid()
Definition
BmnTof1GeoUtils.h:88
LRectangle1::GetWidth
Double_t GetWidth() const
Definition
BmnTof1GeoUtils.h:49
LRectangle1::GetInteriorAngle
void GetInteriorAngle(int vertexIndex) const
Definition
BmnTof1GeoUtils.h:50
LRectangle1::MinDistanceToEdge701
Double_t MinDistanceToEdge701(const TVector3 *pos, Side_t &side) const
Definition
BmnTof1GeoUtils.cxx:403
LRectangle1::GetCenter
TVector3 GetCenter() const
Definition
BmnTof1GeoUtils.h:51
LRectangle1::GetLength
Double_t GetLength() const
Definition
BmnTof1GeoUtils.h:48
LRectangle1::InitCenterPerp
void InitCenterPerp()
Definition
BmnTof1GeoUtils.h:70
LRectangle1::DistanceFromPointToLineSegment
Double_t DistanceFromPointToLineSegment(const TVector3 *pos, const TVector3 &P1, const TVector3 &P2) const
Definition
BmnTof1GeoUtils.cxx:369
LRectangle1::Side_t
Side_t
Definition
BmnTof1GeoUtils.h:19
LRectangle1::kLower
@ kLower
Definition
BmnTof1GeoUtils.h:24
LRectangle1::kInvalid
@ kInvalid
Definition
BmnTof1GeoUtils.h:22
LRectangle1::kLeft
@ kLeft
Definition
BmnTof1GeoUtils.h:21
LRectangle1::kRight
@ kRight
Definition
BmnTof1GeoUtils.h:20
LRectangle1::kUpper
@ kUpper
Definition
BmnTof1GeoUtils.h:23
LRectangle1::B
TVector3 B
Definition
BmnTof1GeoUtils.h:35
LRectangle1::A
TVector3 A
Definition
BmnTof1GeoUtils.h:35
LRectangle1::DistanceFromPointToLine
Double_t DistanceFromPointToLine(const TVector3 *pos, const TVector3 &P1, const TVector3 &P2) const
Definition
BmnTof1GeoUtils.cxx:362
LRectangle1::perp
TVector3 perp
Definition
BmnTof1GeoUtils.h:35
LRectangle1::Shift
void Shift(const TVector3 &shift)
Definition
BmnTof1GeoUtils.h:62
LRectangle1::width
Double_t width
Definition
BmnTof1GeoUtils.h:33
LRectangle1::LRectangle1
LRectangle1()
Definition
BmnTof1GeoUtils.h:37
LRectangle1::isInvalid
bool isInvalid() const
Definition
BmnTof1GeoUtils.h:52
LRectangle1::Print
void Print(std::ostream &out, const TVector3 &point, const char *comment=nullptr) const
Definition
BmnTof1GeoUtils.cxx:418
LRectangle1::IsInvalid
bool IsInvalid
Definition
BmnTof1GeoUtils.h:15
LRectangle1::D
TVector3 D
Definition
BmnTof1GeoUtils.h:35
LRectangle1::C
TVector3 C
Definition
BmnTof1GeoUtils.h:35
LRectangle1::CalculateLengthnWidth
void CalculateLengthnWidth()
Definition
BmnTof1GeoUtils.h:76
LRectangle1::volumeUID
Int_t volumeUID
Definition
BmnTof1GeoUtils.h:32
LRectangle1::center
TVector3 center
Definition
BmnTof1GeoUtils.h:35
LRectangle1::MinDistanceToEdge
Double_t MinDistanceToEdge(const TVector3 *pos, Side_t &side) const
Definition
BmnTof1GeoUtils.cxx:388
LRectangle1::length
Double_t length
Definition
BmnTof1GeoUtils.h:33
LStrip1
Definition
BmnTof1GeoUtils.h:109
LStrip1::IsSameDetector
bool IsSameDetector(const LStrip1 &strip) const
Definition
BmnTof1GeoUtils.h:129
LStrip1::SetIsKilled
void SetIsKilled(bool status)
Definition
BmnTof1GeoUtils.h:127
LStrip1::neighboring
Int_t neighboring[2]
Definition
BmnTof1GeoUtils.h:113
LStrip1::SetIDs
void SetIDs(Int_t uid, Int_t sector, Int_t box, Int_t detector, Int_t strip)
Definition
BmnTof1GeoUtils.h:118
LStrip1::operator!=
bool operator!=(const LStrip1 &rhs)
Definition
BmnTof1GeoUtils.h:138
LStrip1::sectorID
Int_t sectorID
Definition
BmnTof1GeoUtils.h:112
LStrip1::stripID
Int_t stripID
Definition
BmnTof1GeoUtils.h:112
LStrip1::boxID
Int_t boxID
Definition
BmnTof1GeoUtils.h:112
LStrip1::GetIsKilled
bool GetIsKilled() const
Definition
BmnTof1GeoUtils.h:128
LStrip1::Distance701
Double_t Distance701(Side_t side, const LStrip1 &strip)
Definition
BmnTof1GeoUtils.cxx:511
LStrip1::LStrip1
LStrip1()
Definition
BmnTof1GeoUtils.cxx:437
LStrip1::isKilled
Bool_t isKilled
Definition
BmnTof1GeoUtils.h:111
LStrip1::detectorID
Int_t detectorID
Definition
BmnTof1GeoUtils.h:112
LStrip1::operator==
bool operator==(const LStrip1 &rhs)
Definition
BmnTof1GeoUtils.h:133
LStrip1::Distance
Double_t Distance(Side_t side, const LStrip1 &strip)
Definition
BmnTof1GeoUtils.cxx:467
TObject::Dump
virtual void Dump() const
TObject::TObject
TObject()
TVector3
TVector3::Dot
Double_t Dot(const TVector3 &) const
TMath::Abs
Double_t Abs(Double_t d)
detectors
tof1
BmnTof1GeoUtils.h
Generated on
for BmnRoot by
1.17.0