Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 // system includes
0002 #include <cmath>
0003 
0004 // user includes
0005 #include "TEveCaloData.h"
0006 #include "TEveCalo.h"
0007 #include "TH2F.h"
0008 
0009 #include "Fireworks/Core/interface/Context.h"
0010 #include "Fireworks/Core/interface/FWEventItem.h"
0011 #include "Fireworks/Core/interface/FWGeometry.h"
0012 #include "Fireworks/Core/interface/FWModelChangeManager.h"
0013 
0014 #include "Fireworks/Core/interface/fw3dlego_xbins.h"
0015 #include "Fireworks/Calo/plugins/FWHGCalMultiClusterLegoProxyBuilder.h"
0016 #include "Fireworks/Calo/plugins/FWHGCalMultiClusterSliceSelector.h"
0017 
0018 #include "FWCore/Common/interface/EventBase.h"
0019 
0020 #include "DataFormats/DetId/interface/DetId.h"
0021 
0022 #include "TEveCompound.h"
0023 
0024 FWHGCalMultiClusterLegoProxyBuilder::FWHGCalMultiClusterLegoProxyBuilder()
0025     : FWCaloDataHistProxyBuilder(), m_towers(nullptr) {}
0026 
0027 FWHGCalMultiClusterLegoProxyBuilder::~FWHGCalMultiClusterLegoProxyBuilder() {}
0028 
0029 void FWHGCalMultiClusterLegoProxyBuilder::build(const FWEventItem *iItem,
0030                                                 TEveElementList *product,
0031                                                 const FWViewContext *vc) {
0032   m_towers = nullptr;
0033   if (iItem) {
0034     iItem->get(m_towers);
0035     FWCaloDataProxyBuilderBase::build(iItem, product, vc);
0036   }
0037 }
0038 
0039 FWHistSliceSelector *FWHGCalMultiClusterLegoProxyBuilder::instantiateSliceSelector() {
0040   return new FWHGCalMultiClusterSliceSelector(m_hist, item());
0041 }
0042 
0043 void FWHGCalMultiClusterLegoProxyBuilder::fillCaloData() {
0044   m_hist->Reset();
0045 
0046   if (m_towers) {
0047     if (item()->defaultDisplayProperties().isVisible()) {
0048       unsigned int index = 0;
0049       for (std::vector<reco::HGCalMultiCluster>::const_iterator tower = m_towers->begin(); tower != m_towers->end();
0050            ++tower, ++index) {
0051         const FWEventItem::ModelInfo &info = item()->modelInfo(index);
0052         if (info.displayProperties().isVisible()) {
0053           addEntryToTEveCaloData(tower->eta(), tower->phi(), tower->pt(), info.isSelected());
0054         }
0055       }
0056     }
0057   }
0058 }
0059 
0060 REGISTER_FWPROXYBUILDER(FWHGCalMultiClusterLegoProxyBuilder,
0061                         std::vector<reco::HGCalMultiCluster>,
0062                         "HGCMultiClusterLego",
0063                         FWViewType::k3DBit | FWViewType::kAllRPZBits | FWViewType::kAllLegoBits);