Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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):
11
FWFromSliceSelector
(item)
12
{
13
m_hist
=
h
;
14
}
15
16
17
FWHistSliceSelector::~FWHistSliceSelector
()
18
{}
19
20
bool
21
FWHistSliceSelector::matchCell
(
const
TEveCaloData::CellId_t& iCell,
int
itemIdx)
const
22
{
23
float
eta
,
phi
;
24
getItemEntryEtaPhi
(itemIdx, eta, phi);
25
26
int
idx
=
m_hist
->FindBin(eta, phi);
27
int
nBinsX =
m_hist
->GetXaxis()->GetNbins() + 2;
28
29
int
etaBin, phiBin,
w
, newPhiBin;
30
m_hist
->GetBinXYZ(idx, etaBin, phiBin, w);
31
32
if
(
aggregatePhiCells
()) {
33
bool
match
=
false
;
34
if
(
TMath::Abs
(eta) > 4.716)
35
{
36
newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
37
if
(newPhiBin <= 0) newPhiBin = 71;
38
39
idx = etaBin + newPhiBin*nBinsX;
40
match |= (idx == iCell.fTower);
41
42
idx += nBinsX;
43
match |= (idx == iCell.fTower);
44
45
idx += nBinsX;
46
if
(newPhiBin == 71)
47
idx = etaBin + 1*nBinsX;
48
match |= (idx == iCell.fTower);
49
50
idx += nBinsX;
51
match |= (idx == iCell.fTower);
52
}
53
else
if
(
TMath::Abs
(eta) > 1.873)
54
{
55
newPhiBin = ((phiBin + 1) / 2) * 2 -1;
56
idx = etaBin + newPhiBin*nBinsX;
57
match = ( idx == iCell.fTower || idx + nBinsX == iCell.fTower);
58
}
59
else
60
{
61
match = ( idx == iCell.fTower);
62
}
63
64
return
match
;
65
}
66
else
67
{
68
return
idx == iCell.fTower;
69
}
70
}
71
72
void
73
FWHistSliceSelector::doSelect
(
const
TEveCaloData::CellId_t& iCell)
74
{
75
if
(!
m_item
)
return
;
76
77
FWChangeSentry
sentry(*(
m_item
->
changeManager
()));
78
size_t
size
=
m_item
->
size
();
79
for
(
size_t
index
=0;
index
<
size
; ++
index
)
80
{
81
if
(
m_item
->
modelInfo
(
index
).
m_displayProperties
.
isVisible
() && !
m_item
->
modelInfo
(
index
).
isSelected
())
82
{
83
if
(
matchCell
(iCell,
index
))
84
{
85
m_item
->
select
(
index
);
86
break
;
87
}
88
}
89
}
90
}
91
92
void
93
FWHistSliceSelector::doUnselect
(
const
TEveCaloData::CellId_t& iCell)
94
{
95
if
(!
m_item
)
return
;
96
97
// std::cout <<" doUnselect "<<std::endl;
98
99
FWChangeSentry
sentry(*(
m_item
->
changeManager
()));
100
101
size_t
size
=
m_item
->
size
();
102
for
(
size_t
index
=0;
index
<
size
; ++
index
)
103
{
104
if
(
m_item
->
modelInfo
(
index
).
m_displayProperties
.
isVisible
() &&
105
m_item
->
modelInfo
(
index
).
isSelected
()) {
106
if
(
matchCell
(iCell,
index
))
107
{
108
// std::cout <<" doUnselect "<<index<<std::endl;
109
m_item
->
unselect
(
index
);
110
break
;
111
}
112
}
113
}
114
}
FWHistSliceSelector::matchCell
bool matchCell(const TEveCaloData::CellId_t &iCell, int idx) const
Definition:
FWHistSliceSelector.cc:21
FWEventItem::changeManager
FWModelChangeManager * changeManager() const
Definition:
FWEventItem.h:132
FWDisplayProperties::isVisible
bool isVisible() const
Definition:
FWDisplayProperties.h:59
w
const double w
Definition:
UKUtility.cc:23
h
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
Definition:
L1TUtmAlgorithmRcd.h:4
FWEventItem::ModelInfo::isSelected
bool isSelected() const
Definition:
FWEventItem.h:71
FWEventItem::unselect
void unselect(int iIndex) const
Definition:
FWEventItem.cc:241
FWFromSliceSelector::m_item
const FWEventItem * m_item
Definition:
FWFromSliceSelector.h:51
DDAxes::phi
cmsHarvester.index
string index
Definition:
cmsHarvester.py:4379
FWHistSliceSelector::doSelect
virtual void doSelect(const TEveCaloData::CellId_t &)
Definition:
FWHistSliceSelector.cc:73
FWHistSliceSelector::m_hist
TH2F * m_hist
Definition:
FWHistSliceSelector.h:22
FWHistSliceSelector::getItemEntryEtaPhi
virtual void getItemEntryEtaPhi(int itemIdx, float &eta, float &phi) const =0
Abs
T Abs(T a)
Definition:
MathUtil.h:49
eta
Definition:
HIMultiTrackSelector.h:42
FWEventItem::ModelInfo::m_displayProperties
FWDisplayProperties m_displayProperties
Definition:
FWEventItem.h:61
FWHistSliceSelector::~FWHistSliceSelector
virtual ~FWHistSliceSelector()
Definition:
FWHistSliceSelector.cc:17
FWEventItem
Definition:
FWEventItem.h:56
FWEventItem.h
FWModelChangeManager.h
FWHistSliceSelector.h
FWEventItem::size
size_t size() const
Definition:
FWEventItem.cc:550
FWFromSliceSelector
Definition:
FWFromSliceSelector.h:31
customizeTrackingMonitorSeedNumber.idx
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
Definition:
customizeTrackingMonitorSeedNumber.py:15
FWHistSliceSelector::FWHistSliceSelector
FWHistSliceSelector(TH2F *h, const FWEventItem *item)
Definition:
FWHistSliceSelector.cc:10
FWHistSliceSelector::aggregatePhiCells
virtual bool aggregatePhiCells() const
Definition:
FWHistSliceSelector.h:16
FWHistSliceSelector::doUnselect
virtual void doUnselect(const TEveCaloData::CellId_t &)
Definition:
FWHistSliceSelector.cc:93
FWEventItem::select
void select(int iIndex) const
Definition:
FWEventItem.cc:252
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:537
findQualityFiles.size
tuple size
Write out results.
Definition:
findQualityFiles.py:442
FWChangeSentry
Definition:
FWModelChangeManager.h:70
Generated for CMSSW Reference Manual by
1.8.5