Skip to content

Commit 6c80154

Browse files
authored
Merge branch 'AliceO2Group:dev' into new_geometry
2 parents 58dab5d + a16258a commit 6c80154

34 files changed

Lines changed: 832 additions & 139 deletions

File tree

‎Detectors/GlobalTracking/src/MatchCosmics.cxx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ void MatchCosmics::process(const o2::globaltracking::RecoContainer& data)
5757
createSeeds(data);
5858
int ntr = mSeeds.size();
5959
const auto prop = o2::base::Propagator::Instance();
60-
// propagate to DCA to origin
61-
const o2::math_utils::Point3D<float> v{0., 0., 0};
60+
// propagate to DCA to origin. A VertexBase (origin, zero covariance) selects the TrackParCov overload of propagateToDCABxByBz:
61+
// with a Point3D the TrackPar_t overload is used and only the parameters are propagated, the covariance stays the one at the
62+
// track's reference X (TPC inner radius), which makes the y/snp cuts and the chi2 of checkPair far too tight.
63+
const o2::dataformats::VertexBase v;
6264
for (int i = 0; i < ntr; i++) {
6365
auto& trc = mSeeds[i];
6466
if (trc.matchID != Reject) {

‎Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCInterpolationSpec.h‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@
2323
#include "DetectorsBase/GRPGeomHelper.h"
2424
#include "TPCCalibration/VDriftHelper.h"
2525
#include "DataFormatsITSMFT/TopologyDictionary.h"
26+
#include "Steer/MCKinematicsReader.h"
2627

2728
using namespace o2::framework;
2829

2930
namespace o2::globaltracking
3031
{
3132
struct DataRequest;
33+
struct RecoContainer;
3234
} // namespace o2::globaltracking
3335

3436
namespace o2
@@ -40,14 +42,15 @@ class TPCInterpolationDPL : public Task
4042
public:
4143
TPCInterpolationDPL(std::shared_ptr<o2::globaltracking::DataRequest> dr, o2::dataformats::GlobalTrackID::mask_t src, o2::dataformats::GlobalTrackID::mask_t srcMap, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool useMC,
4244
bool processITSTPConly, bool sendTrackData, bool debugOutput, bool extDetResid) : mDataRequest(dr), mSources(src), mSourcesMap(srcMap), mGGCCDBRequest(gr), mUseMC(useMC), mProcessITSTPConly(processITSTPConly), mSendTrackData(sendTrackData), mDebugOutput(debugOutput), mExtDetResid(extDetResid) {}
43-
~TPCInterpolationDPL() override = default;
45+
~TPCInterpolationDPL() override;
4446
void init(InitContext& ic) final;
4547
void run(ProcessingContext& pc) final;
4648
void endOfStream(EndOfStreamContext& ec) final;
4749
void finaliseCCDB(ConcreteDataMatcher& matcher, void* obj) final;
4850

4951
private:
5052
void updateTimeDependentParams(ProcessingContext& pc);
53+
void fillMCTruth(const o2::globaltracking::RecoContainer& recoData);
5154
o2::tpc::TrackInterpolation mInterpolation; ///< track interpolation engine
5255
std::shared_ptr<o2::globaltracking::DataRequest> mDataRequest; ///< steers the input
5356
std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
@@ -56,6 +59,8 @@ class TPCInterpolationDPL : public Task
5659
o2::dataformats::GlobalTrackID::mask_t mSources{}; ///< which input sources are configured
5760
o2::dataformats::GlobalTrackID::mask_t mSourcesMap{}; ///< possible subset of mSources specifically for map creation
5861
bool mUseMC{false}; ///< MC flag
62+
std::unique_ptr<o2::steer::MCKinematicsReader> mMCReader; ///< MC kinematics and track references (MC only)
63+
std::vector<TrackDataMC> mTrackDataMC; ///< MC truth aligned with the TrackData output (MC only)
5964
bool mProcessITSTPConly{false}; ///< should also tracks without outer point (ITS-TPC only) be processed?
6065
bool mProcessSeeds{false}; ///< process not only most complete track, but also its shorter parts
6166
bool mDebugOutput{false}; ///< add more information to the output (track points of ITS, TRD and TOF)

‎Detectors/GlobalTrackingWorkflow/tpcinterpolationworkflow/include/TPCInterpolationWorkflow/TPCResidualAggregatorSpec.h‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace calibration
4141
class ResidualAggregatorDevice : public o2::framework::Task
4242
{
4343
public:
44-
ResidualAggregatorDevice(std::shared_ptr<o2::base::GRPGeomRequest> req, bool trackInput, bool ctpInput, bool writeUnbinnedResiduals, bool writeBinnedResiduals, bool writeTrackData, std::shared_ptr<o2::globaltracking::DataRequest> dataRequest) : mCCDBRequest(req), mTrackInput(trackInput), mCTPInput(ctpInput), mWriteUnbinnedResiduals(writeUnbinnedResiduals), mWriteBinnedResiduals(writeBinnedResiduals), mWriteTrackData(writeTrackData), mDataRequest(dataRequest) {}
44+
ResidualAggregatorDevice(std::shared_ptr<o2::base::GRPGeomRequest> req, bool trackInput, bool ctpInput, bool writeUnbinnedResiduals, bool writeBinnedResiduals, bool writeTrackData, bool mcInput, std::shared_ptr<o2::globaltracking::DataRequest> dataRequest) : mCCDBRequest(req), mTrackInput(trackInput), mCTPInput(ctpInput), mWriteUnbinnedResiduals(writeUnbinnedResiduals), mWriteBinnedResiduals(writeBinnedResiduals), mWriteTrackData(writeTrackData), mMCInput(mcInput), mDataRequest(dataRequest) {}
4545

4646
void init(o2::framework::InitContext& ic) final
4747
{
@@ -97,6 +97,7 @@ class ResidualAggregatorDevice : public o2::framework::Task
9797
mAggregator->setWriteBinnedResiduals(mWriteBinnedResiduals);
9898
mAggregator->setWriteUnbinnedResiduals(mWriteUnbinnedResiduals);
9999
mAggregator->setWriteTrackData(mWriteTrackData);
100+
mAggregator->setWriteTrackDataMC(mMCInput);
100101
mAggregator->setCompression(ic.options().get<int>("compression"));
101102
}
102103

@@ -141,6 +142,14 @@ class ResidualAggregatorDevice : public o2::framework::Task
141142
trkData.emplace(pc.inputs().get<gsl::span<o2::tpc::TrackData>>("trkData"));
142143
trkDataPtr = &trkData.value();
143144
}
145+
// MC truth of the track data (optional, MC only)
146+
const gsl::span<const o2::tpc::TrackDataMC>* trkDataMCPtr = nullptr;
147+
using trkDataMCType = std::decay_t<decltype(pc.inputs().get<gsl::span<o2::tpc::TrackDataMC>>(""))>;
148+
std::optional<trkDataMCType> trkDataMC;
149+
if (mMCInput) {
150+
trkDataMC.emplace(pc.inputs().get<gsl::span<o2::tpc::TrackDataMC>>("trkDataMC"));
151+
trkDataMCPtr = &trkDataMC.value();
152+
}
144153
// CTP lumi input (optional)
145154
const o2::ctp::LumiInfo* lumi = nullptr;
146155
using lumiDataType = std::decay_t<decltype(pc.inputs().get<o2::ctp::LumiInfo>(""))>;
@@ -152,7 +161,7 @@ class ResidualAggregatorDevice : public o2::framework::Task
152161

153162
o2::base::TFIDInfoHelper::fillTFIDInfo(pc, mAggregator->getCurrentTFInfo());
154163
LOG(detail) << "Processing TF " << mAggregator->getCurrentTFInfo().tfCounter << " with " << trkData->size() << " tracks and " << residualsData.size() << " unbinned residuals associated to them";
155-
mAggregator->process(residualsData, residualsDataDet, trackRefs, trkDataPtr, lumi);
164+
mAggregator->process(residualsData, residualsDataDet, trackRefs, trkDataPtr, trkDataMCPtr, lumi);
156165
std::chrono::duration<double, std::milli> runDuration = std::chrono::high_resolution_clock::now() - runStartTime;
157166
LOGP(debug, "Duration for run method: {} ms. From this taken for time dependent param update: {} ms",
158167
std::chrono::duration_cast<std::chrono::milliseconds>(runDuration).count(),
@@ -205,6 +214,7 @@ class ResidualAggregatorDevice : public o2::framework::Task
205214
bool mWriteBinnedResiduals{false}; ///< flag, whether to write binned residuals to output file
206215
bool mWriteUnbinnedResiduals{false}; ///< flag, whether to write unbinned residuals to output file
207216
bool mWriteTrackData{false}; ///< flag, whether to write track data to output file
217+
bool mMCInput{false}; ///< flag whether to expect the MC truth of the track data as input
208218
bool mRunStopRequested{false}; ///< flag in case the run was stopped
209219
bool mInitDone{false}; ///< flag whether initialization was done for current run
210220
};
@@ -214,7 +224,7 @@ class ResidualAggregatorDevice : public o2::framework::Task
214224
namespace framework
215225
{
216226

217-
DataProcessorSpec getTPCResidualAggregatorSpec(bool trackInput, bool ctpInput, bool writeUnbinnedResiduals, bool writeBinnedResiduals, bool writeTrackData)
227+
DataProcessorSpec getTPCResidualAggregatorSpec(bool trackInput, bool ctpInput, bool writeUnbinnedResiduals, bool writeBinnedResiduals, bool writeTrackData, bool mcInput = false)
218228
{
219229
std::shared_ptr<o2::globaltracking::DataRequest> dataRequest = std::make_shared<o2::globaltracking::DataRequest>();
220230
if (ctpInput) {
@@ -227,6 +237,9 @@ DataProcessorSpec getTPCResidualAggregatorSpec(bool trackInput, bool ctpInput, b
227237
inputs.emplace_back("trackRefs", "GLO", "TRKREFS");
228238
if (trackInput) {
229239
inputs.emplace_back("trkData", "GLO", "TRKDATA");
240+
if (mcInput) {
241+
inputs.emplace_back("trkDataMC", "GLO", "TRKDATAMC");
242+
}
230243
}
231244
auto ccdbRequest = std::make_shared<o2::base::GRPGeomRequest>(true, // orbitResetTime
232245
true, // GRPECS=true
@@ -240,7 +253,7 @@ DataProcessorSpec getTPCResidualAggregatorSpec(bool trackInput, bool ctpInput, b
240253
"residual-aggregator",
241254
inputs,
242255
Outputs{},
243-
AlgorithmSpec{adaptFromTask<o2::calibration::ResidualAggregatorDevice>(ccdbRequest, trackInput, ctpInput, writeUnbinnedResiduals, writeBinnedResiduals, writeTrackData, dataRequest)},
256+
AlgorithmSpec{adaptFromTask<o2::calibration::ResidualAggregatorDevice>(ccdbRequest, trackInput, ctpInput, writeUnbinnedResiduals, writeBinnedResiduals, writeTrackData, trackInput && mcInput, dataRequest)},
244257
Options{
245258
{"sec-per-slot", VariantType::UInt32, 600u, {"number of seconds per calibration time slot (put 0 for infinite slot length)"}},
246259
{"updateInterval", VariantType::UInt32, 6'000u, {"update interval in number of TFs (only used in case slot length is infinite)"}},

0 commit comments

Comments
 (0)