CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Fireworks/ParticleFlow/plugins/FWPFPatJetLegoProxyBuilder.cc

Go to the documentation of this file.
00001 #include "FWPFPatJetLegoProxyBuilder.h"
00002 
00003 //______________________________________________________________________________
00004 template<class T> FWPFPatJetLegoProxyBuilder<T>::FWPFPatJetLegoProxyBuilder(){}
00005 template<class T> FWPFPatJetLegoProxyBuilder<T>::~FWPFPatJetLegoProxyBuilder(){}
00006 
00007 //______________________________________________________________________________
00008 template<class T> void
00009 FWPFPatJetLegoProxyBuilder<T>::build( const T& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* vc )
00010 {
00011    std::vector<reco::PFCandidatePtr > consts = iData.getPFConstituents();
00012 
00013    typedef std::vector<reco::PFCandidatePtr >::const_iterator IC;
00014 
00015    for( IC ic = consts.begin(); ic != consts.end(); ++ic ) 
00016    {
00017       const reco::PFCandidatePtr pfCandPtr = *ic;
00018 
00019       FWPFLegoCandidate *candidate = new FWPFLegoCandidate( vc, FWProxyBuilderBase::context(), pfCandPtr->energy(), pfCandPtr->et(),
00020                                                             pfCandPtr->pt(), pfCandPtr->eta(), pfCandPtr->phi() );
00021       candidate->SetMarkerColor( FWProxyBuilderBase::item()->defaultDisplayProperties().color() );
00022       fireworks::setTrackTypePF( (*pfCandPtr), candidate );
00023       FWProxyBuilderBase::setupAddElement( candidate, &oItemHolder );
00024 
00025       FWProxyBuilderBase::context().voteMaxEtAndEnergy( pfCandPtr->et(), pfCandPtr->energy() );
00026    }
00027 }
00028 
00029 //______________________________________________________________________________
00030 template<class T> void
00031 FWPFPatJetLegoProxyBuilder<T>::scaleProduct(TEveElementList* parent, FWViewType::EType type, const FWViewContext* vc)
00032 {
00033    // loop items in product
00034    for( TEveElement::List_i i = parent->BeginChildren(); i!= parent->EndChildren(); ++i )
00035    {
00036       if ( ( *i )->HasChildren() )
00037       {
00038          // loop elements for the reco::PFJet item
00039          for( TEveElement::List_i j = (*i)->BeginChildren(); j != (*i)->EndChildren(); ++j )
00040          {
00041             FWPFLegoCandidate *cand = dynamic_cast<FWPFLegoCandidate*> ( *j );
00042             cand->updateScale( vc, FWProxyBuilderBase::context());
00043          }
00044       }
00045    }
00046 }
00047 
00048 //______________________________________________________________________________
00049 template<class T> void
00050 FWPFPatJetLegoProxyBuilder<T>::localModelChanges(const FWModelId& iId, TEveElement* parent, FWViewType::EType viewType, const FWViewContext* vc)
00051 {
00052    // line set marker is not same color as line, have to fix it here
00053    if ( ( parent )->HasChildren() )
00054    {
00055       for( TEveElement::List_i j = parent->BeginChildren(); j != parent->EndChildren(); ++j )
00056       {
00057          FWPFLegoCandidate *cand = dynamic_cast<FWPFLegoCandidate*> ( *j );
00058          const FWDisplayProperties &dp = FWProxyBuilderBase::item()->modelInfo( iId.index() ).displayProperties();
00059          cand->SetMarkerColor( dp.color() );
00060          cand->ElementChanged();
00061       }
00062    }
00063 }
00064 
00065 //____________________________PAT_______________________________________________
00066 class FWPatJetLegoProxyBuilder : public FWPFPatJetLegoProxyBuilder<pat::Jet>
00067 {
00068    public:
00069       FWPatJetLegoProxyBuilder(){}
00070       virtual ~FWPatJetLegoProxyBuilder(){}
00071 
00072       REGISTER_PROXYBUILDER_METHODS();
00073 };
00074 
00075 //____________________________PF________________________________________________
00076 class FWPFJetLegoProxyBuilder : public FWPFPatJetLegoProxyBuilder<reco::PFJet>
00077 {
00078    public:
00079       FWPFJetLegoProxyBuilder(){}
00080       virtual ~FWPFJetLegoProxyBuilder(){}
00081 
00082       REGISTER_PROXYBUILDER_METHODS();
00083 };
00084 
00085 //______________________________________________________________________________
00086 template class FWPFPatJetLegoProxyBuilder<reco::PFJet>;
00087 template class FWPFPatJetLegoProxyBuilder<pat::Jet>;
00088 
00089 //______________________________________________________________________________
00090 REGISTER_FWPROXYBUILDER(FWPFJetLegoProxyBuilder, reco::PFJet, "PF Jet", FWViewType::kLegoPFECALBit | FWViewType::kLegoBit );
00091 REGISTER_FWPROXYBUILDER(FWPatJetLegoProxyBuilder, pat::Jet, "PF PatJet", FWViewType::kLegoPFECALBit | FWViewType::kLegoBit );