Skip to content

Commit f0492a1

Browse files
committed
Please consider the following formatting changes
1 parent bdc78ee commit f0492a1

2 files changed

Lines changed: 44 additions & 54 deletions

File tree

Detectors/Upgrades/ALICE3/TRK/macros/test/CheckClusterSizeVsEta.C

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
#include <TStyle.h>
1010

1111
// ### required input file: CheckClusters.root, which is the output of CheckClusters.C macro
12-
void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root")
12+
void CheckClusterSizeVsEta(const std::string& strFileInput = "CheckClusters.root")
1313
{
1414
gStyle->SetOptStat(0);
1515

16-
TFile *fileInput = new TFile(strFileInput.c_str());
17-
TTree *tree = (TTree *)fileInput->Get("ntc");
16+
TFile* fileInput = new TFile(strFileInput.c_str());
17+
TTree* tree = (TTree*)fileInput->Get("ntc");
1818

1919
std::cout << "Opened tree: " << tree->GetName()
2020
<< ", entries = " << tree->GetEntries() << std::endl;
@@ -59,26 +59,24 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
5959
tree->SetBranchAddress("pt", &pt);
6060

6161
// Some QA histograms
62-
TH1F *hPt = new TH1F("hPt", "p_{T};p_{T};Entries", 100, 0., 10.);
63-
TH1F *hClusSize = new TH1F("hClusSize", "Cluster size;clusSize;Entries", 20, 0., 20.);
64-
TH1F *hLayer = new TH1F("hLayer", "Layer;layer;Entries", 20, -0.5, 19.5);
65-
TH1F *hDxGlob = new TH1F("hDxGlob", "clusGlobX - hitGlobX;#DeltaX [global];Entries", 200, -1., 1.);
66-
TH1F *hDzGlob = new TH1F("hDzGlob", "clusGlobZ - hitGlobZ;#DeltaZ [global];Entries", 200, -1., 1.);
67-
TH2F *hHitXY = new TH2F("hHitXY", "Hit global XY;hitGlobX;hitGlobY", 200, -20., 20., 200, -20., 20.);
68-
TH2F *hClusVsHitX = new TH2F("hClusVsHitX", "clusGlobX vs hitGlobX;hitGlobX;clusGlobX", 200, -20., 20., 200, -20., 20.);
62+
TH1F* hPt = new TH1F("hPt", "p_{T};p_{T};Entries", 100, 0., 10.);
63+
TH1F* hClusSize = new TH1F("hClusSize", "Cluster size;clusSize;Entries", 20, 0., 20.);
64+
TH1F* hLayer = new TH1F("hLayer", "Layer;layer;Entries", 20, -0.5, 19.5);
65+
TH1F* hDxGlob = new TH1F("hDxGlob", "clusGlobX - hitGlobX;#DeltaX [global];Entries", 200, -1., 1.);
66+
TH1F* hDzGlob = new TH1F("hDzGlob", "clusGlobZ - hitGlobZ;#DeltaZ [global];Entries", 200, -1., 1.);
67+
TH2F* hHitXY = new TH2F("hHitXY", "Hit global XY;hitGlobX;hitGlobY", 200, -20., 20., 200, -20., 20.);
68+
TH2F* hClusVsHitX = new TH2F("hClusVsHitX", "clusGlobX vs hitGlobX;hitGlobX;clusGlobX", 200, -20., 20., 200, -20., 20.);
6969

7070
// histograms for cluster size vs eta for each layer (ML and OT barrel layers):
7171
const int nLayers = 8; // ML and OT barrel layers only
72-
TH2F *hClustSizePerLayerVsEta[nLayers];
73-
for (int i = 0; i < nLayers; i++)
74-
{
72+
TH2F* hClustSizePerLayerVsEta[nLayers];
73+
for (int i = 0; i < nLayers; i++) {
7574
hClustSizePerLayerVsEta[i] = new TH2F(Form("hClustSizePerLayerVsEta_Lay%d", i), Form("Cluster size vs eta for layer %d;#eta;Cluster size", i), 160, -4, 4, 101, -0.5, 100.5);
7675
}
7776

7877
// Loop over entries
7978
const Long64_t nEntries = tree->GetEntries();
80-
for (Long64_t i = 0; i < nEntries; ++i)
81-
{
79+
for (Long64_t i = 0; i < nEntries; ++i) {
8280
tree->GetEntry(i);
8381

8482
// Fill QA histograms
@@ -103,14 +101,13 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
103101
hClustSizePerLayerVsEta[(int)layer]->Fill(clustEta, clusSize);
104102

105103
// progress print
106-
if ((i + 1) % 200000 == 0)
107-
{
104+
if ((i + 1) % 200000 == 0) {
108105
std::cout << "Processed " << (i + 1) << " / " << nEntries << " entries" << std::endl;
109106
}
110107
}
111108

112109
// Save histograms to file
113-
TFile *fout = TFile::Open("clusterSizes_vs_eta.root", "RECREATE");
110+
TFile* fout = TFile::Open("clusterSizes_vs_eta.root", "RECREATE");
114111
hPt->Write();
115112
hClusSize->Write();
116113
hLayer->Write();
@@ -120,7 +117,7 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
120117
hClusVsHitX->Write();
121118

122119
// draw some QA histograms
123-
TCanvas *c1 = new TCanvas("canv_clusters_QA", "Clusters QA", 1200, 800);
120+
TCanvas* c1 = new TCanvas("canv_clusters_QA", "Clusters QA", 1200, 800);
124121
c1->Divide(2, 2);
125122
c1->cd(1);
126123
hPt->Draw();
@@ -131,10 +128,9 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
131128
c1->cd(4);
132129
hHitXY->Draw("COLZ");
133130

134-
TCanvas *canv_clsSize_vs_eta[nLayers];
135-
TProfile *profPerLayerVsEta[nLayers];
136-
for (int i = 0; i < nLayers; i++)
137-
{
131+
TCanvas* canv_clsSize_vs_eta[nLayers];
132+
TProfile* profPerLayerVsEta[nLayers];
133+
for (int i = 0; i < nLayers; i++) {
138134
canv_clsSize_vs_eta[i] = new TCanvas(Form("canv_clsSize_vs_eta_Lay%d", i), Form("Cluster size vs eta for layer %d", i), 800, 600);
139135
hClustSizePerLayerVsEta[i]->Draw("COLZ");
140136
gPad->SetLogz();
@@ -146,11 +142,10 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
146142
}
147143

148144
// canvas with profiles for all layers together
149-
TCanvas *canv_av_clsSize_vs_eta_all_layers = new TCanvas("canv_clsSize_vs_eta_all_layers", "Cluster size vs eta for all layers", 800, 600);
150-
TLegend *legLayers = new TLegend(0.3, 0.52, 0.65, 0.89);
145+
TCanvas* canv_av_clsSize_vs_eta_all_layers = new TCanvas("canv_clsSize_vs_eta_all_layers", "Cluster size vs eta for all layers", 800, 600);
146+
TLegend* legLayers = new TLegend(0.3, 0.52, 0.65, 0.89);
151147
int colors[] = {kRed, kBlue, kMagenta + 1, kCyan + 1, kGray + 2, kRed, kBlue, kMagenta + 1, kCyan, kAzure + 1, kOrange - 9, kRed + 2, kBlue + 2, kMagenta + 2};
152-
for (int i = 0; i < nLayers; i++)
153-
{
148+
for (int i = 0; i < nLayers; i++) {
154149
profPerLayerVsEta[i]->SetLineColor(colors[i]);
155150
profPerLayerVsEta[i]->SetMarkerColor(colors[i]);
156151
profPerLayerVsEta[i]->SetMarkerStyle(i < 5 ? 20 : 24);

Detectors/Upgrades/O2:Upgrades:ALICE3/TRK/macros/test/CheckClusterSizeVsEta.C

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
#include <TStyle.h>
2424

2525
// ### required input file: CheckClusters.root, which is the output of CheckClusters.C macro
26-
void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root")
26+
void CheckClusterSizeVsEta(const std::string& strFileInput = "CheckClusters.root")
2727
{
2828
gStyle->SetOptStat(0);
2929

30-
TFile *fileInput = new TFile(strFileInput.c_str());
31-
TTree *tree = (TTree *)fileInput->Get("ntc");
30+
TFile* fileInput = new TFile(strFileInput.c_str());
31+
TTree* tree = (TTree*)fileInput->Get("ntc");
3232

3333
std::cout << "Opened tree: " << tree->GetName()
3434
<< ", entries = " << tree->GetEntries() << std::endl;
@@ -73,26 +73,24 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
7373
tree->SetBranchAddress("pt", &pt);
7474

7575
// Some QA histograms
76-
TH1F *hPt = new TH1F("hPt", "p_{T};p_{T};Entries", 100, 0., 10.);
77-
TH1F *hClusSize = new TH1F("hClusSize", "Cluster size;clusSize;Entries", 20, 0., 20.);
78-
TH1F *hLayer = new TH1F("hLayer", "Layer;layer;Entries", 20, -0.5, 19.5);
79-
TH1F *hDxGlob = new TH1F("hDxGlob", "clusGlobX - hitGlobX;#DeltaX [global];Entries", 200, -1., 1.);
80-
TH1F *hDzGlob = new TH1F("hDzGlob", "clusGlobZ - hitGlobZ;#DeltaZ [global];Entries", 200, -1., 1.);
81-
TH2F *hHitXY = new TH2F("hHitXY", "Hit global XY;hitGlobX;hitGlobY", 200, -20., 20., 200, -20., 20.);
82-
TH2F *hClusVsHitX = new TH2F("hClusVsHitX", "clusGlobX vs hitGlobX;hitGlobX;clusGlobX", 200, -20., 20., 200, -20., 20.);
76+
TH1F* hPt = new TH1F("hPt", "p_{T};p_{T};Entries", 100, 0., 10.);
77+
TH1F* hClusSize = new TH1F("hClusSize", "Cluster size;clusSize;Entries", 20, 0., 20.);
78+
TH1F* hLayer = new TH1F("hLayer", "Layer;layer;Entries", 20, -0.5, 19.5);
79+
TH1F* hDxGlob = new TH1F("hDxGlob", "clusGlobX - hitGlobX;#DeltaX [global];Entries", 200, -1., 1.);
80+
TH1F* hDzGlob = new TH1F("hDzGlob", "clusGlobZ - hitGlobZ;#DeltaZ [global];Entries", 200, -1., 1.);
81+
TH2F* hHitXY = new TH2F("hHitXY", "Hit global XY;hitGlobX;hitGlobY", 200, -20., 20., 200, -20., 20.);
82+
TH2F* hClusVsHitX = new TH2F("hClusVsHitX", "clusGlobX vs hitGlobX;hitGlobX;clusGlobX", 200, -20., 20., 200, -20., 20.);
8383

8484
// histograms for cluster size vs eta for each layer (ML and OT barrel layers):
8585
const int nLayers = 8; // ML and OT barrel layers only
86-
TH2F *hClustSizePerLayerVsEta[nLayers];
87-
for (int i = 0; i < nLayers; i++)
88-
{
86+
TH2F* hClustSizePerLayerVsEta[nLayers];
87+
for (int i = 0; i < nLayers; i++) {
8988
hClustSizePerLayerVsEta[i] = new TH2F(Form("hClustSizePerLayerVsEta_Lay%d", i), Form("Cluster size vs eta for layer %d;#eta;Cluster size", i), 160, -4, 4, 101, -0.5, 100.5);
9089
}
9190

9291
// Loop over entries
9392
const Long64_t nEntries = tree->GetEntries();
94-
for (Long64_t i = 0; i < nEntries; ++i)
95-
{
93+
for (Long64_t i = 0; i < nEntries; ++i) {
9694
tree->GetEntry(i);
9795

9896
// Fill QA histograms
@@ -117,14 +115,13 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
117115
hClustSizePerLayerVsEta[(int)layer]->Fill(clustEta, clusSize);
118116

119117
// progress print
120-
if ((i + 1) % 200000 == 0)
121-
{
118+
if ((i + 1) % 200000 == 0) {
122119
std::cout << "Processed " << (i + 1) << " / " << nEntries << " entries" << std::endl;
123120
}
124121
}
125122

126123
// Save histograms to file
127-
TFile *fout = TFile::Open("clusterSizes_vs_eta.root", "RECREATE");
124+
TFile* fout = TFile::Open("clusterSizes_vs_eta.root", "RECREATE");
128125
hPt->Write();
129126
hClusSize->Write();
130127
hLayer->Write();
@@ -134,7 +131,7 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
134131
hClusVsHitX->Write();
135132

136133
// draw some QA histograms
137-
TCanvas *c1 = new TCanvas("canv_clusters_QA", "Clusters QA", 1200, 800);
134+
TCanvas* c1 = new TCanvas("canv_clusters_QA", "Clusters QA", 1200, 800);
138135
c1->Divide(2, 2);
139136
c1->cd(1);
140137
hPt->Draw();
@@ -145,10 +142,9 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
145142
c1->cd(4);
146143
hHitXY->Draw("COLZ");
147144

148-
TCanvas *canv_clsSize_vs_eta[nLayers];
149-
TProfile *profPerLayerVsEta[nLayers];
150-
for (int i = 0; i < nLayers; i++)
151-
{
145+
TCanvas* canv_clsSize_vs_eta[nLayers];
146+
TProfile* profPerLayerVsEta[nLayers];
147+
for (int i = 0; i < nLayers; i++) {
152148
canv_clsSize_vs_eta[i] = new TCanvas(Form("canv_clsSize_vs_eta_Lay%d", i), Form("Cluster size vs eta for layer %d", i), 800, 600);
153149
hClustSizePerLayerVsEta[i]->Draw("COLZ");
154150
gPad->SetLogz();
@@ -160,11 +156,10 @@ void CheckClusterSizeVsEta(const std::string &strFileInput = "CheckClusters.root
160156
}
161157

162158
// canvas with profiles for all layers together
163-
TCanvas *canv_av_clsSize_vs_eta_all_layers = new TCanvas("canv_clsSize_vs_eta_all_layers", "Cluster size vs eta for all layers", 800, 600);
164-
TLegend *legLayers = new TLegend(0.3, 0.52, 0.65, 0.89);
159+
TCanvas* canv_av_clsSize_vs_eta_all_layers = new TCanvas("canv_clsSize_vs_eta_all_layers", "Cluster size vs eta for all layers", 800, 600);
160+
TLegend* legLayers = new TLegend(0.3, 0.52, 0.65, 0.89);
165161
int colors[] = {kRed, kBlue, kMagenta + 1, kCyan + 1, kGray + 2, kRed, kBlue, kMagenta + 1, kCyan, kAzure + 1, kOrange - 9, kRed + 2, kBlue + 2, kMagenta + 2};
166-
for (int i = 0; i < nLayers; i++)
167-
{
162+
for (int i = 0; i < nLayers; i++) {
168163
profPerLayerVsEta[i]->SetLineColor(colors[i]);
169164
profPerLayerVsEta[i]->SetMarkerColor(colors[i]);
170165
profPerLayerVsEta[i]->SetMarkerStyle(i < 5 ? 20 : 24);

0 commit comments

Comments
 (0)