File indexing completed on 2024-04-06 12:11:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "TEveCompound.h"
0015 #include "TGeoTube.h"
0016 #include "TEveGeoNode.h"
0017 #include "TEveStraightLineSet.h"
0018 #include "TEveTrack.h"
0019
0020
0021 #include "Fireworks/Calo/interface/FWTauProxyBuilderBase.h"
0022 #include "Fireworks/Core/interface/FWEventItem.h"
0023 #include "Fireworks/Core/interface/FWViewType.h"
0024 #include "Fireworks/Core/interface/fwLog.h"
0025 #include "Fireworks/Core/interface/BuilderUtils.h"
0026
0027 #include "DataFormats/TauReco/interface/PFTau.h"
0028 #include "DataFormats/TrackReco/interface/Track.h"
0029
0030 class FWPFTauProxyBuilder : public FWTauProxyBuilderBase {
0031 public:
0032 FWPFTauProxyBuilder() {}
0033 ~FWPFTauProxyBuilder() override {}
0034
0035 REGISTER_PROXYBUILDER_METHODS();
0036
0037 FWPFTauProxyBuilder(const FWPFTauProxyBuilder&) = delete;
0038 const FWPFTauProxyBuilder& operator=(const FWPFTauProxyBuilder&) = delete;
0039
0040 private:
0041 using FWTauProxyBuilderBase::buildViewType;
0042 void buildViewType(const FWEventItem* iItem,
0043 TEveElementList* product,
0044 FWViewType::EType type,
0045 const FWViewContext*) override;
0046 };
0047
0048 void FWPFTauProxyBuilder::buildViewType(const FWEventItem* iItem,
0049 TEveElementList* product,
0050 FWViewType::EType viewType,
0051 const FWViewContext* vc) {
0052 reco::PFTauCollection const* pfTaus = nullptr;
0053 iItem->get(pfTaus);
0054 if (pfTaus == nullptr)
0055 return;
0056
0057 for (reco::PFTauCollection::const_iterator it = pfTaus->begin(), itEnd = pfTaus->end(); it != itEnd; ++it) {
0058 TEveCompound* comp = createCompound();
0059 if (viewType == FWViewType::kLego) {
0060 fireworks::addCircle((*it).eta(), (*it).phi(), 0.5, 20, comp, this);
0061 } else {
0062
0063 try {
0064 const reco::PFTauTagInfo* tauTagInfo = dynamic_cast<const reco::PFTauTagInfo*>((*it).pfTauTagInfoRef().get());
0065 const reco::Jet* jet = tauTagInfo->pfjetRef().get();
0066 m_minTheta = 100;
0067 m_maxTheta = -100;
0068 std::vector<double> phis;
0069 std::vector<const reco::Candidate*> candidates = jet->getJetConstituentsQuick();
0070 for (std::vector<const reco::Candidate*>::const_iterator candidate = candidates.begin(),
0071 candidateEnd = candidates.end();
0072 candidate != candidateEnd;
0073 ++candidate) {
0074 double itheta = (*candidate)->theta();
0075 if (itheta > m_maxTheta)
0076 m_maxTheta = itheta;
0077 if (itheta < m_minTheta)
0078 m_minTheta = itheta;
0079
0080 m_phis.push_back((*candidate)->phi());
0081 }
0082 if (m_minTheta > m_maxTheta) {
0083 m_minTheta = 0;
0084 m_maxTheta = 0;
0085 }
0086
0087 buildBaseTau(*it, jet, comp, viewType, vc);
0088 m_phis.clear();
0089 } catch (std::exception& e) {
0090 fwLog(fwlog::kInfo) << "FWPFTauProxyBuilder missing PFTauTagInfo. Skip drawing of jets.\n";
0091 buildBaseTau(*it, nullptr, comp, viewType, vc);
0092 }
0093 }
0094 setupAddElement(comp, product);
0095 }
0096 }
0097
0098 REGISTER_FWPROXYBUILDER(FWPFTauProxyBuilder,
0099 reco::PFTauCollection,
0100 "PFTau",
0101 FWViewType::kAll3DBits | FWViewType::kAllRPZBits | FWViewType::kAllLegoBits);