CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
FWCaloClusterProxyBuilder Class Reference
Inheritance diagram for FWCaloClusterProxyBuilder:
FWHeatmapProxyBuilderTemplate< reco::CaloCluster > FWSimpleProxyBuilder FWProxyBuilderBase

Public Member Functions

 FWCaloClusterProxyBuilder (void)
 
const std::string & purpose () const
 
const std::string & typeName () const
 
const std::string & view () const
 
 ~FWCaloClusterProxyBuilder (void) override
 
- Public Member Functions inherited from FWHeatmapProxyBuilderTemplate< reco::CaloCluster >
 FWHeatmapProxyBuilderTemplate ()
 
- Public Member Functions inherited from FWSimpleProxyBuilder
 FWSimpleProxyBuilder (const std::type_info &iType)
 
 ~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 FWEventItem *iItem, TEveElementList *product, const FWViewContext *vc) override
 
void build (const reco::CaloCluster &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *) override
 
 FWCaloClusterProxyBuilder (const FWCaloClusterProxyBuilder &)=delete
 
const FWCaloClusterProxyBuilderoperator= (const FWCaloClusterProxyBuilder &)=delete
 
void setItem (const FWEventItem *iItem) override
 

Private Attributes

bool enableTimeFilter
 
bool heatmap
 
long layer
 
double saturation_energy
 
double timeLowerBound
 
double timeUpperBound
 
edm::Handle< edm::ValueMap< float > > TimeValueMapHandle
 
bool z_minus
 
bool z_plus
 

Additional Inherited Members

- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >::iterator Product_it
 
- Protected Member Functions inherited from FWHeatmapProxyBuilderTemplate< reco::CaloCluster >
void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *vc) override
 
void build (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *context) override
 
void buildViewType (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType viewType, const FWViewContext *context) override
 
virtual void buildViewType (const reco::CaloCluster &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType viewType, const FWViewContext *)
 
const reco::CaloClustermodelData (int index)
 
void setItem (const FWEventItem *iItem) override
 
- Protected Member Functions inherited from FWSimpleProxyBuilder
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< reco::CaloCluster >
std::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< reco::CaloCluster >
static uint8_t gradient [3][gradient_steps]
 
static uint8_t gradient_steps
 

Detailed Description

Definition at line 11 of file FWCaloClusterProxyBuilder.cc.

Constructor & Destructor Documentation

FWCaloClusterProxyBuilder::FWCaloClusterProxyBuilder ( void  )
inline

Definition at line 14 of file FWCaloClusterProxyBuilder.cc.

14 {}
FWCaloClusterProxyBuilder::~FWCaloClusterProxyBuilder ( void  )
inlineoverride

Definition at line 15 of file FWCaloClusterProxyBuilder.cc.

15 {}
FWCaloClusterProxyBuilder::FWCaloClusterProxyBuilder ( const FWCaloClusterProxyBuilder )
privatedelete

Member Function Documentation

void FWCaloClusterProxyBuilder::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext vc 
)
overrideprivatevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 50 of file FWCaloClusterProxyBuilder.cc.

References FWProxyBuilderBase::build(), MessageLogger_cfi::cerr, enableTimeFilter, edm::EventBase::getByLabel(), FWEventItem::getConfig(), FWEventItem::getEvent(), heatmap, edm::HandleBase::isValid(), FWProxyBuilderBase::item(), FWProxyBuilderBase::layer(), SiStripPI::max, min(), saturation_energy, timeLowerBound, timeUpperBound, TimeValueMapHandle, FWProxyBuilderConfiguration::value(), z_minus, and z_plus.

51 {
52  iItem->getEvent()->getByLabel(edm::InputTag("hgcalLayerClusters", "timeLayerCluster"), TimeValueMapHandle);
54  timeLowerBound = std::min(item()->getConfig()->value<double>("TimeLowerBound(ns)"), item()->getConfig()->value<double>("TimeUpperBound(ns)"));
55  timeUpperBound = std::max(item()->getConfig()->value<double>("TimeLowerBound(ns)"), item()->getConfig()->value<double>("TimeUpperBound(ns)"));
56  }
57  else {
58  std::cerr << "Warning: couldn't locate 'timeLayerCluster' ValueMap in root file." << std::endl;
59  }
60 
61  layer = item()->getConfig()->value<long>("Layer");
62  saturation_energy = item()->getConfig()->value<double>("EnergyCutOff");
63  heatmap = item()->getConfig()->value<bool>("Heatmap");
64  z_plus = item()->getConfig()->value<bool>("Z+");
65  z_minus = item()->getConfig()->value<bool>("Z-");
66  enableTimeFilter = item()->getConfig()->value<bool>("EnableTimeFilter");
67 
68  FWHeatmapProxyBuilderTemplate::build(iItem, product, vc);
69 }
edm::Handle< edm::ValueMap< float > > TimeValueMapHandle
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:169
const FWEventItem * item() const
T min(T a, T b)
Definition: MathUtil.h:58
bool isValid() const
Definition: HandleBase.h:74
const edm::EventBase * getEvent() const
Definition: FWEventItem.h:148
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
void FWCaloClusterProxyBuilder::build ( const reco::CaloCluster 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< reco::CaloCluster >.

Definition at line 71 of file FWCaloClusterProxyBuilder.cc.

References reco::CaloCluster::algo(), create_public_lumi_plots::color, constexpr, enableTimeFilter, reco::CaloCluster::energy(), fireworks::energyTower3DCorners(), f, edm::ValueMap< T >::get(), FWGeometry::getCorners(), FWEventItem::getGeom(), FWGeometry::getParameters(), FWGeometry::getShapePars(), FWHeatmapProxyBuilderTemplate< reco::CaloCluster >::gradient, FWHeatmapProxyBuilderTemplate< reco::CaloCluster >::gradient_steps, heatmap, FWHeatmapProxyBuilderTemplate< reco::CaloCluster >::hitmap, reco::CaloCluster::hitsAndFractions(), mps_fire::i, edm::HandleBase::isValid(), FWProxyBuilderBase::item(), FWProxyBuilderBase::layer(), create_public_lumi_plots::marker, PFRecoTauDiscriminationByIsolation_cfi::offset, TCMET_cfi::radius, DetId::rawId(), saturation_energy, reco::CaloCluster::seed(), protons_cff::time, timeUpperBound, TimeValueMapHandle, globals_cff::x1, z, z_minus, and z_plus.

72 {
74  {
75  const float time = TimeValueMapHandle->get(iIndex);
76  if (time < timeLowerBound || time > timeUpperBound)
77  return;
78  }
79 
80  std::vector<std::pair<DetId, float>> clusterDetIds = iData.hitsAndFractions();
81 
82  bool h_hex(false);
83  TEveBoxSet *hex_boxset = new TEveBoxSet();
84  if (!heatmap)
85  hex_boxset->UseSingleColor();
86  hex_boxset->SetPickable(true);
87  hex_boxset->Reset(TEveBoxSet::kBT_Hex, true, 64);
88  hex_boxset->SetAntiFlick(true);
89 
90  bool h_box(false);
91  TEveBoxSet *boxset = new TEveBoxSet();
92  if (!heatmap)
93  boxset->UseSingleColor();
94  boxset->SetPickable(true);
95  boxset->Reset(TEveBoxSet::kBT_FreeBox, true, 64);
96  boxset->SetAntiFlick(true);
97 
98  for (std::vector<std::pair<DetId, float>>::iterator it = clusterDetIds.begin(), itEnd = clusterDetIds.end();
99  it != itEnd; ++it)
100  {
101  const uint8_t type = ((it->first >> 28) & 0xF);
102 
103  const float *corners = item()->getGeom()->getCorners(it->first);
104  if (corners == nullptr)
105  continue;
106 
107  // HGCal
108  if (iData.algo() == 8 || (type >= 8 && type <= 10))
109  {
110 
111  if (heatmap && hitmap.find(it->first) == hitmap.end())
112  continue;
113 
114  const bool z = (it->first >> 25) & 0x1;
115 
116  // discard everything thats not at the side that we are intersted in
117  if (
118  ((z_plus & z_minus) != 1) &&
119  (((z_plus | z_minus) == 0) || !(z == z_minus || z == !z_plus)))
120  continue;
121 
122  const float *parameters = item()->getGeom()->getParameters(it->first);
123  const float *shapes = item()->getGeom()->getShapePars(it->first);
124 
125  if (parameters == nullptr || shapes == nullptr)
126  continue;
127 
128  const int total_points = parameters[0];
129  const bool isScintillator = (total_points == 4);
130 
131  uint8_t ll = layer;
132  if (layer > 0)
133  {
134  if (layer > 28)
135  {
136  if (type == 8)
137  {
138  continue;
139  }
140  ll -= 28;
141  }
142  else
143  {
144  if (type != 8)
145  {
146  continue;
147  }
148  }
149 
150  if (ll != ((it->first >> (isScintillator ? 17 : 20)) & 0x1F))
151  continue;
152  }
153 
154  // seed
155  if (iData.seed().rawId() == it->first.rawId())
156  {
157  TEveStraightLineSet *marker = new TEveStraightLineSet;
158  marker->SetLineWidth(1);
159 
160  // center of RecHit
161  const float center[3] = { corners[total_points*3 + 0], corners[total_points*3+ 1], corners[total_points*3 + 2] + shapes[3] * 0.5f };
162 
163  // draw 3D cross
164  const float crossScale = 1.0f + fmin(iData.energy(), 5.0f);
165  marker->AddLine(
166  center[0] - crossScale, center[1], center[2],
167  center[0] + crossScale, center[1], center[2]);
168  marker->AddLine(
169  center[0], center[1] - crossScale, center[2],
170  center[0], center[1] + crossScale, center[2]);
171  marker->AddLine(
172  center[0], center[1], center[2] - crossScale,
173  center[0], center[1], center[2] + crossScale);
174 
175  oItemHolder.AddElement(marker);
176  }
177 
178  const float energy = fmin((item()->getConfig()->value<bool>("Cluster(0)/RecHit(1)") ? hitmap[it->first]->energy() : iData.energy()) / saturation_energy, 1.0f);
179  const uint8_t colorFactor = gradient_steps*energy;
180 
181  // Scintillator
182  if (isScintillator)
183  {
184  const int total_vertices = 3 * total_points;
185 
186  std::vector<float> pnts(24);
187  for (int i = 0; i < total_points; ++i)
188  {
189  pnts[i * 3 + 0] = corners[i * 3];
190  pnts[i * 3 + 1] = corners[i * 3 + 1];
191  pnts[i * 3 + 2] = corners[i * 3 + 2];
192 
193  pnts[(i * 3 + 0) + total_vertices] = corners[i * 3];
194  pnts[(i * 3 + 1) + total_vertices] = corners[i * 3 + 1];
195  pnts[(i * 3 + 2) + total_vertices] = corners[i * 3 + 2] + shapes[3];
196  }
197  boxset->AddBox(&pnts[0]);
198  if (heatmap)
199  {
200  energy ?
201  boxset->DigitColor(gradient[0][colorFactor], gradient[1][colorFactor], gradient[2][colorFactor]) :
202  boxset->DigitColor(64, 64, 64);
203  }
204 
205  h_box = true;
206  }
207  // Silicon
208  else
209  {
210  constexpr int offset = 9;
211 
212  float centerX = (corners[6] + corners[6 + offset]) / 2;
213  float centerY = (corners[7] + corners[7 + offset]) / 2;
214  float radius = fabs(corners[6] - corners[6 + offset]) / 2;
215  hex_boxset->AddHex(TEveVector(centerX, centerY, corners[2]),
216  radius, 90.0, shapes[3]);
217  if (heatmap)
218  {
219  energy ?
220  hex_boxset->DigitColor(gradient[0][colorFactor], gradient[1][colorFactor], gradient[2][colorFactor]) :
221  hex_boxset->DigitColor(64, 64, 64);
222  }
223 
224  h_hex = true;
225  }
226  }
227  // Not HGCal
228  else
229  {
230  h_box = true;
231 
232  std::vector<float> pnts(24);
233  fireworks::energyTower3DCorners(corners, (*it).second, pnts);
234  boxset->AddBox(&pnts[0]);
235  }
236  }
237 
238  if (h_hex)
239  {
240  hex_boxset->RefitPlex();
241 
242  hex_boxset->CSCTakeAnyParentAsMaster();
243  if (!heatmap)
244  {
245  hex_boxset->CSCApplyMainColorToMatchingChildren();
246  hex_boxset->CSCApplyMainTransparencyToMatchingChildren();
247  hex_boxset->SetMainColor(item()->modelInfo(iIndex).displayProperties().color());
248  hex_boxset->SetMainTransparency(item()->defaultDisplayProperties().transparency());
249  }
250  oItemHolder.AddElement(hex_boxset);
251  }
252 
253  if (h_box)
254  {
255  boxset->RefitPlex();
256 
257  boxset->CSCTakeAnyParentAsMaster();
258  if (!heatmap)
259  {
260  boxset->CSCApplyMainColorToMatchingChildren();
261  boxset->CSCApplyMainTransparencyToMatchingChildren();
262  boxset->SetMainColor(item()->modelInfo(iIndex).displayProperties().color());
263  boxset->SetMainTransparency(item()->defaultDisplayProperties().transparency());
264  }
265  oItemHolder.AddElement(boxset);
266  }
267 }
edm::Handle< edm::ValueMap< float > > TimeValueMapHandle
type
Definition: HCALResponse.h:21
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:446
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:197
const FWEventItem * item() const
AlgoId algo() const
algorithm identifier
Definition: CaloCluster.h:177
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:462
double f[11][100]
double energy() const
cluster energy
Definition: CaloCluster.h:126
bool isValid() const
Definition: HandleBase.h:74
const_reference_type get(ProductID id, size_t idx) const
Definition: ValueMap.h:140
void energyTower3DCorners(const float *corners, float scale, std::vector< float > &, bool reflect=false)
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:207
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:430
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:686
#define constexpr
const std::string & FWCaloClusterProxyBuilder::classPurpose ( )
static

Definition at line 269 of file FWCaloClusterProxyBuilder.cc.

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

Definition at line 269 of file FWCaloClusterProxyBuilder.cc.

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

Definition at line 269 of file FWCaloClusterProxyBuilder.cc.

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

Definition at line 269 of file FWCaloClusterProxyBuilder.cc.

const FWCaloClusterProxyBuilder& FWCaloClusterProxyBuilder::operator= ( const FWCaloClusterProxyBuilder )
privatedelete
const std::string& FWCaloClusterProxyBuilder::purpose ( ) const
inline
void FWCaloClusterProxyBuilder::setItem ( const FWEventItem iItem)
overrideprivatevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 38 of file FWCaloClusterProxyBuilder.cc.

References FWProxyBuilderConfiguration::assertParam(), FWEventItem::getConfig(), and FWHeatmapProxyBuilderTemplate< T >::setItem().

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

39 {
41  if (iItem)
42  {
43  iItem->getConfig()->assertParam("Cluster(0)/RecHit(1)", false);
44  iItem->getConfig()->assertParam("EnableTimeFilter", false);
45  iItem->getConfig()->assertParam("TimeLowerBound(ns)", 0.01, 0.0, 75.0);
46  iItem->getConfig()->assertParam("TimeUpperBound(ns)", 0.01, 0.0, 75.0);
47  }
48 }
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:169
void setItem(const FWEventItem *iItem) override
FWGenericParameter< T > * assertParam(const std::string &name, T def)
const std::string& FWCaloClusterProxyBuilder::typeName ( ) const
inline
const std::string& FWCaloClusterProxyBuilder::view ( ) const
inline

Member Data Documentation

bool FWCaloClusterProxyBuilder::enableTimeFilter
private

Definition at line 27 of file FWCaloClusterProxyBuilder.cc.

Referenced by build().

bool FWCaloClusterProxyBuilder::heatmap
private

Definition at line 24 of file FWCaloClusterProxyBuilder.cc.

Referenced by build().

long FWCaloClusterProxyBuilder::layer
private
double FWCaloClusterProxyBuilder::saturation_energy
private

Definition at line 23 of file FWCaloClusterProxyBuilder.cc.

Referenced by build().

double FWCaloClusterProxyBuilder::timeLowerBound
private

Definition at line 21 of file FWCaloClusterProxyBuilder.cc.

Referenced by build().

double FWCaloClusterProxyBuilder::timeUpperBound
private

Definition at line 21 of file FWCaloClusterProxyBuilder.cc.

Referenced by build().

edm::Handle<edm::ValueMap<float> > FWCaloClusterProxyBuilder::TimeValueMapHandle
private

Definition at line 20 of file FWCaloClusterProxyBuilder.cc.

Referenced by build().

bool FWCaloClusterProxyBuilder::z_minus
private

Definition at line 26 of file FWCaloClusterProxyBuilder.cc.

Referenced by build().

bool FWCaloClusterProxyBuilder::z_plus
private

Definition at line 25 of file FWCaloClusterProxyBuilder.cc.

Referenced by build().