forked from fchinu/Limadou-Event-Display
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c02ecdb
commit ec63939
Showing
1 changed file
with
36 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|