8 #include "TEveBoxSet.h" 9 #include "TEveStraightLineSet.h" 36 TEveElement &oItemHolder,
54 item()->getConfig()->value<double>(
"TimeUpperBound(ns)"));
56 item()->getConfig()->value<double>(
"TimeUpperBound(ns)"));
58 std::cerr <<
"Warning: couldn't locate 'timeLayerCluster' ValueMap in root file." << std::endl;
73 TEveElement &oItemHolder,
81 std::vector<std::pair<DetId, float>> clusterDetIds = iData.
hitsAndFractions();
84 TEveBoxSet *hex_boxset =
new TEveBoxSet();
86 hex_boxset->UseSingleColor();
87 hex_boxset->SetPickable(
true);
88 hex_boxset->Reset(TEveBoxSet::kBT_Hex,
true, 64);
89 hex_boxset->SetAntiFlick(
true);
92 TEveBoxSet *boxset =
new TEveBoxSet();
94 boxset->UseSingleColor();
95 boxset->SetPickable(
true);
96 boxset->Reset(TEveBoxSet::kBT_FreeBox,
true, 64);
97 boxset->SetAntiFlick(
true);
99 for (std::vector<std::pair<DetId, float>>::iterator it = clusterDetIds.begin(), itEnd = clusterDetIds.end();
102 const uint8_t
type = ((it->first >> 28) & 0xF);
105 if (corners ==
nullptr)
109 if (iData.
algo() == 8 || (type >= 8 && type <= 10)) {
113 const bool z = (it->first >> 25) & 0
x1;
122 if (parameters ==
nullptr || shapes ==
nullptr)
125 const int total_points = parameters[0];
126 const bool isScintillator = (total_points == 4);
141 if (ll != ((it->first >> (isScintillator ? 17 : 20)) & 0x1F))
146 if (iData.
seed().
rawId() == it->first.rawId()) {
147 TEveStraightLineSet *marker =
new TEveStraightLineSet;
148 marker->SetLineWidth(1);
151 const float center[3] = {corners[total_points * 3 + 0],
152 corners[total_points * 3 + 1],
153 corners[total_points * 3 + 2] + shapes[3] * 0.5f};
156 const float crossScale = 1.0f + fmin(iData.
energy(), 5.0f);
157 marker->AddLine(center[0] - crossScale, center[1], center[2], center[0] + crossScale, center[1], center[2]);
158 marker->AddLine(center[0], center[1] - crossScale, center[2], center[0], center[1] + crossScale, center[2]);
159 marker->AddLine(center[0], center[1], center[2] - crossScale, center[0], center[1], center[2] + crossScale);
161 oItemHolder.AddElement(marker);
164 const float energy = fmin(
165 (
item()->getConfig()->value<bool>(
"Cluster(0)/RecHit(1)") ?
hitmap[it->first]->energy() : iData.
energy()) /
171 if (isScintillator) {
172 const int total_vertices = 3 * total_points;
174 std::vector<float> pnts(24);
175 for (
int i = 0;
i < total_points; ++
i) {
176 pnts[
i * 3 + 0] = corners[
i * 3];
177 pnts[
i * 3 + 1] = corners[
i * 3 + 1];
178 pnts[
i * 3 + 2] = corners[
i * 3 + 2];
180 pnts[(
i * 3 + 0) + total_vertices] = corners[
i * 3];
181 pnts[(
i * 3 + 1) + total_vertices] = corners[
i * 3 + 1];
182 pnts[(
i * 3 + 2) + total_vertices] = corners[
i * 3 + 2] + shapes[3];
184 boxset->AddBox(&pnts[0]);
187 : boxset->DigitColor(64, 64, 64);
196 float centerX = (corners[6] + corners[6 +
offset]) / 2;
197 float centerY = (corners[7] + corners[7 +
offset]) / 2;
198 float radius = fabs(corners[6] - corners[6 + offset]) / 2;
199 hex_boxset->AddHex(TEveVector(centerX, centerY, corners[2]), radius, 90.0, shapes[3]);
202 : hex_boxset->DigitColor(64, 64, 64);
212 std::vector<float> pnts(24);
214 boxset->AddBox(&pnts[0]);
219 hex_boxset->RefitPlex();
221 hex_boxset->CSCTakeAnyParentAsMaster();
223 hex_boxset->CSCApplyMainColorToMatchingChildren();
224 hex_boxset->CSCApplyMainTransparencyToMatchingChildren();
225 hex_boxset->SetMainColor(
item()->modelInfo(iIndex).displayProperties().color());
226 hex_boxset->SetMainTransparency(
item()->defaultDisplayProperties().transparency());
228 oItemHolder.AddElement(hex_boxset);
234 boxset->CSCTakeAnyParentAsMaster();
236 boxset->CSCApplyMainColorToMatchingChildren();
237 boxset->CSCApplyMainTransparencyToMatchingChildren();
238 boxset->SetMainColor(
item()->modelInfo(iIndex).displayProperties().color());
239 boxset->SetMainTransparency(
item()->defaultDisplayProperties().transparency());
241 oItemHolder.AddElement(boxset);
edm::Handle< edm::ValueMap< float > > TimeValueMapHandle
FWProxyBuilderConfiguration * getConfig() const
std::map< DetId, const HGCRecHit * > hitmap
FWCaloClusterProxyBuilder(void)
void setItem(const FWEventItem *iItem) override
static uint8_t gradient[3][gradient_steps]
~FWCaloClusterProxyBuilder(void) override
const float * getParameters(unsigned int id) const
constexpr uint32_t rawId() const
get the raw id
void setItem(const FWEventItem *iItem) override
const FWEventItem * item() const
AlgoId algo() const
algorithm identifier
const float * getShapePars(unsigned int id) const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
double energy() const
cluster energy
const_reference_type get(ProductID id, size_t idx) const
FWGenericParameter< T > * assertParam(const std::string &name, T def)
const edm::EventBase * getEvent() const
void energyTower3DCorners(const float *corners, float scale, std::vector< float > &, bool reflect=false)
DetId seed() const
return DetId of seed
const float * getCorners(unsigned int id) const
const FWCaloClusterProxyBuilder & operator=(const FWCaloClusterProxyBuilder &)=delete
#define REGISTER_PROXYBUILDER_METHODS()
static uint8_t gradient_steps
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
bool getByLabel(InputTag const &, Handle< T > &) const
T value(const std::string &name)
const FWGeometry * getGeom() const