Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*
0002  *  FWTrackingParticleProxyBuilder.cc
0003  *  FWorks
0004  *
0005  *  Created by Ianna Osborne on 9/9/10.
0006  *
0007  */
0008 
0009 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
0010 #include "Fireworks/Core/interface/Context.h"
0011 #include "Fireworks/Core/interface/FWEventItem.h"
0012 #include "Fireworks/Core/interface/FWGeometry.h"
0013 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
0014 
0015 #include "Fireworks/Core/interface/FWProxyBuilderConfiguration.h"
0016 #include "Fireworks/Core/interface/FWParameters.h"
0017 
0018 #include "TEveTrack.h"
0019 
0020 class FWTrackingParticleProxyBuilder : public FWSimpleProxyBuilderTemplate<TrackingParticle> {
0021 public:
0022   FWTrackingParticleProxyBuilder(void) {}
0023   ~FWTrackingParticleProxyBuilder(void) override {}
0024 
0025   void setItem(const FWEventItem* iItem) override {
0026     FWProxyBuilderBase::setItem(iItem);
0027     iItem->getConfig()->assertParam("Point Size", 1l, 3l, 1l);
0028   }
0029 
0030   REGISTER_PROXYBUILDER_METHODS();
0031 
0032   // Disable default copy constructor
0033   FWTrackingParticleProxyBuilder(const FWTrackingParticleProxyBuilder&) = delete;
0034   // Disable default assignment operator
0035   const FWTrackingParticleProxyBuilder& operator=(const FWTrackingParticleProxyBuilder&) = delete;
0036 
0037 private:
0038   using FWSimpleProxyBuilderTemplate<TrackingParticle>::build;
0039   void build(const TrackingParticle& iData,
0040              unsigned int iIndex,
0041              TEveElement& oItemHolder,
0042              const FWViewContext*) override;
0043 };
0044 
0045 void FWTrackingParticleProxyBuilder::build(const TrackingParticle& iData,
0046                                            unsigned int iIndex,
0047                                            TEveElement& oItemHolder,
0048                                            const FWViewContext*) {
0049   TEveRecTrack t;
0050   t.fBeta = 1.0;
0051   t.fP = TEveVector(iData.px(), iData.py(), iData.pz());
0052   t.fV = TEveVector(iData.vx(), iData.vy(), iData.vz());
0053   t.fSign = iData.charge();
0054 
0055   TEveTrack* track = new TEveTrack(&t, context().getTrackPropagator());
0056   if (t.fSign == 0)
0057     track->SetLineStyle(7);
0058 
0059   track->MakeTrack();
0060   setupAddElement(track, &oItemHolder);
0061 }
0062 
0063 REGISTER_FWPROXYBUILDER(FWTrackingParticleProxyBuilder,
0064                         TrackingParticle,
0065                         "TrackingParticles",
0066                         FWViewType::kAll3DBits | FWViewType::kAllRPZBits);