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 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",
eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
FWEventItem::modelInfo
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
mps_fire.i
i
Definition: mps_fire.py:428
FWSimpleProxyBuilderTemplate.h
FWViewType::EType
EType
Definition: FWViewType.h:31
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWModelId
Definition: FWModelId.h:28
pos
Definition: PixelAliasList.h:18
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:27
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
FWEventItem::defaultDisplayProperties
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:403
cms::cuda::bs
bs
Definition: HistoContainer.h:76
BeamSpot.h
Calorimetry_cff.dp
dp
Definition: Calorimetry_cff.py:158
reco::BeamSpot
Definition: BeamSpot.h:21
N
#define N
Definition: blowfish.cc:9
FWModelId::index
int index() const
Definition: FWModelId.h:41
b
double b
Definition: hdecay.h:118
a
double a
Definition: hdecay.h:119
FWBeamSpotProxyBuilder::~FWBeamSpotProxyBuilder
~FWBeamSpotProxyBuilder(void) override
Definition: FWBeamSpotProxyBuilder.cc:18
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
FWBeamSpotProxyBuilder
Definition: FWBeamSpotProxyBuilder.cc:15
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
FWBeamSpotProxyBuilder::FWBeamSpotProxyBuilder
FWBeamSpotProxyBuilder(void)
Definition: FWBeamSpotProxyBuilder.cc:17
FWDisplayProperties
Definition: FWDisplayProperties.h:28
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWBeamSpotProxyBuilder::operator=
const FWBeamSpotProxyBuilder & operator=(const FWBeamSpotProxyBuilder &)=delete
FWBeamSpotProxyBuilder::localModelChanges
void localModelChanges(const FWModelId &iId, TEveElement *parent, FWViewType::EType viewType, const FWViewContext *vc) override
Definition: FWBeamSpotProxyBuilder.cc:36
S
Definition: CSCDBL1TPParametersExtended.h:16
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
class-composition.parent
parent
Definition: class-composition.py:98
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37