Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw 3D cross over the seed of each HGCal Layer Cluster #25781

Merged
merged 1 commit into from Jan 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
73 changes: 62 additions & 11 deletions Fireworks/Calo/plugins/FWCaloClusterProxyBuilder.cc
Expand Up @@ -5,6 +5,7 @@
#include "DataFormats/CaloRecHit/interface/CaloCluster.h"

#include "TEveBoxSet.h"
#include "TEveStraightLineSet.h"

class FWCaloClusterProxyBuilder : public FWHeatmapProxyBuilderTemplate<reco::CaloCluster>
{
Expand Down Expand Up @@ -51,9 +52,15 @@ void FWCaloClusterProxyBuilder::build(const reco::CaloCluster &iData, unsigned i
it != itEnd; ++it)
{
const uint8_t type = ((it->first >> 28) & 0xF);

const float *corners = item()->getGeom()->getCorners(it->first);
if (corners == nullptr)
continue;

// HGCal
if (type >= 8 && type <= 10)
if (iData.algo() == 8 || (type >= 8 && type <= 10))
{

if(heatmap && hitmap.find(it->first) == hitmap.end())
continue;

Expand All @@ -65,14 +72,11 @@ void FWCaloClusterProxyBuilder::build(const reco::CaloCluster &iData, unsigned i
(((z_plus | z_minus) == 0) || !(z == z_minus || z == !z_plus)))
continue;

const float *corners = item()->getGeom()->getCorners(it->first);
const float *parameters = item()->getGeom()->getParameters(it->first);
const float *shapes = item()->getGeom()->getShapePars(it->first);

if (corners == nullptr || parameters == nullptr || shapes == nullptr)
{
if (parameters == nullptr || shapes == nullptr)
continue;
}

const int total_points = parameters[0];
const bool isScintillator = (total_points == 4);
Expand Down Expand Up @@ -100,6 +104,56 @@ void FWCaloClusterProxyBuilder::build(const reco::CaloCluster &iData, unsigned i
continue;
}

// seed
if(iData.seed().rawId() == it->first.rawId()){
TEveStraightLineSet *marker = new TEveStraightLineSet;
marker->SetLineWidth( 1 );

// center of RecHit
float center[3] = {
corners[0], corners[1], corners[2]+shapes[3]*0.5f
};

if (isScintillator){
constexpr int offset = 9;

center[0] = (corners[6] + corners[6 + offset]) / 2;
center[1] = (corners[7] + corners[7 + offset]) / 2;
} else {
float min[2] = {1e3f, 1e3f};
float max[2] = {-1e3f, -1e3f};

for (int i = 0; i < total_points; ++i)
{
min[0] = fmin(min[0], corners[i * 3]);
min[1] = fmin(min[1], corners[i * 3 + 1]);

max[0] = fmax(max[0], corners[i * 3]);
max[1] = fmax(max[1], corners[i * 3 + 1]);
}

center[0] = (min[0] + max[0]) / 2.0f;
center[1] = (min[1] + max[1]) / 2.0f;
}

// draw 3D cross
const float crossScale = 1.0f + fmin(iData.energy(), 5.0f);
marker->AddLine(
center[0]-crossScale, center[1], center[2],
center[0]+crossScale, center[1], center[2]
);
marker->AddLine(
center[0], center[1]-crossScale, center[2],
center[0], center[1]+crossScale, center[2]
);
marker->AddLine(
center[0], center[1], center[2]-crossScale,
center[0], center[1], center[2]+crossScale
);

oItemHolder.AddElement(marker);
}

// Scintillator
if (isScintillator)
{
Expand Down Expand Up @@ -127,7 +181,7 @@ void FWCaloClusterProxyBuilder::build(const reco::CaloCluster &iData, unsigned i
// Silicon
else
{
const int offset = 9;
constexpr int offset = 9;

float centerX = (corners[6] + corners[6 + offset]) / 2;
float centerY = (corners[7] + corners[7 + offset]) / 2;
Expand All @@ -145,11 +199,6 @@ void FWCaloClusterProxyBuilder::build(const reco::CaloCluster &iData, unsigned i
// Not HGCal
else
{
const float *corners = item()->getGeom()->getCorners(it->first);

if (corners == nullptr)
continue;

h_box = true;

std::vector<float> pnts(24);
Expand All @@ -169,6 +218,7 @@ void FWCaloClusterProxyBuilder::build(const reco::CaloCluster &iData, unsigned i
hex_boxset->CSCApplyMainColorToMatchingChildren();
hex_boxset->CSCApplyMainTransparencyToMatchingChildren();
hex_boxset->SetMainColor(item()->modelInfo(iIndex).displayProperties().color());
hex_boxset->SetMainTransparency(item()->defaultDisplayProperties().transparency());
}
oItemHolder.AddElement(hex_boxset);
}
Expand All @@ -184,6 +234,7 @@ void FWCaloClusterProxyBuilder::build(const reco::CaloCluster &iData, unsigned i
boxset->CSCApplyMainColorToMatchingChildren();
boxset->CSCApplyMainTransparencyToMatchingChildren();
boxset->SetMainColor(item()->modelInfo(iIndex).displayProperties().color());
boxset->SetMainTransparency(item()->defaultDisplayProperties().transparency());
}
oItemHolder.AddElement(boxset);
}
Expand Down