Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-03 04:09:57

0001 // -*- C++ -*-
0002 //
0003 // Package:     CandidatePtrs
0004 // Class  :     FWCandidatePtrProxyBuilder
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Chris Jones
0010 //         Created:  Fri Dec  5 09:56:09 EST 2008
0011 //
0012 
0013 #include "TEveTrack.h"
0014 
0015 // user include files
0016 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
0017 #include "Fireworks/Core/interface/Context.h"
0018 
0019 #include "Fireworks/Candidates/interface/CandidateUtils.h"
0020 
0021 #include "DataFormats/Candidate/interface/Candidate.h"
0022 
0023 class FWCandidatePtrProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::CandidatePtr> {
0024 public:
0025   FWCandidatePtrProxyBuilder() {}
0026   ~FWCandidatePtrProxyBuilder() override {}
0027 
0028   REGISTER_PROXYBUILDER_METHODS();
0029 
0030   FWCandidatePtrProxyBuilder(const FWCandidatePtrProxyBuilder&) = delete;                   // stop default
0031   const FWCandidatePtrProxyBuilder& operator=(const FWCandidatePtrProxyBuilder&) = delete;  // stop default
0032 
0033 private:
0034   using FWSimpleProxyBuilderTemplate<reco::CandidatePtr>::build;
0035   void build(const reco::CandidatePtr& iData,
0036              unsigned int iIndex,
0037              TEveElement& oItemHolder,
0038              const FWViewContext*) override;
0039 };
0040 
0041 void FWCandidatePtrProxyBuilder::build(const reco::CandidatePtr& iData,
0042                                        unsigned int iIndex,
0043                                        TEveElement& oItemHolder,
0044                                        const FWViewContext*) {
0045   TEveTrack* trk = fireworks::prepareCandidate(*iData, context().getTrackPropagator());
0046 
0047   trk->MakeTrack();
0048   setupAddElement(trk, &oItemHolder);
0049   {
0050     TEveRecTrack t;
0051     t.fBeta = 1.;
0052     t.fV = TEveVector(iData->vx(), iData->vy(), iData->vz());
0053     t.fP = TEveVector(-iData->p4().px(), -iData->p4().py(), -iData->p4().pz());
0054     t.fSign = iData->charge();
0055     TEveTrack* trk2 = new TEveTrack(&t, context().getTrackPropagator());
0056     trk2->SetLineStyle(7);
0057     trk2->MakeTrack();
0058     setupAddElement(trk2, &oItemHolder);
0059   }
0060 }
0061 
0062 //
0063 // static member functions
0064 //
0065 REGISTER_FWPROXYBUILDER(FWCandidatePtrProxyBuilder,
0066                         reco::CandidatePtr,
0067                         "CandidatePtrs",
0068                         FWViewType::kAll3DBits | FWViewType::kAllRPZBits);