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
11 changes: 11 additions & 0 deletions Modules/GLO/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ install(TARGETS O2QcGLO
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

# install json files
install(FILES ITSTPCmatchedTracks_external.json
ITSTPCmatchedTracks.json
ITSTPCmatchedTracks_direct.json
vertexing-qc-direct.json
vertexing-qc-direct-mc.json
vertexing-qc.json
vertexing-qc-mc.json
DESTINATION etc
)

add_root_dictionary(O2QcGLO
HEADERS
include/GLO/VertexingQcTask.h
Expand Down
2 changes: 1 addition & 1 deletion Modules/GLO/ITSTPCmatchedTracks.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"id" : "ITSTPCmatchingSampling",
"active" : "true",
"machines" : [],
"query_comment" : "checking every matched track",
"query_comment" : "checking every 10% matched track",
"query" : "trackITSTPC:GLO/TPCITS/0;trackITSTPCABREFS:GLO/TPCITSAB_REFS/0;trackITSTPCABCLID:GLO/TPCITSAB_CLID/0;trackTPC:TPC/TRACKS;trackTPCClRefs:TPC/CLUSREFS",
"samplingConditions" : [
{
Expand Down
76 changes: 76 additions & 0 deletions Modules/GLO/ITSTPCmatchedTracks_direct.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"qc" : {
"config" : {
"database" : {
"implementation" : "CCDB",
"host" : "ccdb-test.cern.ch:8080",
"username" : "not_applicable",
"password" : "not_applicable",
"name" : "not_applicable"
},
"Activity" : {
"number" : "42",
"type" : "2"
},
"monitoring" : {
"url" : "infologger:///debug?qc"
},
"consul" : {
"url" : ""
},
"conditionDB" : {
"url" : "ccdb-test.cern.ch:8080"
},
"infologger" : { "" : "Configuration of the Infologger (optional).",
"filterDiscardDebug" : "false",
"" : "Set to true to discard debug and trace messages (default: false)",
"filterDiscardLevel" : "21",
"" : "Message at this level or above are discarded (default: 21 - Trace)" }
},
"tasks" : {
"MatchedTracksITSTPC" : {
"active" : "true",
"className" : "o2::quality_control_modules::glo::ITSTPCMatchingTask",
"moduleName" : "QcGLO",
"detectorName" : "GLO",
"cycleDurationSeconds" : "3600",
"maxNumberCycles" : "-1",
"dataSource" : {
"type" : "direct",
"query_comment" : "checking every matched track",
"query" : "trackITSTPC:GLO/TPCITS/0;trackITSTPCABREFS:GLO/TPCITSAB_REFS/0;trackITSTPCABCLID:GLO/TPCITSAB_CLID/0;trackTPC:TPC/TRACKS;trackTPCClRefs:TPC/CLUSREFS"
},
"taskParameters" : {
"GID" : "ITS-TPC,ITS",
"verbose" : "false",
"minPtCut" : "0.1f",
"etaCut" : "1.4f",
"minNTPCClustersCut" : "40",
"minDCACut" : "100.f",
"minDCACutY" : "10.f",
"grpFileName" : "o2sim_grp.root",
"geomFileName" : "o2sim_geometry.root"
},
"location" : "remote",
"saveObjectsToFile" : "ITSTPCmatched.root",
"" : "For debugging, path to the file where to save. If empty or missing it won't save."
}
},
"checks" : {
"QcCheck" : {
"active" : "false",
"className" : "o2::quality_control_modules::skeleton::SkeletonCheck",
"moduleName" : "QcSkeleton",
"policy" : "OnAny",
"detectorName" : "TOF",
"dataSource" : [ {
"type" : "Task",
"name" : "QcTask",
"MOs" : ["example"]
} ]
}
}
},
"dataSamplingPolicies" : [
]
}
7 changes: 6 additions & 1 deletion Modules/GLO/include/GLO/VertexingQcTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#include "SimulationDataFormat/MCEventLabel.h"

class TH1F;
class TH2F;
class TProfile;
class TEfficiency;

#include <unordered_map>

Expand Down Expand Up @@ -58,6 +60,8 @@ class VertexingQcTask final : public TaskInterface
TH1F* mNContributors = nullptr; // vertex N contributors
TProfile* mTimeUncVsNContrib = nullptr; // time uncertainty vs N contributors

bool mVerbose = false;

// MC related part
bool mUseMC = false;
o2::steer::MCKinematicsReader mMCReader; // MC reader
Expand All @@ -66,14 +70,15 @@ class VertexingQcTask final : public TaskInterface
std::unordered_map<o2::MCEventLabel, int> mMapEvIDSourceID; // unordered_map counting the number of vertices reconstructed per event and source (--> MCEventLabel)
TH1F* mNPrimaryMCEvWithVtx = nullptr; // event multiplicity for MC events with at least 1 vertex
TH1F* mNPrimaryMCGen = nullptr; // event multiplicity for all MC events
TH1F* mVtxEffVsMult = nullptr; // for vertex efficiency
TEfficiency* mVtxEffVsMult = nullptr; // for vertex efficiency
TProfile* mCloneFactorVsMult = nullptr; // clone factor vs multiplicity
TProfile* mVtxResXVsMult = nullptr; // vertex resolution in X
TProfile* mVtxResYVsMult = nullptr; // vertex resolution in Y
TProfile* mVtxResZVsMult = nullptr; // vertex resolution in Z
TProfile* mVtxPullsXVsMult = nullptr; // vertex pulls in X
TProfile* mVtxPullsYVsMult = nullptr; // vertex pulls in Y
TProfile* mVtxPullsZVsMult = nullptr; // vertex pulls in Z
TH2F* mBeamSpot = nullptr; // bean spot
};

} // namespace o2::quality_control_modules::glo
Expand Down
4 changes: 2 additions & 2 deletions Modules/GLO/src/ITSTPCMatchingTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

///
/// \file ITSTPCMatchingTask.cxx
/// \author My Name
/// \author Chiara Zampolli
///

#include <TCanvas.h>
Expand Down Expand Up @@ -71,7 +71,7 @@ void ITSTPCMatchingTask::initialize(o2::framework::InitContext& /*ctx*/)

mMatchITSTPCQC.init();
getObjectsManager()->startPublishing(mMatchITSTPCQC.getHistoPtTPC());
getObjectsManager()->startPublishing(mMatchITSTPCQC.getHistoFractionITSTPCmatch());
getObjectsManager()->startPublishing(mMatchITSTPCQC.getFractionITSTPCmatch());
getObjectsManager()->startPublishing(mMatchITSTPCQC.getHistoPt());
getObjectsManager()->startPublishing(mMatchITSTPCQC.getHistoEta());
getObjectsManager()->startPublishing(mMatchITSTPCQC.getHistoChi2Matching());
Expand Down
67 changes: 47 additions & 20 deletions Modules/GLO/src/VertexingQcTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
///

#include <TCanvas.h>
#include <TH1.h>
#include <TH1F.h>
#include <TH2F.h>
#include <TProfile.h>
#include <TEfficiency.h>

#include "ReconstructionDataFormats/PrimaryVertex.h"

Expand All @@ -34,6 +36,7 @@ VertexingQcTask::~VertexingQcTask()
delete mZ;
delete mNContributors;
delete mTimeUncVsNContrib;
delete mBeamSpot;
if (mUseMC) {
delete mPurityVsMult;
delete mNPrimaryMCEvWithVtx;
Expand All @@ -54,24 +57,31 @@ void VertexingQcTask::initialize(o2::framework::InitContext& /*ctx*/)
ILOG(Info, Support) << "initialize VertexingQcTask" << ENDM; // QcInfoLogger is used. FairMQ logs will go to there as well.

// this is how to get access to custom parameters defined in the config file at qc.tasks.<task_name>.taskParameters
if (auto param = mCustomParameters.find("verbose"); param != mCustomParameters.end()) {
ILOG(Info, Devel) << "Custom parameter - verbose (= verbose printouts): " << param->second << ENDM;
if (param->second == "true" || param->second == "True" || param->second == "TRUE") {
mVerbose = true;
}
}

if (auto param = mCustomParameters.find("isMC"); param != mCustomParameters.end()) {
ILOG(Info, Devel) << "Custom parameter - isMC: " << param->second << ENDM;
if (param->second == "true" || param->second == "True" || param->second == "TRUE") {
mUseMC = true;
mMCReader.initFromDigitContext("collisioncontext.root");
mPurityVsMult = new TProfile("purityVsMult", "purityVsMult", 100, -0.5, 9999.5, 0.f, 1.f);
mNPrimaryMCEvWithVtx = new TH1F("NPrimaryMCEvWithVtx", "NPrimaryMCEvWithVtx", 100, -0.5, 9999.5);
mPurityVsMult = new TProfile("purityVsMult", "purityVsMult; MC primary mult; vtx purity", 100, -0.5, 9999.5, 0.f, 1.f);
mNPrimaryMCEvWithVtx = new TH1F("NPrimaryMCEvWithVtx", "NPrimaryMCEvWithVtx; MC primary mult; n. events", 100, -0.5, 9999.5);
mNPrimaryMCEvWithVtx->Sumw2();
mNPrimaryMCGen = new TH1F("NPrimaryMCGen", "NPrimaryMCGen", 100, -0.5, 9999.5);
mNPrimaryMCGen = new TH1F("NPrimaryMCGen", "NPrimaryMCGen; MC primary mult; n. events with vtx", 100, -0.5, 9999.5);
mNPrimaryMCGen->Sumw2();
mVtxEffVsMult = new TH1F("vtxEffVsMult", "vtxEffVsMult", 100, -0.5, 9999.5);
mCloneFactorVsMult = new TProfile("cloneFactorVsMult", "cloneFactorVsMult", 100, -0.5, 9999.5, 0.f, 1.f);
mVtxResXVsMult = new TProfile("vtxResXVsMult", "vtxRes (X) vs mult", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxResYVsMult = new TProfile("vtxResYVsMult", "vtxRes (Y) vs mult", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxResZVsMult = new TProfile("vtxResZVsMult", "vtxRes (Z) vs mult", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxPullsXVsMult = new TProfile("vtxPullsXVsMult", "vtxPulls (X) vs mult", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxPullsYVsMult = new TProfile("vtxPullsYVsMult", "vtxPulls (Y) vs mult", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxPullsZVsMult = new TProfile("vtxPullsZVsMult", "vtxPulls (Z) vs mult", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxEffVsMult = new TEfficiency("vtxEffVsMult", "vtxEffVsMult; MC primary mult; vtx reco efficiency", 100, -0.5, 9999.5);
mCloneFactorVsMult = new TProfile("cloneFactorVsMult", "cloneFactorVsMult; MC primary mult; n. cloned vertices", 100, -0.5, 9999.5, 0.f, 1.f);
mVtxResXVsMult = new TProfile("vtxResXVsMult", "vtxRes (X) vs mult; n. contributors; res on X (cm)", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxResYVsMult = new TProfile("vtxResYVsMult", "vtxRes (Y) vs mult; n. conrtibutors; res on Y (cm)", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxResZVsMult = new TProfile("vtxResZVsMult", "vtxRes (Z) vs mult; n. contriobutors; res on Z (cm)", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxPullsXVsMult = new TProfile("vtxPullsXVsMult", "vtxPulls (X) vs mult; MC primary mult; pulls for X", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxPullsYVsMult = new TProfile("vtxPullsYVsMult", "vtxPulls (Y) vs mult; MC primary mult; pulls for Y", 100, -0.5, 9999.5, 0.f, 100.f);
mVtxPullsZVsMult = new TProfile("vtxPullsZVsMult", "vtxPulls (Z) vs mult; MC primary mult; pulls for Z", 100, -0.5, 9999.5, 0.f, 100.f);
getObjectsManager()->startPublishing(mPurityVsMult);
getObjectsManager()->startPublishing(mNPrimaryMCEvWithVtx);
getObjectsManager()->startPublishing(mNPrimaryMCGen);
Expand All @@ -86,17 +96,19 @@ void VertexingQcTask::initialize(o2::framework::InitContext& /*ctx*/)
}
}

mX = new TH1F("vertex_X", "vertex_X", 1000, -1, 1);
mY = new TH1F("vertex_Y", "vertex_Y", 1000, -1, 1);
mZ = new TH1F("vertex_Z", "vertex_Z", 1000, -20, 20);
mNContributors = new TH1F("vertex_NContributors", "vertex_NContributors", 1000, -0.5, 999.5);
mTimeUncVsNContrib = new TProfile("timeUncVsNContrib", "timeUncVsNContrib", 100, -0.5, 999.5, 0.f, 10.f);
mX = new TH1F("vertex_X", "vertex_X; vtx_X (cm); entries", 1000, -1, 1);
mY = new TH1F("vertex_Y", "vertex_Y; vtx_Y (cm); entries", 1000, -1, 1);
mZ = new TH1F("vertex_Z", "vertex_Z; vtx_Z (cm);entries", 1000, -20, 20);
mNContributors = new TH1F("vertex_NContributors", "vertex_NContributors; n. contributors; entries", 1000, -0.5, 999.5);
mTimeUncVsNContrib = new TProfile("timeUncVsNContrib", "timeUncVsNContrib; n. contributors; time uncertainty (us)", 100, -0.5, 999.5, 0.f, 10.f);
mBeamSpot = new TH2F("beamSpot", "beam spot; vtx_X (cm); vtx_Y (cm)", 1000, -1, 1, 1000, -1, 1);

getObjectsManager()->startPublishing(mX);
getObjectsManager()->startPublishing(mY);
getObjectsManager()->startPublishing(mZ);
getObjectsManager()->startPublishing(mNContributors);
getObjectsManager()->startPublishing(mTimeUncVsNContrib);
getObjectsManager()->startPublishing(mBeamSpot);
}

void VertexingQcTask::startOfActivity(Activity& activity)
Expand Down Expand Up @@ -166,12 +178,13 @@ void VertexingQcTask::monitorData(o2::framework::ProcessingContext& ctx)
mZ->Fill(z);
mNContributors->Fill(nContr);
mTimeUncVsNContrib->Fill(nContr, timeUnc);
mBeamSpot->Fill(x, y);

if (mUseMC && mcLbl[i].isSet()) { // make sure the label was set
auto header = mMCReader.getMCEventHeader(mcLbl[i].getSourceID(), mcLbl[i].getEventID());
auto purity = mcLbl[i].getCorrWeight();
auto mult = header.GetNPrim();
ILOG(Info, Support) << "purity = " << purity << ", mult = " << mult << ENDM;
ILOG(Debug, Support) << "purity = " << purity << ", mult = " << mult << ENDM;
mPurityVsMult->Fill(mult, purity);
TVector3 vtMC;
header.GetVertex(vtMC);
Expand All @@ -198,7 +211,21 @@ void VertexingQcTask::endOfCycle()
ILOG(Info, Support) << "endOfCycle" << ENDM;

if (mUseMC) {
mVtxEffVsMult->Divide(mNPrimaryMCEvWithVtx, mNPrimaryMCGen, 1, 1, "B");

if (!mVtxEffVsMult->SetTotalHistogram(*mNPrimaryMCGen, "") ||
!mVtxEffVsMult->SetPassedHistogram(*mNPrimaryMCEvWithVtx, "")) {
ILOG(Fatal, Support) << "Something went wrong in defining the efficiency histograms!!";
} else {
if (mVerbose) {
for (int ibin = 0; ibin < mNPrimaryMCEvWithVtx->GetNbinsX(); ibin++) {
if (mNPrimaryMCEvWithVtx->GetBinContent(ibin + 1) != 0 && mNPrimaryMCGen->GetBinContent(ibin + 1) != 0) {
ILOG(Info, Support) << "ibin = " << ibin + 1 << ", mNPrimaryMCEvWithVtx->GetBinContent(ibin + 1) = " << mNPrimaryMCEvWithVtx->GetBinContent(ibin + 1) << ", mNPrimaryMCGen->GetBinContent(ibin + 1) = " << mNPrimaryMCGen->GetBinContent(ibin + 1) << ", efficiency = " << mVtxEffVsMult->GetEfficiency(ibin + 1) << ENDM;
ILOG(Info, Support) << "ibin = " << ibin + 1 << ", mNPrimaryMCEvWithVtx->GetBinError(ibin + 1) = " << mNPrimaryMCEvWithVtx->GetBinError(ibin + 1) << ", mNPrimaryMCGen->GetBinError(ibin + 1) = " << mNPrimaryMCGen->GetBinError(ibin + 1) << ", efficiency error low = " << mVtxEffVsMult->GetEfficiencyErrorLow(ibin + 1) << ", efficiency error up = " << mVtxEffVsMult->GetEfficiencyErrorUp(ibin + 1) << ENDM;
}
}
ILOG(Info, Support) << "mNPrimaryMCEvWithVtx entries = " << mNPrimaryMCEvWithVtx->GetEntries() << ", mNPrimaryMCGen entries = " << mNPrimaryMCGen->GetEntries() << ENDM;
}
}
}
}

Expand All @@ -216,11 +243,11 @@ void VertexingQcTask::reset()
mY->Reset();
mZ->Reset();
mNContributors->Reset();
mBeamSpot->Reset();
if (mUseMC) {
mPurityVsMult->Reset();
mNPrimaryMCEvWithVtx->Reset();
mNPrimaryMCGen->Reset();
mVtxEffVsMult->Reset();
mCloneFactorVsMult->Reset();
mVtxResXVsMult->Reset();
mVtxResYVsMult->Reset();
Expand Down
5 changes: 5 additions & 0 deletions Modules/TOF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ install(FILES tofdigits.json
tofraw_multinode.json
tofcosmics.json
toftrending.json
tofMatchedTracks_ITSTPCTOF.json
tofMatchedTracks_ITSTPCTOF_TPCTOF.json
tofMatchedTracks_ITSTPCTOF_TPCTOF_MC.json
tofMatchedTracks_ITSTPCTOF_TPCTOF_direct.json
tofMatchedTracks_ITSTPCTOF_TPCTOF_direct_MC.json
DESTINATION etc)

get_property(dirs
Expand Down
32 changes: 28 additions & 4 deletions Modules/TOF/include/TOF/TOFMatchedTracks.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "SimulationDataFormat/MCCompLabel.h"

class TH1F;
class TEfficiency;

namespace o2::quality_control_modules::tof
{
Expand Down Expand Up @@ -53,6 +54,19 @@ class TOFMatchedTracks final : public TaskInterface
void endOfActivity(Activity& activity) override;
void reset() override;

// track selection
bool selectTrack(o2::tpc::TrackTPC const& track);
void setPtCut(float v) { mPtCut = v; }
void setEtaCut(float v) { mEtaCut = v; }
void setMinNTPCClustersCut(float v) { mNTPCClustersCut = v; }
void setMinDCAtoBeamPipeCut(std::array<float, 2> v)
{
setMinDCAtoBeamPipeDistanceCut(v[0]);
setMinDCAtoBeamPipeYCut(v[1]);
}
void setMinDCAtoBeamPipeDistanceCut(float v) { mDCACut = v; }
void setMinDCAtoBeamPipeYCut(float v) { mDCACutY = v; }

private:
std::shared_ptr<o2::globaltracking::DataRequest> mDataRequest;
o2::globaltracking::RecoContainer mRecoCont;
Expand All @@ -73,10 +87,20 @@ class TOFMatchedTracks final : public TaskInterface
TH1F* mMatchedTracksEta[trkType::SIZE] = {};
TH1F* mFakeMatchedTracksPt[trkType::SIZE] = {};
TH1F* mFakeMatchedTracksEta[trkType::SIZE] = {};
TH1F* mEffPt[trkType::SIZE] = {};
TH1F* mEffEta[trkType::SIZE] = {};
TH1F* mFakeFractionTracksPt[trkType::SIZE] = {}; // fraction of fakes among the matched tracks vs pT
TH1F* mFakeFractionTracksEta[trkType::SIZE] = {}; // fraction of fakes among the matched tracks vs Eta
TEfficiency* mEffPt[trkType::SIZE] = {};
TEfficiency* mEffEta[trkType::SIZE] = {};
TEfficiency* mFakeFractionTracksPt[trkType::SIZE] = {}; // fraction of fakes among the matched tracks vs pT
TEfficiency* mFakeFractionTracksEta[trkType::SIZE] = {}; // fraction of fakes among the matched tracks vs Eta

// for track selection
float mPtCut = 0.1f;
float mEtaCut = 1.4f;
int32_t mNTPCClustersCut = 40;
float mDCACut = 100.f;
float mDCACutY = 10.f;
std::string mGRPFileName = "o2sim_grp.root";
std::string mGeomFileName = "o2sim_geometry.root";
float mBz = 0; ///< nominal Bz
};

} // namespace o2::quality_control_modules::tof
Expand Down
Loading