Skip to content

Commit a9eab82

Browse files
authored
ITS General: correct merging of averages with THRatio (#1853)
* First changes in Tracks Task * ÃAdded Track TRatio * Finalized TrackTask * ÃAdded Cluster Task * Clang * Ivan's commments + fixed bug in update * Added mGeneralOccupancy to THRatio + reset of Occupancy arrays * Fixed bug with IB occupancy aray * Update ITSClusterTask.cxx to solve conflict with hEmptyLanesFractio Added arguments to formatAxis(hEmptyLanesFraction), because without all parameters, this function was crashing the code
1 parent 368fc27 commit a9eab82

5 files changed

Lines changed: 190 additions & 217 deletions

File tree

Modules/ITS/include/ITS/ITSClusterTask.h

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <TString.h>
2424
#include <THnSparse.h>
2525
#include <string>
26+
#include "Common/TH2Ratio.h"
2627

2728
#include <DataFormatsITSMFT/TopologyDictionary.h>
2829
#include <ITSBase/GeometryTGeo.h>
@@ -35,6 +36,7 @@ class TH1F;
3536
class TH2F;
3637

3738
using namespace o2::quality_control::core;
39+
using namespace o2::quality_control_modules::common;
3840

3941
namespace o2::quality_control_modules::its
4042
{
@@ -62,7 +64,14 @@ class ITSClusterTask : public TaskInterface
6264

6365
private:
6466
void publishHistos();
65-
void formatAxes(TH1* h, const char* xTitle, const char* yTitle, float xOffset = 1., float yOffset = 1.);
67+
template <class T>
68+
void formatAxes(T* obj, const char* xTitle, const char* yTitle, float xOffset, float yOffset)
69+
{
70+
obj->GetXaxis()->SetTitle(xTitle);
71+
obj->GetYaxis()->SetTitle(yTitle);
72+
obj->GetXaxis()->SetTitleOffset(xOffset);
73+
obj->GetYaxis()->SetTitleOffset(yOffset);
74+
}
6675
void addObject(TObject* aObject);
6776
void getJsonParameters();
6877
void createAllHistos();
@@ -80,8 +89,8 @@ class ITSClusterTask : public TaskInterface
8089
TH1F* hClusterTopologySummaryIB[NLayer][48][9] = { { { nullptr } } };
8190
TH1F* hGroupedClusterSizeSummaryIB[NLayer][48][9] = { { { nullptr } } };
8291

83-
TH2F* hAverageClusterOccupancySummaryIB[NLayer] = { nullptr };
84-
TH2F* hAverageClusterSizeSummaryIB[NLayer] = { nullptr };
92+
std::shared_ptr<TH2FRatio> hAverageClusterOccupancySummaryIB[NLayer];
93+
std::shared_ptr<TH2FRatio> hAverageClusterSizeSummaryIB[NLayer];
8594

8695
int mClusterOccupancyIB[NLayer][48][9] = { { { 0 } } };
8796

@@ -90,8 +99,8 @@ class ITSClusterTask : public TaskInterface
9099
TH1F* hClusterSizeSummaryOB[NLayer][48] = { { nullptr } };
91100
TH1F* hClusterTopologySummaryOB[NLayer][48] = { { nullptr } };
92101

93-
TH2F* hAverageClusterOccupancySummaryOB[NLayer] = { nullptr };
94-
TH2F* hAverageClusterSizeSummaryOB[NLayer] = { nullptr };
102+
std::shared_ptr<TH2FRatio> hAverageClusterOccupancySummaryOB[NLayer];
103+
std::shared_ptr<TH2FRatio> hAverageClusterSizeSummaryOB[NLayer];
95104

96105
int mClusterOccupancyOB[NLayer][48][28] = { { { 0 } } };
97106
int mNLaneEmpty[4] = { 0 }; // IB, ML, OL, TOTAL empty lane
@@ -103,14 +112,15 @@ class ITSClusterTask : public TaskInterface
103112

104113
// General
105114
TH2F* hClusterVsBunchCrossing = nullptr;
106-
TH2F* mGeneralOccupancy = nullptr;
115+
std::unique_ptr<TH2FRatio> mGeneralOccupancy = nullptr;
107116

108117
// Fine checks
109-
TH2F* hAverageClusterOccupancySummaryFine[NLayer] = { nullptr };
110-
TH2F* hAverageClusterSizeSummaryFine[NLayer] = { nullptr };
111118

112-
TH2F* hAverageClusterOccupancySummaryZPhi[NLayer] = { nullptr };
113-
TH2F* hAverageClusterSizeSummaryZPhi[NLayer] = { nullptr };
119+
std::shared_ptr<TH2FRatio> hAverageClusterOccupancySummaryFine[NLayer];
120+
std::shared_ptr<TH2FRatio> hAverageClusterSizeSummaryFine[NLayer];
121+
122+
std::shared_ptr<TH2FRatio> hAverageClusterOccupancySummaryZPhi[NLayer];
123+
std::shared_ptr<TH2FRatio> hAverageClusterSizeSummaryZPhi[NLayer];
114124

115125
TH1D* hEmptyLaneFractionGlobal;
116126

Modules/ITS/include/ITS/ITSTrackTask.h

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@
2525
#include <Framework/TimingInfo.h>
2626
#include <TTree.h>
2727
#include <TLine.h>
28+
#include "Common/TH1Ratio.h"
29+
#include "Common/TH2Ratio.h"
2830

2931
class TH1D;
3032
class TH2D;
3133

3234
using namespace o2::quality_control::core;
35+
using namespace o2::quality_control_modules::common;
3336

3437
namespace o2::quality_control_modules::its
3538
{
@@ -54,6 +57,14 @@ class ITSTrackTask : public TaskInterface
5457
void formatAxes(TH1* h, const char* xTitle, const char* yTitle, float xOffset = 1., float yOffset = 1.);
5558
void addObject(TObject* aObject);
5659
void createAllHistos();
60+
template <class T>
61+
void formatAxes(T* obj, const char* xTitle, const char* yTitle, float xOffset, float yOffset)
62+
{
63+
obj->GetXaxis()->SetTitle(xTitle);
64+
obj->GetYaxis()->SetTitle(yTitle);
65+
obj->GetXaxis()->SetTitleOffset(xOffset);
66+
obj->GetYaxis()->SetTitleOffset(yOffset);
67+
}
5768

5869
static constexpr int NLayer = 7;
5970
static constexpr int NLayerIB = 3;
@@ -63,24 +74,24 @@ class ITSTrackTask : public TaskInterface
6374
std::vector<TObject*> mPublishedObjects;
6475
TH1D* hNClusters;
6576
TH1D* hNClustersReset;
66-
TH1D* hTrackEta;
67-
TH1D* hTrackPhi;
77+
std::unique_ptr<TH1DRatio> hTrackEta;
78+
std::unique_ptr<TH1DRatio> hTrackPhi;
6879
TH1D* hVerticesRof;
69-
TH2D* hAngularDistribution;
80+
std::unique_ptr<TH2DRatio> hAngularDistribution;
7081
TH2D* hVertexCoordinates;
7182
TH2D* hVertexRvsZ;
7283
TH1D* hVertexZ;
7384
TH1D* hVertexContributors;
7485
TH1D* hAssociatedClusterFraction;
7586
TH1D* hNtracks;
7687
TH1D* hNtracksReset;
77-
TH2D* hNClustersPerTrackEta;
78-
TH2D* hNClustersPerTrackPhi;
79-
TH2D* hHitFirstLayerPhiAll;
80-
TH2D* hHitFirstLayerPhi4cls;
81-
TH2D* hHitFirstLayerPhi5cls;
82-
TH2D* hHitFirstLayerPhi6cls;
83-
TH2D* hHitFirstLayerPhi7cls;
88+
std::unique_ptr<TH2DRatio> hNClustersPerTrackEta;
89+
std::unique_ptr<TH2DRatio> hNClustersPerTrackPhi;
90+
std::unique_ptr<TH2DRatio> hHitFirstLayerPhiAll;
91+
std::unique_ptr<TH2DRatio> hHitFirstLayerPhi4cls;
92+
std::unique_ptr<TH2DRatio> hHitFirstLayerPhi5cls;
93+
std::unique_ptr<TH2DRatio> hHitFirstLayerPhi6cls;
94+
std::unique_ptr<TH2DRatio> hHitFirstLayerPhi7cls;
8495
TH2D* hClusterVsBunchCrossing;
8596
TH2D* hNClusterVsChipITS;
8697

Modules/ITS/itsCluster.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"dicttimestamp": "0",
4444
"geomPath": "./",
4545
"publishSummary1D": "0",
46-
"publishDetailedSummary": "0"
46+
"publishDetailedSummary": "1"
4747
},
4848
"grpGeomRequest" : {
4949
"geomRequest": "Aligned",

0 commit comments

Comments
 (0)