Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:31

0001 #include "FWPFPatJet3DProxyBuilder.h"
0002 #include "Fireworks/Core/interface/fwLog.h"
0003 
0004 //______________________________________________________________________________
0005 template <class T>
0006 FWPFPatJet3DProxyBuilder<T>::FWPFPatJet3DProxyBuilder() {}
0007 template <class T>
0008 FWPFPatJet3DProxyBuilder<T>::~FWPFPatJet3DProxyBuilder() {}
0009 
0010 //______________________________________________________________________________
0011 template <class T>
0012 void FWPFPatJet3DProxyBuilder<T>::build(const T& iData,
0013                                         unsigned int iIndex,
0014                                         TEveElement& oItemHolder,
0015                                         const FWViewContext*) {
0016   try {
0017     std::vector<reco::PFCandidatePtr> consts = iData.getPFConstituents();
0018     typedef std::vector<reco::PFCandidatePtr>::const_iterator IC;
0019 
0020     for (IC ic = consts.begin();  // If consts has no constituents then the loop simply won't execute
0021          ic != consts.end();
0022          ic++)  // and so no segmentation fault should occur
0023     {
0024       const reco::PFCandidatePtr pfCandPtr = *ic;
0025 
0026       TEveRecTrack t;
0027       t.fBeta = 1;
0028       t.fP = TEveVector(pfCandPtr->px(), pfCandPtr->py(), pfCandPtr->pz());
0029       t.fV = TEveVector(pfCandPtr->vertex().x(), pfCandPtr->vertex().y(), pfCandPtr->vertex().z());
0030       t.fSign = pfCandPtr->charge();
0031       TEveTrack* trk = new TEveTrack(&t, FWProxyBuilderBase::context().getTrackPropagator());
0032       trk->MakeTrack();
0033       trk->SetLineWidth(3);
0034 
0035       fireworks::setTrackTypePF(*pfCandPtr, trk);
0036 
0037       FWProxyBuilderBase::setupAddElement(trk, &oItemHolder);
0038     }
0039   } catch (cms::Exception& iException) {
0040     fwLog(fwlog::kError) << "FWPFPatJet3DProxyBuilder::build() Caught exception " << iException.what() << std::endl;
0041   }
0042 }
0043 
0044 /* Classes have been created because 'concrete' types (i.e. reco::PFJet and not T) are required to register
0045 a proxy builder. Each class must first register it's methods so that REGISTER_FWPROXYBUILDER macro knows
0046 about them */
0047 //_____________________________PF_______________________________________________
0048 class FWPFJet3DProxyBuilder : public FWPFPatJet3DProxyBuilder<reco::PFJet> {
0049 public:
0050   FWPFJet3DProxyBuilder() {}
0051   ~FWPFJet3DProxyBuilder() override {}
0052 
0053   REGISTER_PROXYBUILDER_METHODS();
0054 };
0055 
0056 //_____________________________PAT______________________________________________
0057 class FWPatJet3DProxyBuilder : public FWPFPatJet3DProxyBuilder<pat::Jet> {
0058 public:
0059   FWPatJet3DProxyBuilder() {}
0060   ~FWPatJet3DProxyBuilder() override {}
0061 
0062   REGISTER_PROXYBUILDER_METHODS();  // Register methods ready for macro
0063 };
0064 
0065 //______________________________________________________________________________
0066 template class FWPFPatJet3DProxyBuilder<reco::PFJet>;
0067 template class FWPFPatJet3DProxyBuilder<pat::Jet>;
0068 
0069 //______________________________________________________________________________
0070 REGISTER_FWPROXYBUILDER(FWPFJet3DProxyBuilder, reco::PFJet, "PF Jet", FWViewType::kAll3DBits | FWViewType::kAllRPZBits);
0071 REGISTER_FWPROXYBUILDER(FWPatJet3DProxyBuilder, pat::Jet, "PF PatJet", FWViewType::kAll3DBits | FWViewType::kAllRPZBits);