CMS 3D CMS Logo

FWConversionProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Conversions
4 // Class : FWConversionProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Dec 2 14:17:03 EST 2008
11 //
12 #include "TEveCompound.h"
13 #include "TEveLine.h"
14 #include "TEveScalableStraightLineSet.h"
15 
20 
24 
27 
29 //
30 // 3D and RPZ proxy builder with shared track list
31 //
33 
34 class FWConversionProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Conversion> {
35 public:
37  ~FWConversionProxyBuilder() override;
38 
39  bool haveSingleProduct() const override { return false; }
40  void cleanLocal() override;
41 
43 
44 private:
45  FWConversionProxyBuilder(const FWConversionProxyBuilder&) = delete; // stop default
46  const FWConversionProxyBuilder& operator=(const FWConversionProxyBuilder&) = delete; // stop default
47 
49  void buildViewType(const reco::Conversion& iData,
50  unsigned int iIndex,
51  TEveElement& oItemHolder,
53  const FWViewContext*) override;
54 
55  TEveElementList* requestCommon();
56 
57  TEveElementList* m_common;
58 };
59 
61  m_common = new TEveElementList("common conversion scene");
62  m_common->IncDenyDestroy();
63 }
64 
66 
68  if (m_common->HasChildren() == false) {
69  for (int i = 0; i < static_cast<int>(item()->size()); ++i) {
71  TEveLine* line = new TEveLine(0);
72  if (conversion.nTracks() == 2) {
73  if (fabs(conversion.zOfPrimaryVertexFromTracks()) < fireworks::Context::caloZ1())
74  line->SetNextPoint(0., 0., conversion.zOfPrimaryVertexFromTracks());
75  else
76  line->SetNextPoint(0., 0., 0.);
77 
78  float phi = conversion.pairMomentum().phi();
79  if (fabs(conversion.pairMomentum().eta()) < fireworks::Context::caloTransEta()) {
81  float z = radius / tan(conversion.pairMomentum().theta());
82  line->SetNextPoint(radius * cos(phi), radius * sin(phi), z);
83  } else {
84  float z = fireworks::Context::caloZ1();
85  float radius = z * tan(conversion.pairMomentum().theta());
86  z *= (conversion.pairMomentum().eta() / fabs(conversion.pairMomentum().eta()));
87  line->SetNextPoint(radius * cos(phi), radius * sin(phi), z);
88  }
89  } else {
90  line->SetNextPoint(0., 0., 0.);
91  line->SetNextPoint(0., 0., 0.);
92  }
93 
95  m_common->AddElement(line);
96  }
97  }
98 
99  return m_common;
100 }
101 
102 void FWConversionProxyBuilder::cleanLocal() { m_common->DestroyElements(); }
103 
105  unsigned int iIndex,
106  TEveElement& oItemHolder,
108  const FWViewContext*) {
109  TEveElementList* lines = requestCommon();
110  TEveElement::List_i linIt = lines->BeginChildren();
111  std::advance(linIt, iIndex);
112  TEveLine* line = (TEveLine*)((*linIt)->CloneElement());
113  TEveVector bvec = line->GetLineStart();
114  TEveVector evec = line->GetLineEnd();
115  if (bvec.Mag() != evec.Mag())
116  setupAddElement(*linIt, &oItemHolder);
117 }
118 
121  "Conversions",
FWConversionProxyBuilder::~FWConversionProxyBuilder
~FWConversionProxyBuilder() override
Definition: FWConversionProxyBuilder.cc:65
reco::Conversion
Definition: Conversion.h:23
mps_fire.i
i
Definition: mps_fire.py:428
FWSimpleProxyBuilderTemplate.h
edm::conversion
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
FWViewType::EType
EType
Definition: FWViewType.h:31
FWProxyBuilderBase::setupElement
void setupElement(TEveElement *el, bool color=true) const
Definition: FWProxyBuilderBase.cc:358
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
FWConversionProxyBuilder::buildViewType
void buildViewType(const reco::Conversion &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
Definition: FWConversionProxyBuilder.cc:104
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:27
FWSimpleProxyBuilderTemplate< reco::Conversion >::modelData
const reco::Conversion & modelData(int index)
Definition: FWSimpleProxyBuilderTemplate.h:43
TrackUtils.h
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
FWViewType.h
DDAxes::z
fireworks::Context::caloTransEta
static float caloTransEta()
Definition: Context.cc:187
FWConversionProxyBuilder::cleanLocal
void cleanLocal() override
Definition: FWConversionProxyBuilder.cc:102
FWConversionProxyBuilder::operator=
const FWConversionProxyBuilder & operator=(const FWConversionProxyBuilder &)=delete
FWConversionProxyBuilder
Definition: FWConversionProxyBuilder.cc:34
groupFilesInBlocks.lines
lines
Definition: groupFilesInBlocks.py:95
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
GsfTrack.h
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
DDAxes::phi
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
makeSuperCluster.h
FWConversionProxyBuilder::FWConversionProxyBuilder
FWConversionProxyBuilder()
Definition: FWConversionProxyBuilder.cc:60
CandidateUtils.h
fireworks::Context::caloZ1
static float caloZ1(bool offset=true)
Definition: Context.cc:183
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
mps_splice.line
line
Definition: mps_splice.py:76
FWConversionProxyBuilder::haveSingleProduct
bool haveSingleProduct() const override
Definition: FWConversionProxyBuilder.cc:39
FWConversionProxyBuilder::m_common
TEveElementList * m_common
Definition: FWConversionProxyBuilder.cc:57
fireworks::Context::caloR1
static float caloR1(bool offset=true)
Definition: Context.cc:180
FWConversionProxyBuilder::requestCommon
TEveElementList * requestCommon()
Definition: FWConversionProxyBuilder.cc:67
Context.h
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
Conversion.h