Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Detectors/GlobalTrackingWorkflow/study/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

#add_compile_options(-O0 -g -fPIC)
# add_compile_options(-O0 -g -fPIC)

o2_add_library(GlobalTrackingStudy
TARGETVARNAME targetName
Expand Down
75 changes: 74 additions & 1 deletion Detectors/GlobalTrackingWorkflow/study/src/CheckResidSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "DataFormatsGlobalTracking/RecoContainer.h"
#include "DataFormatsITSMFT/TrkClusRef.h"
#include "DataFormatsITSMFT/ClustersPerLayer.h"
#include "ITSMFTReconstruction/ChipMappingITS.h"
#include "DataFormatsGlobalTracking/RecoContainerCreateTracksVariadic.h"
#include "ReconstructionDataFormats/TrackTPCITS.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
Expand Down Expand Up @@ -106,6 +107,7 @@ class CheckResidSpec final : public Task
void postProcessHistos();
void drawHistos();

o2::itsmft::ChipMappingITS mChipMap;
o2::globaltracking::RecoContainer* mRecoData = nullptr;
int mNThreads = 1;
bool mMeanVertexUpdated = false;
Expand Down Expand Up @@ -632,6 +634,7 @@ bool CheckResidSpec::refitITStrack(o2::track::TrackParCov& track, GTrackID gid)
void CheckResidSpec::fillHistos(const o2::checkresid::Track& trc)
{
const auto& params = CheckResidConfig::Instance();
auto geom = o2::its::GeometryTGeo::Instance();
int np = trc.points.size();
auto pt = trc.track.getPt();
if (pt < params.minPt || pt > params.maxPt) {
Expand Down Expand Up @@ -662,6 +665,21 @@ void CheckResidSpec::fillHistos(const o2::checkresid::Track& trc)
mHMan->getHisto2F(il * 10 + 1 * 100 + 5 + 2000)->Fill(pt, pull);
mHMan->getHisto2F(il * 10 + 1 * 100 + 5 + 3000)->Fill(trc.track.getTgl(), pull);
}
if (pnt.lr >= 0 && pnt.sens >= 0 && geom->getLayer(pnt.sens) == pnt.lr) {
const int halfBarrel = geom->getHalfBarrel(pnt.sens);
const int chip = geom->getFirstChipIndex(pnt.lr) + geom->getChipIdInLayer(pnt.sens);
const int chipHistoID = (2 * il + halfBarrel) * 100 + 15000;
if (halfBarrel >= 0 && halfBarrel < 2) {
mHMan->getHisto2F(chipHistoID)->Fill(chip, pnt.dy);
mHMan->getHisto2F(chipHistoID + 10)->Fill(chip, pnt.dz);
if (pnt.sig2y > 0) {
mHMan->getHisto2F(chipHistoID + 5)->Fill(chip, pnt.dy / std::sqrt(pnt.sig2y));
}
if (pnt.sig2z > 0) {
mHMan->getHisto2F(chipHistoID + 15)->Fill(chip, pnt.dz / std::sqrt(pnt.sig2z));
}
}
}
}
//--------------
if (trc.trIBOut.getX() > 1 && std::abs(trc.trIBOut.getX() - trc.trOBInw.getX()) < 0.1) {
Expand Down Expand Up @@ -726,6 +744,18 @@ void CheckResidSpec::bookHistos()
mHMan->addHisto(htgl2, il * 10 + iyz * 100 + 3000);
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);
mHMan->addHisto(htgl2p, il * 10 + iyz * 100 + 5 + 3000);

if (il > 0) {
const int ilr = il - 1;
const int nChips = mChipMap.getNChipsOnLayer(ilr) / 2;
for (int ib = 0; ib < 2; ++ib) { // chips per halfbarrel
const int startChip = ib * nChips + mChipMap.getFirstChipsOnLayer(ilr);
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]);
mHMan->addHisto(h2, (2 * il + ib) * 100 + iyz * 10 + 15000);
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);
mHMan->addHisto(h2p, (2 * il + ib) * 100 + iyz * 10 + 5 + 15000);
}
}
}
}

Expand Down Expand Up @@ -805,14 +835,24 @@ void CheckResidSpec::postProcessHistos()
}
}
}
for (int il = 1; il < 8; il++) {
for (int ib = 0; ib < 2; ib++) {
for (int iyz = 0; iyz < 2; iyz++) {
for (int iht = 0; iht < 2; iht++) {
const int offsV = iht == 0 ? 0 : 5;
fitSlices((2 * il + ib) * 100 + iyz * 10 + offsV + 15000);
}
}
}
}
histm->write();
}
delete gs;
}

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

for (int il = 1; il < 8; ++il) {
for (int ib = 0; ib < 2; ib++) {
cchip.Clear();
cchip.Divide(1, 4);
for (int iv = 0; iv < 4; ++iv) {
cchip.cd(iv + 1);
const int iyz = iv / 2;
const float yRange = iyz == 0 ? params.resMMLrY[il] : params.resMMLrZ[il];
int nh = this->mHManV.size();
bool drawn = false;
for (int j = 0; j < nh; j++) {
auto hman = this->mHManV[j].get();
const int id = 15000 + iyz * 10 + (2 * il + ib) * 100 + 1 + (iv % 2);
auto histo = hman->getHisto(id);
if (histo) {
histo->SetMaximum(yRange);
histo->SetMinimum((iv % 2) ? 0 : -yRange);
if (il > 3) {
histo->SetMarkerSize(0.3);
histo->SetLineStyle(3);
}
histo->Draw(drawn ? "same" : "");
drawn = true;
}
}
gPad->SetGrid();
}
cchip.Print(Form("%s_hman.pdf", params.outname.c_str()));
}
}

cly.Print(Form("%s_hman.pdf]", params.outname.c_str()));
}

Expand Down
Loading