Skip to content
Merged
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
38 changes: 26 additions & 12 deletions DPG/Tasks/AOTEvent/eventSelectionQa.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "Common/CCDB/EventSelectionParams.h"
#include "Common/CCDB/TriggerAliases.h"
#include "Common/Core/MetadataHelper.h"
#include "Common/DataModel/EventSelection.h"

#include <CCDB/BasicCCDBManager.h>
Expand Down Expand Up @@ -59,14 +60,15 @@ using namespace o2::framework;
using namespace o2;
using namespace o2::aod::evsel;

o2::common::core::MetadataHelper metadataInfo;

using BCsRun2 = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Timestamps, aod::BcSels, aod::Run2MatchedToBCSparse>;
using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
using ColEvSels = soa::Join<aod::Collisions, aod::EvSels>;
using FullTracksIU = soa::Join<aod::TracksIU, aod::TracksExtra>;
using FullTracksIUwithLabels = soa::Join<aod::TracksIU, aod::TracksExtra, aod::McTrackLabels>;

struct EventSelectionQaTask {
Configurable<bool> isMC{"isMC", 0, "0 - data, 1 - MC"};
Configurable<int32_t> nGlobalBCs{"nGlobalBCs", 100000, "number of global bcs for detailed monitoring"};
Configurable<bool> isLowFlux{"isLowFlux", 1, "1 - low flux (pp, pPb), 0 - high flux (PbPb)"};
Configurable<bool> fillITSdeadStaveHists{"fillITSdeadStaveHists", 0, "0 - no, 1 - yes"};
Expand All @@ -85,6 +87,10 @@ struct EventSelectionQaTask {
int rofOffset = -1; // ITS ROF offset, in bc
int rofLength = -1; // ITS ROF length, in bc

std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata
std::string strPassName = ""; // RecoPassName (for data) or AnchorPassName (for MC) from metadata
bool isMC = false;

std::bitset<nBCsPerOrbit> bcPatternA;
std::bitset<nBCsPerOrbit> bcPatternC;
std::bitset<nBCsPerOrbit> bcPatternB;
Expand All @@ -111,9 +117,13 @@ struct EventSelectionQaTask {
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();

const AxisSpec axisMultV0M{1000, 0., isLowFlux ? 40000. : 40000., "V0M multiplicity"};
isMC = metadataInfo.isMC();
strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag
strPassName = metadataInfo.get(isMC ? "AnchorPassName" : "RecoPassName");

const AxisSpec axisMultV0M{1000, 0., 40000., "V0M multiplicity"};
const AxisSpec axisMultV0A{1000, 0., isLowFlux ? 40000. : 200000., "V0A multiplicity"};
const AxisSpec axisMultV0C{1000, 0., isLowFlux ? 30000. : 30000., "V0C multiplicity"};
const AxisSpec axisMultV0C{1000, 0., 30000., "V0C multiplicity"};
const AxisSpec axisMultT0A{1000, 0., isLowFlux ? 10000. : 200000., "T0A multiplicity"};
const AxisSpec axisMultT0C{1000, 0., isLowFlux ? 2000. : 70000., "T0C multiplicity"};
const AxisSpec axisMultT0M{1000, 0., isLowFlux ? 12000. : 270000., "T0M multiplicity"};
Expand Down Expand Up @@ -568,9 +578,7 @@ struct EventSelectionQaTask {
histos.fill(HIST("hV0C012vsTklCol"), nTracklets, multRingV0C012);

// filling plots for accepted events
bool accepted = 0;
accepted |= !isINT1period & col.sel7();
accepted |= isINT1period & sel1;
bool accepted = (!isINT1period && col.sel7()) || (isINT1period && sel1);
if (!accepted) {
continue;
}
Expand Down Expand Up @@ -622,8 +630,13 @@ struct EventSelectionQaTask {
lastRun = run;
int64_t tsSOR = 0; // dummy start-of-run timestamp for unanchored MC
int64_t tsEOR = 1; // dummy end-of-run timestamp for unanchored MC
if (run >= 500000) {
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
const int run3min = 500000;
if (run >= run3min) {
auto runInfo = (!isMC) ? o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run)
: o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag);
LOGP(info, "eventSelectionQA: isMC = {}, NumberOfOrbitsPerTF extracted from AggregatedRunInfo = {}", isMC, runInfo.orbitsPerTF);
LOGP(info, "eventSelectionQA: strLPMProductionTag = {}, strPassName = {}", strLPMProductionTag, strPassName);

// first bc of the first orbit
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
// number of orbits per TF
Expand Down Expand Up @@ -786,13 +799,13 @@ struct EventSelectionQaTask {
const auto& bcPast = bcs.iteratorAt(bc.globalIndex() - deltaIndex);
deltaBC = globalBC - bcPast.globalBC();
if (deltaBC < maxDeltaBC) {
pastActivityFT0 |= bcPast.has_ft0();
pastActivityFV0 |= bcPast.has_fv0a();
pastActivityFDD |= bcPast.has_fdd();
pastActivityFT0 = pastActivityFT0 || bcPast.has_ft0();
pastActivityFV0 = pastActivityFV0 || bcPast.has_fv0a();
pastActivityFDD = pastActivityFDD || bcPast.has_fdd();
}
}

bool pastActivity = pastActivityFT0 | pastActivityFV0 | pastActivityFDD;
bool pastActivity = pastActivityFT0 || pastActivityFV0 || pastActivityFDD;

int localBC = bc.globalBC() % nBCsPerOrbit;
float timeV0A = bc.has_fv0a() ? bc.fv0a().time() : -999.f;
Expand Down Expand Up @@ -1508,6 +1521,7 @@ struct EventSelectionQaTask {

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
metadataInfo.initMetadata(cfgc);
return WorkflowSpec{
adaptAnalysisTask<EventSelectionQaTask>(cfgc)};
}
Loading