CMS 3D CMS Logo

FWPFPatJet3DProxyBuilder.cc
Go to the documentation of this file.
3 
4 //______________________________________________________________________________
5 template <class T>
7 template <class T>
9 
10 //______________________________________________________________________________
11 template <class T>
13  unsigned int iIndex,
14  TEveElement& oItemHolder,
15  const FWViewContext*) {
16  try {
17  std::vector<reco::PFCandidatePtr> consts = iData.getPFConstituents();
18  typedef std::vector<reco::PFCandidatePtr>::const_iterator IC;
19 
20  for (IC ic = consts.begin(); // If consts has no constituents then the loop simply won't execute
21  ic != consts.end();
22  ic++) // and so no segmentation fault should occur
23  {
24  const reco::PFCandidatePtr& pfCandPtr = *ic;
25 
26  TEveRecTrack t;
27  t.fBeta = 1;
28  t.fP = TEveVector(pfCandPtr->px(), pfCandPtr->py(), pfCandPtr->pz());
29  t.fV = TEveVector(pfCandPtr->vertex().x(), pfCandPtr->vertex().y(), pfCandPtr->vertex().z());
30  t.fSign = pfCandPtr->charge();
31  TEveTrack* trk = new TEveTrack(&t, FWProxyBuilderBase::context().getTrackPropagator());
32  trk->MakeTrack();
33  trk->SetLineWidth(3);
34 
35  fireworks::setTrackTypePF(*pfCandPtr, trk);
36 
38  }
39  } catch (cms::Exception& iException) {
40  fwLog(fwlog::kError) << "FWPFPatJet3DProxyBuilder::build() Caught exception " << iException.what() << std::endl;
41  }
42 }
43 
44 /* Classes have been created because 'concrete' types (i.e. reco::PFJet and not T) are required to register
45 a proxy builder. Each class must first register it's methods so that REGISTER_FWPROXYBUILDER macro knows
46 about them */
47 //_____________________________PF_______________________________________________
48 class FWPFJet3DProxyBuilder : public FWPFPatJet3DProxyBuilder<reco::PFJet> {
49 public:
51  ~FWPFJet3DProxyBuilder() override {}
52 
54 };
55 
56 //_____________________________PAT______________________________________________
58 public:
61 
62  REGISTER_PROXYBUILDER_METHODS(); // Register methods ready for macro
63 };
64 
65 //______________________________________________________________________________
68 
69 //______________________________________________________________________________
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:57
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Trktree trk
Definition: Trktree.cc:2
Jets made from PFObjects.
Definition: PFJet.h:20
static const int kAll3DBits
Definition: FWViewType.h:58
const fireworks::Context & context() const
#define fwLog(_level_)
Definition: fwLog.h:45
Analysis-level calorimeter jet class.
Definition: Jet.h:77
void setTrackTypePF(const reco::PFCandidate &pfCand, TAttLine *track)
char const * what() const noexcept override
Definition: Exception.cc:107
long double T