CMS 3D CMS Logo

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