Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:     Muons
0004 // Class  :     FWMuonRhoPhiProxyBuilder
0005 //
0006 //
0007 
0008 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
0009 #include "Fireworks/Core/interface/FWProxyBuilderConfiguration.h"
0010 #include "Fireworks/Core/interface/FWEventItem.h"
0011 #include "Fireworks/Muons/interface/FWMuonBuilder.h"
0012 #include "DataFormats/MuonReco/interface/Muon.h"
0013 
0014 class FWMuonRhoPhiProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Muon> {
0015 public:
0016   FWMuonRhoPhiProxyBuilder(void) {}
0017   ~FWMuonRhoPhiProxyBuilder(void) override {}
0018 
0019   void setItem(const FWEventItem* iItem) override;
0020 
0021   REGISTER_PROXYBUILDER_METHODS();
0022 
0023   // Disable default copy constructor
0024   FWMuonRhoPhiProxyBuilder(const FWMuonRhoPhiProxyBuilder&) = delete;
0025   // Disable default assignment operator
0026   const FWMuonRhoPhiProxyBuilder& operator=(const FWMuonRhoPhiProxyBuilder&) = delete;
0027 
0028 private:
0029   using FWSimpleProxyBuilderTemplate<reco::Muon>::build;
0030   void build(const reco::Muon& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
0031 
0032   void localModelChanges(const FWModelId& iId,
0033                          TEveElement* iCompound,
0034                          FWViewType::EType viewType,
0035                          const FWViewContext* vc) override;
0036 
0037   mutable FWMuonBuilder m_builder;
0038 };
0039 
0040 void FWMuonRhoPhiProxyBuilder::setItem(const FWEventItem* iItem) {
0041   FWProxyBuilderBase::setItem(iItem);
0042 
0043   if (iItem) {
0044     iItem->getConfig()->assertParam("LineWidth", long(1), long(1), long(4));
0045   }
0046 }
0047 
0048 void FWMuonRhoPhiProxyBuilder::build(const reco::Muon& iData,
0049                                      unsigned int iIndex,
0050                                      TEveElement& oItemHolder,
0051                                      const FWViewContext*) {
0052   int width = item()->getConfig()->value<long>("LineWidth");
0053   m_builder.setLineWidth(width);
0054 
0055   // To build in RhoPhi we should simply disable the Endcap drawing
0056   // by passing a false flag to a muon builder:
0057   m_builder.buildMuon(this, &iData, &oItemHolder, false, false);
0058 
0059   increaseComponentTransparency(iIndex, &oItemHolder, "Chamber", 40);
0060 }
0061 
0062 void FWMuonRhoPhiProxyBuilder::localModelChanges(const FWModelId& iId,
0063                                                  TEveElement* iCompound,
0064                                                  FWViewType::EType viewType,
0065                                                  const FWViewContext* vc) {
0066   increaseComponentTransparency(iId.index(), iCompound, "Chamber", 40);
0067 }
0068 
0069 REGISTER_FWPROXYBUILDER(FWMuonRhoPhiProxyBuilder,
0070                         reco::Muon,
0071                         "Muons",
0072                         FWViewType::kRhoPhiBit | FWViewType::kRhoPhiPFBit);