Skip to content

Commit

Permalink
GLO: QC: minor cleanup (removal of some headers and other stuff)
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
  • Loading branch information
f3sch committed Jan 29, 2025
1 parent 73c976a commit 632af8d
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 62 deletions.
54 changes: 17 additions & 37 deletions Detectors/GLOQC/include/GLOQC/MatchITSTPCQC.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@
#include "DataFormatsGlobalTracking/RecoContainer.h"
#include "Framework/ProcessingContext.h"
#include "SimulationDataFormat/MCCompLabel.h"
#include "SimulationDataFormat/MCTrack.h"
#include "Steer/MCKinematicsReader.h"
#include "ReconstructionDataFormats/PID.h"
#include "DCAFitter/DCAFitterN.h"
#include "GPUO2InterfaceConfiguration.h"
// #include "GPUSettingsO2.h"
#include "GPUParam.h"
#include "GPUParam.inc"

Expand All @@ -56,11 +54,15 @@ struct LblInfo {
class MatchITSTPCQC
{
public:
enum matchType : int { TPC = 0,
ITS,
SIZE };
enum matchType : uint8_t { TPC = 0,
ITS,
SIZE };

MatchITSTPCQC() = default;
MatchITSTPCQC(const MatchITSTPCQC&) = delete;
MatchITSTPCQC(MatchITSTPCQC&&) = delete;
MatchITSTPCQC& operator=(const MatchITSTPCQC&) = delete;
MatchITSTPCQC& operator=(MatchITSTPCQC&&) = delete;
~MatchITSTPCQC();

bool init();
Expand Down Expand Up @@ -260,14 +262,14 @@ class MatchITSTPCQC
// ITS track
void setMinPtITSCut(float v) { mPtITSCut = v; };
void setEtaITSCut(float v) { mEtaITSCut = v; }; // TODO: define 2 different values for min and max (**)
void setMinNClustersITS(float v) { mMinNClustersITS = v; }
void setMinNClustersITS(int v) { mMinNClustersITS = v; }
void setMaxChi2PerClusterITS(float v) { mMaxChi2PerClusterITS = v; }
// TO DO: define an agreed way to implement the setter for ITS matching (min. # layers, which layers)
// [...] --> exploit the method TrackCuts::setRequireHitsInITSLayers(...)
// TPC track
void setMinPtTPCCut(float v) { mPtTPCCut = v; };
void setEtaTPCCut(float v) { mEtaTPCCut = v; }; // TODO: define 2 different values for min and max (***)
void setMinNTPCClustersCut(float v) { mNTPCClustersCut = v; }
void setMinNTPCClustersCut(int v) { mNTPCClustersCut = v; }
void setMinDCAtoBeamPipeCut(std::array<float, 2> v)
{
setMinDCAtoBeamPipeDistanceCut(v[0]);
Expand Down Expand Up @@ -295,33 +297,11 @@ class MatchITSTPCQC
void setK0Scaling(float v) { mK0Scaling = v; }
float getK0Scaling() const { return mK0Scaling; }
void setK0MaxDCA(float v) { mK0MaxDCA = v; }
float getK0MaxDCA() { return mK0MaxDCA; }
float getK0MaxDCA() const { return mK0MaxDCA; }
void setK0MinCosPA(float v) { mK0MinCosPA = v; }
float getK0MinCosPA() const { return mK0MinCosPA; }

void printParams()
{
LOG(info) << "minPtITSCut = " << mPtITSCut;
LOG(info) << "etaITSCut = " << mEtaITSCut;
LOG(info) << "minNITSClustersCut = " << mMinNClustersITS;
LOG(info) << "maxChi2PerClusterITS = " << mMaxChi2PerClusterITS;
LOG(info) << "minPtTPCCut = " << mPtTPCCut;
LOG(info) << "etaTPCCut = " << mEtaTPCCut;
LOG(info) << "minNTPCClustersCut = " << mNTPCClustersCut;
LOG(info) << "minDCACut = " << mDCATPCCut;
LOG(info) << "minDCACutY = " << mDCATPCCutY;
LOG(info) << "minPtCut = " << mPtCut;
LOG(info) << "maxPtCut = " << mPtMaxCut;
LOG(info) << "etaCut = " << mEtaCut;
LOG(info) << "cutK0Mass = " << mCutK0Mass;
LOG(info) << "maxEtaK0 = " << mMaxEtaK0;
LOG(info) << "minTPCOccpp = " << mMinTPCOccpp;
LOG(info) << "maxTPCOccpp = " << mMaxTPCOccpp;
LOG(info) << "nBinsTPCOccpp = " << mNBinsTPCOccpp;
LOG(info) << "minTPCOccPbPb = " << mMinTPCOccPbPb;
LOG(info) << "maxTPCOccPbPb = " << mMaxTPCOccPbPb;
LOG(info) << "nBinsTPCOccPbPb = " << mNBinsTPCOccPbPb;
}
void printParams() const;

private:
std::shared_ptr<o2::globaltracking::DataRequest> mDataRequest;
Expand Down Expand Up @@ -428,11 +408,11 @@ class MatchITSTPCQC

// cut values
// ITS track
float mPtITSCut = 0.1f; // min pT for ITS track
float mEtaITSCut = 1.4f; // eta window for ITS track --> TODO: define 2 different values for min and max (**)
int mMinNClustersITS = 0; // min number of ITS clusters
float mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster
std::vector<std::pair<int8_t, std::set<uint8_t>>> mRequiredITSHits{}; // vector of ITS requirements (minNRequiredHits in specific requiredLayers)
float mPtITSCut = 0.1f; // min pT for ITS track
float mEtaITSCut = 1.4f; // eta window for ITS track --> TODO: define 2 different values for min and max (**)
int mMinNClustersITS = 0; // min number of ITS clusters
float mMaxChi2PerClusterITS{1e10f}; // max its fit chi2 per ITS cluster
std::vector<std::pair<int8_t, std::set<uint8_t>>> mRequiredITSHits; // vector of ITS requirements (minNRequiredHits in specific requiredLayers)
// TPC track
float mPtTPCCut = 0.1f; // min pT for TPC track
float mEtaTPCCut = 1.4f; // eta window for TPC track --> TODO: define 2 different values for min and max (***)
Expand Down Expand Up @@ -462,7 +442,7 @@ class MatchITSTPCQC
std::shared_ptr<o2::gpu::GPUParam> mParam = nullptr;
int mNHBPerTF = 0;
int mNTPCOccBinLength = 0; ///< TPC occ. histo bin length in TBs
float mNTPCOccBinLengthInv;
float mNTPCOccBinLengthInv{};
std::vector<float> mTBinClOcc; ///< TPC occupancy histo: i-th entry is the integrated occupancy for ~1 orbit starting from the TB = i*mNTPCOccBinLength
gsl::span<const unsigned int> mTPCRefitterOccMap; ///< externally set TPC clusters occupancy map
bool mIsHI = false;
Expand Down
71 changes: 46 additions & 25 deletions Detectors/GLOQC/src/MatchITSTPCQC.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,24 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include <algorithm>

#include "GLOQC/MatchITSTPCQC.h"
#include "ReconstructionDataFormats/TrackTPCITS.h"
#include "DataFormatsTPC/TrackTPC.h"
#include "Framework/InputSpec.h"
#include "ReconstructionDataFormats/TrackParametrization.h"
#include "DetectorsBase/Propagator.h"
#include "SimulationDataFormat/MCUtils.h"
#include <algorithm>
#include "TGraphAsymmErrors.h"
#include "GlobalTracking/TrackCuts.h"
#include <DetectorsBase/GRPGeomHelper.h>
#include <TEfficiency.h>
#include "ReconstructionDataFormats/PrimaryVertex.h"
#include "ReconstructionDataFormats/V0.h"
// #include "GlobalTrackingStudy/V0Ext.h"
#include "DetectorsVertexing/SVertexerParams.h"
#include "Framework/InputRecord.h"
#include "Framework/TimingInfo.h"
#include "GPUO2InterfaceUtils.h"
#include "CommonConstants/LHCConstants.h"
#include "DataFormatsTPC/Constants.h"
#include "DetectorsCommonDataFormats/DetID.h"

#include "GPUO2InterfaceRefit.h"

using namespace o2::gloqc;
Expand All @@ -41,7 +36,6 @@ using DetID = o2::detectors::DetID;

MatchITSTPCQC::~MatchITSTPCQC()
{

deleteHistograms();
}

Expand Down Expand Up @@ -467,7 +461,7 @@ void MatchITSTPCQC::initDataRequest()

mSrc &= mAllowedSources;

if (mSrc[GID::Source::ITSTPC] == 0 || mSrc[GID::Source::TPC] == 0 || mSrc[GID::Source::ITS] == 0) {
if (!mSrc[GID::Source::ITSTPC] || !mSrc[GID::Source::TPC] || !mSrc[GID::Source::ITS]) {
LOG(fatal) << "We cannot do ITSTPC QC, some sources are missing, check sources in " << mSrc;
}

Expand Down Expand Up @@ -518,7 +512,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
}

static int evCount = 0;
mRecoCont.collectData(ctx, *mDataRequest.get());
mRecoCont.collectData(ctx, *mDataRequest);
mTPCTracks = mRecoCont.getTPCTracks();
mITSTracks = mRecoCont.getITSTracks();
mITSTPCTracks = mRecoCont.getTPCITSTracks();
Expand Down Expand Up @@ -581,7 +575,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
if (trk.getRefITS().getSource() != GID::ITS) {
continue;
}
if (isTPCTrackSelectedEntry[idxTrkTpc] == true) {
if (isTPCTrackSelectedEntry[idxTrkTpc]) {
auto lbl = mRecoCont.getTrackMCLabel({(unsigned int)(itrk), GID::Source::ITSTPC});
if (!lbl.isValid()) {
continue;
Expand All @@ -592,9 +586,9 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
const std::vector<o2::MCTrack>& pcontainer = mcReader.getTracks(source, event);
const o2::MCTrack& p = pcontainer[lbl.getTrackID()];
if (MCTrackNavigator::isPhysicalPrimary(p, pcontainer)) {
mMapLabels[matchType::TPC].insert({lbl, {itrk, true}});
mMapLabels[matchType::TPC].insert({lbl, {.mIdx = itrk, .mIsPhysicalPrimary = true}});
} else {
mMapLabels[matchType::TPC].insert({lbl, {itrk, false}});
mMapLabels[matchType::TPC].insert({lbl, {.mIdx = itrk, .mIsPhysicalPrimary = false}});
}
} else {
// winner (if more tracks have the same label) has the highest pt
Expand All @@ -604,7 +598,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
}
}
auto idxTrkIts = trk.getRefITS().getIndex();
if (isITSTrackSelectedEntry[idxTrkIts] == true) {
if (isITSTrackSelectedEntry[idxTrkIts]) {
auto lbl = mRecoCont.getTrackMCLabel({(unsigned int)(itrk), GID::Source::ITSTPC});
if (!lbl.isValid()) {
continue;
Expand All @@ -615,9 +609,9 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
const std::vector<o2::MCTrack>& pcontainer = mcReader.getTracks(source, event);
const o2::MCTrack& p = pcontainer[lbl.getTrackID()];
if (MCTrackNavigator::isPhysicalPrimary(p, pcontainer)) {
mMapLabels[matchType::ITS].insert({lbl, {itrk, true}});
mMapLabels[matchType::ITS].insert({lbl, {.mIdx = itrk, .mIsPhysicalPrimary = true}});
} else {
mMapLabels[matchType::ITS].insert({lbl, {itrk, false}});
mMapLabels[matchType::ITS].insert({lbl, {.mIdx = itrk, .mIsPhysicalPrimary = false}});
}
} else {
// winner (if more tracks have the same label) has the highest pt
Expand Down Expand Up @@ -725,13 +719,13 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
std::array<std::string, 2> title{"TPC", "ITS"};
for (int i = 0; i < matchType::SIZE; ++i) {
o2::track::TrackParCov trkRef;
int idxTrkRef;
unsigned int idxTrkRef{0};
bool fillHisto = false;
bool isEtaITSOk = true;
if (i == matchType::TPC) {
trkRef = mTPCTracks[trk.getRefTPC()];
idxTrkRef = trk.getRefTPC().getIndex();
if (isTPCTrackSelectedEntry[idxTrkRef] == true) {
if (isTPCTrackSelectedEntry[idxTrkRef]) {
fillHisto = true;
++mNITSTPCSelectedTracks[i];
}
Expand All @@ -747,7 +741,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
}
trkRef = mITSTracks[trk.getRefITS()];
LOG(debug) << "Checking track (ITS) with id " << idxTrkRef << " for ITSTPC track " << iITSTPC << " and pt = " << trkRef.getPt();
if (isITSTrackSelectedEntry[idxTrkRef] == true) {
if (isITSTrackSelectedEntry[idxTrkRef]) {
LOG(debug) << "Track was selected (ITS), with id " << idxTrkRef << " for ITSTPC track " << iITSTPC << " , we keep it in the numerator, pt = " << trkRef.getPt();
fillHisto = true;
++mNITSTPCSelectedTracks[i];
Expand All @@ -760,7 +754,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
LOG(debug) << "Track (ITS), with id " << idxTrkRef << " for ITSTPC track " << iITSTPC << " will be discarded when filling pt of phi related histograms, since eta = " << trkRef.getEta() << " , we don't keep it in the numerator, pt = " << trkRef.getPt();
}
}
if (fillHisto == true) {
if (fillHisto) {
if (!mUseMC) {
LOG(debug) << "Filling num (" << title[i] << ") with track with id " << idxTrkRef << " for ITSTPC track " << iITSTPC << " with pt = " << trkRef.getPt();
if (isEtaITSOk) {
Expand Down Expand Up @@ -800,7 +794,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
mChi2Refit->Fill(trk.getChi2Refit());
mTimeResVsPt->Fill(trkRef.getPt(), trk.getTimeMUS().getTimeStampError());
math_utils::Point3D<float> v{};
std::array<float, 2> dca;
std::array<float, 2> dca{-999, -999};
if (trkRef.propagateParamToDCA(v, mBz, &dca)) {
mDCAr->Fill(dca[0]);
if (!mUseMC) {
Expand All @@ -825,7 +819,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
// track with the highest number of TPC clusters
for (int itrk = 0; itrk < static_cast<int>(mTPCTracks.size()); ++itrk) {
auto const& trk = mTPCTracks[itrk];
if (isTPCTrackSelectedEntry[itrk] == true) {
if (isTPCTrackSelectedEntry[itrk]) {
auto lbl = mRecoCont.getTrackMCLabel({(unsigned int)(itrk), GID::Source::TPC});
if (!lbl.isValid()) {
continue;
Expand Down Expand Up @@ -857,7 +851,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
// track with the highest number of ITS clusters
for (int itrk = 0; itrk < static_cast<int>(mITSTracks.size()); ++itrk) {
auto const& trk = mITSTracks[itrk];
if (isITSTrackSelectedEntry[itrk] == true) {
if (isITSTrackSelectedEntry[itrk]) {
auto lbl = mRecoCont.getTrackMCLabel({(unsigned int)(itrk), GID::Source::ITS});
if (!lbl.isValid()) {
continue;
Expand Down Expand Up @@ -945,7 +939,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
// if we are in data, we loop over all tracks (no check on the label)
for (size_t itrk = 0; itrk < mTPCTracks.size(); ++itrk) {
auto const& trk = mTPCTracks[itrk];
if (isTPCTrackSelectedEntry[itrk] == true) {
if (isTPCTrackSelectedEntry[itrk]) {
LOG(debug) << "Filling den (TPC) with track with pt = " << trk.getPt();
mPtDen[matchType::TPC]->Fill(trk.getPt());
if (std::abs(trk.getEta()) > mEtaNo0Cut) {
Expand All @@ -972,7 +966,7 @@ void MatchITSTPCQC::run(o2::framework::ProcessingContext& ctx)
for (size_t itrk = 0; itrk < mITSTracks.size(); ++itrk) {
auto const& trk = mITSTracks[itrk];
LOG(debug) << "Checking den for track (ITS) " << itrk << " with pt " << trk.getPt() << " and eta = " << trk.getEta();
if (isITSTrackSelectedEntry[itrk] == true) {
if (isITSTrackSelectedEntry[itrk]) {
if (std::abs(trk.getEta()) < mEtaITSCut) {
LOG(debug) << "Filling den for track (ITS) " << itrk << " with pt = " << trk.getPt() << " and eta = " << trk.getEta();
mPtDen[matchType::ITS]->Fill(trk.getPt());
Expand Down Expand Up @@ -1428,3 +1422,30 @@ void MatchITSTPCQC::getHistos(TObjArray& objar)
objar.Add(mK0MassVsPtVsOccpp);
objar.Add(mK0MassVsPtVsOccPbPb);
}

void MatchITSTPCQC::printParams() const
{
LOG(info) << "MatchITSTPCQC parameters:";
LOG(info) << " - minPtBins = " << mPtBins;
LOG(info) << " - minPtITSCut = " << mPtITSCut;
LOG(info) << " - etaITSCut = " << mEtaITSCut;
LOG(info) << " - minNITSClustersCut = " << mMinNClustersITS;
LOG(info) << " - maxChi2PerClusterITS = " << mMaxChi2PerClusterITS;
LOG(info) << " - minPtTPCCut = " << mPtTPCCut;
LOG(info) << " - etaTPCCut = " << mEtaTPCCut;
LOG(info) << " - minNTPCClustersCut = " << mNTPCClustersCut;
LOG(info) << " - mEtaNo0Cut = " << mEtaNo0Cut;
LOG(info) << " - minDCACut = " << mDCATPCCut;
LOG(info) << " - minDCACutY = " << mDCATPCCutY;
LOG(info) << " - minPtCut = " << mPtCut;
LOG(info) << " - maxPtCut = " << mPtMaxCut;
LOG(info) << " - etaCut = " << mEtaCut;
LOG(info) << " - cutK0Mass = " << mCutK0Mass;
LOG(info) << " - maxEtaK0 = " << mMaxEtaK0;
LOG(info) << " - minTPCOccpp = " << mMinTPCOccpp;
LOG(info) << " - maxTPCOccpp = " << mMaxTPCOccpp;
LOG(info) << " - nBinsTPCOccpp = " << mNBinsTPCOccpp;
LOG(info) << " - minTPCOccPbPb = " << mMinTPCOccPbPb;
LOG(info) << " - maxTPCOccPbPb = " << mMaxTPCOccPbPb;
LOG(info) << " - nBinsTPCOccPbPb = " << mNBinsTPCOccPbPb;
}

0 comments on commit 632af8d

Please sign in to comment.