CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWCaloRecHitDigitSetProxyBuilder Class Reference

#include <FWCaloRecHitDigitSetProxyBuilder.h>

Inheritance diagram for FWCaloRecHitDigitSetProxyBuilder:
FWDigitSetProxyBuilder FWProxyBuilderBase FWCastorRecHitProxyBuilder FWEcalRecHitProxyBuilder FWFTLRecHitProxyBuilder FWHBHERecHitProxyBuilder FWHFRecHitProxyBuilder FWHGCRecHitProxyBuilder FWHORecHitProxyBuilder FWZDCRecHitProxyBuilder

Public Member Functions

void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
 FWCaloRecHitDigitSetProxyBuilder ()
 
bool havePerViewProduct (FWViewType::EType) const override
 
virtual void invertBox (bool x)
 
virtual float scaleFactor (const FWViewContext *vc)
 
void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
 
void setItem (const FWEventItem *iItem) override
 
virtual void viewContextBoxScale (const float *corners, float scale, bool plotEt, std::vector< float > &scaledCorners, const CaloRecHit *)
 
 ~FWCaloRecHitDigitSetProxyBuilder (void) override
 
- Public Member Functions inherited from FWDigitSetProxyBuilder
 FWDigitSetProxyBuilder ()
 
bool willHandleInteraction () const override
 
 ~FWDigitSetProxyBuilder () override
 
- Public Member Functions inherited from FWProxyBuilderBase
void build ()
 
virtual bool canHandle (const FWEventItem &)
 
const fireworks::Contextcontext () const
 
TEveElementList * createProduct (FWViewType::EType, const FWViewContext *)
 
 FWProxyBuilderBase ()
 
bool getHaveWindow () const
 
virtual bool haveSingleProduct () const
 
const FWEventItemitem () const
 
virtual void itemBeingDestroyed (const FWEventItem *)
 
void itemChanged (const FWEventItem *)
 
int layer () const
 
void modelChanges (const FWModelIds &)
 
void removePerViewProduct (FWViewType::EType, const FWViewContext *vc)
 
void scaleChanged (const FWViewContext *)
 
void setHaveWindow (bool iFlag)
 
virtual void setInteractionList (FWInteractionList *, const std::string &)
 
void setupAddElement (TEveElement *el, TEveElement *parent, bool set_color=true) const
 
void setupElement (TEveElement *el, bool color=true) const
 
virtual ~FWProxyBuilderBase ()
 

Private Member Functions

 FWCaloRecHitDigitSetProxyBuilder (const FWCaloRecHitDigitSetProxyBuilder &)=delete
 
const FWCaloRecHitDigitSetProxyBuilderoperator= (const FWCaloRecHitDigitSetProxyBuilder &)=delete
 

Private Attributes

double m_enlarge
 
bool m_ignoreGeoShapeSize
 
bool m_invertBox
 
TEveVector m_vector
 

Additional Inherited Members

- Static Public Member Functions inherited from FWProxyBuilderBase
static bool representsSubPart ()
 
static std::string typeOfBuilder ()
 Used by the plugin system to determine how the proxy uses the data from FWEventItem. More...
 
- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >::iterator Product_it
 
- Protected Member Functions inherited from FWDigitSetProxyBuilder
void addBox (TEveBoxSet *set, const float *pnts, const FWDisplayProperties &dp)
 
TEveBoxSet * addBoxSetToProduct (TEveElementList *product)
 
TEveBoxSet * getBoxSet () const
 
- Protected Member Functions inherited from FWProxyBuilderBase
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
 
virtual void clean ()
 
virtual void cleanLocal ()
 
TEveCompound * createCompound (bool set_color=true, bool propagate_color_to_all_children=false) const
 
 FWProxyBuilderBase (const FWProxyBuilderBase &)
 
void increaseComponentTransparency (unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
 
virtual void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
 
const FWProxyBuilderBaseoperator= (const FWProxyBuilderBase &)
 
virtual bool visibilityModelChanges (const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 9 of file FWCaloRecHitDigitSetProxyBuilder.h.

Constructor & Destructor Documentation

FWCaloRecHitDigitSetProxyBuilder::FWCaloRecHitDigitSetProxyBuilder ( )
FWCaloRecHitDigitSetProxyBuilder::~FWCaloRecHitDigitSetProxyBuilder ( void  )
inlineoverride

Definition at line 13 of file FWCaloRecHitDigitSetProxyBuilder.h.

References setItem().

13 {}
FWCaloRecHitDigitSetProxyBuilder::FWCaloRecHitDigitSetProxyBuilder ( const FWCaloRecHitDigitSetProxyBuilder )
privatedelete

Member Function Documentation

void FWCaloRecHitDigitSetProxyBuilder::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext vc 
)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 142 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References FWDigitSetProxyBuilder::addBox(), FWDigitSetProxyBuilder::addBoxSetToProduct(), FWProxyBuilderBase::context(), CaloRecHit::detid(), FWEventItem::ModelInfo::displayProperties(), CaloRecHit::energy(), f, FWEventItem::getConfig(), FWGeometry::getCorners(), FWViewContext::getEnergyScale(), fireworks::Context::getGeom(), FWViewEnergyScale::getPlotEt(), mps_fire::i, FWProxyBuilderBase::item(), m_enlarge, m_vector, FWEventItem::modelData(), FWEventItem::modelInfo(), Scenarios_cff::scale, scaleFactor(), FWEventItem::size(), findQualityFiles::size, FWProxyBuilderConfiguration::value(), viewContextBoxScale(), and fireworks::Context::voteMaxEtAndEnergy().

143 {
144  size_t size = iItem->size();
145  if (!size) return;
146 
147  // m_ignoreGeoShapeSize = item()->getConfig()->value<bool>("IgnoreShapeSize");
148  m_enlarge = item()->getConfig()->value<double>("Enlarge");
149 
150  std::vector<float> scaledCorners(24);
151 
152  float scale = scaleFactor(vc);
153 
154  TEveBoxSet* boxSet = addBoxSetToProduct(product);
155  boxSet->SetAntiFlick(kTRUE);
156  for (int index = 0; index < static_cast<int>(size); ++index)
157  {
158  const CaloRecHit* hit = (const CaloRecHit*)item()->modelData(index);
159 
160  const float* corners = context().getGeom()->getCorners(hit->detid());
161  if (corners)
162  {
163  m_vector.Set(0.f, 0.f, 0.f);
164  for( unsigned int i = 0; i < 24; i += 3 )
165  {
166  m_vector[0] += corners[i];
167  m_vector[1] += corners[i + 1];
168  m_vector[2] += corners[i + 2];
169  }
170  m_vector.Normalize();
171  context().voteMaxEtAndEnergy( m_vector.Perp() *hit->energy(), hit->energy());
172  viewContextBoxScale( corners, hit->energy()*scale, vc->getEnergyScale()->getPlotEt(), scaledCorners, hit);
173  }
174 
175  addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index).displayProperties());
176  }
177 }
constexpr float energy() const
Definition: CaloRecHit.h:31
size
Write out results.
const fireworks::Context & context() const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:169
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
constexpr const DetId & detid() const
Definition: CaloRecHit.h:35
const FWGeometry * getGeom() const
Definition: Context.h:83
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:183
FWViewEnergyScale * getEnergyScale() const
virtual void viewContextBoxScale(const float *corners, float scale, bool plotEt, std::vector< float > &scaledCorners, const CaloRecHit *)
const FWEventItem * item() const
double f[11][100]
virtual float scaleFactor(const FWViewContext *vc)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:297
size_t size() const
Definition: FWEventItem.cc:550
TEveBoxSet * addBoxSetToProduct(TEveElementList *product)
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:569
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
void addBox(TEveBoxSet *set, const float *pnts, const FWDisplayProperties &dp)
bool getPlotEt() const
bool FWCaloRecHitDigitSetProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 17 of file FWCaloRecHitDigitSetProxyBuilder.h.

References FWProxyBuilderBase::build(), class-composition::parent, scaleFactor(), and scaleProduct().

17 { return true; }
virtual void FWCaloRecHitDigitSetProxyBuilder::invertBox ( bool  x)
inlinevirtual
const FWCaloRecHitDigitSetProxyBuilder& FWCaloRecHitDigitSetProxyBuilder::operator= ( const FWCaloRecHitDigitSetProxyBuilder )
privatedelete

Referenced by invertBox().

float FWCaloRecHitDigitSetProxyBuilder::scaleFactor ( const FWViewContext vc)
virtual

Reimplemented in FWCastorRecHitProxyBuilder.

Definition at line 105 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References FWViewContext::getEnergyScale(), and FWViewEnergyScale::getScaleFactor3D().

Referenced by build(), havePerViewProduct(), FWCastorRecHitProxyBuilder::scaleFactor(), and scaleProduct().

106 {
107  // printf("scale face %f \n", vc->getEnergyScale()->getScaleFactor3D());
108  return vc->getEnergyScale()->getScaleFactor3D()/50;
109 }
float getScaleFactor3D() const
FWViewEnergyScale * getEnergyScale() const
void FWCaloRecHitDigitSetProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 114 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References b, CaloRecHit::detid(), CaloRecHit::energy(), FWDigitSetProxyBuilder::BFreeBox_t::fVertices, FWGeometry::getCorners(), FWViewContext::getEnergyScale(), FWEventItem::getGeom(), FWViewEnergyScale::getPlotEt(), FWProxyBuilderBase::item(), FWEventItem::modelData(), Scenarios_cff::scale, scaleFactor(), FWEventItem::size(), findQualityFiles::size, and viewContextBoxScale().

Referenced by havePerViewProduct().

115 {
116  size_t size = item()->size();
117  if (!size) return;
118 
119 
120  std::vector<float> scaledCorners(24);
121  float scale = scaleFactor(vc);
122 
123  assert(parent->NumChildren() == 1);
124  TEveBoxSet* boxSet = static_cast<TEveBoxSet*>(*parent->BeginChildren());
125 
126  for (int index = 0; index < static_cast<int>(size); ++index)
127  {
128  const CaloRecHit* hit = (const CaloRecHit*)item()->modelData(index);
129  const float* corners = item()->getGeom()->getCorners(hit->detid());
130  if (corners == nullptr) continue;
131 
133 
134  viewContextBoxScale(corners, hit->energy()*scale, vc->getEnergyScale()->getPlotEt(), scaledCorners, hit);
135  memcpy(b->fVertices, &scaledCorners[0], sizeof(b->fVertices));
136  }
137  boxSet->ElementChanged();
138 }
constexpr float energy() const
Definition: CaloRecHit.h:31
size
Write out results.
constexpr const DetId & detid() const
Definition: CaloRecHit.h:35
FWViewEnergyScale * getEnergyScale() const
virtual void viewContextBoxScale(const float *corners, float scale, bool plotEt, std::vector< float > &scaledCorners, const CaloRecHit *)
const FWEventItem * item() const
virtual float scaleFactor(const FWViewContext *vc)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:297
size_t size() const
Definition: FWEventItem.cc:550
double b
Definition: hdecay.h:120
const void * modelData(int iIndex) const
Definition: FWEventItem.cc:569
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683
bool getPlotEt() const
void FWCaloRecHitDigitSetProxyBuilder::setItem ( const FWEventItem iItem)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 19 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References FWProxyBuilderConfiguration::assertParam(), FWEventItem::getConfig(), and FWProxyBuilderBase::setItem().

Referenced by Vispa.Plugins.EdmBrowser.EventContentView.EventContentView::_addRow(), Vispa.Views.TableView.TableView::_createItem(), Vispa.Views.PropertyView.PropertyView::addCategory(), Vispa.Views.PropertyView.PropertyView::append(), and ~FWCaloRecHitDigitSetProxyBuilder().

20 {
22  if (iItem) {
23  iItem->getConfig()->assertParam( "Enlarge", 1.0, 1.0, 5.0);
24  // iItem->getConfig()->assertParam( "IgnoreShapeSize", false);
25  }
26 }
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:169
virtual void setItem(const FWEventItem *iItem)
FWGenericParameter< T > * assertParam(const std::string &name, T def)
void FWCaloRecHitDigitSetProxyBuilder::viewContextBoxScale ( const float *  corners,
float  scale,
bool  plotEt,
std::vector< float > &  scaledCorners,
const CaloRecHit  
)
virtual

Reimplemented in FWEcalRecHitProxyBuilder.

Definition at line 29 of file FWCaloRecHitDigitSetProxyBuilder.cc.

References f, mps_fire::i, fireworks::invertBox(), m_enlarge, m_ignoreGeoShapeSize, m_invertBox, m_vector, and Scenarios_cff::scale.

Referenced by build(), invertBox(), scaleProduct(), and FWEcalRecHitProxyBuilder::viewContextBoxScale().

30 {
31  scale *= m_enlarge;
33  {
34  // Same functionality as fireworks::energyTower3DCorners()
35 
36  for( int i = 0; i < 24; ++i )
37  scaledCorners[i] = corners[i];
38 
39  // Coordinates of a front face scaled
40  if( m_invertBox )
41  {
42  // We know, that an ES rechit geometry in -Z needs correction.
43  // The back face is actually its front face.
44  for( unsigned int i = 0; i < 12; i += 3 )
45  {
46  m_vector.Set( corners[i] - corners[i + 12], corners[i + 1] - corners[i + 13], corners[i + 2] - corners[i + 14] );
47  m_vector.Normalize();
48  m_vector *= scale;
49 
50  scaledCorners[i] = corners[i] + m_vector.fX;
51  scaledCorners[i + 1] = corners[i + 1] + m_vector.fY;
52  scaledCorners[i + 2] = corners[i + 2] + m_vector.fZ;
53  }
54  }
55  else
56  {
57  for( unsigned int i = 0; i < 12; i += 3 )
58  {
59  m_vector.Set( corners[i + 12] - corners[i], corners[i + 13] - corners[i + 1], corners[i + 14] - corners[i + 2] );
60  m_vector.Normalize();
61  m_vector *= scale;
62 
63  scaledCorners[i] = corners[i + 12];
64  scaledCorners[i + 1] = corners[i + 13];
65  scaledCorners[i + 2] = corners[i + 14];
66 
67  scaledCorners[i + 12] = corners[i + 12] + m_vector.fX;
68  scaledCorners[i + 13] = corners[i + 13] + m_vector.fY;
69  scaledCorners[i + 14] = corners[i + 14] + m_vector.fZ;
70  }
71  }
72  }
73  else {
74 
75  // Same functionality as fireworks::energyScaledBox3DCorners().
76 
77  m_vector.Set(0.f, 0.f, 0.f);
78  for( unsigned int i = 0; i < 24; i += 3 )
79  {
80  m_vector[0] += corners[i];
81  m_vector[1] += corners[i + 1];
82  m_vector[2] += corners[i + 2];
83  }
84  m_vector *= 1.f/8.f;
85 
86  if (plotEt)
87  {
88  scale *= m_vector.Perp()/m_vector.Mag();
89  }
90 
91  // Coordinates for a scaled version of the original box
92  for( unsigned int i = 0; i < 24; i += 3 )
93  {
94  scaledCorners[i] = m_vector[0] + ( corners[i] - m_vector[0] ) * scale;
95  scaledCorners[i + 1] = m_vector[1] + ( corners[i + 1] - m_vector[1] ) * scale;
96  scaledCorners[i + 2] = m_vector[2] + ( corners[i + 2] - m_vector[2] ) * scale;
97  }
98 
99  if( m_invertBox )
100  fireworks::invertBox( scaledCorners );
101  }
102 }
void invertBox(std::vector< float > &corners)
double f[11][100]

Member Data Documentation

double FWCaloRecHitDigitSetProxyBuilder::m_enlarge
private

Definition at line 32 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by build(), and viewContextBoxScale().

bool FWCaloRecHitDigitSetProxyBuilder::m_ignoreGeoShapeSize
private

Definition at line 31 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by viewContextBoxScale().

bool FWCaloRecHitDigitSetProxyBuilder::m_invertBox
private

Definition at line 30 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by invertBox(), and viewContextBoxScale().

TEveVector FWCaloRecHitDigitSetProxyBuilder::m_vector
private

Definition at line 33 of file FWCaloRecHitDigitSetProxyBuilder.h.

Referenced by build(), and viewContextBoxScale().