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
// $Id: FWCaloTowerSliceSelector.cc,v 1.3 2010/12/01 21:40:31 amraktad Exp $
12
//
13
14
// system include files
15
16
// user include files
17
#include "TH2F.h"
18
#include "TMath.h"
19
#include "
Fireworks/Calo/plugins/FWCaloTowerSliceSelector.h
"
20
#include "
Fireworks/Core/interface/FWModelChangeManager.h
"
21
#include "
Fireworks/Core/interface/FWEventItem.h
"
22
#include "
DataFormats/CaloTowers/interface/CaloTower.h
"
23
#include "
DataFormats/CaloTowers/interface/CaloTowerFwd.h
"
24
25
26
FWCaloTowerSliceSelector::FWCaloTowerSliceSelector
(TH2F*
h
,
const
FWEventItem
*
i
):
27
FWFromSliceSelector
(i),
28
m_hist(h)
29
{
30
}
31
32
FWCaloTowerSliceSelector::~FWCaloTowerSliceSelector
()
33
{
34
}
35
36
//
37
// member functions
38
//
39
//
40
41
bool
42
FWCaloTowerSliceSelector::matchCell
(
const
TEveCaloData::CellId_t& iCell,
const
CaloTower
& tower)
const
43
{
44
bool
match
=
false
;
45
int
idx
=
m_hist
->FindBin(tower.
eta
(), tower.
phi
());
46
int
nBinsX =
m_hist
->GetXaxis()->GetNbins() + 2;
47
48
int
etaBin, phiBin,
w
, newPhiBin;
49
m_hist
->GetBinXYZ(idx, etaBin, phiBin, w);
50
51
if
(tower.
ietaAbs
() > 39)
52
{
53
newPhiBin = ((phiBin + 1) / 4) * 4 - 1;
54
if
(newPhiBin <= 0) newPhiBin = 71;
55
56
idx = etaBin + newPhiBin*nBinsX;
57
match |= (idx == iCell.fTower);
58
59
idx += nBinsX;
60
match |= (idx == iCell.fTower);
61
62
idx += nBinsX;
63
if
(newPhiBin == 71)
64
idx = etaBin + 1*nBinsX;
65
match |= (idx == iCell.fTower);
66
67
idx += nBinsX;
68
match |= (idx == iCell.fTower);
69
}
70
else
if
(tower.
ietaAbs
() > 20)
71
{
72
newPhiBin = ((phiBin + 1) / 2) * 2 -1;
73
idx = etaBin + newPhiBin*nBinsX;
74
match = ( idx == iCell.fTower || idx + nBinsX == iCell.fTower);
75
}
76
else
77
{
78
match = ( idx == iCell.fTower);
79
}
80
return
match
;
81
}
82
83
void
84
FWCaloTowerSliceSelector::doSelect
(
const
TEveCaloData::CellId_t& iCell)
85
{
86
if
(!
m_item
)
return
;
87
88
const
CaloTowerCollection
* towers=0;
89
m_item
->
get
(towers);
90
assert(0!=towers);
91
int
index
= 0;
92
93
FWChangeSentry
sentry(*(
m_item
->
changeManager
()));
94
for
(
CaloTowerCollection::const_iterator
tower = towers->
begin
(); tower != towers->
end
(); ++tower,++
index
)
95
{
96
if
(
m_item
->
modelInfo
(index).
m_displayProperties
.
isVisible
() && !
m_item
->
modelInfo
(index).
isSelected
())
97
{
98
if
(
matchCell
(iCell, *tower))
99
{
100
m_item
->
select
(index);
101
break
;
102
}
103
}
104
}
105
}
106
107
void
108
FWCaloTowerSliceSelector::doUnselect
(
const
TEveCaloData::CellId_t& iCell)
109
{
110
if
(!
m_item
)
return
;
111
112
// std::cout <<" doUnselect "<<std::endl;
113
114
const
CaloTowerCollection
* towers=0;
115
m_item
->
get
(towers);
116
assert(0!=towers);
117
int
index
= 0;
118
FWChangeSentry
sentry(*(
m_item
->
changeManager
()));
119
for
(
CaloTowerCollection::const_iterator
tower = towers->
begin
(); tower != towers->
end
(); ++tower,++
index
)
120
{
121
if
(
m_item
->
modelInfo
(index).
m_displayProperties
.
isVisible
() &&
122
m_item
->
modelInfo
(index).
isSelected
()) {
123
if
(
matchCell
(iCell, *tower))
124
{
125
// std::cout <<" doUnselect "<<index<<std::endl;
126
m_item
->
unselect
(index);
127
break
;
128
}
129
}
130
}
131
}
FWCaloTowerSliceSelector::doUnselect
virtual void doUnselect(const TEveCaloData::CellId_t &)
Definition:
FWCaloTowerSliceSelector.cc:108
i
int i
Definition:
DBlmapReader.cc:9
FWEventItem::changeManager
FWModelChangeManager * changeManager() const
Definition:
FWEventItem.h:131
FWDisplayProperties::isVisible
bool isVisible() const
Definition:
FWDisplayProperties.h:60
edm::SortedCollection< CaloTower >
FWEventItem::ModelInfo::isSelected
bool isSelected() const
Definition:
FWEventItem.h:71
getHLTprescales.index
tuple index
Definition:
getHLTprescales.py:79
FWEventItem::get
void get(const T *&oData) const
Definition:
FWEventItem.h:85
edm::SortedCollection< CaloTower >::const_iterator
std::vector< CaloTower >::const_iterator const_iterator
Definition:
SortedCollection.h:80
FWEventItem::unselect
void unselect(int iIndex) const
Definition:
FWEventItem.cc:240
FWFromSliceSelector::m_item
const FWEventItem * m_item
Definition:
FWFromSliceSelector.h:52
reco::LeafCandidate::phi
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
Definition:
LeafCandidate.h:155
FWCaloTowerSliceSelector.h
FWCaloTowerSliceSelector::~FWCaloTowerSliceSelector
virtual ~FWCaloTowerSliceSelector()
Definition:
FWCaloTowerSliceSelector.cc:32
CaloTower
Definition:
CaloTower.h:28
FWCaloTowerSliceSelector::matchCell
bool matchCell(const TEveCaloData::CellId_t &iCell, const CaloTower &tower) const
Definition:
FWCaloTowerSliceSelector.cc:42
FWEventItem::ModelInfo::m_displayProperties
FWDisplayProperties m_displayProperties
Definition:
FWEventItem.h:61
reco::LeafCandidate::eta
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
Definition:
LeafCandidate.h:159
edm::SortedCollection::end
const_iterator end() const
Definition:
SortedCollection.h:301
FWEventItem
Definition:
FWEventItem.h:57
FWEventItem.h
FWModelChangeManager.h
FWFromSliceSelector
Definition:
FWFromSliceSelector.h:32
h
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition:
Activities.doc:4
FWCaloTowerSliceSelector::FWCaloTowerSliceSelector
FWCaloTowerSliceSelector(TH2F *h, const FWEventItem *i)
Definition:
FWCaloTowerSliceSelector.cc:26
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:41
CaloTower.h
FWCaloTowerSliceSelector::doSelect
virtual void doSelect(const TEveCaloData::CellId_t &)
Definition:
FWCaloTowerSliceSelector.cc:84
CaloTower::ietaAbs
int ietaAbs() const
Definition:
CaloTower.h:155
FWEventItem::select
void select(int iIndex) const
Definition:
FWEventItem.cc:251
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:536
FWChangeSentry
Definition:
FWModelChangeManager.h:71
edm::SortedCollection::begin
const_iterator begin() const
Definition:
SortedCollection.h:294
CaloTowerFwd.h
Generated for CMSSW Reference Manual by
1.8.5