CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/Fireworks/ParticleFlow/plugins/FWPFPatJetLegoProxyBuilder.cc

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