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
6 changes: 6 additions & 0 deletions Common/TableProducer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,18 @@
O2::DataFormatsITSMFT
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(event-selection-service-run2
SOURCES eventSelectionServiceRun2.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCCDB
O2::DataFormatsITSMFT
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(multiplicity-table
SOURCES multiplicityTable.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(multcenttable

Check failure on line 48 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name multcenttable does not match its file name multCentTable.cxx. (Matches multcenttable.cxx.)
SOURCES multCentTable.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
Expand Down Expand Up @@ -79,7 +85,7 @@
PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(calo-clusters

Check failure on line 88 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name calo-clusters does not match its file name caloClusterProducer.cxx. (Matches caloClusters.cxx.)
SOURCES caloClusterProducer.cxx
PUBLIC_LINK_LIBRARIES O2::DataFormatsPHOS O2::PHOSBase O2::PHOSReconstruction O2Physics::DataModel
COMPONENT_NAME Analysis)
Expand All @@ -102,12 +108,12 @@
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(mccollisionextra

Check failure on line 111 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name mccollisionextra does not match its file name mcCollsExtra.cxx. (Matches mccollisionextra.cxx.)
SOURCES mcCollsExtra.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(qvector-table

Check failure on line 116 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name qvector-table does not match its file name qVectorsTable.cxx. (Matches qvectorTable.cxx.)
SOURCES qVectorsTable.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2Physics::AnalysisCore
Expand All @@ -116,7 +122,7 @@
O2::CCDB
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(mftmchmatchingml

Check failure on line 125 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name mftmchmatchingml does not match its file name mftmchMatchingML.cxx. (Matches mftmchmatchingml.cxx.)
SOURCES mftmchMatchingML.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2Physics::AnalysisCore
Expand All @@ -125,7 +131,7 @@
O2::ReconstructionDataFormats
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(match-mft-ft0

Check failure on line 134 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name match-mft-ft0 does not match its file name match-mft-ft0.cxx. (Matches matchMftFt0.cxx.)
SOURCES match-mft-ft0.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
O2::ReconstructionDataFormats
Expand All @@ -142,17 +148,17 @@
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(mftmch-matching-data

Check failure on line 151 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name mftmch-matching-data does not match its file name match-mft-mch-data.cxx. (Matches mftmchMatchingData.cxx.)
SOURCES match-mft-mch-data.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::GlobalTracking
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(occ-table-producer

Check failure on line 156 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name occ-table-producer does not match its file name occupancyTableProducer.cxx. (Matches occTableProducer.cxx.)
SOURCES occupancyTableProducer.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(mftmch-matching-data-mc

Check failure on line 161 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name mftmch-matching-data-mc does not match its file name match-mft-mch-data-mc.cxx. (Matches mftmchMatchingDataMc.cxx.)
SOURCES match-mft-mch-data-mc.cxx
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::GlobalTracking
COMPONENT_NAME Analysis)
Expand All @@ -162,7 +168,7 @@
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2::DetectorsBase O2::DetectorsCommonDataFormats O2::MathUtils O2::MCHTracking O2::DataFormatsMCH O2::GlobalTracking O2::MCHBase O2::MCHGeometryTransformer O2::CommonUtils
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(selectionstudytable

Check failure on line 171 in Common/TableProducer/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-workflow]

Workflow name selectionstudytable does not match its file name selectionStudyTable.cxx. (Matches selectionstudytable.cxx.)
SOURCES selectionStudyTable.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
COMPONENT_NAME Analysis)
5 changes: 0 additions & 5 deletions Common/TableProducer/PID/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ o2physics_add_dpl_workflow(pid-tpc-service-run2
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(pid-tpc-service-run3
SOURCES pidTPCServiceRun3.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB
COMPONENT_NAME Analysis)

o2physics_add_dpl_workflow(pid-tpc-base
SOURCES pidTPCBase.cxx
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB
Expand Down
20 changes: 5 additions & 15 deletions Common/TableProducer/PID/pidTPCService.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,33 +67,23 @@ struct pidTpcService {
pidTPC.init(ccdb, ccdbApi, initContext, pidTPCopts, metadataInfo);
}

void processTracks(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::Tracks, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs)
{
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
}
void processTracksWithTracksQA(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::Tracks, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs, aod::TracksQA const& tracksQA)
{
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products);
}

void processTracksMC(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::Tracks, aod::TracksExtra, aod::McTrackLabels> const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&)
void processTracksIU(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::TracksIU, aod::TracksCovIU, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs)
{
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
}

void processTracksIU(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::TracksIU, aod::TracksCovIU, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs)
void processTracksMCIU(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::TracksIU, aod::TracksCovIU, aod::TracksExtra, aod::McTrackLabels> const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&)
{
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
}

void processTracksMCIU(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::TracksIU, aod::TracksCovIU, aod::TracksExtra, aod::McTrackLabels> const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&)
void processTracksIUWithTracksQA(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::TracksIU, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs, aod::TracksQAVersion const& tracksQA)
{
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products);
}

PROCESS_SWITCH(pidTpcService, processTracks, "Process Tracks", false);
PROCESS_SWITCH(pidTpcService, processTracksMC, "Process Tracks in MC (enables tune-on-data)", false);
PROCESS_SWITCH(pidTpcService, processTracksIU, "Process TracksIU (Run 3)", true);
PROCESS_SWITCH(pidTpcService, processTracksIUWithTracksQA, "Process TracksIU (Run 3)", false);
PROCESS_SWITCH(pidTpcService, processTracksMCIU, "Process TracksIUMC (Run 3)", false);
};

Expand Down
4 changes: 0 additions & 4 deletions Common/TableProducer/PID/pidTPCServiceRun2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ struct pidTpcServiceRun2 {
{
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
}
void processTracksWithTracksQA(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::Tracks, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs, aod::TracksQA const& tracksQA)
{
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products);
}

void processTracksMC(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::Tracks, aod::TracksExtra, aod::McTrackLabels> const& tracks, aod::BCsWithTimestamps const& bcs, aod::McParticles const&)
{
Expand Down
96 changes: 0 additions & 96 deletions Common/TableProducer/PID/pidTPCServiceRun3.cxx

This file was deleted.

5 changes: 5 additions & 0 deletions Common/TableProducer/eventSelectionService.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
if (isRun3) {
return WorkflowSpec{adaptAnalysisTask<eventselectionRun3>(cfgc)};
} else {
LOGF(info, "******************************************************************");
LOGF(info, " Event selection service self-configuring for Run 2.");
LOGF(info, " WARNING: THIS HAS NOT BEEN VALIDATED YET, USE WITH CAUTION");
LOGF(info, " If this fails, please use event-selection-service-run2 instead.");
LOGF(info, "******************************************************************");
return WorkflowSpec{adaptAnalysisTask<eventselectionRun2>(cfgc)};
}
}
Expand Down
186 changes: 186 additions & 0 deletions Common/TableProducer/eventSelectionServiceRun2.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// \file eventSelectionTester.cxx
/// \brief unified, self-configuring event selection task
/// \author ALICE

//===============================================================
//
// Unified, self-configuring event selection task
//
//===============================================================

#include "Common/Core/MetadataHelper.h"
#include "Common/DataModel/EventSelection.h"
#include "Common/Tools/EventSelectionModule.h"
#include "Common/Tools/timestampModule.h"

#include <CCDB/BasicCCDBManager.h>
#include <Framework/AnalysisDataModel.h>
#include <Framework/AnalysisHelpers.h>
#include <Framework/AnalysisTask.h>
#include <Framework/Configurable.h>
#include <Framework/DataTypes.h>
#include <Framework/HistogramRegistry.h>
#include <Framework/InitContext.h>
#include <Framework/OutputObjHeader.h>
#include <Framework/runDataProcessing.h>

#include <cstdint>
#include <stdexcept>
#include <string>
#include <vector>

using namespace o2;
using namespace o2::framework;

o2::common::core::MetadataHelper metadataInfo; // Metadata helper

using BCsWithRun2InfosAndMatches = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Run2MatchedToBCSparse>;
using BCsWithRun3Matchings = soa::Join<aod::BCs, aod::Run3MatchedToBCSparse>;
using FullTracks = soa::Join<aod::Tracks, aod::TracksExtra>;
using FullTracksIU = soa::Join<aod::TracksIU, aod::TracksExtra>;

struct eventselectionRun2 {
o2::common::timestamp::timestampConfigurables timestampConfigurables;
o2::common::timestamp::TimestampModule timestampMod;

o2::common::eventselection::bcselConfigurables bcselOpts;
o2::common::eventselection::BcSelectionModule bcselmodule;

o2::common::eventselection::evselConfigurables evselOpts;
o2::common::eventselection::EventSelectionModule evselmodule;

Produces<aod::Timestamps> timestampTable; /// Table with SOR timestamps produced by the task
Produces<aod::BcSels> bcsel;
Produces<aod::EvSels> evsel;

// for slicing
SliceCache cache;

// CCDB boilerplate declarations
o2::framework::Configurable<std::string> ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Service<o2::ccdb::BasicCCDBManager> ccdb;

HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};

// buffering intermediate results for passing
std::vector<uint64_t> timestamps;
std::vector<o2::common::eventselection::bcselEntry> bcselsbuffer;

// auxiliary
Partition<FullTracks> tracklets = (aod::track::trackType == static_cast<uint8_t>(o2::aod::track::TrackTypeEnum::Run2Tracklet));
Preslice<FullTracks> perCollision = aod::track::collisionId;

void init(o2::framework::InitContext& context)
{
// CCDB boilerplate init
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();
ccdb->setURL(ccdburl.value);

// task-specific
timestampMod.init(timestampConfigurables, metadataInfo);
bcselmodule.init(context, bcselOpts, histos, metadataInfo);
evselmodule.init(context, evselOpts, histos, metadataInfo);
}

void process(BCsWithRun2InfosAndMatches const& bcs,
aod::Collisions const& collisions,
aod::Zdcs const&,
aod::FV0As const&,
aod::FV0Cs const&,
aod::FT0s const&,
aod::FDDs const&,
FullTracks const&)
{
timestampMod.process(bcs, ccdb, timestamps, timestampTable);
bcselmodule.processRun2(ccdb, bcs, timestamps, bcselsbuffer, bcsel);
evselmodule.processRun2(ccdb, histos, collisions, tracklets, cache, timestamps, bcselsbuffer, evsel);
}
};

struct eventselectionRun3 {
o2::common::timestamp::timestampConfigurables timestampConfigurables;
o2::common::timestamp::TimestampModule timestampMod;

o2::common::eventselection::bcselConfigurables bcselOpts;
o2::common::eventselection::BcSelectionModule bcselmodule;

o2::common::eventselection::evselConfigurables evselOpts;
o2::common::eventselection::EventSelectionModule evselmodule;

o2::common::eventselection::lumiConfigurables lumiOpts;
o2::common::eventselection::LumiModule lumimodule;

Produces<aod::Timestamps> timestampTable; /// Table with SOR timestamps produced by the task
Produces<aod::BcSels> bcsel;
Produces<aod::EvSels> evsel;

// for slicing
SliceCache cache;

// CCDB boilerplate declarations
o2::framework::Configurable<std::string> ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
Service<o2::ccdb::BasicCCDBManager> ccdb;

HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};

// the best: have readable cursors
// this: a stopgap solution to avoid spawning yet another device
std::vector<uint64_t> timestamps;
std::vector<o2::common::eventselection::bcselEntry> bcselsbuffer;

// auxiliary
Partition<FullTracksIU> pvTracks = ((aod::track::flags & static_cast<uint32_t>(o2::aod::track::PVContributor)) == static_cast<uint32_t>(o2::aod::track::PVContributor));
Preslice<FullTracksIU> perCollisionIU = aod::track::collisionId;

void init(o2::framework::InitContext& context)
{
// CCDB boilerplate init
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();
ccdb->setURL(ccdburl.value);

// task-specific
timestampMod.init(timestampConfigurables, metadataInfo);
bcselmodule.init(context, bcselOpts, histos, metadataInfo);
evselmodule.init(context, evselOpts, histos, metadataInfo);
lumimodule.init(context, lumiOpts, histos);
}

void process(aod::Collisions const& collisions,
BCsWithRun3Matchings const& bcs,
aod::Zdcs const&,
aod::FV0As const&,
aod::FT0s const& ft0s, // to resolve iterator
aod::FDDs const&,
FullTracksIU const&)
{
timestampMod.process(bcs, ccdb, timestamps, timestampTable);
bcselmodule.processRun3(ccdb, histos, bcs, timestamps, bcselsbuffer, bcsel);
evselmodule.processRun3(ccdb, histos, bcs, collisions, pvTracks, ft0s, cache, timestamps, bcselsbuffer, evsel);
lumimodule.process(ccdb, histos, bcs, timestamps, bcselsbuffer);
}
};

WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
// Parse the metadata for later too
metadataInfo.initMetadata(cfgc);

LOGF(info, "Event selection with forced Run 2 mode engaging in unchecked mode.");
LOGF(info, "To be improved once metadata enabling in defineDataProcessing is worked out.");

// force Run 2 mode
return WorkflowSpec{adaptAnalysisTask<eventselectionRun2>(cfgc)};
}
Loading