File indexing completed on 2024-04-06 12:11:51
0001 #include "FWPFClusterRPZProxyBuilder.h"
0002
0003
0004 FWPFClusterRPZProxyBuilder::FWPFClusterRPZProxyBuilder() { m_clusterUtils = new FWPFClusterRPZUtils(); }
0005
0006
0007 FWPFClusterRPZProxyBuilder::~FWPFClusterRPZProxyBuilder() { delete m_clusterUtils; }
0008
0009
0010 void FWPFClusterRPZProxyBuilder::scaleProduct(TEveElementList *parent,
0011 FWViewType::EType viewType,
0012 const FWViewContext *vc) {
0013 typedef std::vector<ScalableLines> Lines_t;
0014 FWViewEnergyScale *caloScale = vc->getEnergyScale();
0015
0016 for (Lines_t::iterator i = m_clusters.begin(); i != m_clusters.end(); ++i) {
0017 if (vc == (*i).m_vc) {
0018 float value = caloScale->getPlotEt() ? (*i).m_et : (*i).m_energy;
0019 (*i).m_ls->SetScale(caloScale->getScaleFactor3D() * value);
0020 TEveProjected *proj = *(*i).m_ls->BeginProjecteds();
0021 proj->UpdateProjection();
0022 }
0023 }
0024 }
0025
0026
0027 void FWPFClusterRPZProxyBuilder::sharedBuild(
0028 const reco::PFCluster &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *vc, float r) {
0029
0030 TEveScalableStraightLineSet *ls;
0031 TEveVector centre = TEveVector(iData.x(), iData.y(), iData.z());
0032 const FWDisplayProperties &dp = item()->defaultDisplayProperties();
0033 float energy, et;
0034
0035 energy = iData.energy();
0036 et = FWPFMaths::calculateEt(centre, energy);
0037 context().voteMaxEtAndEnergy(et, energy);
0038
0039 ls = m_clusterUtils->buildRhoPhiClusterLineSet(iData, vc, energy, et, r);
0040 ls->SetLineColor(dp.color());
0041 m_clusters.push_back(ScalableLines(ls, et, energy, vc));
0042 setupAddElement(ls, &oItemHolder);
0043 }
0044
0045
0046 void FWPFClusterRPZProxyBuilder::build(const reco::PFCluster &iData,
0047 unsigned int iIndex,
0048 TEveElement &oItemHolder,
0049 const FWViewContext *vc) {
0050
0051 float energy, et;
0052 float ecalR = context().caloR1();
0053 float ecalZ = context().caloZ1();
0054 const FWDisplayProperties &dp = item()->defaultDisplayProperties();
0055 TEveScalableStraightLineSet *ls;
0056 TEveVector centre = TEveVector(iData.x(), iData.y(), iData.z());
0057
0058 energy = iData.energy();
0059 et = FWPFMaths::calculateEt(centre, energy);
0060 context().voteMaxEtAndEnergy(et, energy);
0061
0062 ls = m_clusterUtils->buildRhoZClusterLineSet(iData, vc, context().caloTransAngle(), energy, et, ecalR, ecalZ);
0063 ls->SetLineColor(dp.color());
0064
0065 m_clusters.push_back(ScalableLines(ls, et, energy, vc));
0066 setupAddElement(ls, &oItemHolder);
0067 }
0068
0069
0070 void FWPFEcalClusterRPZProxyBuilder::build(const reco::PFCluster &iData,
0071 unsigned int iIndex,
0072 TEveElement &oItemHolder,
0073 const FWViewContext *vc) {
0074 PFLayer::Layer layer = iData.layer();
0075 const FWEventItem::ModelInfo &info = item()->modelInfo(iIndex);
0076 if (info.displayProperties().isVisible()) {
0077 if (layer < 0)
0078 sharedBuild(iData, iIndex, oItemHolder, vc, FWPFGeom::caloR1());
0079 else
0080 sharedBuild(iData, iIndex, oItemHolder, vc, FWPFGeom::caloR2());
0081 }
0082 }
0083
0084
0085 void FWPFHcalClusterRPZProxyBuilder::build(const reco::PFCluster &iData,
0086 unsigned int iIndex,
0087 TEveElement &oItemHolder,
0088 const FWViewContext *vc) {
0089 const FWEventItem::ModelInfo &info = item()->modelInfo(iIndex);
0090 if (info.displayProperties().isVisible())
0091 sharedBuild(iData, iIndex, oItemHolder, vc, FWPFGeom::caloR1());
0092 }
0093
0094
0095 REGISTER_FWPROXYBUILDER(FWPFClusterRPZProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kRhoZBit);
0096 REGISTER_FWPROXYBUILDER(FWPFEcalClusterRPZProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kRhoPhiPFBit);
0097 REGISTER_FWPROXYBUILDER(FWPFHcalClusterRPZProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kRhoPhiBit);