src
DetectorDescription
Core
src
DDComparator.cc
Go to the documentation of this file.
1
#include "
DetectorDescription/Core/interface/DDComparator.h
"
2
3
#include <cstddef>
4
#include <memory>
5
6
#include "
DetectorDescription/Core/interface/DDBase.h
"
7
8
// reason for the ctor: reference initialization at construction.
9
// FIXME: DDCompareEqual: use pointers instead of references, initialize to 0 and
10
// FIXME: do the check in operator() instead of in the ctor
11
12
bool
DDCompareEqual::operator()
(
const
DDGeoHistory
&,
const
DDPartSelection
&) {
return
(*
this
)(); }
13
14
bool
DDCompareEqual::operator()
() {
15
// don't compare, if history or partsel is empty! (see ctor)
16
bool
result
(
absResult_
);
17
18
/*
19
sIndex_ = running index in the part-selection-std::vector
20
sMax_ = max. value + 1 of sIndex_
21
hIndex_ = runninig index in the geo-history-std::vector
22
hMax_ = max. value + 1 of hIndex_
23
sLp_ = current LogicalPart (the redir-ptr!) in the part-selection-std::vector
24
hLp_ = current LogicalPart (the redir-ptr!) in the geo-history-std::vector
25
sCopyno_ = current copy-no in the part-selection-std::vector
26
*/
27
//DCOUT('U', "DDCompareEqual: comparing");
28
29
while
(
result
&&
sIndex_
<
sMax_
) {
30
sLp_
=
partsel_
[
sIndex_
].lp_;
31
sCopyno_
=
partsel_
[
sIndex_
].copyno_;
32
ddselection_type
stype =
partsel_
[
sIndex_
].selectionType_;
33
switch
(stype) {
34
case
ddanylogp
:
35
result
=
nextAnylogp
();
36
break
;
37
38
case
ddanyposp
:
39
result
=
nextAnyposp
();
40
break
;
41
42
case
ddchildlogp
:
43
result
=
nextChildlogp
();
44
break
;
45
46
case
ddchildposp
:
47
result
=
nextChildposp
();
48
break
;
49
50
case
ddanychild
:
51
++
sIndex_
;
52
++
hIndex_
;
53
result
=
true
;
54
break
;
55
56
// ddanynode IS NOT SUPPORTED IN PROTOTYPE SW !!!!
57
case
ddanynode
:
58
result
=
false
;
59
break
;
60
61
default
:
62
result
=
false
;
63
//throw DDException("DDCompareEqual: undefined state!");
64
}
65
++
sIndex_
;
66
}
67
return
result
;
68
}
69
70
bool
DDCompareEqual::nextAnylogp
() {
71
size_t
hi
=
hIndex_
;
72
while
(
hi
<
hMax_
) {
73
if
(
sLp_
==
hist_
[
hi
].logicalPart()) {
74
hIndex_
=
hi
+ 1;
75
return
true
;
76
}
77
++
hi
;
78
}
79
hIndex_
=
hi
;
80
return
false
;
81
}
82
83
bool
DDCompareEqual::nextAnyposp
() {
84
bool
result
(
false
);
85
while
(
hIndex_
<
hMax_
) {
86
if
(
sLp_
==
hist_
[
hIndex_
].logicalPart() &&
sCopyno_
==
hist_
[
hIndex_
].copyno()) {
87
result
=
true
;
88
++
hIndex_
;
89
break
;
90
}
91
++
hIndex_
;
92
}
93
return
result
;
94
}
95
96
bool
DDCompareEqual::nextChildlogp
() {
97
bool
result
(
false
);
98
if
(
hIndex_
<
hMax_
) {
99
if
(
sLp_
==
hist_
[
hIndex_
].logicalPart()) {
100
++
hIndex_
;
101
result
=
true
;
102
}
103
}
104
return
result
;
105
}
106
107
bool
DDCompareEqual::nextChildposp
() {
108
bool
result
(
false
);
109
if
(
hIndex_
<
hMax_
) {
110
if
(
sLp_
==
hist_
[
hIndex_
].logicalPart() &&
sCopyno_
==
hist_
[
hIndex_
].copyno()) {
111
++
hIndex_
;
112
result
=
true
;
113
}
114
}
115
return
result
;
116
}
ddanylogp
Definition:
DDPartSelection.h:15
ddchildlogp
Definition:
DDPartSelection.h:17
mps_fire.result
result
Definition:
mps_fire.py:311
DDCompareEqual::absResult_
bool absResult_
Definition:
DDComparator.h:50
DDComparator.h
DDCompareEqual::sCopyno_
int sCopyno_
Definition:
DDComparator.h:49
DDCompareEqual::sIndex_
DDPartSelection::size_type sIndex_
Definition:
DDComparator.h:47
DDCompareEqual::nextChildposp
bool nextChildposp()
Definition:
DDComparator.cc:107
DDCompareEqual::sMax_
DDPartSelection::size_type const sMax_
Definition:
DDComparator.h:46
DDPartSelection
Definition:
DDPartSelection.h:37
ddanynode
Definition:
DDPartSelection.h:13
hi
Definition:
EPCuts.h:4
DDCompareEqual::nextAnyposp
bool nextAnyposp()
Definition:
DDComparator.cc:83
ddselection_type
ddselection_type
Definition:
DDPartSelection.h:11
DDCompareEqual::sLp_
DDLogicalPart sLp_
Definition:
DDComparator.h:48
DDCompareEqual::nextAnylogp
bool nextAnylogp()
Definition:
DDComparator.cc:70
DDGeoHistory
std::vector< DDExpandedNode > DDGeoHistory
Geometrical 'path' of the current node up to the root-node.
Definition:
DDExpandedNode.h:82
DDCompareEqual::operator()
bool operator()()
Definition:
DDComparator.cc:14
ddanychild
Definition:
DDPartSelection.h:14
DDCompareEqual::partsel_
const DDPartSelection & partsel_
Definition:
DDComparator.h:43
DDBase.h
ddanyposp
Definition:
DDPartSelection.h:16
DDCompareEqual::hIndex_
DDGeoHistory::size_type hIndex_
Definition:
DDComparator.h:45
DDCompareEqual::hMax_
DDGeoHistory::size_type const hMax_
Definition:
DDComparator.h:44
DDCompareEqual::nextChildlogp
bool nextChildlogp()
Definition:
DDComparator.cc:96
ddchildposp
Definition:
DDPartSelection.h:18
DDCompareEqual::hist_
const DDGeoHistory & hist_
Definition:
DDComparator.h:42
Generated for CMSSW Reference Manual by
1.8.14