CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/Fireworks/Tracks/plugins/FWBeamSpotOnlineProxyBuilder.cc

Go to the documentation of this file.
00001 /*
00002  *  FWBeamSpotProxyBuilder.cc
00003  *  FWorks
00004  *
00005  *  Created by Ianna Osborne on 7/29/10.
00006  *
00007  */
00008 
00009 #include "TEvePointSet.h"
00010 #include "TEveStraightLineSet.h"
00011 
00012 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
00013 #include "Fireworks/Core/interface/FWEventItem.h"
00014 
00015 #include "DataFormats/Scalers/interface/BeamSpotOnline.h"
00016 
00017 class FWBeamSpotOnlineProxyBuilder : public FWSimpleProxyBuilderTemplate<BeamSpotOnline>
00018 {
00019 public:
00020   FWBeamSpotOnlineProxyBuilder( void ) {}
00021   virtual ~FWBeamSpotOnlineProxyBuilder( void ) {}
00022    
00023   REGISTER_PROXYBUILDER_METHODS();
00024 
00025 private:
00026   // Disable default copy constructor
00027   FWBeamSpotOnlineProxyBuilder( const FWBeamSpotOnlineProxyBuilder& );
00028   // Disable default assignment operator
00029   const FWBeamSpotOnlineProxyBuilder& operator=( const FWBeamSpotOnlineProxyBuilder& );
00030 
00031   virtual void build( const BeamSpotOnline& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* );
00032 };
00033 
00034 void
00035 FWBeamSpotOnlineProxyBuilder::build( const BeamSpotOnline& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
00036 {
00037   TEvePointSet* pointSet = new TEvePointSet;
00038   setupAddElement( pointSet, &oItemHolder );
00039 
00040   TEveStraightLineSet* lineSet = new TEveStraightLineSet;
00041   setupAddElement( lineSet, &oItemHolder );
00042 
00043   double posx = iData.x();
00044   double posy = iData.y();
00045   double posz = iData.z();
00046   double errx = iData.err_x();
00047   double erry = iData.err_y();
00048   double errz = iData.err_z();
00049   
00050   pointSet->SetNextPoint( posx, posy, posz ); 
00051   pointSet->SetNextPoint( posx + errx, posy + erry, posz + errz );
00052   pointSet->SetNextPoint( posx - errx, posy - erry, posz - errz );
00053   
00054   lineSet->AddLine( posx + errx, posy + erry, posz + errz,
00055                     posx - errx, posy - erry, posz - errz );
00056 }
00057 
00058 REGISTER_FWPROXYBUILDER( FWBeamSpotOnlineProxyBuilder, BeamSpotOnline, "Beam Spot Online",  FWViewType::kAll3DBits | FWViewType::kAllRPZBits );