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 
43  virtual void buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType type , const FWViewContext*);
44 };
45 
46 void
47 FWPFTauProxyBuilder::buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType viewType , const FWViewContext* vc)
48 {
49  reco::PFTauCollection const * pfTaus = 0;
50  iItem->get( pfTaus );
51  if( pfTaus == 0 ) return;
52 
53  for( reco::PFTauCollection::const_iterator it = pfTaus->begin(), itEnd = pfTaus->end(); it != itEnd; ++it)
54  {
55  TEveCompound* comp = createCompound();
56  if (viewType == FWViewType::kLego)
57  {
58  fireworks::addCircle( (*it).eta(), (*it).phi(), 0.5, 20, comp, this );
59  }
60  else
61  {
62  // prepare phi-list and theta range
63  try {
64  const reco::PFTauTagInfo *tauTagInfo = dynamic_cast<const reco::PFTauTagInfo*>( (*it).pfTauTagInfoRef().get() );
65  const reco::PFJet *jet = dynamic_cast<const reco::PFJet*>( tauTagInfo->pfjetRef().get() );
66  m_minTheta = 100;
67  m_maxTheta = -100;
68  std::vector<double> phis;
69  std::vector <const reco::Candidate*> candidates = jet->getJetConstituentsQuick();
70  for( std::vector<const reco::Candidate*>::const_iterator candidate = candidates.begin(), candidateEnd = candidates.end();
71  candidate != candidateEnd; ++candidate )
72  {
73  double itheta = (*candidate)->theta();
74  if( itheta > m_maxTheta ) m_maxTheta = itheta;
75  if( itheta < m_minTheta ) m_minTheta = itheta;
76 
77  m_phis.push_back( (*candidate)->phi() );
78  }
79  if( m_minTheta > m_maxTheta ) {
80  m_minTheta = 0;
81  m_maxTheta = 0;
82  }
83 
84  buildBaseTau(*it, jet, comp, viewType, vc);
85  m_phis.clear();
86  }
87  catch (std::exception& e)
88  {
89  fwLog(fwlog::kInfo) << "FWPFTauProxyBuilder missing PFTauTagInfo. Skip drawing of jets.\n";
90  buildBaseTau(*it, 0, comp, viewType, vc);
91  }
92  }
93  setupAddElement( comp, product );
94  }
95 }
96 
98 
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:139
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)
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 std::vector< const reco::Candidate * > getJetConstituentsQuick() const
quick list of constituents
Definition: Jet.cc:358
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