Fireworks
ParticleFlow
plugins
FWPFEcalRecHitRPProxyBuilder.cc
Go to the documentation of this file.
1
#include "
FWPFEcalRecHitRPProxyBuilder.h
"
2
3
//______________________________________________________________________________
4
void
FWPFEcalRecHitRPProxyBuilder::scaleProduct
(TEveElementList *
parent
,
5
FWViewType::EType
type
,
6
const
FWViewContext
*vc) {
7
typedef
std::vector<FWPFRhoPhiRecHit *> rpRecHits;
8
unsigned
int
index
= 0;
9
10
for
(rpRecHits::iterator
i
=
m_towers
.begin();
i
!=
m_towers
.end(); ++
i
) {
11
m_towers
[
index
]->updateScale(vc);
12
index
++;
13
}
14
}
15
16
//______________________________________________________________________________
17
void
FWPFEcalRecHitRPProxyBuilder::cleanLocal
() {
18
typedef
std::vector<FWPFRhoPhiRecHit *> rpRecHits;
19
for
(rpRecHits::iterator
i
=
m_towers
.begin();
i
!=
m_towers
.end(); ++
i
)
20
(*i)->clean();
21
22
m_towers
.clear();
23
}
24
25
//______________________________________________________________________________
26
TEveVector
FWPFEcalRecHitRPProxyBuilder::calculateCentre
(
const
float
*
vertices
) {
27
TEveVector centre;
28
29
for
(
unsigned
int
i
= 0;
i
< 8;
i
++) {
30
int
j
=
i
* 3;
31
centre.fX +=
vertices
[
j
];
32
centre.fY +=
vertices
[
j
+ 1];
// Total x,y,z values
33
centre.fZ +=
vertices
[
j
+ 2];
34
}
35
36
centre *= 1.0f / 8.0f;
// Actually calculate the centre point
37
38
return
centre;
39
}
40
41
//______________________________________________________________________________
42
void
FWPFEcalRecHitRPProxyBuilder::build
(
const
FWEventItem
*iItem, TEveElementList *product,
const
FWViewContext
*vc) {
43
m_towers
.clear();
// Bug fix required for when multiple RhoPhiPF views are active
44
for
(
unsigned
int
index
= 0; index < static_cast<unsigned int>(iItem->
size
()); ++
index
) {
45
TEveCompound *itemHolder =
createCompound
();
46
product->AddElement(itemHolder);
47
const
FWEventItem::ModelInfo
&
info
=
item
()->
modelInfo
(
index
);
48
49
if
(
info
.displayProperties().isVisible()) {
50
bool
added =
false
;
51
float
E,
et
;
52
float
ecalR =
FWPFGeom::caloR1
();
53
Double_t lPhi, rPhi;
54
const
EcalRecHit
&iData =
modelData
(
index
);
55
const
float
*
vertices
=
item
()->
getGeom
()->
getCorners
(iData.
detid
());
56
57
TEveVector centre =
calculateCentre
(
vertices
);
58
TEveVector lVec = TEveVector(
vertices
[0],
vertices
[1], 0);
// Bottom left corner of tower
59
TEveVector rVec = TEveVector(
vertices
[9],
vertices
[10], 0);
// Bottom right corner of tower
60
61
lPhi = lVec.Phi();
62
rPhi = rVec.Phi();
63
E = iData.
energy
();
64
et
=
FWPFMaths::calculateEt
(centre, E);
65
66
for
(
unsigned
int
i
= 0;
i
<
m_towers
.size();
i
++) {
// Small range to catch rounding inaccuracies etc.
67
Double_t
phi
=
m_towers
[
i
]->getlPhi();
68
if
((lPhi ==
phi
) || ((lPhi <
phi
+ 0.0005) && (lPhi >
phi
- 0.0005))) {
69
m_towers
[
i
]->addChild(
this
, itemHolder, vc, E,
et
);
70
context
().
voteMaxEtAndEnergy
(
et
, E);
71
added =
true
;
72
break
;
73
}
74
}
75
76
if
(!added) {
77
rVec.fX = ecalR *
cos
(rPhi);
78
rVec.fY = ecalR *
sin
(rPhi);
79
lVec.fX = ecalR *
cos
(lPhi);
80
lVec.fY = ecalR *
sin
(lPhi);
81
std::vector<TEveVector> bCorners(2);
82
bCorners[0] = lVec;
83
bCorners[1] = rVec;
84
85
FWPFRhoPhiRecHit
*rh =
new
FWPFRhoPhiRecHit
(
this
, itemHolder, vc, E,
et
, lPhi, rPhi, bCorners);
86
context
().
voteMaxEtAndEnergy
(
et
, E);
87
m_towers
.push_back(rh);
88
}
89
}
90
}
91
}
92
93
//______________________________________________________________________________
94
REGISTER_FWPROXYBUILDER
(
FWPFEcalRecHitRPProxyBuilder
,
EcalRecHit
,
"PF Ecal RecHit"
,
FWViewType::kRhoPhiPFBit
);
FWViewType::kRhoPhiPFBit
Definition:
FWViewType.h:53
EcalRecHit
Definition:
EcalRecHit.h:15
FWEventItem::modelInfo
ModelInfo modelInfo(int iIndex) const
Definition:
FWEventItem.cc:446
mps_fire.i
i
Definition:
mps_fire.py:428
EcalRecHit::detid
const DetId & detid() const
Definition:
EcalRecHit.h:72
FWGeometry::getCorners
const float * getCorners(unsigned int id) const
Definition:
FWGeometry.cc:467
FWViewType::EType
EType
Definition:
FWViewType.h:31
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition:
FWProxyBuilderFactory.h:33
FWPFEcalRecHitRPProxyBuilder
Definition:
FWPFEcalRecHitRPProxyBuilder.h:35
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition:
FWCollectionSummaryWidget.cc:153
FWPFEcalRecHitRPProxyBuilder::m_towers
std::vector< FWPFRhoPhiRecHit * > m_towers
Definition:
FWPFEcalRecHitRPProxyBuilder.h:60
EcalRecHit::energy
float energy() const
Definition:
EcalRecHit.h:68
FWProxyBuilderBase::createCompound
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
Definition:
FWProxyBuilderBase.cc:374
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
FWEventItem::ModelInfo
Definition:
FWEventItem.h:58
FWPFMaths::calculateEt
float calculateEt(const TEveVector ¢re, float e)
Definition:
FWPFMaths.cc:115
funct::cos
Cos< T >::type cos(const T &t)
Definition:
Cos.h:22
fireworks::Context::voteMaxEtAndEnergy
void voteMaxEtAndEnergy(float Et, float energy) const
Definition:
Context.cc:162
FWPFGeom::caloR1
float caloR1()
Definition:
FWPFGeom.h:20
type
type
Definition:
SiPixelVCal_PayloadInspector.cc:37
EgHLTOffHistBins_cfi.et
et
Definition:
EgHLTOffHistBins_cfi.py:8
FWProxyBuilderBase::build
void build()
Definition:
FWProxyBuilderBase.cc:110
FWViewContext
Definition:
FWViewContext.h:32
FWPFEcalRecHitRPProxyBuilder::scaleProduct
void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
Definition:
FWPFEcalRecHitRPProxyBuilder.cc:4
FWPFEcalRecHitRPProxyBuilder.h
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition:
FWEventItem.cc:548
DDAxes::phi
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition:
FWProxyBuilderBase.h:64
FWEventItem
Definition:
FWEventItem.h:56
FWProxyBuilderTemplate< EcalRecHit >::modelData
const EcalRecHit & modelData(int index)
Definition:
FWProxyBuilderTemplate.h:42
FWPFEcalRecHitRPProxyBuilder::cleanLocal
void cleanLocal() override
Definition:
FWPFEcalRecHitRPProxyBuilder.cc:17
FWPFRhoPhiRecHit
Definition:
FWPFRhoPhiRecHit.h:28
FWPFEcalRecHitRPProxyBuilder::calculateCentre
TEveVector calculateCentre(const float *corners)
Definition:
FWPFEcalRecHitRPProxyBuilder.cc:26
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition:
FWProxyBuilderBase.cc:412
AlignmentPI::index
index
Definition:
AlignmentPayloadInspectorHelper.h:46
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
class-composition.parent
parent
Definition:
class-composition.py:88
FWEventItem::size
size_t size() const
Definition:
FWEventItem.cc:457
pwdgSkimBPark_cfi.vertices
vertices
Definition:
pwdgSkimBPark_cfi.py:7
Generated for CMSSW Reference Manual by
1.8.16