src
Fireworks
Calo
src
FWHistSliceSelector.cc
Go to the documentation of this file.
1
#include "
Fireworks/Calo/interface/FWHistSliceSelector.h
"
2
3
#include "
Fireworks/Core/interface/FWModelChangeManager.h
"
4
#include "
Fireworks/Core/interface/FWEventItem.h
"
5
6
#include "TEveCaloData.h"
7
#include "TH2F.h"
8
#include "Rtypes.h"
9
10
FWHistSliceSelector::FWHistSliceSelector
(TH2F*
h
,
const
FWEventItem
*
item
) :
FWFromSliceSelector
(
item
) {
m_hist
=
h
; }
11
12
FWHistSliceSelector::~FWHistSliceSelector
() {}
13
14
bool
FWHistSliceSelector::matchCell
(
const
TEveCaloData::CellId_t& iCell,
int
itemIdx)
const
{
15
float
eta
,
phi
;
16
getItemEntryEtaPhi
(itemIdx,
eta
,
phi
);
17
18
int
idx
=
m_hist
->FindBin(
eta
,
phi
);
19
int
nBinsX =
m_hist
->GetXaxis()->GetNbins() + 2;
20
21
int
etaBin
,
phiBin
,
w
, newPhiBin;
22
m_hist
->GetBinXYZ(
idx
,
etaBin
,
phiBin
,
w
);
23
24
if
(
aggregatePhiCells
()) {
25
bool
match
=
false
;
26
if
(TMath::Abs(
eta
) > 4.716) {
27
newPhiBin = ((
phiBin
+ 1) / 4) * 4 - 1;
28
if
(newPhiBin <= 0)
29
newPhiBin = 71;
30
31
idx
=
etaBin
+ newPhiBin * nBinsX;
32
match
|= (
idx
== iCell.fTower);
33
34
idx
+= nBinsX;
35
match
|= (
idx
== iCell.fTower);
36
37
idx
+= nBinsX;
38
if
(newPhiBin == 71)
39
idx
=
etaBin
+ 1 * nBinsX;
40
match
|= (
idx
== iCell.fTower);
41
42
idx
+= nBinsX;
43
match
|= (
idx
== iCell.fTower);
44
}
else
if
(TMath::Abs(
eta
) > 1.873) {
45
newPhiBin = ((
phiBin
+ 1) / 2) * 2 - 1;
46
idx
=
etaBin
+ newPhiBin * nBinsX;
47
match
= (
idx
== iCell.fTower ||
idx
+ nBinsX == iCell.fTower);
48
}
else
{
49
match
= (
idx
== iCell.fTower);
50
}
51
52
return
match
;
53
}
else
{
54
return
idx
== iCell.fTower;
55
}
56
}
57
58
void
FWHistSliceSelector::doSelect
(
const
TEveCaloData::CellId_t& iCell) {
59
if
(!
m_item
)
60
return
;
61
62
FWChangeSentry
sentry(*(
m_item
->
changeManager
()));
63
size_t
size
=
m_item
->
size
();
64
for
(
size_t
index
= 0;
index
<
size
; ++
index
) {
65
if
(
m_item
->
modelInfo
(
index
).
m_displayProperties
.
isVisible
() && !
m_item
->
modelInfo
(
index
).
isSelected
()) {
66
if
(
matchCell
(iCell,
index
)) {
67
m_item
->
select
(
index
);
68
break
;
69
}
70
}
71
}
72
}
73
74
void
FWHistSliceSelector::doUnselect
(
const
TEveCaloData::CellId_t& iCell) {
75
if
(!
m_item
)
76
return
;
77
78
// std::cout <<" doUnselect "<<std::endl;
79
80
FWChangeSentry
sentry(*(
m_item
->
changeManager
()));
81
82
size_t
size
=
m_item
->
size
();
83
for
(
size_t
index
= 0;
index
<
size
; ++
index
) {
84
if
(
m_item
->
modelInfo
(
index
).
m_displayProperties
.
isVisible
() &&
m_item
->
modelInfo
(
index
).
isSelected
()) {
85
if
(
matchCell
(iCell,
index
)) {
86
// std::cout <<" doUnselect "<<index<<std::endl;
87
m_item
->
unselect
(
index
);
88
break
;
89
}
90
}
91
}
92
}
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
FWEventItem::size
size_t size() const
Definition:
FWEventItem.cc:457
heavyIonCSV_trainingSettings.idx
idx
Definition:
heavyIonCSV_trainingSettings.py:5
w
T w() const
Definition:
extBasic3DVector.h:225
FWDisplayProperties::isVisible
bool isVisible() const
Definition:
FWDisplayProperties.h:51
FWEventItem::changeManager
FWModelChangeManager * changeManager() const
Definition:
FWEventItem.h:123
FWHistSliceSelector::matchCell
bool matchCell(const TEveCaloData::CellId_t &iCell, int idx) const
Definition:
FWHistSliceSelector.cc:14
PVValHelper::eta
Definition:
PVValidationHelpers.h:70
FWFromSliceSelector::m_item
const FWEventItem * m_item
Definition:
FWFromSliceSelector.h:49
B2GTnPMonitor_cfi.item
item
Definition:
B2GTnPMonitor_cfi.py:148
FWHistSliceSelector::aggregatePhiCells
virtual bool aggregatePhiCells() const
Definition:
FWHistSliceSelector.h:15
DDAxes::phi
FWEventItem::select
void select(int iIndex) const
Definition:
FWEventItem.cc:224
FWHistSliceSelector::doUnselect
void doUnselect(const TEveCaloData::CellId_t &) override
Definition:
FWHistSliceSelector.cc:74
FWHistSliceSelector::m_hist
TH2F * m_hist
Definition:
FWHistSliceSelector.h:21
FWEventItem::ModelInfo::isSelected
bool isSelected() const
Definition:
FWEventItem.h:65
FWHistSliceSelector::getItemEntryEtaPhi
virtual void getItemEntryEtaPhi(int itemIdx, float &eta, float &phi) const =0
FWEventItem::unselect
void unselect(int iIndex) const
Definition:
FWEventItem.cc:215
AlignmentPI::index
index
Definition:
AlignmentPayloadInspectorHelper.h:93
BeamMonitor_cff.phiBin
phiBin
Definition:
BeamMonitor_cff.py:79
FWEventItem::ModelInfo::m_displayProperties
FWDisplayProperties m_displayProperties
Definition:
FWEventItem.h:59
FWEventItem
Definition:
FWEventItem.h:56
FWEventItem.h
FWModelChangeManager.h
FWHistSliceSelector.h
FWFromSliceSelector
Definition:
FWFromSliceSelector.h:30
FWHistSliceSelector::FWHistSliceSelector
FWHistSliceSelector(TH2F *h, const FWEventItem *item)
Definition:
FWHistSliceSelector.cc:10
FWHistSliceSelector::doSelect
void doSelect(const TEveCaloData::CellId_t &) override
Definition:
FWHistSliceSelector.cc:58
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
FWEventItem::modelInfo
ModelInfo modelInfo(int iIndex) const
Definition:
FWEventItem.cc:446
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition:
Activities.doc:4
FWHistSliceSelector::~FWHistSliceSelector
~FWHistSliceSelector() override
Definition:
FWHistSliceSelector.cc:12
FWChangeSentry
Definition:
FWModelChangeManager.h:68
muonRecoAnalyzer_cfi.etaBin
etaBin
Definition:
muonRecoAnalyzer_cfi.py:29
Generated for CMSSW Reference Manual by
1.8.14