CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions
FWCaloParticleProxyBuilder Class Reference
Inheritance diagram for FWCaloParticleProxyBuilder:
FWHeatmapProxyBuilderTemplate< CaloParticle > FWSimpleProxyBuilder FWProxyBuilderBase

Public Member Functions

 FWCaloParticleProxyBuilder (void)
 
 FWCaloParticleProxyBuilder (const FWCaloParticleProxyBuilder &)=delete
 
const FWCaloParticleProxyBuilderoperator= (const FWCaloParticleProxyBuilder &)=delete
 
const std::string & purpose () const
 
const std::string & typeName () const
 
const std::string & view () const
 
 ~FWCaloParticleProxyBuilder (void) override
 
- Public Member Functions inherited from FWHeatmapProxyBuilderTemplate< CaloParticle >
 FWHeatmapProxyBuilderTemplate ()
 
 FWHeatmapProxyBuilderTemplate (const FWHeatmapProxyBuilderTemplate &)=delete
 
const FWHeatmapProxyBuilderTemplateoperator= (const FWHeatmapProxyBuilderTemplate &)=delete
 
- Public Member Functions inherited from FWSimpleProxyBuilder
 FWSimpleProxyBuilder (const std::type_info &iType)
 
 FWSimpleProxyBuilder (const FWSimpleProxyBuilder &)=delete
 
const FWSimpleProxyBuilderoperator= (const FWSimpleProxyBuilder &)=delete
 
 ~FWSimpleProxyBuilder () 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 havePerViewProduct (FWViewType::EType) 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 bool willHandleInteraction () const
 
virtual ~FWProxyBuilderBase ()
 

Static Public Member Functions

static const std::string & classPurpose ()
 
static const std::string & classRegisterTypeName ()
 
static const std::string & classTypeName ()
 
static const std::string & classView ()
 
- Static Public Member Functions inherited from FWSimpleProxyBuilder
static std::string typeOfBuilder ()
 Used by the plugin system to determine how the proxy uses the data from FWEventItem. More...
 
- 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...
 

Private Member Functions

void build (const CaloParticle &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *) override
 

Additional Inherited Members

- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >::iterator Product_it
 
- Protected Member Functions inherited from FWHeatmapProxyBuilderTemplate< CaloParticle >
void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *vc) override
 
void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
virtual void build (const void *, unsigned int iIndex, TEveElement &iItemHolder, const FWViewContext *)=0
 
void build (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *context) override
 
virtual void buildViewType (const void *, unsigned int iIndex, TEveElement &iItemHolder, FWViewType::EType, const FWViewContext *)=0
 
void buildViewType (const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *) override
 
void buildViewType (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType viewType, const FWViewContext *context) override
 
virtual void buildViewType (const CaloParticle &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType viewType, const FWViewContext *)
 
const CaloParticlemodelData (int index)
 
void setItem (const FWEventItem *iItem) override
 
- Protected Member Functions inherited from FWSimpleProxyBuilder
void build ()
 
virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
 
void buildViewType (const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *) override
 
void clean () override
 
- Protected Member Functions inherited from FWProxyBuilderBase
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)
 
virtual void modelChanges (const FWModelIds &, Product *)
 
const FWProxyBuilderBaseoperator= (const FWProxyBuilderBase &)
 
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
 
- Protected Attributes inherited from FWHeatmapProxyBuilderTemplate< CaloParticle >
std::unordered_map< DetId, const HGCRecHit *> * hitmap
 
- Protected Attributes inherited from FWSimpleProxyBuilder
FWSimpleProxyHelper m_helper
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 
- Static Protected Attributes inherited from FWHeatmapProxyBuilderTemplate< CaloParticle >
static constexpr uint8_t gradient [3][gradient_steps]
 
static constexpr uint8_t gradient_steps
 

Detailed Description

Definition at line 18 of file FWCaloParticleProxyBuilder.cc.

Constructor & Destructor Documentation

◆ FWCaloParticleProxyBuilder() [1/2]

FWCaloParticleProxyBuilder::FWCaloParticleProxyBuilder ( void  )
inline

Definition at line 20 of file FWCaloParticleProxyBuilder.cc.

20 {}

◆ ~FWCaloParticleProxyBuilder()

FWCaloParticleProxyBuilder::~FWCaloParticleProxyBuilder ( void  )
inlineoverride

Definition at line 21 of file FWCaloParticleProxyBuilder.cc.

21 {}

◆ FWCaloParticleProxyBuilder() [2/2]

FWCaloParticleProxyBuilder::FWCaloParticleProxyBuilder ( const FWCaloParticleProxyBuilder )
delete

Member Function Documentation

◆ build()

void FWCaloParticleProxyBuilder::build ( const CaloParticle iData,
unsigned int  iIndex,
TEveElement &  oItemHolder,
const FWViewContext  
)
overrideprivatevirtual

iIndex is the index where iData is found in the container from which it came iItemHolder is the object to which you add your own objects which inherit from TEveElement

Reimplemented from FWHeatmapProxyBuilderTemplate< CaloParticle >.

Definition at line 34 of file FWCaloParticleProxyBuilder.cc.

References c, FWEventItem::getConfig(), FWGeometry::getCorners(), FWEventItem::getGeom(), FWGeometry::getParameters(), FWGeometry::getShapePars(), FWHeatmapProxyBuilderTemplate< CaloParticle >::gradient, FWHeatmapProxyBuilderTemplate< CaloParticle >::gradient_steps, FWHeatmapProxyBuilderTemplate< CaloParticle >::hitmap, mps_fire::i, FWProxyBuilderBase::item(), FWProxyBuilderBase::layer(), hltrates_dqm_sourceclient-live_cfg::offset, CosmicsPD_Skims::radius, CaloParticle::simClusters(), FWProxyBuilderConfiguration::value(), testProducerWithPsetDescEmpty_cfi::x1, and z.

37  {
38  const long layer = item()->getConfig()->value<long>("Layer");
39  const double saturation_energy = item()->getConfig()->value<double>("EnergyCutOff");
40  const bool heatmap = item()->getConfig()->value<bool>("Heatmap");
41  const bool z_plus = item()->getConfig()->value<bool>("Z+");
42  const bool z_minus = item()->getConfig()->value<bool>("Z-");
43 
44  bool h_hex(false);
45  TEveBoxSet *hex_boxset = new TEveBoxSet();
46  if (!heatmap)
47  hex_boxset->UseSingleColor();
48  hex_boxset->SetPickable(true);
49  hex_boxset->Reset(TEveBoxSet::kBT_Hex, true, 64);
50  hex_boxset->SetAntiFlick(true);
51 
52  bool h_box(false);
53  TEveBoxSet *boxset = new TEveBoxSet();
54  if (!heatmap)
55  boxset->UseSingleColor();
56  boxset->SetPickable(true);
57  boxset->Reset(TEveBoxSet::kBT_FreeBox, true, 64);
58  boxset->SetAntiFlick(true);
59 
60  for (const auto &c : iData.simClusters()) {
61  for (const auto &it : (*c).hits_and_fractions()) {
62  if (heatmap && hitmap->find(it.first) == hitmap->end())
63  continue;
64 
65  const bool z = (it.first >> 25) & 0x1;
66 
67  // discard everything thats not at the side that we are intersted in
68  if (((z_plus & z_minus) != 1) && (((z_plus | z_minus) == 0) || !(z == z_minus || z == !z_plus)))
69  continue;
70 
71  const float *corners = item()->getGeom()->getCorners(it.first);
72  const float *parameters = item()->getGeom()->getParameters(it.first);
73  const float *shapes = item()->getGeom()->getShapePars(it.first);
74 
75  if (corners == nullptr || parameters == nullptr || shapes == nullptr) {
76  continue;
77  }
78 
79  const int total_points = parameters[0];
80  const bool isScintillator = (total_points == 4);
81  const uint8_t type = ((it.first >> 28) & 0xF);
82 
83  uint8_t ll = layer;
84  if (layer > 0) {
85  if (layer > 28) {
86  if (type == 8) {
87  continue;
88  }
89  ll -= 28;
90  } else {
91  if (type != 8) {
92  continue;
93  }
94  }
95 
96  if (ll != ((it.first >> (isScintillator ? 17 : 20)) & 0x1F))
97  continue;
98  }
99 
100  // Scintillator
101  if (isScintillator) {
102  const int total_vertices = 3 * total_points;
103 
104  std::vector<float> pnts(24);
105  for (int i = 0; i < total_points; ++i) {
106  pnts[i * 3 + 0] = corners[i * 3];
107  pnts[i * 3 + 1] = corners[i * 3 + 1];
108  pnts[i * 3 + 2] = corners[i * 3 + 2];
109 
110  pnts[(i * 3 + 0) + total_vertices] = corners[i * 3];
111  pnts[(i * 3 + 1) + total_vertices] = corners[i * 3 + 1];
112  pnts[(i * 3 + 2) + total_vertices] = corners[i * 3 + 2] + shapes[3];
113  }
114  boxset->AddBox(&pnts[0]);
115  if (heatmap) {
116  const uint8_t colorFactor = gradient_steps * (fmin(hitmap->at(it.first)->energy() / saturation_energy, 1.0f));
117  boxset->DigitColor(gradient[0][colorFactor], gradient[1][colorFactor], gradient[2][colorFactor]);
118  }
119 
120  h_box = true;
121  }
122  // Silicon
123  else {
124  const int offset = 9;
125 
126  float centerX = (corners[6] + corners[6 + offset]) / 2;
127  float centerY = (corners[7] + corners[7 + offset]) / 2;
128  float radius = fabs(corners[6] - corners[6 + offset]) / 2;
129  hex_boxset->AddHex(TEveVector(centerX, centerY, corners[2]), radius, shapes[2], shapes[3]);
130  if (heatmap) {
131  const uint8_t colorFactor = gradient_steps * (fmin(hitmap->at(it.first)->energy() / saturation_energy, 1.0f));
132  hex_boxset->DigitColor(gradient[0][colorFactor], gradient[1][colorFactor], gradient[2][colorFactor]);
133  }
134 
135  h_hex = true;
136  }
137  }
138  }
139 
140  if (h_hex) {
141  hex_boxset->RefitPlex();
142 
143  hex_boxset->CSCTakeAnyParentAsMaster();
144  if (!heatmap) {
145  hex_boxset->CSCApplyMainColorToMatchingChildren();
146  hex_boxset->CSCApplyMainTransparencyToMatchingChildren();
147  hex_boxset->SetMainColor(item()->modelInfo(iIndex).displayProperties().color());
148  hex_boxset->SetMainTransparency(item()->defaultDisplayProperties().transparency());
149  }
150  oItemHolder.AddElement(hex_boxset);
151  }
152 
153  if (h_box) {
154  boxset->RefitPlex();
155 
156  boxset->CSCTakeAnyParentAsMaster();
157  if (!heatmap) {
158  boxset->CSCApplyMainColorToMatchingChildren();
159  boxset->CSCApplyMainTransparencyToMatchingChildren();
160  boxset->SetMainColor(item()->modelInfo(iIndex).displayProperties().color());
161  boxset->SetMainTransparency(item()->defaultDisplayProperties().transparency());
162  }
163  oItemHolder.AddElement(boxset);
164  }
165 }
const SimClusterRefVector & simClusters() const
Definition: CaloParticle.h:72
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:439
static constexpr uint8_t gradient[3][gradient_steps]
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:461
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:450
const FWEventItem * item() const
std::unordered_map< DetId, const HGCRecHit *> * hitmap

◆ classPurpose()

const std::string & FWCaloParticleProxyBuilder::classPurpose ( )
static

Definition at line 170 of file FWCaloParticleProxyBuilder.cc.

◆ classRegisterTypeName()

const std::string & FWCaloParticleProxyBuilder::classRegisterTypeName ( )
static

Definition at line 170 of file FWCaloParticleProxyBuilder.cc.

◆ classTypeName()

const std::string & FWCaloParticleProxyBuilder::classTypeName ( )
static

Definition at line 170 of file FWCaloParticleProxyBuilder.cc.

◆ classView()

const std::string & FWCaloParticleProxyBuilder::classView ( )
static

Definition at line 170 of file FWCaloParticleProxyBuilder.cc.

◆ operator=()

const FWCaloParticleProxyBuilder& FWCaloParticleProxyBuilder::operator= ( const FWCaloParticleProxyBuilder )
delete

◆ purpose()

const std::string& FWCaloParticleProxyBuilder::purpose ( ) const
inline

Definition at line 23 of file FWCaloParticleProxyBuilder.cc.

30 :
31  void build(const CaloParticle &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *) override;

◆ typeName()

const std::string& FWCaloParticleProxyBuilder::typeName ( ) const
inline

Definition at line 23 of file FWCaloParticleProxyBuilder.cc.

30 :
31  void build(const CaloParticle &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *) override;

◆ view()

const std::string& FWCaloParticleProxyBuilder::view ( ) const
inline

Definition at line 23 of file FWCaloParticleProxyBuilder.cc.

30 :
31  void build(const CaloParticle &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *) override;