CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWPFTauProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Calo
4 // Class : FWPFTauProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Sun Jan 6 23:57:00 EST 2008
11 // $Id: FWPFTauProxyBuilder.cc,v 1.17 2012/03/23 00:08:29 amraktad Exp $
12 //
13 
14 // system include files
15 #include "TEveCompound.h"
16 #include "TGeoTube.h"
17 #include "TEveGeoNode.h"
18 #include "TEveStraightLineSet.h"
19 #include "TEveTrack.h"
20 
21 // user include files
27 
28 
31 
33 {
34 public:
36  virtual ~FWPFTauProxyBuilder() {}
37 
39 
40 private:
41  FWPFTauProxyBuilder( const FWPFTauProxyBuilder& ); // stop default
42  const FWPFTauProxyBuilder& operator=( const FWPFTauProxyBuilder& ); // stop default
43 
44  virtual void buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType type , const FWViewContext*);
45 };
46 
47 void
48 FWPFTauProxyBuilder::buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType viewType , const FWViewContext* vc)
49 {
50  reco::PFTauCollection const * pfTaus = 0;
51  iItem->get( pfTaus );
52  if( pfTaus == 0 ) return;
53 
54  for( reco::PFTauCollection::const_iterator it = pfTaus->begin(), itEnd = pfTaus->end(); it != itEnd; ++it)
55  {
56  TEveCompound* comp = createCompound();
57  if (viewType == FWViewType::kLego)
58  {
59  fireworks::addCircle( (*it).eta(), (*it).phi(), 0.5, 20, comp, this );
60  }
61  else
62  {
63  // prepare phi-list and theta range
64  try {
65  const reco::PFTauTagInfo *tauTagInfo = dynamic_cast<const reco::PFTauTagInfo*>( (*it).pfTauTagInfoRef().get() );
66  const reco::PFJet *jet = dynamic_cast<const reco::PFJet*>( tauTagInfo->pfjetRef().get() );
67  m_minTheta = 100;
68  m_maxTheta = -100;
69  std::vector<double> phis;
70  std::vector <const reco::Candidate*> candidates = jet->getJetConstituentsQuick();
71  for( std::vector<const reco::Candidate*>::const_iterator candidate = candidates.begin(), candidateEnd = candidates.end();
72  candidate != candidateEnd; ++candidate )
73  {
74  double itheta = (*candidate)->theta();
75  if( itheta > m_maxTheta ) m_maxTheta = itheta;
76  if( itheta < m_minTheta ) m_minTheta = itheta;
77 
78  m_phis.push_back( (*candidate)->phi() );
79  }
80  if( m_minTheta > m_maxTheta ) {
81  m_minTheta = 0;
82  m_maxTheta = 0;
83  }
84 
85  buildBaseTau(*it, jet, comp, viewType, vc);
86  m_phis.clear();
87  }
88  catch (std::exception& e)
89  {
90  fwLog(fwlog::kInfo) << "FWPFTauProxyBuilder missing PFTauTagInfo. Skip drawing of jets.\n";
91  buildBaseTau(*it, 0, comp, viewType, vc);
92  }
93  }
94  setupAddElement( comp, product );
95  }
96 }
97 
99 
type
Definition: HCALResponse.h:21
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
tuple pfTaus
Definition: pfTaus_cff.py:130
static const int kAllRPZBits
Definition: FWViewType.h:59
const PFJetRef & pfjetRef() const
Definition: PFTauTagInfo.cc:22
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:85
Jets made from PFObjects.
Definition: PFJet.h:22
static const int kAll3DBits
Definition: FWViewType.h:60
const FWPFTauProxyBuilder & operator=(const FWPFTauProxyBuilder &)
void buildBaseTau(const reco::BaseTau &iTau, const reco::Jet *iJet, TEveElement *comp, FWViewType::EType type, const FWViewContext *vc)
void addCircle(double eta, double phi, double radius, const unsigned int nLineSegments, TEveElement *comp, FWProxyBuilderBase *pb)
#define fwLog(_level_)
Definition: fwLog.h:51
static const int kAllLegoBits
Definition: FWViewType.h:61
virtual std::vector< const reco::Candidate * > getJetConstituentsQuick() const
quick list of constituents
Definition: Jet.cc:359
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *product, FWViewType::EType type, const FWViewContext *)
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
std::vector< double > m_phis
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242