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 
29 
31 public:
33  ~FWPFTauProxyBuilder() override {}
34 
36 
37  FWPFTauProxyBuilder(const FWPFTauProxyBuilder&) = delete; // stop default
38  const FWPFTauProxyBuilder& operator=(const FWPFTauProxyBuilder&) = delete; // stop default
39 
40 private:
42  void buildViewType(const FWEventItem* iItem,
43  TEveElementList* product,
45  const FWViewContext*) override;
46 };
47 
49  TEveElementList* product,
50  FWViewType::EType viewType,
51  const FWViewContext* vc) {
52  reco::PFTauCollection const* pfTaus = nullptr;
53  iItem->get(pfTaus);
54  if (pfTaus == nullptr)
55  return;
56 
57  for (reco::PFTauCollection::const_iterator it = pfTaus->begin(), itEnd = pfTaus->end(); it != itEnd; ++it) {
58  TEveCompound* comp = createCompound();
59  if (viewType == FWViewType::kLego) {
60  fireworks::addCircle((*it).eta(), (*it).phi(), 0.5, 20, comp, this);
61  } else {
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::Jet* jet = 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(),
71  candidateEnd = candidates.end();
72  candidate != candidateEnd;
73  ++candidate) {
74  double itheta = (*candidate)->theta();
75  if (itheta > m_maxTheta)
76  m_maxTheta = itheta;
77  if (itheta < m_minTheta)
78  m_minTheta = itheta;
79 
80  m_phis.push_back((*candidate)->phi());
81  }
82  if (m_minTheta > m_maxTheta) {
83  m_minTheta = 0;
84  m_maxTheta = 0;
85  }
86 
87  buildBaseTau(*it, jet, comp, viewType, vc);
88  m_phis.clear();
89  } catch (std::exception& e) {
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 
100  "PFTau",
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:57
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Base class for all types of Jets.
Definition: Jet.h:20
void get(const T *&oData) const
Definition: FWEventItem.h:78
static const int kAll3DBits
Definition: FWViewType.h:58
const JetBaseRef & pfjetRef() const
Definition: PFTauTagInfo.cc:30
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:45
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
static const int kAllLegoBits
Definition: FWViewType.h:59
std::vector< double > m_phis
value_type const * get() const
Definition: RefToBase.h:216