Skip to content

Commit bbfa651

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents 2f66c33 + 66a62b9 commit bbfa651

File tree

22 files changed

+1990
-1024
lines changed

22 files changed

+1990
-1024
lines changed

.clang-format

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,60 @@ PenaltyBreakFirstLessLess: 120
3939
PenaltyBreakString: 1000
4040
PenaltyExcessCharacter: 1000000
4141
PenaltyReturnTypeOnItsOwnLine: 200
42-
SortIncludes: false
42+
SortIncludes: CaseSensitive
43+
IncludeBlocks: Regroup
44+
IncludeCategories:
45+
# O2Physics, PWG
46+
- Regex: ^(<|")PWG[A-Z]{2}/.*\.h
47+
Priority: 2
48+
CaseSensitive: true
49+
# O2Physics, non-PWG
50+
- Regex: ^(<|")(Common|ALICE3|DPG|EventFiltering|Tools|Tutorials)/.*\.h
51+
Priority: 3
52+
CaseSensitive: true
53+
# O2
54+
- Regex: ^(<|")(Algorithm|CCDB|Common[A-Z]|DataFormats|DCAFitter|Detectors|EMCAL|Field|Framework|FT0|FV0|GlobalTracking|ITS|MathUtils|MFT|MCH|MID|PHOS|PID|ReconstructionDataFormats|SimulationDataFormat|TOF|TPC|ZDC).*/.*\.h
55+
Priority: 4
56+
CaseSensitive: true
57+
# ROOT
58+
- Regex: ^(<|")(T[A-Z]|Math/|Roo[A-Z])[[:alnum:]/]+\.h
59+
Priority: 5
60+
CaseSensitive: true
61+
# known third-party: KFParticle
62+
- Regex: ^(<|")KF[A-Z][[:alnum:]]+\.h
63+
Priority: 6
64+
CaseSensitive: true
65+
# known third-party: FastJet
66+
- Regex: ^(<|")fastjet/
67+
Priority: 6
68+
CaseSensitive: true
69+
# known third-party: ONNX runtime
70+
- Regex: ^(<|")onnxruntime
71+
Priority: 6
72+
CaseSensitive: true
73+
# incomplete path to DataModel
74+
- Regex: ^(<|").*DataModel/
75+
Priority: 1
76+
CaseSensitive: true
77+
# other third-party
78+
- Regex: ^(<|")([[:alnum:]_]+/)+[[:alnum:]_]+\.h
79+
Priority: 6
80+
CaseSensitive: true
81+
# other local-looking file
82+
- Regex: ^".*\.
83+
Priority: 1
84+
CaseSensitive: true
85+
# C system
86+
- Regex: ^(<|")[[:lower:]_]+\.h(>|")
87+
Priority: 102
88+
CaseSensitive: true
89+
# C++ system
90+
- Regex: ^(<|")[[:lower:]_/]+(>|")
91+
Priority: 101
92+
CaseSensitive: true
93+
# rest
94+
- Regex: .*
95+
Priority: 100
4396
SpaceBeforeAssignmentOperators: true
4497
SpaceBeforeParens: ControlStatements
4598
SpaceInEmptyParentheses: false

ALICE3/TableProducer/OTF/onTheFlyTracker.cxx

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,48 +23,42 @@
2323
/// \author Roberto Preghenella preghenella@bo.infn.it
2424
///
2525

26-
#include <utility>
27-
#include <array>
28-
#include <string>
29-
#include <map>
30-
#include <vector>
31-
32-
#include <TGeoGlobalMagField.h>
33-
#include <TGenPhaseSpace.h>
34-
#include <TLorentzVector.h>
35-
#include <TRandom3.h>
26+
#include "ALICE3/Core/DelphesO2TrackSmearer.h"
27+
#include "ALICE3/Core/DetLayer.h"
28+
#include "ALICE3/Core/FastTracker.h"
29+
#include "ALICE3/Core/TrackUtilities.h"
30+
#include "ALICE3/DataModel/OTFStrangeness.h"
31+
#include "ALICE3/DataModel/collisionAlice3.h"
32+
#include "ALICE3/DataModel/tracksAlice3.h"
33+
#include "Common/Core/RecoDecay.h"
34+
#include "Common/DataModel/TrackSelectionTables.h"
3635

36+
#include "CommonConstants/MathConstants.h"
37+
#include "DCAFitter/DCAFitterN.h"
38+
#include "DataFormatsParameters/GRPMagField.h"
39+
#include "DetectorsBase/Propagator.h"
40+
#include "DetectorsVertexing/PVertexer.h"
41+
#include "DetectorsVertexing/PVertexerHelpers.h"
42+
#include "Field/MagneticField.h"
3743
#include "Framework/AnalysisDataModel.h"
3844
#include "Framework/AnalysisTask.h"
39-
#include "Framework/runDataProcessing.h"
4045
#include "Framework/HistogramRegistry.h"
41-
#include <TPDGCode.h>
42-
#include "DCAFitter/DCAFitterN.h"
43-
#include "Common/Core/RecoDecay.h"
4446
#include "Framework/O2DatabasePDGPlugin.h"
45-
#include "Common/DataModel/TrackSelectionTables.h"
47+
#include "Framework/runDataProcessing.h"
4648
#include "ReconstructionDataFormats/DCA.h"
47-
#include "DetectorsBase/Propagator.h"
48-
#include "DataFormatsParameters/GRPMagField.h"
49-
#include "DetectorsVertexing/PVertexer.h"
50-
#include "DetectorsVertexing/PVertexerHelpers.h"
5149
#include "SimulationDataFormat/InteractionSampler.h"
52-
#include "Field/MagneticField.h"
5350

54-
#include "ITSMFTSimulation/Hit.h"
55-
#include "ITStracking/Configuration.h"
56-
#include "ITStracking/IOUtils.h"
57-
#include "ITStracking/Tracker.h"
58-
#include "ITStracking/Vertexer.h"
59-
#include "ITStracking/VertexerTraits.h"
51+
#include <TGenPhaseSpace.h>
52+
#include <TGeoGlobalMagField.h>
53+
#include <TLorentzVector.h>
54+
#include <TPDGCode.h>
55+
#include <TRandom3.h>
6056

61-
#include "ALICE3/Core/DelphesO2TrackSmearer.h"
62-
#include "ALICE3/Core/FastTracker.h"
63-
#include "ALICE3/Core/DetLayer.h"
64-
#include "ALICE3/Core/TrackUtilities.h"
65-
#include "ALICE3/DataModel/collisionAlice3.h"
66-
#include "ALICE3/DataModel/tracksAlice3.h"
67-
#include "ALICE3/DataModel/OTFStrangeness.h"
57+
#include <array>
58+
#include <map>
59+
#include <string>
60+
#include <utility>
61+
#include <vector>
6862

6963
using namespace o2;
7064
using namespace o2::framework;
@@ -808,7 +802,7 @@ struct OnTheFlyTracker {
808802
std::array<float, 3> posClusterCandidate;
809803
trackParCov.getXYZGlo(posClusterCandidate);
810804
float r{std::hypot(posClusterCandidate[0], posClusterCandidate[1])};
811-
float phi{std::atan2(-posClusterCandidate[1], -posClusterCandidate[0]) + o2::its::constants::math::Pi};
805+
float phi{std::atan2(-posClusterCandidate[1], -posClusterCandidate[0]) + o2::constants::math::PI};
812806
o2::fastsim::DetLayer currentTrackingLayer = fastTracker.GetLayer(i);
813807

814808
if (currentTrackingLayer.getResolutionRPhi() > 1e-8 && currentTrackingLayer.getResolutionZ() > 1e-8) { // catch zero (though should not really happen...)

CPPLINT.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
filter=-build/c++11,-build/namespaces,-readability/fn_size,-readability/todo,-runtime/references,-whitespace/blank_line,-whitespace/braces,-whitespace/comments,-whitespace/indent_namespace,-whitespace/line_length,-whitespace/semicolon,-whitespace/todo
1+
filter=-build/c++11,-build/include_order,-build/namespaces,-readability/fn_size,-readability/todo,-runtime/references,-whitespace/blank_line,-whitespace/braces,-whitespace/comments,-whitespace/indent_namespace,-whitespace/line_length,-whitespace/semicolon,-whitespace/todo

Common/TableProducer/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ o2physics_add_dpl_workflow(track-propagation
6262
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
6363
COMPONENT_NAME Analysis)
6464

65+
o2physics_add_dpl_workflow(track-dca-cov-filler-run2
66+
SOURCES trackDcaCovFillerRun2.cxx
67+
PUBLIC_LINK_LIBRARIES O2::DetectorsBase O2Physics::AnalysisCore
68+
COMPONENT_NAME Analysis)
69+
6570
o2physics_add_dpl_workflow(track-propagation-tester
6671
SOURCES trackPropagationTester.cxx
6772
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::trackSelectionRequest
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
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 trackDcaCovFillerRun2.cxx
13+
/// \author Aimeric Landou <aimeric.landou@cern.ch>, CERN
14+
/// \brief Fills DCA and DCA Cov tables for Run 2 tracks
15+
// Run 2 AO2Ds cannot have their dcacov filled by the current track-propagation workflow as the workflow isn't designed for them, given Run 2 tracks are already propagated to the PV.
16+
// This task fills the DCA Cov (and DCA) tables for Run 2 tracks by "propagating" the tracks (though given they are already at the PV it doesn't actually do the propagation) and retrieving the DCA and DCA cov given by the propagateToDCABxByBz function
17+
18+
#include <string>
19+
20+
#include "TableHelper.h"
21+
#include "Common/Tools/TrackTuner.h"
22+
#include "DataFormatsParameters/GRPObject.h"
23+
24+
using namespace o2;
25+
using namespace o2::framework;
26+
// using namespace o2::framework::expressions;
27+
28+
struct TrackDcaCovFillerRun2 {
29+
Produces<aod::TracksDCA> tracksDCA;
30+
Produces<aod::TracksDCACov> tracksDCACov;
31+
32+
// Produces<aod::TrackTunerTable> tunertable;
33+
34+
Service<o2::ccdb::BasicCCDBManager> ccdb;
35+
36+
bool fillTracksDCA = false;
37+
bool fillTracksDCACov = false;
38+
int runNumber = -1;
39+
40+
o2::base::Propagator::MatCorrType matCorr = o2::base::Propagator::MatCorrType::USEMatCorrNONE;
41+
42+
const o2::dataformats::MeanVertexObject* mMeanVtx = nullptr;
43+
o2::parameters::GRPMagField* grpmag = nullptr;
44+
o2::base::MatLayerCylSet* lut = nullptr;
45+
46+
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
47+
Configurable<std::string> ccdbPathGrp{"ccdbPathGrp", "GLO/GRP/GRP", "CCDB path of the grp file (run2)"};
48+
Configurable<std::string> mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"};
49+
50+
HistogramRegistry registry{"registry"};
51+
52+
void init(o2::framework::InitContext& initContext)
53+
{
54+
// Checking if the tables are requested in the workflow and enabling them
55+
fillTracksDCA = isTableRequiredInWorkflow(initContext, "TracksDCA");
56+
fillTracksDCACov = isTableRequiredInWorkflow(initContext, "TracksDCACov");
57+
58+
ccdb->setURL(ccdburl);
59+
ccdb->setCaching(true);
60+
ccdb->setLocalObjectValidityChecking();
61+
}
62+
63+
void initCCDB(aod::BCsWithTimestamps::iterator const& bc)
64+
{
65+
if (runNumber == bc.runNumber()) {
66+
return;
67+
}
68+
69+
// Run 2 GRP object
70+
o2::parameters::GRPObject* grpo = ccdb->getForTimeStamp<o2::parameters::GRPObject>(ccdbPathGrp, bc.timestamp());
71+
if (grpo == nullptr) {
72+
LOGF(fatal, "Run 2 GRP object (type o2::parameters::GRPObject) is not available in CCDB for run=%d at timestamp=%llu", bc.runNumber(), bc.timestamp());
73+
}
74+
o2::base::Propagator::initFieldFromGRP(grpo);
75+
LOGF(info, "Setting magnetic field to %d kG for run %d from its GRP CCDB object (type o2::parameters::GRPObject)", grpo->getNominalL3Field(), bc.runNumber());
76+
77+
mMeanVtx = ccdb->getForTimeStamp<o2::dataformats::MeanVertexObject>(mVtxPath, bc.timestamp());
78+
runNumber = bc.runNumber();
79+
}
80+
81+
// Running variables
82+
std::array<float, 2> mDcaInfo;
83+
o2::dataformats::DCA mDcaInfoCov;
84+
o2::dataformats::VertexBase mVtx;
85+
o2::track::TrackParametrization<float> mTrackPar;
86+
o2::track::TrackParametrizationWithError<float> mTrackParCov;
87+
88+
template <typename TTrack, typename TParticle, bool isMc, bool fillCovMat = false>
89+
void fillTrackTables(TTrack const& tracks,
90+
TParticle const&,
91+
aod::Collisions const&,
92+
aod::BCsWithTimestamps const& bcs)
93+
{
94+
if (bcs.size() == 0) {
95+
return;
96+
}
97+
initCCDB(bcs.begin());
98+
99+
if constexpr (fillCovMat) {
100+
if (fillTracksDCACov) {
101+
tracksDCACov.reserve(tracks.size());
102+
}
103+
} else {
104+
if (fillTracksDCA) {
105+
tracksDCA.reserve(tracks.size());
106+
}
107+
}
108+
109+
for (auto const& track : tracks) {
110+
if constexpr (fillCovMat) {
111+
if (fillTracksDCA || fillTracksDCACov) {
112+
mDcaInfoCov.set(999, 999, 999, 999, 999);
113+
}
114+
setTrackParCov(track, mTrackParCov);
115+
} else {
116+
if (fillTracksDCA) {
117+
mDcaInfo[0] = 999;
118+
mDcaInfo[1] = 999;
119+
}
120+
setTrackPar(track, mTrackPar);
121+
}
122+
123+
if (track.has_collision()) {
124+
auto const& collision = track.collision();
125+
if constexpr (fillCovMat) {
126+
mVtx.setPos({collision.posX(), collision.posY(), collision.posZ()});
127+
mVtx.setCov(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ());
128+
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, mTrackParCov, 2.f, matCorr, &mDcaInfoCov);
129+
} else {
130+
o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, mTrackPar, 2.f, matCorr, &mDcaInfo);
131+
}
132+
} else {
133+
if constexpr (fillCovMat) {
134+
mVtx.setPos({mMeanVtx->getX(), mMeanVtx->getY(), mMeanVtx->getZ()});
135+
mVtx.setCov(mMeanVtx->getSigmaX() * mMeanVtx->getSigmaX(), 0.0f, mMeanVtx->getSigmaY() * mMeanVtx->getSigmaY(), 0.0f, 0.0f, mMeanVtx->getSigmaZ() * mMeanVtx->getSigmaZ());
136+
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, mTrackParCov, 2.f, matCorr, &mDcaInfoCov);
137+
} else {
138+
o2::base::Propagator::Instance()->propagateToDCABxByBz({mMeanVtx->getX(), mMeanVtx->getY(), mMeanVtx->getZ()}, mTrackPar, 2.f, matCorr, &mDcaInfo);
139+
}
140+
}
141+
142+
if constexpr (fillCovMat) {
143+
if (fillTracksDCA) {
144+
tracksDCA(mDcaInfoCov.getY(), mDcaInfoCov.getZ());
145+
}
146+
if (fillTracksDCACov) {
147+
tracksDCACov(mDcaInfoCov.getSigmaY2(), mDcaInfoCov.getSigmaZ2());
148+
}
149+
} else {
150+
if (fillTracksDCA) {
151+
tracksDCA(mDcaInfo[0], mDcaInfo[1]);
152+
}
153+
}
154+
}
155+
}
156+
157+
void processCovariance(soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksCov> const& tracks, aod::Collisions const& collisions, aod::BCsWithTimestamps const& bcs)
158+
{
159+
fillTrackTables</*TTrack*/ soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksCov>, /*Particle*/ soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksCov>, /*isMc = */ false, /*fillCovMat =*/true>(tracks, tracks, collisions, bcs);
160+
}
161+
PROCESS_SWITCH(TrackDcaCovFillerRun2, processCovariance, "Process with covariance", false);
162+
163+
void processStandard(soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksCov> const& tracks, aod::Collisions const& collisions, aod::BCsWithTimestamps const& bcs)
164+
{
165+
fillTrackTables</*TTrack*/ soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksCov>, /*Particle*/ soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksCov>, /*isMc = */ false, /*fillCovMat =*/false>(tracks, tracks, collisions, bcs);
166+
}
167+
PROCESS_SWITCH(TrackDcaCovFillerRun2, processStandard, "Process without covariance", true);
168+
};
169+
170+
//****************************************************************************************
171+
/**
172+
* Workflow definition.
173+
*/
174+
//****************************************************************************************
175+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
176+
{
177+
WorkflowSpec workflow{adaptAnalysisTask<TrackDcaCovFillerRun2>(cfgc)};
178+
return workflow;
179+
}

EventFiltering/PWGCF/CFFilterAll.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ enum CFTriggers {
6161
kPPRho,
6262
kPD,
6363
kLD,
64-
kRhoD,
6564
kPhiD,
65+
kRhoD,
6666
kNTriggers
6767
};
6868

EventFiltering/macros/getMenu.C

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
#include "CCDB/BasicCCDBManager.h"
13+
14+
#include <TAxis.h>
15+
#include <TH1.h>
16+
17+
#include <string>
18+
19+
void getMenu(int runNumber, std::string baseCCDBPath = "Users/m/mpuccio/EventFiltering/OTS/Chunked/")
20+
{
21+
auto& ccdb = o2::ccdb::BasicCCDBManager::instance();
22+
TH1* counters = ccdb.getForRun<TH1>(baseCCDBPath + "FilterCounters", runNumber);
23+
TAxis* axis = counters->GetXaxis();
24+
25+
std::vector<std::string> binLabels(axis->GetNbins() - 2); // skip first and last bins
26+
std::cout << "Menu for run " << runNumber << ":\n";
27+
for (int i = 2; i < axis->GetNbins(); ++i) {
28+
binLabels[i - 1] = axis->GetBinLabel(i);
29+
std::cout << "Id " << i - 2 << ": " << axis->GetBinLabel(i) << "\n";
30+
}
31+
}

0 commit comments

Comments
 (0)