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 //
12 
13 // system include files
14 #include "TEveCompound.h"
15 #include "TGeoTube.h"
16 #include "TEveGeoNode.h"
17 #include "TEveStraightLineSet.h"
18 #include "TEveTrack.h"
19 
20 // user include files
26 
27 
30 
32 {
33 public:
35  virtual ~FWPFTauProxyBuilder() {}
36 
38 
39 private:
40  FWPFTauProxyBuilder( const FWPFTauProxyBuilder& ); // stop default
41  const FWPFTauProxyBuilder& operator=( const FWPFTauProxyBuilder& ); // stop default
42 
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
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
#define REGISTER_PROXYBUILDER_METHODS()
#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:136
static const int kAllRPZBits
Definition: FWViewType.h:58
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:84
Jets made from PFObjects.
Definition: PFJet.h:21
static const int kAll3DBits
Definition: FWViewType.h:59
const FWPFTauProxyBuilder & operator=(const FWPFTauProxyBuilder &)
void buildBaseTau(const reco::BaseTau &iTau, const reco::Jet *iJet, TEveElement *comp, FWViewType::EType type, const FWViewContext *vc)
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:242
void addCircle(double eta, double phi, double radius, const unsigned int nLineSegments, TEveElement *comp, FWProxyBuilderBase *pb)
#define fwLog(_level_)
Definition: fwLog.h:50
static const int kAllLegoBits
Definition: FWViewType.h:60
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
virtual std::vector< const reco::Candidate * > getJetConstituentsQuick() const
quick list of constituents