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