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 private:
38  FWPFTauProxyBuilder(const FWPFTauProxyBuilder&) = delete; // stop default
39  const FWPFTauProxyBuilder& operator=(const FWPFTauProxyBuilder&) = delete; // stop default
40 
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",
FWPFTauProxyBuilder::operator=
const FWPFTauProxyBuilder & operator=(const FWPFTauProxyBuilder &)=delete
AlCaHLTBitMon_QueryRunRegistry.comp
string comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
FWTauProxyBuilderBase::buildBaseTau
void buildBaseTau(const reco::BaseTau &iTau, const reco::Jet *iJet, TEveElement *comp, FWViewType::EType type, const FWViewContext *vc)
Definition: FWTauProxyBuilderBase.cc:51
FWViewType::EType
EType
Definition: FWViewType.h:31
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWEventItem::get
void get(const T *&oData) const
Definition: FWEventItem.h:78
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:27
BuilderUtils.h
FWTauProxyBuilderBase::m_maxTheta
float m_maxTheta
Definition: FWTauProxyBuilderBase.h:53
FWProxyBuilderBase::createCompound
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
Definition: FWProxyBuilderBase.cc:374
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
Track.h
FWViewType.h
FWViewType::kLego
Definition: FWViewType.h:36
reco::PFTauCollection
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
FWViewType::kAllLegoBits
static const int kAllLegoBits
Definition: FWViewType.h:69
FWProxyBuilderBase::buildViewType
virtual void buildViewType(const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
Definition: FWProxyBuilderBase.cc:333
edm::RefToBase::get
value_type const * get() const
Definition: RefToBase.h:209
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
fireworks::addCircle
void addCircle(double eta, double phi, double radius, const unsigned int nLineSegments, TEveElement *comp, FWProxyBuilderBase *pb)
Definition: BuilderUtils.cc:161
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
FWPFTauProxyBuilder::buildViewType
void buildViewType(const FWEventItem *iItem, TEveElementList *product, FWViewType::EType type, const FWViewContext *) override
Definition: FWPFTauProxyBuilder.cc:48
fwLog.h
FWEventItem.h
reco::PFTauTagInfo::pfjetRef
const JetBaseRef & pfjetRef() const
Definition: PFTauTagInfo.cc:30
FWViewContext
Definition: FWViewContext.h:32
FWTauProxyBuilderBase::m_phis
std::vector< double > m_phis
Definition: FWTauProxyBuilderBase.h:54
FWPFTauProxyBuilder::FWPFTauProxyBuilder
FWPFTauProxyBuilder()
Definition: FWPFTauProxyBuilder.cc:32
fwlog::kInfo
Definition: fwLog.h:35
FWEventItem
Definition: FWEventItem.h:56
FWPFTauProxyBuilder
Definition: FWPFTauProxyBuilder.cc:30
metsig::jet
Definition: SignAlgoResolutions.h:47
HLT_FULL_cff.candidates
candidates
Definition: HLT_FULL_cff.py:55017
PFTau.h
FWTauProxyBuilderBase::m_minTheta
float m_minTheta
Definition: FWTauProxyBuilderBase.h:52
reco::PFTauTagInfo
Definition: PFTauTagInfo.h:19
FWTauProxyBuilderBase
Definition: FWTauProxyBuilderBase.h:39
FWPFTauProxyBuilder::~FWPFTauProxyBuilder
~FWPFTauProxyBuilder() override
Definition: FWPFTauProxyBuilder.cc:33
FWTauProxyBuilderBase.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37