Skip to content

Commit 1409648

Browse files
authored
Add per HB histos with 1 channel/chip (#15948)
1 parent 4a43295 commit 1409648

2 files changed

Lines changed: 75 additions & 2 deletions

File tree

‎Detectors/GlobalTrackingWorkflow/study/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# granted to it by virtue of its status as an Intergovernmental Organization
1010
# or submit itself to any jurisdiction.
1111

12-
#add_compile_options(-O0 -g -fPIC)
12+
# add_compile_options(-O0 -g -fPIC)
1313

1414
o2_add_library(GlobalTrackingStudy
1515
TARGETVARNAME targetName

‎Detectors/GlobalTrackingWorkflow/study/src/CheckResidSpec.cxx‎

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "DataFormatsGlobalTracking/RecoContainer.h"
2727
#include "DataFormatsITSMFT/TrkClusRef.h"
2828
#include "DataFormatsITSMFT/ClustersPerLayer.h"
29+
#include "ITSMFTReconstruction/ChipMappingITS.h"
2930
#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h"
3031
#include "ReconstructionDataFormats/TrackTPCITS.h"
3132
#include "ReconstructionDataFormats/GlobalTrackID.h"
@@ -106,6 +107,7 @@ class CheckResidSpec final : public Task
106107
void postProcessHistos();
107108
void drawHistos();
108109

110+
o2::itsmft::ChipMappingITS mChipMap;
109111
o2::globaltracking::RecoContainer* mRecoData = nullptr;
110112
int mNThreads = 1;
111113
bool mMeanVertexUpdated = false;
@@ -632,6 +634,7 @@ bool CheckResidSpec::refitITStrack(o2::track::TrackParCov& track, GTrackID gid)
632634
void CheckResidSpec::fillHistos(const o2::checkresid::Track& trc)
633635
{
634636
const auto& params = CheckResidConfig::Instance();
637+
auto geom = o2::its::GeometryTGeo::Instance();
635638
int np = trc.points.size();
636639
auto pt = trc.track.getPt();
637640
if (pt < params.minPt || pt > params.maxPt) {
@@ -662,6 +665,21 @@ void CheckResidSpec::fillHistos(const o2::checkresid::Track& trc)
662665
mHMan->getHisto2F(il * 10 + 1 * 100 + 5 + 2000)->Fill(pt, pull);
663666
mHMan->getHisto2F(il * 10 + 1 * 100 + 5 + 3000)->Fill(trc.track.getTgl(), pull);
664667
}
668+
if (pnt.lr >= 0 && pnt.sens >= 0 && geom->getLayer(pnt.sens) == pnt.lr) {
669+
const int halfBarrel = geom->getHalfBarrel(pnt.sens);
670+
const int chip = geom->getFirstChipIndex(pnt.lr) + geom->getChipIdInLayer(pnt.sens);
671+
const int chipHistoID = (2 * il + halfBarrel) * 100 + 15000;
672+
if (halfBarrel >= 0 && halfBarrel < 2) {
673+
mHMan->getHisto2F(chipHistoID)->Fill(chip, pnt.dy);
674+
mHMan->getHisto2F(chipHistoID + 10)->Fill(chip, pnt.dz);
675+
if (pnt.sig2y > 0) {
676+
mHMan->getHisto2F(chipHistoID + 5)->Fill(chip, pnt.dy / std::sqrt(pnt.sig2y));
677+
}
678+
if (pnt.sig2z > 0) {
679+
mHMan->getHisto2F(chipHistoID + 15)->Fill(chip, pnt.dz / std::sqrt(pnt.sig2z));
680+
}
681+
}
682+
}
665683
}
666684
//--------------
667685
if (trc.trIBOut.getX() > 1 && std::abs(trc.trIBOut.getX() - trc.trOBInw.getX()) < 0.1) {
@@ -726,6 +744,18 @@ void CheckResidSpec::bookHistos()
726744
mHMan->addHisto(htgl2, il * 10 + iyz * 100 + 3000);
727745
auto htgl2p = new TH2F(fmt::format("{}_{}_{}_pull", dname, lrName, "tgl").c_str(), fmt::format("pull {}_{{{}}} vs {};tg#lambda; pull{}", dtit, lrName, "tg#lambda", dtit).c_str(), params.nBinsTgl, -params.maxTgl, params.maxTgl, params.nBinsRes, -params.maxPull, params.maxPull);
728746
mHMan->addHisto(htgl2p, il * 10 + iyz * 100 + 5 + 3000);
747+
748+
if (il > 0) {
749+
const int ilr = il - 1;
750+
const int nChips = mChipMap.getNChipsOnLayer(ilr) / 2;
751+
for (int ib = 0; ib < 2; ++ib) { // chips per halfbarrel
752+
const int startChip = ib * nChips + mChipMap.getFirstChipsOnLayer(ilr);
753+
auto h2 = new TH2F(fmt::format("{}_{}_{}", dname, lrName, ib).c_str(), fmt::format("{} Lr{} HB{};chip;{}", dname, lrName, ib, dtit).c_str(), nChips, startChip - 0.5, startChip - 0.5 + nChips, params.nBinsRes, -params.maxDYZ[il], params.maxDYZ[il]);
754+
mHMan->addHisto(h2, (2 * il + ib) * 100 + iyz * 10 + 15000);
755+
auto h2p = new TH2F(fmt::format("{}_{}_{}_pull", dname, lrName, ib).c_str(), fmt::format("{} Lr{} HB{} pull;chip;pull{}", dname, lrName, ib, dtit).c_str(), nChips, startChip - 0.5, startChip - 0.5 + nChips, params.nBinsRes, -params.maxPull, params.maxPull);
756+
mHMan->addHisto(h2p, (2 * il + ib) * 100 + iyz * 10 + 5 + 15000);
757+
}
758+
}
729759
}
730760
}
731761

@@ -805,14 +835,24 @@ void CheckResidSpec::postProcessHistos()
805835
}
806836
}
807837
}
838+
for (int il = 1; il < 8; il++) {
839+
for (int ib = 0; ib < 2; ib++) {
840+
for (int iyz = 0; iyz < 2; iyz++) {
841+
for (int iht = 0; iht < 2; iht++) {
842+
const int offsV = iht == 0 ? 0 : 5;
843+
fitSlices((2 * il + ib) * 100 + iyz * 10 + offsV + 15000);
844+
}
845+
}
846+
}
847+
}
808848
histm->write();
809849
}
810850
delete gs;
811851
}
812852

813853
void CheckResidSpec::drawHistos()
814854
{
815-
gROOT->SetBatch(true);
855+
// gROOT->SetBatch(true);
816856
gStyle->SetTitleX(0.2);
817857
gStyle->SetTitleY(0.88);
818858
gStyle->SetTitleW(0.25);
@@ -928,6 +968,8 @@ void CheckResidSpec::drawHistos()
928968
}
929969
TCanvas cly("cly", "", 600, 800), clz("clz", "", 600, 800), clpar("clpar", "", 600, 800);
930970
TCanvas czly("czly", "", 600, 800), czlz("czlz", "", 600, 800), czlpar("czlpar", "", 600, 800);
971+
TCanvas cchip("cchip", "", 600, 800);
972+
constexpr std::array<const char*, 4> chipTitles{"#DeltaY", "pull #DeltaY", "#DeltaZ", "pull #DeltaZ"};
931973
auto AddLabel = [](const char* txt, float x = 0.1, float y = 0.9, int color = kBlack, float size = 0.04) {
932974
TLatex* lt = new TLatex(x, y, txt);
933975
lt->SetNDC();
@@ -1062,6 +1104,37 @@ void CheckResidSpec::drawHistos()
10621104
AddLabel("IB-OB tracks params differences at R = 12 cm", 0.2, 0.8);
10631105
czlpar.Print(Form("%s_hman.pdf", params.outname.c_str()));
10641106

1107+
for (int il = 1; il < 8; ++il) {
1108+
for (int ib = 0; ib < 2; ib++) {
1109+
cchip.Clear();
1110+
cchip.Divide(1, 4);
1111+
for (int iv = 0; iv < 4; ++iv) {
1112+
cchip.cd(iv + 1);
1113+
const int iyz = iv / 2;
1114+
const float yRange = iyz == 0 ? params.resMMLrY[il] : params.resMMLrZ[il];
1115+
int nh = this->mHManV.size();
1116+
bool drawn = false;
1117+
for (int j = 0; j < nh; j++) {
1118+
auto hman = this->mHManV[j].get();
1119+
const int id = 15000 + iyz * 10 + (2 * il + ib) * 100 + 1 + (iv % 2);
1120+
auto histo = hman->getHisto(id);
1121+
if (histo) {
1122+
histo->SetMaximum(yRange);
1123+
histo->SetMinimum((iv % 2) ? 0 : -yRange);
1124+
if (il > 3) {
1125+
histo->SetMarkerSize(0.3);
1126+
histo->SetLineStyle(3);
1127+
}
1128+
histo->Draw(drawn ? "same" : "");
1129+
drawn = true;
1130+
}
1131+
}
1132+
gPad->SetGrid();
1133+
}
1134+
cchip.Print(Form("%s_hman.pdf", params.outname.c_str()));
1135+
}
1136+
}
1137+
10651138
cly.Print(Form("%s_hman.pdf]", params.outname.c_str()));
10661139
}
10671140

0 commit comments

Comments
 (0)