CMS 3D CMS Logo

FWBeamSpotProxyBuilder.cc
Go to the documentation of this file.
1 /*
2  * FWBeamSpotProxyBuilder.cc
3  * FWorks
4  *
5  * Created by Ianna Osborne on 7/29/10.
6  *
7  */
8 #include "TEveStraightLineSet.h"
9 
12 
14 
15 class FWBeamSpotProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::BeamSpot> {
16 public:
18  ~FWBeamSpotProxyBuilder(void) override {}
19 
21 
22  // Disable default copy constructor
24  // Disable default assignment operator
26 
27 private:
28  void localModelChanges(const FWModelId& iId,
29  TEveElement* parent,
30  FWViewType::EType viewType,
31  const FWViewContext* vc) override;
32 
34  void build(const reco::BeamSpot& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
35 };
36 
38  TEveElement* parent,
39  FWViewType::EType viewType,
40  const FWViewContext* vc) {
41  if (TEveStraightLineSet* ls = dynamic_cast<TEveStraightLineSet*>(*parent->BeginChildren())) {
42  Color_t c = FWProxyBuilderBase::item()->modelInfo(iId.index()).displayProperties().color();
43  for (TEveProjectable::ProjList_i j = ls->BeginProjecteds(); j != ls->EndProjecteds(); ++j) {
44  if (TEveStraightLineSet* pls = dynamic_cast<TEveStraightLineSet*>(*j)) {
45  pls->SetMarkerColor(c);
46  pls->ElementChanged();
47  }
48  }
49 
50  ls->SetMarkerColor(c);
51  ls->ElementChanged();
52  }
53 }
54 
56  unsigned int iIndex,
57  TEveElement& oItemHolder,
58  const FWViewContext*) {
59  TEveStraightLineSet* ls = new TEveStraightLineSet();
60 
61  double pos[3] = {bs.x0(), bs.y0(), bs.z0()};
62  double e[3] = {bs.x0Error(), bs.y0Error(), bs.z0Error()};
63 
64  const Int_t N = 32;
65  const Float_t S = 2 * TMath::Pi() / N;
66 
67  Float_t a = e[0], b = e[1];
68  for (Int_t i = 0; i < N; i++)
69  ls->AddLine(
70  a * TMath::Cos(i * S), b * TMath::Sin(i * S), 0, a * TMath::Cos(i * S + S), b * TMath::Sin(i * S + S), 0);
71 
72  a = e[0];
73  b = e[2];
74  for (Int_t i = 0; i < N; i++)
75  ls->AddLine(
76  a * TMath::Cos(i * S), 0, b * TMath::Sin(i * S), a * TMath::Cos(i * S + S), 0, b * TMath::Sin(i * S + S));
77 
78  a = e[1];
79  b = e[2];
80  for (Int_t i = 0; i < N; i++)
81  ls->AddLine(
82  0, a * TMath::Cos(i * S), b * TMath::Sin(i * S), 0, a * TMath::Cos(i * S + S), b * TMath::Sin(i * S + S));
83 
84  ls->AddLine(0, 0, 0, 0, 0, 0);
85  ls->AddMarker(0, 0, 0);
86  ls->SetMarkerStyle(21);
88  ls->SetMarkerColor(dp.color());
89 
90  ls->RefMainTrans().SetPos(pos);
91  setupAddElement(ls, &oItemHolder);
92 }
93 
96  "Beam Spot",
const double Pi
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:67
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
int index() const
Definition: FWModelId.h:41
const FWBeamSpotProxyBuilder & operator=(const FWBeamSpotProxyBuilder &)=delete
static const int kAll3DBits
Definition: FWViewType.h:68
void localModelChanges(const FWModelId &iId, TEveElement *parent, FWViewType::EType viewType, const FWViewContext *vc) override
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:403
def ls(path, rec=False)
Definition: eostools.py:349
#define N
Definition: blowfish.cc:9
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
~FWBeamSpotProxyBuilder(void) override
const FWEventItem * item() const