Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Package:     Calo
0004 // Class  :     FWCaloTowerProxyBuilderBase
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Chris Jones
0010 //         Created:  Wed Dec  3 11:28:28 EST 2008
0011 //
0012 
0013 // system includes
0014 #include <cmath>
0015 
0016 // user includes
0017 #include "TEveCaloData.h"
0018 #include "TEveCalo.h"
0019 #include "TH2F.h"
0020 
0021 #include "Fireworks/Core/interface/Context.h"
0022 #include "Fireworks/Core/interface/FWEventItem.h"
0023 #include "Fireworks/Core/interface/FWModelChangeManager.h"
0024 
0025 #include "Fireworks/Core/interface/fw3dlego_xbins.h"
0026 #include "Fireworks/Calo/plugins/FWCaloTowerProxyBuilder.h"
0027 #include "Fireworks/Calo/plugins/FWCaloTowerSliceSelector.h"
0028 
0029 #include "DataFormats/CaloTowers/interface/CaloTower.h"
0030 
0031 //
0032 // constructors , dectructors
0033 //
0034 FWCaloTowerProxyBuilderBase::FWCaloTowerProxyBuilderBase() : FWCaloDataHistProxyBuilder(), m_towers(nullptr) {}
0035 
0036 FWCaloTowerProxyBuilderBase::~FWCaloTowerProxyBuilderBase() {}
0037 
0038 void FWCaloTowerProxyBuilderBase::build(const FWEventItem* iItem, TEveElementList* el, const FWViewContext* ctx) {
0039   m_towers = nullptr;
0040   if (iItem) {
0041     iItem->get(m_towers);
0042     FWCaloDataProxyBuilderBase::build(iItem, el, ctx);
0043   }
0044 }
0045 
0046 FWHistSliceSelector* FWCaloTowerProxyBuilderBase::instantiateSliceSelector() {
0047   return new FWCaloTowerSliceSelector(m_hist, item());
0048 }
0049 
0050 void FWCaloTowerProxyBuilderBase::fillCaloData() {
0051   m_hist->Reset();
0052 
0053   if (m_towers) {
0054     if (item()->defaultDisplayProperties().isVisible()) {
0055       unsigned int index = 0;
0056       for (CaloTowerCollection::const_iterator tower = m_towers->begin(); tower != m_towers->end(); ++tower, ++index) {
0057         const FWEventItem::ModelInfo& info = item()->modelInfo(index);
0058         if (info.displayProperties().isVisible()) {
0059           addEntryToTEveCaloData(tower->eta(), tower->phi(), getEt(*tower), info.isSelected());
0060         }
0061       }
0062     }
0063   }
0064 }
0065 
0066 REGISTER_FWPROXYBUILDER(FWECalCaloTowerProxyBuilder,
0067                         CaloTowerCollection,
0068                         "ECal",
0069                         FWViewType::k3DBit | FWViewType::kAllRPZBits | FWViewType::kAllLegoBits);
0070 REGISTER_FWPROXYBUILDER(FWHCalCaloTowerProxyBuilder,
0071                         CaloTowerCollection,
0072                         "HCal",
0073                         FWViewType::k3DBit | FWViewType::kAllRPZBits | FWViewType::kAllLegoBits);
0074 REGISTER_FWPROXYBUILDER(FWHOCaloTowerProxyBuilder,
0075                         CaloTowerCollection,
0076                         "HCal Outer",
0077                         FWViewType::k3DBit | FWViewType::kAllRPZBits | FWViewType::kAllLegoBits);