Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
Fireworks
Calo
plugins
FWCaloTowerSliceSelector.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: Calo
4
// Class : FWCaloTowerSliceSelector
5
//
6
// Implementation:
7
// [Notes on implementation]
8
//
9
// Original Author: Alja Mrak-Tadel
10
// Created: Wed Jun 2 17:36:23 CEST 2010
11
//
12
13
// system include files
14
15
// user include files
16
#include "TH2F.h"
17
#include "TMath.h"
18
#include "
Fireworks/Calo/plugins/FWCaloTowerSliceSelector.h
"
19
#include "
Fireworks/Core/interface/FWModelChangeManager.h
"
20
#include "
Fireworks/Core/interface/FWEventItem.h
"
21
#include "
DataFormats/CaloTowers/interface/CaloTower.h
"
22
#include "
DataFormats/CaloTowers/interface/CaloTowerFwd.h
"
23
24
25
FWCaloTowerSliceSelector::FWCaloTowerSliceSelector
(TH2F*
h
,
const
FWEventItem
*
i
):
26
FWFromSliceSelector
(i),
27
m_hist(h)
28
{
29
}
30
31
FWCaloTowerSliceSelector::~FWCaloTowerSliceSelector
()
32
{
33
}
34
35
//
36
// member functions
37
//
38
//
39
40
bool
41
FWCaloTowerSliceSelector::matchCell
(
const
TEveCaloData::CellId_t& iCell,
const
CaloTower
& tower)
const
42
{
43
bool
match
=
false
;
44
int
idx
=
m_hist
->FindBin(tower.
eta
(), tower.
phi
());
45
int
nBinsX =
m_hist
->GetXaxis()->GetNbins() + 2;
46
47
int
etaBin, phiBin,
w
, newPhiBin;
48
m_hist
->GetBinXYZ(idx, etaBin, phiBin, w);
49
50
if
(tower.
ietaAbs
() > 39)
51
{
52
newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
53
if
(newPhiBin <= 0) newPhiBin = 71;
54
55
idx = etaBin + newPhiBin*nBinsX;
56
match |= (idx == iCell.fTower);
57
58
idx += nBinsX;
59
match |= (idx == iCell.fTower);
60
61
idx += nBinsX;
62
if
(newPhiBin == 71)
63
idx = etaBin + 1*nBinsX;
64
match |= (idx == iCell.fTower);
65
66
idx += nBinsX;
67
match |= (idx == iCell.fTower);
68
}
69
else
if
(tower.
ietaAbs
() > 20)
70
{
71
newPhiBin = ((phiBin + 1) / 2) * 2 -1;
72
idx = etaBin + newPhiBin*nBinsX;
73
match = ( idx == iCell.fTower || idx + nBinsX == iCell.fTower);
74
}
75
else
76
{
77
match = ( idx == iCell.fTower);
78
}
79
return
match
;
80
}
81
82
void
83
FWCaloTowerSliceSelector::doSelect
(
const
TEveCaloData::CellId_t& iCell)
84
{
85
if
(!
m_item
)
return
;
86
87
const
CaloTowerCollection
* towers=0;
88
m_item
->
get
(towers);
89
assert(0!=towers);
90
int
index
= 0;
91
92
FWChangeSentry
sentry(*(
m_item
->
changeManager
()));
93
for
(
CaloTowerCollection::const_iterator
tower = towers->
begin
(); tower != towers->
end
(); ++tower,++
index
)
94
{
95
if
(
m_item
->
modelInfo
(index).
m_displayProperties
.
isVisible
() && !
m_item
->
modelInfo
(index).
isSelected
())
96
{
97
if
(
matchCell
(iCell, *tower))
98
{
99
m_item
->
select
(index);
100
break
;
101
}
102
}
103
}
104
}
105
106
void
107
FWCaloTowerSliceSelector::doUnselect
(
const
TEveCaloData::CellId_t& iCell)
108
{
109
if
(!
m_item
)
return
;
110
111
// std::cout <<" doUnselect "<<std::endl;
112
113
const
CaloTowerCollection
* towers=0;
114
m_item
->
get
(towers);
115
assert(0!=towers);
116
int
index
= 0;
117
FWChangeSentry
sentry(*(
m_item
->
changeManager
()));
118
for
(
CaloTowerCollection::const_iterator
tower = towers->
begin
(); tower != towers->
end
(); ++tower,++
index
)
119
{
120
if
(
m_item
->
modelInfo
(index).
m_displayProperties
.
isVisible
() &&
121
m_item
->
modelInfo
(index).
isSelected
()) {
122
if
(
matchCell
(iCell, *tower))
123
{
124
// std::cout <<" doUnselect "<<index<<std::endl;
125
m_item
->
unselect
(index);
126
break
;
127
}
128
}
129
}
130
}
FWCaloTowerSliceSelector::doUnselect
virtual void doUnselect(const TEveCaloData::CellId_t &)
Definition:
FWCaloTowerSliceSelector.cc:107
i
int i
Definition:
DBlmapReader.cc:9
FWEventItem::changeManager
FWModelChangeManager * changeManager() const
Definition:
FWEventItem.h:130
FWDisplayProperties::isVisible
bool isVisible() const
Definition:
FWDisplayProperties.h:59
edm::SortedCollection< CaloTower >
FWEventItem::ModelInfo::isSelected
bool isSelected() const
Definition:
FWEventItem.h:70
CaloTower.h
FWEventItem::get
void get(const T *&oData) const
Definition:
FWEventItem.h:84
edm::SortedCollection< CaloTower >::const_iterator
std::vector< CaloTower >::const_iterator const_iterator
Definition:
SortedCollection.h:82
FWEventItem::unselect
void unselect(int iIndex) const
Definition:
FWEventItem.cc:239
FWFromSliceSelector::m_item
const FWEventItem * m_item
Definition:
FWFromSliceSelector.h:51
cmsHarvester.index
string index
Definition:
cmsHarvester.py:4378
reco::LeafCandidate::phi
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
Definition:
LeafCandidate.h:180
FWCaloTowerSliceSelector.h
FWCaloTowerSliceSelector::~FWCaloTowerSliceSelector
virtual ~FWCaloTowerSliceSelector()
Definition:
FWCaloTowerSliceSelector.cc:31
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition:
Activities.doc:4
CaloTower
Definition:
CaloTower.h:26
FWCaloTowerSliceSelector::matchCell
bool matchCell(const TEveCaloData::CellId_t &iCell, const CaloTower &tower) const
Definition:
FWCaloTowerSliceSelector.cc:41
FWEventItem::ModelInfo::m_displayProperties
FWDisplayProperties m_displayProperties
Definition:
FWEventItem.h:60
reco::LeafCandidate::eta
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
Definition:
LeafCandidate.h:184
edm::SortedCollection::end
const_iterator end() const
Definition:
SortedCollection.h:310
FWEventItem
Definition:
FWEventItem.h:56
FWEventItem.h
FWModelChangeManager.h
FWFromSliceSelector
Definition:
FWFromSliceSelector.h:31
FWCaloTowerSliceSelector::FWCaloTowerSliceSelector
FWCaloTowerSliceSelector(TH2F *h, const FWEventItem *i)
Definition:
FWCaloTowerSliceSelector.cc:25
customizeTrackingMonitorSeedNumber.idx
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
Definition:
customizeTrackingMonitorSeedNumber.py:15
FWCaloTowerSliceSelector::m_hist
TH2F * m_hist
Definition:
FWCaloTowerSliceSelector.h:40
FWCaloTowerSliceSelector::doSelect
virtual void doSelect(const TEveCaloData::CellId_t &)
Definition:
FWCaloTowerSliceSelector.cc:83
CaloTower::ietaAbs
int ietaAbs() const
Definition:
CaloTower.h:170
FWEventItem::select
void select(int iIndex) const
Definition:
FWEventItem.cc:250
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:6
w
T w() const
Definition:
extBasic3DVector.h:245
FWEventItem::modelInfo
ModelInfo modelInfo(int iIndex) const
Definition:
FWEventItem.cc:535
FWChangeSentry
Definition:
FWModelChangeManager.h:70
edm::SortedCollection::begin
const_iterator begin() const
Definition:
SortedCollection.h:303
CaloTowerFwd.h
Generated for CMSSW Reference Manual by
1.8.5