-
Notifications
You must be signed in to change notification settings - Fork 632
[Common] Use helix propagation to compute fwdtrack DCA in fwdtrackextension #14282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mcoquet642
wants to merge
6
commits into
AliceO2Group:master
Choose a base branch
from
mcoquet642:fwddca-helix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,11 +10,19 @@ | |
| // or submit itself to any jurisdiction. | ||
|
|
||
| // | ||
| // Task performing forward track DCA computation | ||
| // \file fwdtrackextension.cxx | ||
| // \brief Task performing forward track DCA computation. | ||
| // \author Maurice Coquet, [email protected] | ||
| // | ||
|
|
||
| #include "Common/Core/fwdtrackUtilities.h" | ||
| #include "Common/DataModel/TrackSelectionTables.h" | ||
|
|
||
| #include <CCDB/BasicCCDBManager.h> | ||
| #include <DataFormatsParameters/GRPMagField.h> | ||
| #include <DetectorsBase/GeometryManager.h> | ||
| #include <DetectorsBase/Propagator.h> | ||
| #include <GlobalTracking/MatchGlobalFwd.h> | ||
| #include <Framework/AnalysisDataModel.h> | ||
| #include <Framework/AnalysisHelpers.h> | ||
| #include <Framework/AnalysisTask.h> | ||
|
|
@@ -26,6 +34,7 @@ | |
| #include <Math/SMatrix.h> | ||
|
|
||
| #include <vector> | ||
| #include <string> | ||
|
|
||
| using namespace o2; | ||
| using namespace o2::framework; | ||
|
|
@@ -34,30 +43,62 @@ using namespace o2::framework::expressions; | |
| using SMatrix55 = ROOT::Math::SMatrix<double, 5, 5, ROOT::Math::MatRepSym<double, 5>>; | ||
| using SMatrix5 = ROOT::Math::SVector<double, 5>; | ||
|
|
||
| using MuonsWithCov = soa::Join<aod::FwdTracks, aod::FwdTracksCov>; | ||
|
|
||
| struct FwdTrackExtension { | ||
| Produces<aod::FwdTracksDCA> extendedTrackQuantities; | ||
| Produces<aod::FwdTracksDCA> fwdDCA; | ||
| Configurable<std::string> fGeoPath{"fGeoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"}; | ||
| Configurable<std::string> fGrpmagPath{"fGrpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"}; | ||
| Configurable<std::string> fConfigCcdbUrl{"fConfigCcdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; | ||
| Configurable<bool> fRefitGlobalMuon{"fRefitGlobalMuon", true, "Recompute parameters of global muons"}; | ||
|
|
||
| Service<o2::ccdb::BasicCCDBManager> fCCDB; | ||
| o2::parameters::GRPMagField* grpmag = nullptr; // for run 3, we access GRPMagField from GLO/Config/GRPMagField | ||
| int fCurrentRun; // needed to detect if the run changed and trigger update of magnetic field | ||
|
|
||
| void process(aod::FwdTracks const& tracks, aod::Collisions const&) | ||
| void init(o2::framework::InitContext&) | ||
| { | ||
| for (auto& track : tracks) { | ||
| float dcaX = -999; | ||
| float dcaY = -999; | ||
| if (track.has_collision()) { | ||
| if (track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack || track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalForwardTrack || track.trackType() == o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) { | ||
| // Load geometry | ||
| fCCDB->setURL(fConfigCcdbUrl); | ||
| fCCDB->setCaching(true); | ||
| fCCDB->setLocalObjectValidityChecking(); | ||
|
|
||
| auto const& collision = track.collision(); | ||
| double chi2 = track.chi2(); | ||
| SMatrix5 tpars(track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt()); | ||
| std::vector<double> v1; | ||
| SMatrix55 tcovs(v1.begin(), v1.end()); | ||
| o2::track::TrackParCovFwd pars1{track.z(), tpars, tcovs, chi2}; | ||
| pars1.propagateToZlinear(collision.posZ()); | ||
| if (!o2::base::GeometryManager::isGeometryLoaded()) { | ||
| LOGF(info, "Load geometry from CCDB"); | ||
| fCCDB->get<TGeoManager>(fGeoPath); | ||
| } | ||
| } | ||
|
|
||
| dcaX = (pars1.getX() - collision.posX()); | ||
| dcaY = (pars1.getY() - collision.posY()); | ||
| } | ||
| void process(aod::Collisions::iterator const& collision, o2::aod::BCsWithTimestamps const& /*...*/, MuonsWithCov const& tracks, aod::MFTTracks const& /*...*/) | ||
| { | ||
| auto bc = collision.template bc_as<o2::aod::BCsWithTimestamps>(); | ||
| if (fCurrentRun != bc.runNumber()) { | ||
| grpmag = fCCDB->getForTimeStamp<o2::parameters::GRPMagField>(fGrpmagPath, bc.timestamp()); | ||
| if (grpmag != nullptr) { | ||
| LOGF(info, "Init field from GRP"); | ||
| o2::base::Propagator::initFieldFromGRP(grpmag); | ||
| } | ||
| LOGF(info, "Set field for muons"); | ||
| o2::mch::TrackExtrap::setField(); | ||
| fCurrentRun = bc.runNumber(); | ||
| } | ||
| const float zField = grpmag->getNominalL3Field(); | ||
| for (const auto& track : tracks) { | ||
| const auto trackType = track.trackType(); | ||
| o2::dataformats::GlobalFwdTrack fwdtrack = o2::aod::fwdtrackutils::getTrackParCovFwd(track, track); | ||
| if (fRefitGlobalMuon && (trackType == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack || trackType == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalForwardTrack)) { | ||
| auto muontrack = track.template matchMCHTrack_as<MuonsWithCov>(); | ||
| auto mfttrack = track.template matchMFTTrack_as<aod::MFTTracks>(); | ||
| o2::dataformats::GlobalFwdTrack propmuon = o2::aod::fwdtrackutils::propagateMuon(muontrack, muontrack, collision, o2::aod::fwdtrackutils::propagationPoint::kToVertex, 0.f, zField); | ||
| SMatrix5 tpars(mfttrack.x(), mfttrack.y(), mfttrack.phi(), mfttrack.tgl(), mfttrack.signed1Pt()); | ||
| SMatrix55 tcovs{}; | ||
| o2::track::TrackParCovFwd mft{mfttrack.z(), tpars, tcovs, mfttrack.chi2()}; | ||
| fwdtrack = o2::aod::fwdtrackutils::refitGlobalMuonCov(propmuon, mft); | ||
| } | ||
| extendedTrackQuantities(dcaX, dcaY); | ||
| const auto proptrack = o2::aod::fwdtrackutils::propagateTrackParCovFwd(fwdtrack, trackType, collision, o2::aod::fwdtrackutils::propagationPoint::kToDCA, 0.f, zField); | ||
| const float dcaX = (proptrack.getX() - collision.posX()); | ||
| const float dcaY = (proptrack.getY() - collision.posY()); | ||
| fwdDCA(dcaX, dcaY); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.