Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberta-Ferioli committed Mar 20, 2024
1 parent c02ecdb commit ec63939
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions Event_Display/ClusterShapeDisplay.cpp
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
#include <iostream>
#include <bitset>
#include "TH2D.h"
#include "TCanvas.h"
#include "TH2D.h"
#include "TStyle.h"
#include <bitset>
#include <iostream>

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 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;
// 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;
}






0 comments on commit ec63939

Please sign in to comment.