CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/Fireworks/Calo/plugins/FWPFTauProxyBuilder.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Calo
00004 // Class  :     FWPFTauProxyBuilder
00005 //
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:
00010 //         Created:  Sun Jan  6 23:57:00 EST 2008
00011 // $Id: FWPFTauProxyBuilder.cc,v 1.16 2010/11/05 10:54:33 amraktad Exp $
00012 //
00013 
00014 // system include files
00015 #include "TEveCompound.h"
00016 #include "TGeoTube.h"
00017 #include "TEveGeoNode.h"
00018 #include "TEveStraightLineSet.h"
00019 #include "TEveTrack.h"
00020 
00021 // user include files
00022 #include "Fireworks/Calo/interface/FWTauProxyBuilderBase.h"
00023 #include "Fireworks/Core/interface/FWEventItem.h"
00024 #include "Fireworks/Core/interface/FWViewType.h"
00025 #include "Fireworks/Core/interface/BuilderUtils.h"
00026 
00027 
00028 #include "DataFormats/TauReco/interface/PFTau.h"
00029 #include "DataFormats/TrackReco/interface/Track.h"
00030 
00031 class FWPFTauProxyBuilder : public FWTauProxyBuilderBase
00032 {
00033 public:
00034    FWPFTauProxyBuilder() {}
00035    virtual ~FWPFTauProxyBuilder() {}
00036 
00037    REGISTER_PROXYBUILDER_METHODS();
00038 
00039 private:
00040    FWPFTauProxyBuilder( const FWPFTauProxyBuilder& );    // stop default
00041    const FWPFTauProxyBuilder& operator=( const FWPFTauProxyBuilder& );    // stop default
00042 
00043    virtual void buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType type , const FWViewContext*);
00044 };
00045 
00046 void
00047 FWPFTauProxyBuilder::buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType viewType , const FWViewContext* vc)
00048 {
00049    reco::PFTauCollection const * pfTaus = 0;
00050    iItem->get( pfTaus );
00051    if( pfTaus == 0 ) return;
00052 
00053    for( reco::PFTauCollection::const_iterator it = pfTaus->begin(), itEnd = pfTaus->end(); it != itEnd; ++it)
00054    { 
00055       TEveCompound* comp = createCompound();
00056 
00057       if (viewType == FWViewType::kLego)
00058       {
00059          fireworks::addCircle( (*it).eta(), (*it).phi(), 0.5, 20, comp, this );
00060       }
00061       else
00062       {
00063          // prepare phi-list and theta range
00064          const reco::PFTauTagInfo *tauTagInfo = dynamic_cast<const reco::PFTauTagInfo*>( (*it).pfTauTagInfoRef().get() );
00065          const reco::PFJet *jet = dynamic_cast<const reco::PFJet*>( tauTagInfo->pfjetRef().get() );
00066          m_minTheta =  100;
00067          m_maxTheta = -100;
00068          std::vector<double> phis;
00069          std::vector <const reco::Candidate*> candidates = jet->getJetConstituentsQuick();
00070          for( std::vector<const reco::Candidate*>::const_iterator candidate = candidates.begin(), candidateEnd = candidates.end();
00071               candidate != candidateEnd; ++candidate )
00072          {
00073             double itheta = (*candidate)->theta();
00074             if( itheta > m_maxTheta ) m_maxTheta = itheta;
00075             if( itheta < m_minTheta ) m_minTheta = itheta;
00076 
00077             m_phis.push_back( (*candidate)->phi() );
00078          }
00079          if( m_minTheta > m_maxTheta ) {        
00080             m_minTheta = 0;
00081             m_maxTheta = 0;
00082          }
00083 
00084          buildBaseTau(*it, *jet, comp, viewType, vc);
00085          m_phis.clear();
00086       }
00087       setupAddElement( comp, product );
00088    }
00089 }
00090 
00091 REGISTER_FWPROXYBUILDER( FWPFTauProxyBuilder, reco::PFTauCollection, "PFTau", FWViewType::kAll3DBits | FWViewType::kAllRPZBits | FWViewType::kAllLegoBits);
00092