Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:30

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/ParticleFlow/plugins/FWPFCandidateTowerProxyBuilder.h"
0027 #include "Fireworks/ParticleFlow/plugins/FWPFCandidateTowerSliceSelector.h"
0028 
0029 #include "DataFormats/CaloTowers/interface/CaloTower.h"
0030 
0031 //

0032 // constructors , dectructors

0033 //

0034 FWPFCandidateTowerProxyBuilder::FWPFCandidateTowerProxyBuilder() : m_towers(nullptr) {}
0035 
0036 FWPFCandidateTowerProxyBuilder::~FWPFCandidateTowerProxyBuilder() {}
0037 
0038 //

0039 // member functions

0040 //

0041 
0042 void FWPFCandidateTowerProxyBuilder::build(const FWEventItem* iItem, TEveElementList* el, const FWViewContext* ctx) {
0043   m_towers = nullptr;
0044   if (iItem) {
0045     iItem->get(m_towers);
0046     FWCaloDataProxyBuilderBase::build(iItem, el, ctx);
0047   }
0048 }
0049 
0050 FWHistSliceSelector* FWPFCandidateTowerProxyBuilder::instantiateSliceSelector() {
0051   return new FWPFCandidateTowerSliceSelector(m_hist, item());
0052 }
0053 
0054 void FWPFCandidateTowerProxyBuilder::fillCaloData() {
0055   m_hist->Reset();
0056 
0057   if (m_towers) {
0058     if (item()->defaultDisplayProperties().isVisible()) {
0059       // assert(item()->size() >= m_towers->size());

0060       unsigned int index = 0;
0061       for (reco::PFCandidateConstIterator tower = m_towers->begin(); tower != m_towers->end(); ++tower, ++index) {
0062         const FWEventItem::ModelInfo& info = item()->modelInfo(index);
0063         if (info.displayProperties().isVisible()) {
0064           addEntryToTEveCaloData(tower->eta(), tower->phi(), getEt(*tower), info.isSelected());
0065         }
0066       }
0067     }
0068   }
0069 }
0070 
0071 REGISTER_FWPROXYBUILDER(FWECalPFCandidateProxyBuilder,
0072                         reco::PFCandidateCollection,
0073                         "CaloTowerPfCandEcal",
0074                         FWViewType::k3DBit | FWViewType::kAllRPZBits | FWViewType::kAllLegoBits);
0075 REGISTER_FWPROXYBUILDER(FWHCalPFCandidateProxyBuilder,
0076                         reco::PFCandidateCollection,
0077                         "CaloTowerPfCandHcal",
0078                         FWViewType::k3DBit | FWViewType::kAllRPZBits | FWViewType::kAllLegoBits);