Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:51

0001 #include "FWPFClusterLegoProxyBuilder.h"
0002 #include "Fireworks/Candidates/interface/FWLegoCandidate.h"
0003 
0004 //______________________________________________________________________________
0005 void FWPFClusterLegoProxyBuilder::localModelChanges(const FWModelId &iId,
0006                                                     TEveElement *parent,
0007                                                     FWViewType::EType viewType,
0008                                                     const FWViewContext *vc) {
0009   // Line set marker is not the same colour as line, fixed here
0010   if ((parent)->HasChildren()) {
0011     for (TEveElement::List_i j = parent->BeginChildren(); j != parent->EndChildren(); j++) {
0012       FWLegoCandidate *cluster = dynamic_cast<FWLegoCandidate *>(*j);
0013       cluster->SetMarkerColor(FWProxyBuilderBase::item()->modelInfo(iId.index()).displayProperties().color());
0014       cluster->ElementChanged();
0015     }
0016   }
0017 }
0018 
0019 //______________________________________________________________________________
0020 void FWPFClusterLegoProxyBuilder::scaleProduct(TEveElementList *parent,
0021                                                FWViewType::EType type,
0022                                                const FWViewContext *vc) {
0023   for (TEveElement::List_i i = parent->BeginChildren(); i != parent->EndChildren(); ++i) {
0024     if ((*i)->HasChildren()) {
0025       TEveElement *el = (*i)->FirstChild();  // there is only one child added in this proxy builder
0026       FWLegoCandidate *cluster = dynamic_cast<FWLegoCandidate *>(el);
0027       cluster->updateScale(vc, context());
0028     }
0029   }
0030 }
0031 
0032 //______________________________________________________________________________
0033 void FWPFClusterLegoProxyBuilder::sharedBuild(const reco::PFCluster &iData,
0034                                               TEveElement &oItemHolder,
0035                                               const FWViewContext *vc) {
0036   TEveVector centre = TEveVector(iData.x(), iData.y(), iData.z());
0037   float energy = iData.energy();
0038   float et = FWPFMaths::calculateEt(centre, energy);
0039   float pt = et;
0040   float eta = iData.eta();
0041   float phi = iData.phi();
0042 
0043   context().voteMaxEtAndEnergy(et, energy);
0044 
0045   FWLegoCandidate *cluster = new FWLegoCandidate(vc, FWProxyBuilderBase::context(), energy, et, pt, eta, phi);
0046   cluster->SetMarkerColor(FWProxyBuilderBase::item()->defaultDisplayProperties().color());
0047   setupAddElement(cluster, &oItemHolder);
0048 }
0049 
0050 //______________________________ECAL____________________________________________
0051 void FWPFEcalClusterLegoProxyBuilder::build(const reco::PFCluster &iData,
0052                                             unsigned int iIndex,
0053                                             TEveElement &oItemHolder,
0054                                             const FWViewContext *vc) {
0055   PFLayer::Layer layer = iData.layer();
0056   if (layer < 0)
0057     sharedBuild(iData, oItemHolder, vc);
0058 }
0059 
0060 //______________________________HCAL____________________________________________
0061 void FWPFHcalClusterLegoProxyBuilder::build(const reco::PFCluster &iData,
0062                                             unsigned int iIndex,
0063                                             TEveElement &oItemHolder,
0064                                             const FWViewContext *vc) {
0065   PFLayer::Layer layer = iData.layer();
0066   if (layer > 0)
0067     sharedBuild(iData, oItemHolder, vc);
0068 }
0069 
0070 //______________________________________________________________________________
0071 REGISTER_FWPROXYBUILDER(FWPFEcalClusterLegoProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kLegoPFECALBit);
0072 REGISTER_FWPROXYBUILDER(FWPFHcalClusterLegoProxyBuilder, reco::PFCluster, "PF Cluster", FWViewType::kLegoBit);