13 #include "TEveBoxSet.h" 14 #include "TEveStraightLineSet.h" 45 TEveElement &oItemHolder,
70 <<
"lower time bound is larger than upper time bound. Maybe opposite is desired?";
75 << __FILE__ <<
":" << __LINE__
76 <<
" couldn't locate 'hgcalLayerClusters:timeLayerCluster' ValueMap in input file. Trying to access " 77 "'hgcalMergeLayerClusters:timeLayerClusters' ValueMap";
80 << __FILE__ <<
":" << __LINE__
81 <<
" couldn't locate 'hgcalMergeLayerClusters:timeLayerCluster' ValueMap in input file.";
88 << __FILE__ <<
":" << __LINE__
89 <<
" couldn't locate 'hgcalLayerClusters' collection " 90 "in input file. Trying to access 'hgcalMergeLayerClusters' collection.";
93 << __FILE__ <<
":" << __LINE__ <<
" couldn't locate 'hgcalMergeLayerClusters' collection in input file.";
112 TEveElement &oItemHolder,
121 const size_t N = trackster.
vertices().size();
124 TEveBoxSet *hex_boxset =
new TEveBoxSet();
126 hex_boxset->UseSingleColor();
127 hex_boxset->SetPickable(
true);
128 hex_boxset->Reset(TEveBoxSet::kBT_Hex,
true, 64);
130 TEveBoxSet *boxset =
new TEveBoxSet();
132 boxset->UseSingleColor();
133 boxset->SetPickable(
true);
134 boxset->Reset(TEveBoxSet::kBT_FreeBox,
true, 64);
136 TEveStraightLineSet *seed_marker =
nullptr;
138 seed_marker =
new TEveStraightLineSet(
"seeds");
139 seed_marker->SetLineWidth(2);
140 seed_marker->SetLineColor(kOrange + 10);
141 seed_marker->GetLinePlex().Reset(
sizeof(TEveStraightLineSet::Line_t), 2 *
N);
144 TEveStraightLineSet *position_marker =
nullptr;
146 position_marker =
new TEveStraightLineSet(
"positions");
147 position_marker->SetLineWidth(2);
148 position_marker->SetLineColor(kOrange);
149 position_marker->GetLinePlex().Reset(
sizeof(TEveStraightLineSet::Line_t), 2 *
N);
152 for (
size_t i = 0;
i <
N; ++
i) {
154 std::vector<std::pair<DetId, float>> clusterDetIds = layerCluster.
hitsAndFractions();
156 for (
std::vector<std::pair<DetId, float>>::iterator
it = clusterDetIds.begin(), itEnd = clusterDetIds.end();
160 if (corners ==
nullptr)
169 if (
parameters ==
nullptr || shapes ==
nullptr)
179 auto const z_plus_selection_ok =
z_plus_ && (
zside == 1);
183 if (z_selection_is_on && !(z_plus_selection_ok || z_minus_selection_ok))
190 if (layerCluster.
seed().
rawId() ==
it->first.rawId()) {
191 const float crossScale = 0.2f + fmin(layerCluster.
energy(), 5.0f);
194 const float center[3] = {corners[total_points * 3 + 0],
195 corners[total_points * 3 + 1],
196 corners[total_points * 3 + 2] + shapes[3] * 0.5f};
199 seed_marker->AddLine(
200 center[0] - crossScale, center[1], center[2], center[0] + crossScale, center[1], center[2]);
201 seed_marker->AddLine(
202 center[0], center[1] - crossScale, center[2], center[0], center[1] + crossScale, center[2]);
207 const float position_crossScale = crossScale * 0.5;
208 position_marker->AddLine(
209 pos.x() - position_crossScale,
pos.y(),
pos.z(),
pos.x() + position_crossScale,
pos.y(),
pos.z());
210 position_marker->AddLine(
211 pos.x(),
pos.y() - position_crossScale,
pos.z(),
pos.x(),
pos.y() + position_crossScale,
pos.z());
216 fmin((
item()->getConfig()->value<bool>(
"Cluster(0)/RecHit(1)") ?
hitmap->at(
it->first)->energy()
217 : layerCluster.
energy()) /
222 UChar_t
alpha = (255 * (100 - transparency)) / 100;
226 const int total_vertices = 3 * total_points;
228 std::vector<float> pnts(24);
229 for (
int i = 0;
i < total_points; ++
i) {
230 pnts[
i * 3 + 0] = corners[
i * 3];
231 pnts[
i * 3 + 1] = corners[
i * 3 + 1];
232 pnts[
i * 3 + 2] = corners[
i * 3 + 2];
234 pnts[(
i * 3 + 0) + total_vertices] = corners[
i * 3];
235 pnts[(
i * 3 + 1) + total_vertices] = corners[
i * 3 + 1];
236 pnts[(
i * 3 + 2) + total_vertices] = corners[
i * 3 + 2] + shapes[3];
238 boxset->AddBox(&pnts[0]);
242 : boxset->DigitColor(64, 64, 64,
alpha);
249 float centerX = (corners[6] + corners[6 +
offset]) / 2;
250 float centerY = (corners[7] + corners[7 +
offset]) / 2;
251 float radius = fabs(corners[6] - corners[6 +
offset]) / 2;
252 hex_boxset->AddHex(TEveVector(centerX, centerY, corners[2]),
radius, shapes[2], shapes[3]);
254 energy ? hex_boxset->DigitColor(
256 : hex_boxset->DigitColor(64, 64, 64,
alpha);
258 hex_boxset->CSCApplyMainColorToMatchingChildren();
259 hex_boxset->CSCApplyMainTransparencyToMatchingChildren();
260 hex_boxset->SetMainColor(
item()->modelInfo(iIndex).displayProperties().color());
261 hex_boxset->SetMainTransparency(
item()->defaultDisplayProperties().transparency());
267 hex_boxset->RefitPlex();
273 oItemHolder.AddElement(seed_marker);
276 oItemHolder.AddElement(position_marker);
281 TEveStraightLineSet *adjacent_marker =
new TEveStraightLineSet(
"adj_edges");
282 adjacent_marker->SetLineWidth(2);
283 adjacent_marker->SetLineColor(kYellow);
284 adjacent_marker->GetLinePlex().Reset(
sizeof(TEveStraightLineSet::Line_t),
edges.size());
286 TEveStraightLineSet *non_adjacent_marker =
new TEveStraightLineSet(
"non_adj_edges");
287 non_adjacent_marker->SetLineWidth(2);
288 non_adjacent_marker->SetLineColor(kRed);
289 non_adjacent_marker->GetLinePlex().Reset(
sizeof(TEveStraightLineSet::Line_t),
edges.size());
291 for (
auto edge :
edges) {
297 const bool isAdjacent =
std::abs(layerOut - layerIn) == 1;
302 adjacent_marker->AddLine(doublet.first.x(),
309 non_adjacent_marker->AddLine(doublet.first.x(),
317 oItemHolder.AddElement(adjacent_marker);
318 oItemHolder.AddElement(non_adjacent_marker);
const math::XYZPoint & position() const
cluster centroid position
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
bool enablePositionLines_
void setItem(const FWEventItem *iItem) override
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
FWProxyBuilderConfiguration * getConfig() const
static constexpr uint8_t gradient_steps
const_reference_type get(ProductID id, size_t idx) const
FWTracksterHitsProxyBuilder(void)
DetId seed() const
return DetId of seed
Char_t transparency() const
edm::Handle< edm::ValueMap< std::pair< float, float > > > TimeValueMapHandle_
bool getByLabel(InputTag const &, Handle< T > &) const
std::vector< std::array< unsigned int, 2 > > & edges()
edm::Handle< std::vector< reco::CaloCluster > > layerClustersHandle_
const FWDisplayProperties & displayProperties() const
const float * getCorners(unsigned int id) const
void setItem(const FWEventItem *iItem) override
Abs< T >::type abs(const T &t)
static constexpr uint8_t gradient[3][gradient_steps]
const edm::EventBase * getEvent() const
FWGenericParameter< T > * assertParam(const std::string &name, T def)
double energy() const
cluster energy
std::vector< unsigned int > & vertices()
const FWGeometry * getGeom() const
constexpr uint32_t rawId() const
get the raw id
const float * getShapePars(unsigned int id) const
const FWTracksterHitsProxyBuilder & operator=(const FWTracksterHitsProxyBuilder &)=delete
const float * getParameters(unsigned int id) const
T value(const std::string &name)
Log< level::Warning, false > LogWarning
ModelInfo modelInfo(int iIndex) const
const FWEventItem * item() const
double saturation_energy_
std::unordered_map< DetId, const HGCRecHit *> * hitmap
~FWTracksterHitsProxyBuilder(void) override