CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

FWCaloTowerProxyBuilderBase Class Reference

#include <FWCaloTowerProxyBuilder.h>

Inheritance diagram for FWCaloTowerProxyBuilderBase:
FWCaloDataProxyBuilderBase FWProxyBuilderBase FWECalCaloTowerProxyBuilder FWHCalCaloTowerProxyBuilder FWHOCaloTowerProxyBuilder

List of all members.

Public Member Functions

 FWCaloTowerProxyBuilderBase ()
virtual double getEt (const CaloTower &) const =0
virtual ~FWCaloTowerProxyBuilderBase ()

Protected Member Functions

bool assertCaloDataSlice ()
virtual void fillCaloData ()
virtual void itemBeingDestroyed (const FWEventItem *)
virtual void setCaloData (const fireworks::Context &)

Private Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 FWCaloTowerProxyBuilderBase (const FWCaloTowerProxyBuilderBase &)
const FWCaloTowerProxyBuilderBaseoperator= (const FWCaloTowerProxyBuilderBase &)

Private Attributes

TH2F * m_hist
const CaloTowerCollectionm_towers

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 36 of file FWCaloTowerProxyBuilder.h.


Constructor & Destructor Documentation

FWCaloTowerProxyBuilderBase::FWCaloTowerProxyBuilderBase ( )

Definition at line 37 of file FWCaloTowerProxyBuilder.cc.

                                                        :
m_towers(0),
m_hist(0)
{
}
FWCaloTowerProxyBuilderBase::~FWCaloTowerProxyBuilderBase ( ) [virtual]

Definition at line 43 of file FWCaloTowerProxyBuilder.cc.

{
}
FWCaloTowerProxyBuilderBase::FWCaloTowerProxyBuilderBase ( const FWCaloTowerProxyBuilderBase ) [private]

Member Function Documentation

bool FWCaloTowerProxyBuilderBase::assertCaloDataSlice ( ) [protected, virtual]

Implements FWCaloDataProxyBuilderBase.

Definition at line 159 of file FWCaloTowerProxyBuilder.cc.

References FWFromTEveCaloDataSelector::addSliceSelector(), newFWLiteAna::base, FWProxyBuilderBase::item(), FWCaloDataProxyBuilderBase::m_caloData, m_hist, M_PI, FWCaloDataProxyBuilderBase::m_sliceIndex, AlCaRecoCosmics_cfg::name, runTheMatrix::sel, ntuplemaker::status, fw3dlego::xbins, and fw3dlego::xbins_n.

{
   if (m_hist == 0)
   {
      // add new slice
      Bool_t status = TH1::AddDirectoryStatus();
      TH1::AddDirectory(kFALSE); //Keeps histogram from going into memory
      m_hist = new TH2F("caloHist",
                        "caloHist",
                        fw3dlego::xbins_n - 1, fw3dlego::xbins,
                        72, -M_PI, M_PI);
      TH1::AddDirectory(status);
      TEveCaloDataHist* ch = static_cast<TEveCaloDataHist*>(m_caloData);
      m_sliceIndex = ch->AddHistogram(m_hist);



      m_caloData->RefSliceInfo(m_sliceIndex).Setup(item()->name().c_str(), 0., 
                                                   item()->defaultDisplayProperties().color(),
                                                   item()->defaultDisplayProperties().transparency());

      // add new selector
      FWFromTEveCaloDataSelector* sel = 0;
      if (m_caloData->GetUserData())
      {
         FWFromEveSelectorBase* base = reinterpret_cast<FWFromEveSelectorBase*>(m_caloData->GetUserData());
         assert(0!=base);
         sel = dynamic_cast<FWFromTEveCaloDataSelector*> (base);
         assert(0!=sel);
      }
      else
      {
         sel = new FWFromTEveCaloDataSelector(m_caloData);
         //make sure it is accessible via the base class
         m_caloData->SetUserData(static_cast<FWFromEveSelectorBase*>(sel));
      }
     
      sel->addSliceSelector(m_sliceIndex, new FWCaloTowerSliceSelector(m_hist,item()));
     
      return true;
   }
   return false;
}
void FWCaloTowerProxyBuilderBase::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext ctx 
) [private, virtual]

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 59 of file FWCaloTowerProxyBuilder.cc.

References FWProxyBuilderBase::build(), FWEventItem::get(), and m_towers.

{
   m_towers=0;
   if (iItem)
   {
      iItem->get(m_towers);
      FWCaloDataProxyBuilderBase::build(iItem, el, ctx);
   }
}
void FWCaloTowerProxyBuilderBase::fillCaloData ( ) [protected, virtual]

Implements FWCaloDataProxyBuilderBase.

Definition at line 97 of file FWCaloTowerProxyBuilder.cc.

References edm::SortedCollection< T, SORT >::begin(), FWEventItem::ModelInfo::displayProperties(), edm::SortedCollection< T, SORT >::end(), getEt(), getHLTprescales::index, info, FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), FWProxyBuilderBase::item(), FWCaloDataProxyBuilderBase::m_caloData, m_hist, FWCaloDataProxyBuilderBase::m_sliceIndex, m_towers, FWEventItem::modelInfo(), Pi, and wrapPi().

{
   static float d = 2.5*TMath::Pi()/180;
   m_hist->Reset();

   if (m_towers)
   {
      TEveCaloData::vCellId_t& selected = m_caloData->GetCellsSelected();

      if(item()->defaultDisplayProperties().isVisible()) {
         // assert(item()->size() >= m_towers->size());
         unsigned int index=0;
         for(CaloTowerCollection::const_iterator tower = m_towers->begin(); tower != m_towers->end(); ++tower,++index) {
            const FWEventItem::ModelInfo& info = item()->modelInfo(index);
            if(info.displayProperties().isVisible()) {
               if (tower->ietaAbs() > 39)
               {
                  m_hist->Fill(tower->eta(),wrapPi(tower->phi() - 3*d), getEt(*tower) *0.25);
                  m_hist->Fill(tower->eta(),wrapPi(tower->phi() -   d), getEt(*tower) *0.25);
                  m_hist->Fill(tower->eta(),wrapPi(tower->phi() +   d), getEt(*tower) *0.25);
                  m_hist->Fill(tower->eta(),wrapPi(tower->phi() + 3*d), getEt(*tower) *0.25);
               }
               else if (tower->ietaAbs() > 20)
               {
                  m_hist->Fill(tower->eta(),wrapPi(tower->phi() - d), getEt(*tower) *0.5);
                  m_hist->Fill(tower->eta(),wrapPi(tower->phi() + d), getEt(*tower) *0.5);
               }
               else
               {
                  m_hist->Fill(tower->eta(),tower->phi(), getEt(*tower));
               }
            }
            if(info.isSelected()) {
               //NOTE: I tried calling TEveCalo::GetCellList but it always returned 0, probably because of threshold issues
               // but looking at the TEveCaloHist::GetCellList code the CellId_t is just the histograms bin # and the slice
               // printf("applyChangesToAllModels ...check selected \n");

               if (tower->ietaAbs() > 39)
               {
                  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(tower->eta(), wrapPi(tower->phi() -3*d)),m_sliceIndex));
                  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(tower->eta(), wrapPi(tower->phi() -d))  ,m_sliceIndex));
                  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(tower->eta(), wrapPi(tower->phi() +d))  ,m_sliceIndex));
                  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(tower->eta(), wrapPi(tower->phi() +3*d)),m_sliceIndex));
               }
               else if (tower->ietaAbs() > 20)
               {
                  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(tower->eta(), wrapPi(tower->phi() -d)), m_sliceIndex));
                  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(tower->eta(), wrapPi(tower->phi() +d)), m_sliceIndex));
               }
               else
               {
                  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(tower->eta(),tower->phi()),m_sliceIndex));
               }
            }
         }
      }
   }

}
virtual double FWCaloTowerProxyBuilderBase::getEt ( const CaloTower ) const [pure virtual]
void FWCaloTowerProxyBuilderBase::itemBeingDestroyed ( const FWEventItem iItem) [protected, virtual]

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 71 of file FWCaloTowerProxyBuilder.cc.

References m_hist.

const FWCaloTowerProxyBuilderBase& FWCaloTowerProxyBuilderBase::operator= ( const FWCaloTowerProxyBuilderBase ) [private]
void FWCaloTowerProxyBuilderBase::setCaloData ( const fireworks::Context ) [protected, virtual]

Member Data Documentation

Definition at line 62 of file FWCaloTowerProxyBuilder.h.

Referenced by assertCaloDataSlice(), fillCaloData(), and itemBeingDestroyed().

Definition at line 61 of file FWCaloTowerProxyBuilder.h.

Referenced by build(), and fillCaloData().