CMS 3D CMS Logo

FWPFBlockProxyBuilder.cc
Go to the documentation of this file.
3 
4 //______________________________________________________________________________
5 void FWPFBlockProxyBuilder::scaleProduct(TEveElementList *parent, FWViewType::EType viewType, const FWViewContext *vc) {
6  typedef std::vector<ScalableLines> Lines_t;
7  FWViewEnergyScale *caloScale = vc->getEnergyScale();
8 
9  if (viewType == FWViewType::kRhoPhiPF ||
10  viewType == FWViewType::kRhoZ) { /* Handle the rhophi and rhoz cluster scaling */
11  for (Lines_t::iterator i = m_clusters.begin(); i != m_clusters.end(); ++i) {
12  if (vc == (*i).m_vc) {
13  float value = caloScale->getPlotEt() ? (*i).m_et : (*i).m_energy;
14  (*i).m_ls->SetScale(caloScale->getScaleFactor3D() * value);
15  TEveProjected *proj = *(*i).m_ls->BeginProjecteds();
16  proj->UpdateProjection();
17  }
18  }
19  } /* Handle cluster scaling in lego view(s) */
20  else if (viewType == FWViewType::kLego || viewType == FWViewType::kLegoPFECAL) { // Loop products
21  for (TEveElement::List_i i = parent->BeginChildren(); i != parent->EndChildren(); ++i) {
22  if ((*i)->HasChildren()) { // Loop elements of block
23  for (TEveElement::List_i j = (*i)->BeginChildren(); j != (*i)->EndChildren(); ++j) {
24  if (strcmp((*j)->GetElementName(), "BlockCluster") == 0) {
25  FWLegoCandidate *cluster = dynamic_cast<FWLegoCandidate *>(*j);
26  cluster->updateScale(vc, context());
27  }
28  }
29  }
30  }
31  }
32 }
33 
34 //______________________________________________________________________________
36  TEveElement &oItemHolder,
37  const FWViewContext *vc,
38  FWViewType::EType viewType) {
39  if (blockElement.trackType(reco::PFBlockElement::DEFAULT)) {
40  reco::Track track = *blockElement.trackRef();
41  FWPFTrackUtils *trackUtils = new FWPFTrackUtils();
42 
43  if (viewType == FWViewType::kLego || viewType == FWViewType::kLegoPFECAL) // Lego views
44  {
45  TEveStraightLineSet *legoTrack = trackUtils->setupLegoTrack(track);
46  setupAddElement(legoTrack, &oItemHolder);
47  } else if (viewType == FWViewType::kRhoPhiPF) // RhoPhi view
48  {
49  TEveTrack *trk = trackUtils->setupTrack(track);
50  TEvePointSet *ps = trackUtils->getCollisionMarkers(trk);
51  setupAddElement(trk, &oItemHolder);
52  if (ps->GetN() != 0)
53  setupAddElement(ps, &oItemHolder);
54  else
55  delete ps;
56  } else if (viewType == FWViewType::kRhoZ) // RhoZ view
57  {
58  TEveTrack *trk = trackUtils->setupTrack(track);
59  TEvePointSet *markers = trackUtils->getCollisionMarkers(trk);
60  TEvePointSet *ps = new TEvePointSet();
61  setupAddElement(trk, &oItemHolder);
62 
63  Float_t *trackPoints = trk->GetP();
64  unsigned int last = (trk->GetN() - 1) * 3;
65  float y = trackPoints[last + 1];
66  float z = trackPoints[last + 2];
67 
68  // Reposition any points that have been translated in RhoZ
69  for (signed int i = 0; i < markers->GetN(); ++i) {
70  Float_t a, b, c;
71  markers->GetPoint(i, a, b, c);
72 
73  if (y < 0 && b > 0)
74  b *= -1;
75  else if (y > 0 && b < 0)
76  b *= -1;
77 
78  if (z < 0 && c > 0)
79  c *= -1;
80  else if (z > 0 && c < 0)
81  c *= -1;
82 
83  ps->SetNextPoint(a, b, c);
84  }
85 
86  if (ps->GetN() != 0)
87  setupAddElement(ps, &oItemHolder);
88  else
89  delete ps;
90  delete markers;
91  }
92 
93  delete trackUtils;
94  }
95 }
96 
97 //______________________________________________________________________________
99  TEveElement &oItemHolder,
100  const FWViewContext *vc,
101  FWViewType::EType viewType,
102  float r) {
103  // Get reference to PFCluster
104  reco::PFCluster cluster = *blockElement.clusterRef();
105  TEveVector centre = TEveVector(cluster.x(), cluster.y(), cluster.z());
106  float energy = cluster.energy();
107  float et = FWPFMaths::calculateEt(centre, energy);
108  float pt = et;
109  float eta = cluster.eta();
110  float phi = cluster.phi();
111 
113 
114  if (viewType == FWViewType::kLego || viewType == FWViewType::kLegoPFECAL) {
116  legoCluster->SetMarkerColor(FWProxyBuilderBase::item()->defaultDisplayProperties().color());
117  legoCluster->SetElementName("BlockCluster");
118  setupAddElement(legoCluster, &oItemHolder);
119  }
120  if (viewType == FWViewType::kRhoPhiPF) {
122  FWPFClusterRPZUtils *clusterUtils = new FWPFClusterRPZUtils();
123  TEveScalableStraightLineSet *rpCluster = clusterUtils->buildRhoPhiClusterLineSet(cluster, vc, energy, et, r);
124  rpCluster->SetLineColor(dp.color());
125  m_clusters.push_back(ScalableLines(rpCluster, et, energy, vc));
126  setupAddElement(rpCluster, &oItemHolder);
127  delete clusterUtils;
128  } else if (viewType == FWViewType::kRhoZ) {
130  FWPFClusterRPZUtils *clusterUtils = new FWPFClusterRPZUtils();
131  TEveScalableStraightLineSet *rzCluster = clusterUtils->buildRhoZClusterLineSet(
132  cluster, vc, context().caloTransAngle(), energy, et, r, context().caloZ1());
133  rzCluster->SetLineColor(dp.color());
134  m_clusters.push_back(ScalableLines(rzCluster, et, energy, vc));
135  setupAddElement(rzCluster, &oItemHolder);
136  delete clusterUtils;
137  }
138 }
139 
140 //______________________________________________________________________________
142  unsigned int iIndex,
143  TEveElement &oItemHolder,
144  FWViewType::EType viewType,
145  const FWViewContext *vc) {
147 
148  for (unsigned int i = 0; i < elements.size(); ++i) {
150  switch (type) {
151  case 1: // TRACK
152  if (e_builderType == BASE)
153  setupTrackElement(elements[i], oItemHolder, vc, viewType);
154  break;
155 
156  case 4: // ECAL
157  if (e_builderType == ECAL)
158  setupClusterElement(elements[i], oItemHolder, vc, viewType, FWPFGeom::caloR1());
159  break;
160 
161  case 5: // HCAL
162  if (e_builderType == HCAL) {
163  if (viewType == FWViewType::kRhoPhiPF)
164  setupClusterElement(elements[i], oItemHolder, vc, viewType, FWPFGeom::caloR2());
165  else // RhoZ
166  setupClusterElement(elements[i], oItemHolder, vc, viewType, context().caloR1());
167  }
168  break;
169 
170  default: // Ignore anything that isn't wanted
171  break;
172  }
173  }
174 }
175 
176 //______________________________________________________________________________
179  "PF Block",
184  "PF Block",
188  "PF Block",
FWViewType::kRhoPhiPFBit
Definition: FWViewType.h:53
FWPFBlockProxyBuilder::setupClusterElement
void setupClusterElement(const reco::PFBlockElement &, TEveElement &, const FWViewContext *, FWViewType::EType, float r)
Definition: FWPFBlockProxyBuilder.cc:98
reco::CaloCluster::phi
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
DDAxes::y
reco::CaloCluster::y
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:175
FWPFBlockHcalProxyBuilder
Definition: FWPFBlockProxyBuilder.h:95
reco::PFBlockElement::trackType
virtual bool trackType(TrackType trType) const
Definition: PFBlockElement.h:72
mps_fire.i
i
Definition: mps_fire.py:428
FWPFBlockProxyBuilder::scaleProduct
void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
Definition: FWPFBlockProxyBuilder.cc:5
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
FWViewType::kLegoBit
Definition: FWViewType.h:55
FWViewType::EType
EType
Definition: FWViewType.h:31
FWPFClusterRPZUtils
Definition: FWPFClusterRPZUtils.h:38
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWPFTrackUtils::setupLegoTrack
TEveStraightLineSet * setupLegoTrack(const reco::Track &)
Definition: FWPFTrackUtils.cc:63
FWViewType::kLegoPFECALBit
Definition: FWViewType.h:57
reco::PFBlock
Block of elements.
Definition: PFBlock.h:26
FWPFBlockEcalProxyBuilder
Definition: FWPFBlockProxyBuilder.h:79
FWViewType::kRhoZ
Definition: FWViewType.h:33
FWPFClusterRPZUtils::buildRhoPhiClusterLineSet
TEveScalableStraightLineSet * buildRhoPhiClusterLineSet(const reco::PFCluster &, const FWViewContext *, float r)
Definition: FWPFClusterRPZUtils.cc:4
reco::CaloCluster::z
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:178
FWViewEnergyScale::getPlotEt
bool getPlotEt() const
Definition: FWViewEnergyScale.h:47
FWPFBlockProxyBuilder::BASE
Definition: FWPFBlockProxyBuilder.h:37
ScalableLines
Definition: FWPFClusterRPZUtils.h:26
FWLegoCandidate
Definition: FWLegoCandidate.h:28
reco::PFBlockElement::Type
Type
Definition: PFBlockElement.h:30
FWPFBlockProxyBuilder::ECAL
Definition: FWPFBlockProxyBuilder.h:37
FWEventItem::defaultDisplayProperties
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:403
FWPFTrackUtils::getCollisionMarkers
TEvePointSet * getCollisionMarkers(const TEveTrack *)
Definition: FWPFTrackUtils.cc:246
reco::PFCluster::energy
double energy() const
cluster energy
Definition: PFCluster.h:74
dqmdumpme.last
last
Definition: dqmdumpme.py:56
FWPFMaths::calculateEt
float calculateEt(const TEveVector &centre, float e)
Definition: FWPFMaths.cc:115
Calorimetry_cff.dp
dp
Definition: Calorimetry_cff.py:158
fireworks::Context::voteMaxEtAndEnergy
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:162
PVValHelper::eta
Definition: PVValidationHelpers.h:70
FWViewType::kLego
Definition: FWViewType.h:36
DDAxes::z
reco::Track
Definition: Track.h:27
FWViewType::kLegoPFECAL
Definition: FWViewType.h:43
FWPFBlockProxyBuilder::m_clusters
std::vector< ScalableLines > m_clusters
Definition: FWPFBlockProxyBuilder.h:68
FWPFClusterRPZUtils::buildRhoZClusterLineSet
TEveScalableStraightLineSet * buildRhoZClusterLineSet(const reco::PFCluster &, const FWViewContext *, float caloTransAngle, float r, float z)
Definition: FWPFClusterRPZUtils.cc:38
FWPFBlockProxyBuilder
Definition: FWPFBlockProxyBuilder.h:35
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HCAL
Definition: HCAL.py:1
b
double b
Definition: hdecay.h:118
FWPFGeom::caloR1
float caloR1()
Definition: FWPFGeom.h:20
FWPFBlockProxyBuilder::e_builderType
BuilderType e_builderType
Definition: FWPFBlockProxyBuilder.h:67
FWPFTrackUtils::setupTrack
TEveTrack * setupTrack(const reco::Track &)
Definition: FWPFTrackUtils.cc:231
amptDefault_cfi.proj
proj
Definition: amptDefault_cfi.py:13
a
double a
Definition: hdecay.h:119
reco::CaloCluster::eta
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
FWPFBlockProxyBuilder::setupTrackElement
void setupTrackElement(const reco::PFBlockElement &, TEveElement &, const FWViewContext *, FWViewType::EType)
Definition: FWPFBlockProxyBuilder.cc:35
reco::PFBlockElement::DEFAULT
Definition: PFBlockElement.h:47
FWViewType::kRhoZBit
Definition: FWViewType.h:52
FWPFGeom::caloZ1
float caloZ1()
Definition: FWPFGeom.h:21
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
reco::PFBlockElement::trackRef
virtual const reco::TrackRef & trackRef() const
Definition: PFBlockElement.h:88
value
Definition: value.py:1
reco::PFBlock::elements
const edm::OwnVector< reco::PFBlockElement > & elements() const
Definition: PFBlock.h:85
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
FWPFBlockProxyBuilder::buildViewType
void buildViewType(const reco::PFBlock &, unsigned int, TEveElement &, FWViewType::EType, const FWViewContext *) override
Definition: FWPFBlockProxyBuilder.cc:141
reco::PFBlockElement
Abstract base class for a PFBlock element (track, cluster...)
Definition: PFBlockElement.h:26
FWViewContext
Definition: FWViewContext.h:32
FWDisplayProperties
Definition: FWDisplayProperties.h:28
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWViewEnergyScale::getScaleFactor3D
float getScaleFactor3D() const
Definition: FWViewEnergyScale.h:44
bookConverter.elements
elements
Definition: bookConverter.py:147
relativeConstraints.value
value
Definition: relativeConstraints.py:53
reco::PFCluster
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
FWViewEnergyScale
Definition: FWViewEnergyScale.h:34
FWLegoCandidate.h
FWLegoCandidate::updateScale
void updateScale(const FWViewContext *vc, const fireworks::Context &)
Definition: FWLegoCandidate.cc:41
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
FWPFBlockProxyBuilder.h
FWViewType::kRhoPhiPF
Definition: FWViewType.h:42
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
FWViewContext::getEnergyScale
FWViewEnergyScale * getEnergyScale() const
Definition: FWViewContext.cc:25
class-composition.parent
parent
Definition: class-composition.py:88
reco::CaloCluster::x
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:172
edm::OwnVector< reco::PFBlockElement >
FWPFGeom::caloR2
float caloR2()
Definition: FWPFGeom.h:26
FWPFTrackUtils
Definition: FWPFTrackUtils.h:68
reco::PFBlockElement::clusterRef
virtual const PFClusterRef & clusterRef() const
Definition: PFBlockElement.h:90