Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:53

0001 /*
0002  *  FWBeamSpotProxyBuilder.cc
0003  *  FWorks
0004  *
0005  *  Created by Ianna Osborne on 7/29/10.
0006  *
0007  */
0008 
0009 #include "TEvePointSet.h"
0010 #include "TEveStraightLineSet.h"
0011 
0012 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
0013 #include "Fireworks/Core/interface/FWEventItem.h"
0014 
0015 #include "DataFormats/Scalers/interface/BeamSpotOnline.h"
0016 
0017 class FWBeamSpotOnlineProxyBuilder : public FWSimpleProxyBuilderTemplate<BeamSpotOnline> {
0018 public:
0019   FWBeamSpotOnlineProxyBuilder(void) {}
0020   ~FWBeamSpotOnlineProxyBuilder(void) override {}
0021 
0022   REGISTER_PROXYBUILDER_METHODS();
0023 
0024   // Disable default copy constructor
0025   FWBeamSpotOnlineProxyBuilder(const FWBeamSpotOnlineProxyBuilder&) = delete;
0026   // Disable default assignment operator
0027   const FWBeamSpotOnlineProxyBuilder& operator=(const FWBeamSpotOnlineProxyBuilder&) = delete;
0028 
0029 private:
0030   using FWSimpleProxyBuilderTemplate<BeamSpotOnline>::build;
0031   void build(const BeamSpotOnline& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
0032 };
0033 
0034 void FWBeamSpotOnlineProxyBuilder::build(const BeamSpotOnline& iData,
0035                                          unsigned int iIndex,
0036                                          TEveElement& oItemHolder,
0037                                          const FWViewContext*) {
0038   TEvePointSet* pointSet = new TEvePointSet;
0039   setupAddElement(pointSet, &oItemHolder);
0040 
0041   TEveStraightLineSet* lineSet = new TEveStraightLineSet;
0042   setupAddElement(lineSet, &oItemHolder);
0043 
0044   double posx = iData.x();
0045   double posy = iData.y();
0046   double posz = iData.z();
0047   double errx = iData.err_x();
0048   double erry = iData.err_y();
0049   double errz = iData.err_z();
0050 
0051   pointSet->SetNextPoint(posx, posy, posz);
0052   pointSet->SetNextPoint(posx + errx, posy + erry, posz + errz);
0053   pointSet->SetNextPoint(posx - errx, posy - erry, posz - errz);
0054 
0055   lineSet->AddLine(posx + errx, posy + erry, posz + errz, posx - errx, posy - erry, posz - errz);
0056 }
0057 
0058 REGISTER_FWPROXYBUILDER(FWBeamSpotOnlineProxyBuilder,
0059                         BeamSpotOnline,
0060                         "Beam Spot Online",
0061                         FWViewType::kAll3DBits | FWViewType::kAllRPZBits);