CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 private:
23  // Disable default copy constructor
25  // Disable default assignment operator
27  void localModelChanges(const FWModelId& iId,
28  TEveElement* parent,
29  FWViewType::EType viewType,
30  const FWViewContext* vc) override;
31 
33  void build(const reco::BeamSpot& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
34 };
35 
37  TEveElement* parent,
38  FWViewType::EType viewType,
39  const FWViewContext* vc) {
40  if (TEveStraightLineSet* ls = dynamic_cast<TEveStraightLineSet*>(*parent->BeginChildren())) {
41  Color_t c = FWProxyBuilderBase::item()->modelInfo(iId.index()).displayProperties().color();
42  for (TEveProjectable::ProjList_i j = ls->BeginProjecteds(); j != ls->EndProjecteds(); ++j) {
43  if (TEveStraightLineSet* pls = dynamic_cast<TEveStraightLineSet*>(*j)) {
44  pls->SetMarkerColor(c);
45  pls->ElementChanged();
46  }
47  }
48 
49  ls->SetMarkerColor(c);
50  ls->ElementChanged();
51  }
52 }
53 
55  unsigned int iIndex,
56  TEveElement& oItemHolder,
57  const FWViewContext*) {
58  TEveStraightLineSet* ls = new TEveStraightLineSet();
59 
60  double pos[3] = {bs.x0(), bs.y0(), bs.z0()};
61  double e[3] = {bs.x0Error(), bs.y0Error(), bs.z0Error()};
62 
63  const Int_t N = 32;
64  const Float_t S = 2 * TMath::Pi() / N;
65 
66  Float_t a = e[0], b = e[1];
67  for (Int_t i = 0; i < N; i++)
68  ls->AddLine(
69  a * TMath::Cos(i * S), b * TMath::Sin(i * S), 0, a * TMath::Cos(i * S + S), b * TMath::Sin(i * S + S), 0);
70 
71  a = e[0];
72  b = e[2];
73  for (Int_t i = 0; i < N; i++)
74  ls->AddLine(
75  a * TMath::Cos(i * S), 0, b * TMath::Sin(i * S), a * TMath::Cos(i * S + S), 0, b * TMath::Sin(i * S + S));
76 
77  a = e[1];
78  b = e[2];
79  for (Int_t i = 0; i < N; i++)
80  ls->AddLine(
81  0, a * TMath::Cos(i * S), b * TMath::Sin(i * S), 0, a * TMath::Cos(i * S + S), b * TMath::Sin(i * S + S));
82 
83  ls->AddLine(0, 0, 0, 0, 0, 0);
84  ls->AddMarker(0, 0, 0);
85  ls->SetMarkerStyle(21);
87  ls->SetMarkerColor(dp.color());
88 
89  ls->RefMainTrans().SetPos(pos);
90  setupAddElement(ls, &oItemHolder);
91 }
92 
95  "Beam Spot",
const double Pi
double z0() const
z coordinate
Definition: BeamSpot.h:65
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:403
static const int kAllRPZBits
Definition: FWViewType.h:67
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWBeamSpotProxyBuilder & operator=(const FWBeamSpotProxyBuilder &)=delete
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:68
Color_t color() const
void localModelChanges(const FWModelId &iId, TEveElement *parent, FWViewType::EType viewType, const FWViewContext *vc) override
int index() const
Definition: FWModelId.h:41
double z0Error() const
error on z
Definition: BeamSpot.h:90
double x0Error() const
error on x
Definition: BeamSpot.h:86
double y0Error() const
error on y
Definition: BeamSpot.h:88
def ls(path, rec=False)
Definition: eostools.py:349
#define N
Definition: blowfish.cc:9
#define REGISTER_PROXYBUILDER_METHODS()
double b
Definition: hdecay.h:118
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
double a
Definition: hdecay.h:119
double y0() const
y coordinate
Definition: BeamSpot.h:63
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
~FWBeamSpotProxyBuilder(void) override
double x0() const
x coordinate
Definition: BeamSpot.h:61