CMS 3D CMS Logo

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  ~FWPFTauProxyBuilder() override {}
36 
38 
39 private:
40  FWPFTauProxyBuilder( const FWPFTauProxyBuilder& ) = delete; // stop default
41  const FWPFTauProxyBuilder& operator=( const FWPFTauProxyBuilder& ) = delete; // stop default
42 
44  void buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType type , const FWViewContext*) override;
45 };
46 
47 void
48 FWPFTauProxyBuilder::buildViewType( const FWEventItem* iItem, TEveElementList* product, FWViewType::EType viewType , const FWViewContext* vc)
49 {
50  reco::PFTauCollection const * pfTaus = nullptr;
51  iItem->get( pfTaus );
52  if( pfTaus == nullptr ) 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::Jet *jet = 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, nullptr, comp, viewType, vc);
92  }
93  }
94  setupAddElement( comp, product );
95  }
96 }
97 
99 
type
Definition: HCALResponse.h:21
value_type const * get() const
Definition: RefToBase.h:234
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
void buildViewType(const FWEventItem *iItem, TEveElementList *product, FWViewType::EType type, const FWViewContext *) override
static const int kAllRPZBits
Definition: FWViewType.h:58
Base class for all types of Jets.
Definition: Jet.h:20
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:85
const JetBaseRef & pfjetRef() const
Definition: PFTauTagInfo.cc:22
static const int kAll3DBits
Definition: FWViewType.h:59
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)
const FWPFTauProxyBuilder & operator=(const FWPFTauProxyBuilder &)=delete
#define fwLog(_level_)
Definition: fwLog.h:50
static const int kAllLegoBits
Definition: FWViewType.h:60
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