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)
 
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 ()
 
- 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 CaloParticle &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *) override
 
 FWCaloParticleProxyBuilder (const FWCaloParticleProxyBuilder &)=delete
 
const FWCaloParticleProxyBuilderoperator= (const FWCaloParticleProxyBuilder &)=delete
 

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 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 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 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::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 uint8_t gradient [3][gradient_steps]
 
static uint8_t gradient_steps
 

Detailed Description

Definition at line 18 of file FWCaloParticleProxyBuilder.cc.

Constructor & Destructor Documentation

FWCaloParticleProxyBuilder::FWCaloParticleProxyBuilder ( void  )
inline

Definition at line 21 of file FWCaloParticleProxyBuilder.cc.

21 {}
FWCaloParticleProxyBuilder::~FWCaloParticleProxyBuilder ( void  )
inlineoverride

Definition at line 22 of file FWCaloParticleProxyBuilder.cc.

22 {}
FWCaloParticleProxyBuilder::FWCaloParticleProxyBuilder ( const FWCaloParticleProxyBuilder )
privatedelete

Member Function Documentation

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 35 of file FWCaloParticleProxyBuilder.cc.

References EnergyCorrector::c, create_public_lumi_plots::color, 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(), PFRecoTauDiscriminationByIsolation_cfi::offset, TCMET_cfi::radius, CaloParticle::simClusters(), FWProxyBuilderConfiguration::value(), globals_cff::x1, and z.

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

Definition at line 185 of file FWCaloParticleProxyBuilder.cc.

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

Definition at line 185 of file FWCaloParticleProxyBuilder.cc.

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

Definition at line 185 of file FWCaloParticleProxyBuilder.cc.

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

Definition at line 185 of file FWCaloParticleProxyBuilder.cc.

const FWCaloParticleProxyBuilder& FWCaloParticleProxyBuilder::operator= ( const FWCaloParticleProxyBuilder )
privatedelete
const std::string& FWCaloParticleProxyBuilder::purpose ( ) const
inline

Definition at line 24 of file FWCaloParticleProxyBuilder.cc.

26 :
27  // Disable default copy constructor
const std::string& FWCaloParticleProxyBuilder::typeName ( ) const
inline

Definition at line 24 of file FWCaloParticleProxyBuilder.cc.

26 :
27  // Disable default copy constructor
const std::string& FWCaloParticleProxyBuilder::view ( ) const
inline

Definition at line 24 of file FWCaloParticleProxyBuilder.cc.

26 :
27  // Disable default copy constructor