Skip to content

Commit 6a5d6d6

Browse files
Merge branch 'AliceO2Group:master' into master
2 parents 25a80b9 + 6aa00f1 commit 6a5d6d6

35 files changed

+3601
-1417
lines changed

Common/TableProducer/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ o2physics_add_dpl_workflow(event-selection-service
3434
O2::DataFormatsITSMFT
3535
COMPONENT_NAME Analysis)
3636

37+
o2physics_add_dpl_workflow(event-selection-service-run2
38+
SOURCES eventSelectionServiceRun2.cxx
39+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCCDB
40+
O2::DataFormatsITSMFT
41+
COMPONENT_NAME Analysis)
42+
3743
o2physics_add_dpl_workflow(multiplicity-table
3844
SOURCES multiplicityTable.cxx
3945
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
@@ -74,6 +80,16 @@ o2physics_add_dpl_workflow(track-propagation
7480
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
7581
COMPONENT_NAME Analysis)
7682

83+
o2physics_add_dpl_workflow(propagationservice
84+
SOURCES propagationService.cxx
85+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::TPCDriftManager
86+
COMPONENT_NAME Analysis)
87+
88+
o2physics_add_dpl_workflow(propagationservice-run2
89+
SOURCES propagationServiceRun2.cxx
90+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DCAFitter KFParticle::KFParticle O2Physics::TPCDriftManager
91+
COMPONENT_NAME Analysis)
92+
7793
o2physics_add_dpl_workflow(track-dca-cov-filler-run2
7894
SOURCES trackDcaCovFillerRun2.cxx
7995
PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2Physics::AnalysisCore

Common/TableProducer/PID/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ o2physics_add_dpl_workflow(pid-tpc-service-run2
5353
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB
5454
COMPONENT_NAME Analysis)
5555

56-
o2physics_add_dpl_workflow(pid-tpc-service-run3
57-
SOURCES pidTPCServiceRun3.cxx
58-
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::MLCore O2Physics::AnalysisCCDB
59-
COMPONENT_NAME Analysis)
60-
6156
o2physics_add_dpl_workflow(pid-tpc-base
6257
SOURCES pidTPCBase.cxx
6358
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::AnalysisCCDB

Common/TableProducer/PID/pidTPCService.cxx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,33 +67,23 @@ struct pidTpcService {
6767
pidTPC.init(ccdb, ccdbApi, initContext, pidTPCopts, metadataInfo);
6868
}
6969

70-
void processTracks(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::Tracks, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs)
71-
{
72-
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
73-
}
74-
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)
75-
{
76-
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products);
77-
}
78-
79-
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&)
70+
void processTracksIU(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::TracksIU, aod::TracksCovIU, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs)
8071
{
8172
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
8273
}
8374

84-
void processTracksIU(soa::Join<aod::Collisions, aod::EvSels> const& collisions, soa::Join<aod::TracksIU, aod::TracksCovIU, aod::TracksExtra> const& tracks, aod::BCsWithTimestamps const& bcs)
75+
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&)
8576
{
8677
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
8778
}
8879

89-
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&)
80+
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)
9081
{
91-
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
82+
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products);
9283
}
9384

94-
PROCESS_SWITCH(pidTpcService, processTracks, "Process Tracks", false);
95-
PROCESS_SWITCH(pidTpcService, processTracksMC, "Process Tracks in MC (enables tune-on-data)", false);
9685
PROCESS_SWITCH(pidTpcService, processTracksIU, "Process TracksIU (Run 3)", true);
86+
PROCESS_SWITCH(pidTpcService, processTracksIUWithTracksQA, "Process TracksIU (Run 3)", false);
9787
PROCESS_SWITCH(pidTpcService, processTracksMCIU, "Process TracksIUMC (Run 3)", false);
9888
};
9989

Common/TableProducer/PID/pidTPCServiceRun2.cxx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ struct pidTpcServiceRun2 {
7171
{
7272
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, static_cast<TObject*>(nullptr), products);
7373
}
74-
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)
75-
{
76-
pidTPC.process(ccdb, ccdbApi, bcs, collisions, tracks, tracksQA, products);
77-
}
7874

7975
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&)
8076
{

Common/TableProducer/PID/pidTPCServiceRun3.cxx

Lines changed: 0 additions & 96 deletions
This file was deleted.

Common/TableProducer/eventSelectionService.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
197197
if (isRun3) {
198198
return WorkflowSpec{adaptAnalysisTask<eventselectionRun3>(cfgc)};
199199
} else {
200+
LOGF(info, "******************************************************************");
201+
LOGF(info, " Event selection service self-configuring for Run 2.");
202+
LOGF(info, " WARNING: THIS HAS NOT BEEN VALIDATED YET, USE WITH CAUTION");
203+
LOGF(info, " If this fails, please use event-selection-service-run2 instead.");
204+
LOGF(info, "******************************************************************");
200205
return WorkflowSpec{adaptAnalysisTask<eventselectionRun2>(cfgc)};
201206
}
202207
}
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file eventSelectionTester.cxx
13+
/// \brief unified, self-configuring event selection task
14+
/// \author ALICE
15+
16+
//===============================================================
17+
//
18+
// Unified, self-configuring event selection task
19+
//
20+
//===============================================================
21+
22+
#include "Common/Core/MetadataHelper.h"
23+
#include "Common/DataModel/EventSelection.h"
24+
#include "Common/Tools/EventSelectionModule.h"
25+
#include "Common/Tools/timestampModule.h"
26+
27+
#include <CCDB/BasicCCDBManager.h>
28+
#include <Framework/AnalysisDataModel.h>
29+
#include <Framework/AnalysisHelpers.h>
30+
#include <Framework/AnalysisTask.h>
31+
#include <Framework/Configurable.h>
32+
#include <Framework/DataTypes.h>
33+
#include <Framework/HistogramRegistry.h>
34+
#include <Framework/InitContext.h>
35+
#include <Framework/OutputObjHeader.h>
36+
#include <Framework/runDataProcessing.h>
37+
38+
#include <cstdint>
39+
#include <stdexcept>
40+
#include <string>
41+
#include <vector>
42+
43+
using namespace o2;
44+
using namespace o2::framework;
45+
46+
o2::common::core::MetadataHelper metadataInfo; // Metadata helper
47+
48+
using BCsWithRun2InfosAndMatches = soa::Join<aod::BCs, aod::Run2BCInfos, aod::Run2MatchedToBCSparse>;
49+
using BCsWithRun3Matchings = soa::Join<aod::BCs, aod::Run3MatchedToBCSparse>;
50+
using FullTracks = soa::Join<aod::Tracks, aod::TracksExtra>;
51+
using FullTracksIU = soa::Join<aod::TracksIU, aod::TracksExtra>;
52+
53+
struct eventselectionRun2 {
54+
o2::common::timestamp::timestampConfigurables timestampConfigurables;
55+
o2::common::timestamp::TimestampModule timestampMod;
56+
57+
o2::common::eventselection::bcselConfigurables bcselOpts;
58+
o2::common::eventselection::BcSelectionModule bcselmodule;
59+
60+
o2::common::eventselection::evselConfigurables evselOpts;
61+
o2::common::eventselection::EventSelectionModule evselmodule;
62+
63+
Produces<aod::Timestamps> timestampTable; /// Table with SOR timestamps produced by the task
64+
Produces<aod::BcSels> bcsel;
65+
Produces<aod::EvSels> evsel;
66+
67+
// for slicing
68+
SliceCache cache;
69+
70+
// CCDB boilerplate declarations
71+
o2::framework::Configurable<std::string> ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
72+
Service<o2::ccdb::BasicCCDBManager> ccdb;
73+
74+
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
75+
76+
// buffering intermediate results for passing
77+
std::vector<uint64_t> timestamps;
78+
std::vector<o2::common::eventselection::bcselEntry> bcselsbuffer;
79+
80+
// auxiliary
81+
Partition<FullTracks> tracklets = (aod::track::trackType == static_cast<uint8_t>(o2::aod::track::TrackTypeEnum::Run2Tracklet));
82+
Preslice<FullTracks> perCollision = aod::track::collisionId;
83+
84+
void init(o2::framework::InitContext& context)
85+
{
86+
// CCDB boilerplate init
87+
ccdb->setCaching(true);
88+
ccdb->setLocalObjectValidityChecking();
89+
ccdb->setURL(ccdburl.value);
90+
91+
// task-specific
92+
timestampMod.init(timestampConfigurables, metadataInfo);
93+
bcselmodule.init(context, bcselOpts, histos, metadataInfo);
94+
evselmodule.init(context, evselOpts, histos, metadataInfo);
95+
}
96+
97+
void process(BCsWithRun2InfosAndMatches const& bcs,
98+
aod::Collisions const& collisions,
99+
aod::Zdcs const&,
100+
aod::FV0As const&,
101+
aod::FV0Cs const&,
102+
aod::FT0s const&,
103+
aod::FDDs const&,
104+
FullTracks const&)
105+
{
106+
timestampMod.process(bcs, ccdb, timestamps, timestampTable);
107+
bcselmodule.processRun2(ccdb, bcs, timestamps, bcselsbuffer, bcsel);
108+
evselmodule.processRun2(ccdb, histos, collisions, tracklets, cache, timestamps, bcselsbuffer, evsel);
109+
}
110+
};
111+
112+
struct eventselectionRun3 {
113+
o2::common::timestamp::timestampConfigurables timestampConfigurables;
114+
o2::common::timestamp::TimestampModule timestampMod;
115+
116+
o2::common::eventselection::bcselConfigurables bcselOpts;
117+
o2::common::eventselection::BcSelectionModule bcselmodule;
118+
119+
o2::common::eventselection::evselConfigurables evselOpts;
120+
o2::common::eventselection::EventSelectionModule evselmodule;
121+
122+
o2::common::eventselection::lumiConfigurables lumiOpts;
123+
o2::common::eventselection::LumiModule lumimodule;
124+
125+
Produces<aod::Timestamps> timestampTable; /// Table with SOR timestamps produced by the task
126+
Produces<aod::BcSels> bcsel;
127+
Produces<aod::EvSels> evsel;
128+
129+
// for slicing
130+
SliceCache cache;
131+
132+
// CCDB boilerplate declarations
133+
o2::framework::Configurable<std::string> ccdburl{"ccdburl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
134+
Service<o2::ccdb::BasicCCDBManager> ccdb;
135+
136+
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
137+
138+
// the best: have readable cursors
139+
// this: a stopgap solution to avoid spawning yet another device
140+
std::vector<uint64_t> timestamps;
141+
std::vector<o2::common::eventselection::bcselEntry> bcselsbuffer;
142+
143+
// auxiliary
144+
Partition<FullTracksIU> pvTracks = ((aod::track::flags & static_cast<uint32_t>(o2::aod::track::PVContributor)) == static_cast<uint32_t>(o2::aod::track::PVContributor));
145+
Preslice<FullTracksIU> perCollisionIU = aod::track::collisionId;
146+
147+
void init(o2::framework::InitContext& context)
148+
{
149+
// CCDB boilerplate init
150+
ccdb->setCaching(true);
151+
ccdb->setLocalObjectValidityChecking();
152+
ccdb->setURL(ccdburl.value);
153+
154+
// task-specific
155+
timestampMod.init(timestampConfigurables, metadataInfo);
156+
bcselmodule.init(context, bcselOpts, histos, metadataInfo);
157+
evselmodule.init(context, evselOpts, histos, metadataInfo);
158+
lumimodule.init(context, lumiOpts, histos);
159+
}
160+
161+
void process(aod::Collisions const& collisions,
162+
BCsWithRun3Matchings const& bcs,
163+
aod::Zdcs const&,
164+
aod::FV0As const&,
165+
aod::FT0s const& ft0s, // to resolve iterator
166+
aod::FDDs const&,
167+
FullTracksIU const&)
168+
{
169+
timestampMod.process(bcs, ccdb, timestamps, timestampTable);
170+
bcselmodule.processRun3(ccdb, histos, bcs, timestamps, bcselsbuffer, bcsel);
171+
evselmodule.processRun3(ccdb, histos, bcs, collisions, pvTracks, ft0s, cache, timestamps, bcselsbuffer, evsel);
172+
lumimodule.process(ccdb, histos, bcs, timestamps, bcselsbuffer);
173+
}
174+
};
175+
176+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
177+
{
178+
// Parse the metadata for later too
179+
metadataInfo.initMetadata(cfgc);
180+
181+
LOGF(info, "Event selection with forced Run 2 mode engaging in unchecked mode.");
182+
LOGF(info, "To be improved once metadata enabling in defineDataProcessing is worked out.");
183+
184+
// force Run 2 mode
185+
return WorkflowSpec{adaptAnalysisTask<eventselectionRun2>(cfgc)};
186+
}

0 commit comments

Comments
 (0)