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
104 const size_t N = trackster.vertices().size();
107 TEveBoxSet *hex_boxset =
new TEveBoxSet();
109 hex_boxset->UseSingleColor();
110 hex_boxset->SetPickable(
true);
111 hex_boxset->Reset(TEveBoxSet::kBT_Hex,
true, 64);
113 TEveBoxSet *boxset =
new TEveBoxSet();
115 boxset->UseSingleColor();
116 boxset->SetPickable(
true);
117 boxset->Reset(TEveBoxSet::kBT_FreeBox,
true, 64);
119 TEveStraightLineSet *seed_marker =
nullptr;
121 seed_marker =
new TEveStraightLineSet(
"seeds");
122 seed_marker->SetLineWidth(2);
123 seed_marker->SetLineColor(kOrange + 10);
124 seed_marker->GetLinePlex().Reset(
sizeof(TEveStraightLineSet::Line_t), 2 * N);
127 TEveStraightLineSet *position_marker =
nullptr;
129 position_marker =
new TEveStraightLineSet(
"positions");
130 position_marker->SetLineWidth(2);
131 position_marker->SetLineColor(kOrange);
132 position_marker->GetLinePlex().Reset(
sizeof(TEveStraightLineSet::Line_t), 2 * N);
135 for (
size_t i = 0;
i <
N; ++
i) {
137 std::vector<std::pair<DetId, float>> clusterDetIds = layerCluster.
hitsAndFractions();
139 for (
std::vector<std::pair<DetId, float>>::iterator it = clusterDetIds.begin(), itEnd = clusterDetIds.end();
143 if (corners ==
nullptr)
152 if (parameters ==
nullptr || shapes ==
nullptr)
155 const int total_points = parameters[0];
156 const int layer = parameters[1];
157 const int zside = parameters[2];
158 const bool isSilicon = parameters[3];
162 auto const z_plus_selection_ok =
z_plus_ && (zside == 1);
163 auto const z_minus_selection_ok = z_minus_ && (zside == -1);
166 if (z_selection_is_on && !(z_plus_selection_ok || z_minus_selection_ok))
173 if (layerCluster.
seed().
rawId() == it->first.rawId()) {
174 const float crossScale = 0.2f + fmin(layerCluster.
energy(), 5.0f);
177 const float center[3] = {corners[total_points * 3 + 0],
178 corners[total_points * 3 + 1],
179 corners[total_points * 3 + 2] + shapes[3] * 0.5f};
182 seed_marker->AddLine(
183 center[0] - crossScale, center[1], center[2], center[0] + crossScale, center[1], center[2]);
184 seed_marker->AddLine(
185 center[0], center[1] - crossScale, center[2], center[0], center[1] + crossScale, center[2]);
189 auto const &pos = layerCluster.
position();
190 const float position_crossScale = crossScale * 0.5;
191 position_marker->AddLine(
192 pos.x() - position_crossScale, pos.y(), pos.z(), pos.x() + position_crossScale, pos.y(), pos.z());
193 position_marker->AddLine(
194 pos.x(), pos.y() - position_crossScale, pos.z(), pos.x(), pos.y() + position_crossScale, pos.z());
199 fmin((
item()->getConfig()->value<bool>(
"Cluster(0)/RecHit(1)") ?
hitmap->at(it->first)->energy()
200 : layerCluster.
energy()) /
205 UChar_t
alpha = (255 * (100 - transparency)) / 100;
209 const int total_vertices = 3 * total_points;
211 std::vector<float> pnts(24);
212 for (
int i = 0;
i < total_points; ++
i) {
213 pnts[
i * 3 + 0] = corners[
i * 3];
214 pnts[
i * 3 + 1] = corners[
i * 3 + 1];
215 pnts[
i * 3 + 2] = corners[
i * 3 + 2];
217 pnts[(
i * 3 + 0) + total_vertices] = corners[
i * 3];
218 pnts[(
i * 3 + 1) + total_vertices] = corners[
i * 3 + 1];
219 pnts[(
i * 3 + 2) + total_vertices] = corners[
i * 3 + 2] + shapes[3];
221 boxset->AddBox(&pnts[0]);
225 : boxset->DigitColor(64, 64, 64, alpha);
232 float centerX = (corners[6] + corners[6 +
offset]) / 2;
233 float centerY = (corners[7] + corners[7 +
offset]) / 2;
234 float radius = fabs(corners[6] - corners[6 + offset]) / 2;
235 hex_boxset->AddHex(TEveVector(centerX, centerY, corners[2]), radius, 90.0, shapes[3]);
237 energy ? hex_boxset->DigitColor(
239 : hex_boxset->DigitColor(64, 64, 64, alpha);
241 hex_boxset->CSCApplyMainColorToMatchingChildren();
242 hex_boxset->CSCApplyMainTransparencyToMatchingChildren();
243 hex_boxset->SetMainColor(
item()->modelInfo(iIndex).displayProperties().color());
244 hex_boxset->SetMainTransparency(
item()->defaultDisplayProperties().transparency());
250 hex_boxset->RefitPlex();
256 oItemHolder.AddElement(seed_marker);
259 oItemHolder.AddElement(position_marker);
262 auto &edges = trackster.edges();
264 TEveStraightLineSet *adjacent_marker =
new TEveStraightLineSet(
"adj_edges");
265 adjacent_marker->SetLineWidth(2);
266 adjacent_marker->SetLineColor(kYellow);
267 adjacent_marker->GetLinePlex().Reset(
sizeof(TEveStraightLineSet::Line_t), edges.size());
269 TEveStraightLineSet *non_adjacent_marker =
new TEveStraightLineSet(
"non_adj_edges");
270 non_adjacent_marker->SetLineWidth(2);
271 non_adjacent_marker->SetLineColor(kRed);
272 non_adjacent_marker->GetLinePlex().Reset(
sizeof(TEveStraightLineSet::Line_t), edges.size());
274 for (
auto edge : edges) {
275 auto doublet = std::make_pair(layerClusters[edge[0]], layerClusters[edge[1]]);
280 const bool isAdjacent =
std::abs(layerOut - layerIn) == 1;
285 adjacent_marker->AddLine(doublet.first.x(),
292 non_adjacent_marker->AddLine(doublet.first.x(),
300 oItemHolder.AddElement(adjacent_marker);
301 oItemHolder.AddElement(non_adjacent_marker);
const math::XYZPoint & position() const
cluster centroid position
const FWDisplayProperties & displayProperties() const
bool enablePositionLines_
const float * getParameters(unsigned int id) const
static constexpr uint8_t gradient_steps
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
constexpr uint32_t rawId() const
get the raw id
edm::Handle< edm::ValueMap< std::pair< float, float > > > TimeValueMapHandle_
edm::Handle< std::vector< reco::CaloCluster > > layerClustersHandle_
const FWEventItem * item() const
const float * getShapePars(unsigned int id) const
Char_t transparency() const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Abs< T >::type abs(const T &t)
double energy() const
cluster energy
static constexpr uint8_t gradient[3][gradient_steps]
const_reference_type get(ProductID id, size_t idx) const
DetId seed() const
return DetId of seed
const float * getCorners(unsigned int id) const
ModelInfo modelInfo(int iIndex) const
const FWGeometry * getGeom() const
double saturation_energy_
std::unordered_map< DetId, const HGCRecHit * > * hitmap