Skip to content

Commit

Permalink
[WIP] cluster-shape representation
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberta-Ferioli committed Mar 20, 2024
1 parent 2770ab8 commit c02ecdb
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Event_Display/ClusterShapeDisplay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include <iostream>
#include <bitset>
#include "TH2D.h"
#include "TCanvas.h"
#include "TStyle.h"

void fillBinaryMatrix(TH2D* hist, const uint8_t* ExampleArray, int size, int max_length, int xClusterPosition, int yClusterPosition) {
for (int i = 0; i < size; ++i) {
std::bitset<8> bits(ExampleArray[i]);
for (int j = 0; j < max_length; j++) {
hist->Fill(xClusterPosition + j, yClusterPosition - i-1, bits[max_length - 1 - j]); // Adjusting the y-position
}
}
}

void ClusterShapeDisplay() {
//need to link t cluster class
//uint8_t ExampleArray[] = {16, 48, 48, 224, 32, 0, 0, 0};// Example array
uint8_t ExampleArray[] = {192, 192, 80, 248, 16, 16, 16, 16};
int size = sizeof(ExampleArray) / sizeof(ExampleArray[0]);
int max_length = 8;
//int xClusterPosition = 123;
//int yClusterPosition = 456;
int xClusterPosition = 379;
int yClusterPosition = 28;

TH2D* hist = new TH2D("Cluster", "Cluster", max_length, xClusterPosition, xClusterPosition + max_length, size, yClusterPosition - size, yClusterPosition);

fillBinaryMatrix(hist, ExampleArray, size, max_length, xClusterPosition, yClusterPosition);

TCanvas* canvas = new TCanvas("canvas", "Canvas", 800, 600);
gStyle->SetOptStat(0);
hist->Draw("col");
canvas->SaveAs("clusterShape1.png");

delete hist;
delete canvas;
}






Binary file added Event_Display/clusterShape.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Event_Display/clusterShape1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c02ecdb

Please sign in to comment.