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  TEveStraightLineSet *ls = dynamic_cast<TEveStraightLineSet*> ( *parent->BeginChildren() );
36  Color_t c = FWProxyBuilderBase::item()->modelInfo( iId.index() ).displayProperties().color();
37  for (TEveProjectable::ProjList_i j = ls->BeginProjecteds(); j != ls->EndProjecteds(); ++j)
38  {
39  TEveStraightLineSet *pls = dynamic_cast<TEveStraightLineSet*> (*j);
40  pls->SetMarkerColor(c);
41  pls->ElementChanged();
42  }
43 
44  ls->SetMarkerColor(c);
45  ls->ElementChanged();
46 }
47 
48 
49 void
50 FWBeamSpotProxyBuilder::build( const reco::BeamSpot& bs, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
51 {
52  TEveStraightLineSet* ls = new TEveStraightLineSet();
53 
54  double pos[3] = { bs.x0(), bs.y0(), bs.z0() };
55  double e[3] = { bs.x0Error(), bs.y0Error(), bs.z0Error() };
56 
57  const Int_t N = 32;
58  const Float_t S = 2*TMath::Pi()/N;
59 
60  Float_t a = e[0], b = e[1];
61  for (Int_t i = 0; i<N; i++)
62  ls->AddLine(a*TMath::Cos(i*S) , b*TMath::Sin(i*S) , 0,
63  a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S), 0);
64 
65  a = e[0]; b = e[2];
66  for (Int_t i = 0; i<N; i++)
67  ls->AddLine(a*TMath::Cos(i*S) , 0, b*TMath::Sin(i*S),
68  a*TMath::Cos(i*S+S), 0, b*TMath::Sin(i*S+S));
69 
70  a = e[1]; b = e[2];
71  for (Int_t i = 0; i<N; i++)
72  ls->AddLine(0, a*TMath::Cos(i*S) , b*TMath::Sin(i*S),
73  0, a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S));
74 
75  ls->AddLine(0,0,0,0,0,0);
76  ls->AddMarker(0,0,0);
77  ls->SetMarkerStyle(21);
78  const FWDisplayProperties &dp =
80  ls->SetMarkerColor( dp.color() );
81 
82  ls->RefMainTrans().SetPos(pos);
83  setupAddElement(ls, &oItemHolder);
84 
85 }
86 
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:451
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
list parent
Definition: dbtoconf.py:74
static const int kAllRPZBits
Definition: FWViewType.h:58
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
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
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:535
double x0() const
x coordinate
Definition: BeamSpot.h:65