Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "Fireworks/Candidates/plugins/FWCandidateTowerProxyBuilder.h"
0002 
0003 // system includes

0004 #include <cmath>
0005 
0006 // user includes

0007 #include "TEveCaloData.h"
0008 #include "TEveCalo.h"
0009 #include "TH2F.h"
0010 
0011 #include "Fireworks/Core/interface/Context.h"
0012 #include "Fireworks/Core/interface/FWEventItem.h"
0013 #include "Fireworks/Core/interface/FWModelChangeManager.h"
0014 #include "Fireworks/Candidates/interface/FWCandidateTowerSliceSelector.h"
0015 
0016 #include "Fireworks/Core/interface/fw3dlego_xbins.h"
0017 
0018 #include "DataFormats/CaloTowers/interface/CaloTower.h"
0019 
0020 //

0021 // constructors , dectructors

0022 //

0023 FWCandidateTowerProxyBuilder::FWCandidateTowerProxyBuilder() : m_helper(typeid(reco::Candidate)) {}
0024 
0025 FWCandidateTowerProxyBuilder::~FWCandidateTowerProxyBuilder() {}
0026 
0027 //

0028 // member functions

0029 //

0030 
0031 void FWCandidateTowerProxyBuilder::itemChangedImp(const FWEventItem* iItem) {
0032   if (iItem) {
0033     m_helper.itemChanged(iItem);
0034   }
0035 }
0036 
0037 void FWCandidateTowerProxyBuilder::build(const FWEventItem* iItem, TEveElementList* el, const FWViewContext* ctx) {
0038   //  m_towers=0;

0039   if (iItem) {
0040     //      iItem->get(m_towers);

0041     FWCaloDataProxyBuilderBase::build(iItem, el, ctx);
0042   }
0043 }
0044 
0045 FWHistSliceSelector* FWCandidateTowerProxyBuilder::instantiateSliceSelector() {
0046   FWCandidateTowerSliceSelector* ss = new FWCandidateTowerSliceSelector(m_hist, item(), &m_helper);
0047   return ss;
0048 }
0049 
0050 void FWCandidateTowerProxyBuilder::fillCaloData() {
0051   m_hist->Reset();
0052 
0053   //  if (m_towers)

0054   {
0055     if (item()->defaultDisplayProperties().isVisible()) {
0056       // assert(item()->size() >= m_towers->size());

0057       for (size_t index = 0; index < item()->size(); ++index) {
0058         const FWEventItem::ModelInfo& info = item()->modelInfo(index);
0059         if (info.displayProperties().isVisible()) {
0060           const void* modelData = item()->modelData((int)index);
0061 
0062           const reco::Candidate* tower = reinterpret_cast<const reco::Candidate*>(m_helper.offsetObject(modelData));
0063           addEntryToTEveCaloData(tower->eta(), tower->phi(), getEt(*tower), info.isSelected());
0064         }
0065       }
0066     }
0067   }
0068 }
0069 
0070 REGISTER_FWPROXYBUILDER(FWCandidateTowerProxyBuilder,
0071                         reco::Candidate,
0072                         "CaloTower",
0073                         FWViewType::k3DBit | FWViewType::kAllRPZBits | FWViewType::kAllLegoBits);