Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-03 04:10:01

0001 // -*- C++ -*-
0002 //
0003 // Package:     Muons
0004 // Class  :     FWElectronLegoProxyBuilder
0005 //
0006 //
0007 
0008 #include "TEveStraightLineSet.h"
0009 #include "TEveTrack.h"
0010 
0011 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
0012 #include "Fireworks/Core/interface/FWEventItem.h"
0013 
0014 #include "Fireworks/Candidates/interface/CandidateUtils.h"
0015 #include "Fireworks/Tracks/interface/TrackUtils.h"
0016 
0017 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0018 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
0019 
0020 class FWElectronLegoProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::GsfElectron> {
0021 public:
0022   FWElectronLegoProxyBuilder() {}
0023   ~FWElectronLegoProxyBuilder() override {}
0024 
0025   REGISTER_PROXYBUILDER_METHODS();
0026 
0027   FWElectronLegoProxyBuilder(const FWElectronLegoProxyBuilder&) = delete;
0028   const FWElectronLegoProxyBuilder& operator=(const FWElectronLegoProxyBuilder&) = delete;
0029 
0030 private:
0031   using FWSimpleProxyBuilderTemplate<reco::GsfElectron>::build;
0032   void build(const reco::GsfElectron& iData,
0033              unsigned int iIndex,
0034              TEveElement& oItemHolder,
0035              const FWViewContext*) override;
0036 };
0037 
0038 void FWElectronLegoProxyBuilder::build(const reco::GsfElectron& iData,
0039                                        unsigned int iIndex,
0040                                        TEveElement& oItemHolder,
0041                                        const FWViewContext*) {
0042   TEveStraightLineSet* marker = new TEveStraightLineSet("marker");
0043   setupAddElement(marker, &oItemHolder);
0044 
0045   TEveTrack* track(nullptr);
0046 
0047   if (iData.gsfTrack().isAvailable())
0048     track = fireworks::prepareTrack(*iData.gsfTrack(), context().getTrackPropagator());
0049   else
0050     track = fireworks::prepareCandidate(iData, context().getTrackPropagator());
0051 
0052   track->MakeTrack();
0053   const double delta = 0.1;
0054   marker->AddLine(track->GetEndMomentum().Eta() - delta,
0055                   track->GetEndMomentum().Phi() - delta,
0056                   0.1,
0057                   track->GetEndMomentum().Eta() + delta,
0058                   track->GetEndMomentum().Phi() + delta,
0059                   0.1);
0060   marker->AddLine(track->GetEndMomentum().Eta() - delta,
0061                   track->GetEndMomentum().Phi() + delta,
0062                   0.1,
0063                   track->GetEndMomentum().Eta() + delta,
0064                   track->GetEndMomentum().Phi() - delta,
0065                   0.1);
0066   marker->AddLine(track->GetEndMomentum().Eta(),
0067                   track->GetEndMomentum().Phi() - delta,
0068                   0.1,
0069                   track->GetEndMomentum().Eta(),
0070                   track->GetEndMomentum().Phi() + delta,
0071                   0.1);
0072   marker->AddLine(track->GetEndMomentum().Eta() - delta,
0073                   track->GetEndMomentum().Phi(),
0074                   0.1,
0075                   track->GetEndMomentum().Eta() + delta,
0076                   track->GetEndMomentum().Phi(),
0077                   0.1);
0078 }
0079 
0080 REGISTER_FWPROXYBUILDER(FWElectronLegoProxyBuilder, reco::GsfElectron, "Electrons", FWViewType::kAllLegoBits);