Fireworks
Electrons
plugins
FWConversionProxyBuilder.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: Conversions
4
// Class : FWConversionProxyBuilder
5
//
6
// Implementation:
7
// <Notes on implementation>
8
//
9
// Original Author: Chris Jones
10
// Created: Tue Dec 2 14:17:03 EST 2008
11
//
12
#include "TEveCompound.h"
13
#include "TEveLine.h"
14
#include "TEveScalableStraightLineSet.h"
15
16
#include "
Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h
"
17
#include "
Fireworks/Core/interface/FWEventItem.h
"
18
#include "
Fireworks/Core/interface/FWViewType.h
"
19
#include "
Fireworks/Core/interface/Context.h
"
20
21
#include "
Fireworks/Candidates/interface/CandidateUtils.h
"
22
#include "
Fireworks/Tracks/interface/TrackUtils.h
"
23
#include "
Fireworks/Electrons/interface/makeSuperCluster.h
"
24
25
#include "
DataFormats/EgammaCandidates/interface/Conversion.h
"
26
#include "
DataFormats/GsfTrackReco/interface/GsfTrack.h
"
27
29
//
30
// 3D and RPZ proxy builder with shared track list
31
//
33
34
class
FWConversionProxyBuilder
:
public
FWSimpleProxyBuilderTemplate
<reco::Conversion> {
35
public
:
36
FWConversionProxyBuilder
();
37
~FWConversionProxyBuilder
()
override
;
38
39
bool
haveSingleProduct
()
const override
{
return
false
; }
40
void
cleanLocal
()
override
;
41
42
REGISTER_PROXYBUILDER_METHODS
();
43
44
private
:
45
FWConversionProxyBuilder
(
const
FWConversionProxyBuilder
&) =
delete
;
// stop default
46
const
FWConversionProxyBuilder
&
operator=
(
const
FWConversionProxyBuilder
&) =
delete
;
// stop default
47
48
using
FWSimpleProxyBuilderTemplate<reco::Conversion>::buildViewType
;
49
void
buildViewType
(
const
reco::Conversion
& iData,
50
unsigned
int
iIndex,
51
TEveElement& oItemHolder,
52
FWViewType::EType
type
,
53
const
FWViewContext
*)
override
;
54
55
TEveElementList*
requestCommon
();
56
57
TEveElementList*
m_common
;
58
};
59
60
FWConversionProxyBuilder::FWConversionProxyBuilder
() : m_common(nullptr) {
61
m_common
=
new
TEveElementList(
"common conversion scene"
);
62
m_common
->IncDenyDestroy();
63
}
64
65
FWConversionProxyBuilder::~FWConversionProxyBuilder
() {
m_common
->DecDenyDestroy(); }
66
67
TEveElementList*
FWConversionProxyBuilder::requestCommon
() {
68
if
(
m_common
->HasChildren() ==
false
) {
69
for
(
int
i
= 0; i < static_cast<int>(
item
()->
size
()); ++
i
) {
70
const
reco::Conversion
&
conversion
=
modelData
(
i
);
71
TEveLine*
line
=
new
TEveLine(0);
72
if
(
conversion
.nTracks() == 2) {
73
if
(fabs(
conversion
.zOfPrimaryVertexFromTracks()) <
fireworks::Context::caloZ1
())
74
line
->SetNextPoint(0., 0.,
conversion
.zOfPrimaryVertexFromTracks());
75
else
76
line
->SetNextPoint(0., 0., 0.);
77
78
float
phi
=
conversion
.pairMomentum().phi();
79
if
(fabs(
conversion
.pairMomentum().eta()) <
fireworks::Context::caloTransEta
()) {
80
float
radius
=
fireworks::Context::caloR1
();
81
float
z
=
radius
/
tan
(
conversion
.pairMomentum().theta());
82
line
->SetNextPoint(
radius
*
cos
(
phi
),
radius
*
sin
(
phi
),
z
);
83
}
else
{
84
float
z
=
fireworks::Context::caloZ1
();
85
float
radius
=
z
*
tan
(
conversion
.pairMomentum().theta());
86
z
*= (
conversion
.pairMomentum().eta() / fabs(
conversion
.pairMomentum().eta()));
87
line
->SetNextPoint(
radius
*
cos
(
phi
),
radius
*
sin
(
phi
),
z
);
88
}
89
}
else
{
90
line
->SetNextPoint(0., 0., 0.);
91
line
->SetNextPoint(0., 0., 0.);
92
}
93
94
setupElement
(
line
);
95
m_common
->AddElement(
line
);
96
}
97
}
98
99
return
m_common
;
100
}
101
102
void
FWConversionProxyBuilder::cleanLocal
() {
m_common
->DestroyElements(); }
103
104
void
FWConversionProxyBuilder::buildViewType
(
const
reco::Conversion
&
conversion
,
105
unsigned
int
iIndex,
106
TEveElement& oItemHolder,
107
FWViewType::EType
type
,
108
const
FWViewContext
*) {
109
TEveElementList*
lines
=
requestCommon
();
110
TEveElement::List_i linIt =
lines
->BeginChildren();
111
std::advance(linIt, iIndex);
112
TEveLine*
line
= (TEveLine*)((*linIt)->CloneElement());
113
TEveVector bvec =
line
->GetLineStart();
114
TEveVector evec =
line
->GetLineEnd();
115
if
(bvec.Mag() != evec.Mag())
116
setupAddElement
(*linIt, &oItemHolder);
117
}
118
119
REGISTER_FWPROXYBUILDER
(
FWConversionProxyBuilder
,
120
reco::Conversion
,
121
"Conversions"
,
122
FWViewType::kAll3DBits
|
FWViewType::kAllRPZBits
);
FWConversionProxyBuilder::~FWConversionProxyBuilder
~FWConversionProxyBuilder() override
Definition:
FWConversionProxyBuilder.cc:65
reco::Conversion
Definition:
Conversion.h:23
mps_fire.i
i
Definition:
mps_fire.py:428
FWSimpleProxyBuilderTemplate.h
edm::conversion
void conversion(EventAux const &from, EventAuxiliary &to)
Definition:
EventAux.cc:9
FWViewType::EType
EType
Definition:
FWViewType.h:31
FWProxyBuilderBase::setupElement
void setupElement(TEveElement *el, bool color=true) const
Definition:
FWProxyBuilderBase.cc:358
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition:
FWViewType.h:67
FWConversionProxyBuilder::buildViewType
void buildViewType(const reco::Conversion &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
Definition:
FWConversionProxyBuilder.cc:104
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition:
FWProxyBuilderFactory.h:33
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition:
register_dataproxybuilder_macro.h:28
FWSimpleProxyBuilderTemplate< reco::Conversion >::modelData
const reco::Conversion & modelData(int index)
Definition:
FWSimpleProxyBuilderTemplate.h:43
TrackUtils.h
FWViewType::kAll3DBits
static const int kAll3DBits
Definition:
FWViewType.h:68
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition:
Cos.h:22
FWViewType.h
DDAxes::z
fireworks::Context::caloTransEta
static float caloTransEta()
Definition:
Context.cc:187
FWConversionProxyBuilder::cleanLocal
void cleanLocal() override
Definition:
FWConversionProxyBuilder.cc:102
FWConversionProxyBuilder::operator=
const FWConversionProxyBuilder & operator=(const FWConversionProxyBuilder &)=delete
FWConversionProxyBuilder
Definition:
FWConversionProxyBuilder.cc:34
groupFilesInBlocks.lines
lines
Definition:
groupFilesInBlocks.py:95
type
type
Definition:
SiPixelVCal_PayloadInspector.cc:37
funct::tan
Tan< T >::type tan(const T &t)
Definition:
Tan.h:22
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition:
FWProxyBuilderBase.cc:350
GsfTrack.h
FWEventItem.h
FWViewContext
Definition:
FWViewContext.h:32
DDAxes::phi
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition:
FWProxyBuilderBase.h:64
makeSuperCluster.h
FWConversionProxyBuilder::FWConversionProxyBuilder
FWConversionProxyBuilder()
Definition:
FWConversionProxyBuilder.cc:60
CandidateUtils.h
fireworks::Context::caloZ1
static float caloZ1(bool offset=true)
Definition:
Context.cc:183
CosmicsPD_Skims.radius
radius
Definition:
CosmicsPD_Skims.py:135
FWSimpleProxyBuilderTemplate
Definition:
FWSimpleProxyBuilderTemplate.h:30
mps_splice.line
line
Definition:
mps_splice.py:76
FWConversionProxyBuilder::haveSingleProduct
bool haveSingleProduct() const override
Definition:
FWConversionProxyBuilder.cc:39
FWConversionProxyBuilder::m_common
TEveElementList * m_common
Definition:
FWConversionProxyBuilder.cc:57
fireworks::Context::caloR1
static float caloR1(bool offset=true)
Definition:
Context.cc:180
FWConversionProxyBuilder::requestCommon
TEveElementList * requestCommon()
Definition:
FWConversionProxyBuilder.cc:67
Context.h
findQualityFiles.size
size
Write out results.
Definition:
findQualityFiles.py:443
Conversion.h
Generated for CMSSW Reference Manual by
1.8.16