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 
16 {
17 public:
19  virtual ~FWBeamSpotProxyBuilder( void ) {}
20 
22 
23 private:
24  // Disable default copy constructor
26  // Disable default assignment operator
28  virtual void localModelChanges(const FWModelId& iId, TEveElement* parent, FWViewType::EType viewType, const FWViewContext* vc);
29 
30  virtual void build( const reco::BeamSpot& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* );
31 };
32 
34 {
35  if( TEveStraightLineSet *ls = dynamic_cast<TEveStraightLineSet*> ( *parent->BeginChildren() ))
36  {
37  Color_t c = FWProxyBuilderBase::item()->modelInfo( iId.index() ).displayProperties().color();
38  for (TEveProjectable::ProjList_i j = ls->BeginProjecteds(); j != ls->EndProjecteds(); ++j)
39  {
40  if( TEveStraightLineSet *pls = dynamic_cast<TEveStraightLineSet*> (*j))
41  {
42  pls->SetMarkerColor(c);
43  pls->ElementChanged();
44  }
45  }
46 
47  ls->SetMarkerColor(c);
48  ls->ElementChanged();
49  }
50 }
51 
52 void
53 FWBeamSpotProxyBuilder::build( const reco::BeamSpot& bs, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
54 {
55  TEveStraightLineSet* ls = new TEveStraightLineSet();
56 
57  double pos[3] = { bs.x0(), bs.y0(), bs.z0() };
58  double e[3] = { bs.x0Error(), bs.y0Error(), bs.z0Error() };
59 
60  const Int_t N = 32;
61  const Float_t S = 2*TMath::Pi()/N;
62 
63  Float_t a = e[0], b = e[1];
64  for (Int_t i = 0; i<N; i++)
65  ls->AddLine(a*TMath::Cos(i*S) , b*TMath::Sin(i*S) , 0,
66  a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S), 0);
67 
68  a = e[0]; b = e[2];
69  for (Int_t i = 0; i<N; i++)
70  ls->AddLine(a*TMath::Cos(i*S) , 0, b*TMath::Sin(i*S),
71  a*TMath::Cos(i*S+S), 0, b*TMath::Sin(i*S+S));
72 
73  a = e[1]; b = e[2];
74  for (Int_t i = 0; i<N; i++)
75  ls->AddLine(0, a*TMath::Cos(i*S) , b*TMath::Sin(i*S),
76  0, a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S));
77 
78  ls->AddLine(0,0,0,0,0,0);
79  ls->AddMarker(0,0,0);
80  ls->SetMarkerStyle(21);
81  const FWDisplayProperties &dp =
83  ls->SetMarkerColor( dp.color() );
84 
85  ls->RefMainTrans().SetPos(pos);
86  setupAddElement(ls, &oItemHolder);
87 }
88 
const double Pi
double z0() const
z coordinate
Definition: BeamSpot.h:69
int i
Definition: DBlmapReader.cc:9
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:452
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
list parent
Definition: dbtoconf.py:74
static const int kAllRPZBits
Definition: FWViewType.h:59
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:60
Color_t color() const
int index() const
Definition: FWModelId.h:50
virtual void localModelChanges(const FWModelId &iId, TEveElement *parent, FWViewType::EType viewType, const FWViewContext *vc)
int j
Definition: DBlmapReader.cc:9
double z0Error() const
error on z
Definition: BeamSpot.h:95
const FWBeamSpotProxyBuilder & operator=(const FWBeamSpotProxyBuilder &)
double x0Error() const
error on x
Definition: BeamSpot.h:91
double y0Error() const
error on y
Definition: BeamSpot.h:93
#define N
Definition: blowfish.cc:9
auto dp
Definition: deltaR.h:24
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
double y0() const
y coordinate
Definition: BeamSpot.h:67
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:536
double x0() const
x coordinate
Definition: BeamSpot.h:65