1616
1717// root includes
1818#include " TFile.h"
19- #include " TMathBase.h"
2019
2120// o2 includes
2221#include " DataFormatsTPC/TrackTPC.h"
2322#include " DataFormatsTPC/dEdxInfo.h"
2423#include " GPUCommonArray.h"
2524#include " DetectorsBase/Propagator.h"
26- #include " DataFormatsParameters/GRPMagField.h"
27- #include " TGeoManager.h"
2825#include " TPCQC/Tracks.h"
2926#include " TPCQC/Helpers.h"
3027
@@ -86,8 +83,7 @@ void Tracks::initializeHistograms()
8683
8784 // DCA Histograms
8885 for (const auto type : types) {
89- mMapHist [fmt::format (" hDCAr_{}" , type).data ()] = std::make_unique<TH2F >(fmt::format (" hDCAr_{}" , type).data (), fmt::format (" DCAr {};phi;DCAr (cm)" , type).data (), 360 , 0 , o2::math_utils::twoPid (), 100 , -3 ., 3 .);
90- mMapHist [fmt::format (" hDCAz_{}" , type).data ()] = std::make_unique<TH2F >(fmt::format (" hDCAz_{}" , type).data (), fmt::format (" DCAz {};phi;DCAr (cm)" , type).data (), 360 , 0 , o2::math_utils::twoPid (), 100 , -3 ., 3 .);
86+ mMapHist [fmt::format (" hDCAr_{}" , type).data ()] = std::make_unique<TH2F >(fmt::format (" hDCAr_{}" , type).data (), fmt::format (" DCAr {};phi;DCAr (cm)" , type).data (), 360 , 0 , o2::math_utils::twoPid (), 250 , -10 ., 10 .);
9187 }
9288}
9389// ______________________________________________________________________________
@@ -111,7 +107,7 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
111107 const auto hasASideOnly = track.hasASideClustersOnly ();
112108 const auto hasCSideOnly = track.hasCSideClustersOnly ();
113109
114- double absEta = TMath::Abs (eta);
110+ const auto absEta = std::abs (eta);
115111
116112 // ===| histogram filling before cuts |===
117113 mMapHist [" hNClustersBeforeCuts" ]->Fill (nCls);
@@ -128,44 +124,30 @@ bool Tracks::processTrack(const o2::tpc::TrackTPC& track)
128124 mMapHist [" hNClustersAfterCuts" ]->Fill (nCls);
129125 mMapHist [" hEta" ]->Fill (eta);
130126
131- auto & ccdbmgr = o2::ccdb::BasicCCDBManager::instance ();
132- ccdbmgr.setURL (" https://alice-ccdb.cern.ch" );
133- auto runDuration = ccdbmgr.getRunDuration (runNumber);
134- auto tRun = runDuration.first + (runDuration.second - runDuration.first ) / 2 ; // time stamp for the middle of the run duration
135- ccdbmgr.setTimestamp (tRun);
136-
137- // CTP orbit reset time
138- auto orbitResetTimeNS = ccdbmgr.get <std::vector<int64_t >>(" CTP/Calib/OrbitReset" );
139- int64_t orbitResetTimeMS = (*orbitResetTimeNS)[0 ] * 1e-3 ;
140- LOGP (info, " Orbit reset time in MS is {}" , orbitResetTimeMS);
141-
142- auto geoAligned = ccdbmgr.get <TGeoManager>(" GLO/Config/GeometryAligned" );
143- auto magField = ccdbmgr.get <o2::parameters::GRPMagField>(" GLO/Config/GRPMagField" );
144- const o2::base::MatLayerCylSet* matLut = o2::base::MatLayerCylSet::rectifyPtrFromFile (ccdbmgr.get <o2::base::MatLayerCylSet>(" GLO/Param/MatLUT" ));
145- auto propagator = o2::base::Propagator::Instance ();
146- propagator->setMatLUT (matLut);
147- // ---| propagate to 0,0,0 |---
127+ // ---| propagate to 0,0,0 |---
128+ //
129+ // propagator instance must be configured before (LUT, MagField)
130+ auto propagator = o2::base::Propagator::Instance (true );
131+ const int type = (track.getQ2Pt () < 0 ) + 2 * track.hasCSideClustersOnly ();
132+ auto dcaHist = mMapHist [fmt::format (" hDCAr_{}" , types[type]).data ()].get ();
133+
134+ if (propagator->getMatLUT () && propagator->hasMagFieldSet ()) {
135+ // ---| fill DCA histos |---
148136 o2::gpu::gpustd::array<float , 2 > dca;
149137 const o2::math_utils::Point3D<float > refPoint{0 , 0 , 0 };
150- // auto propTrack = TrackTPC(track);
151- o2::track::TrackPar propTrack (track); // Should be cheaper than the one above
152- bool useThisTrack = true ;
153- if (!propagator->propagateToDCABxByBz (refPoint, propTrack, 0.5 , o2::base::Propagator::MatCorrType::USEMatCorrLUT, &dca)) {
154- useThisTrack = false ;
155- }
156- // /fine grained propagation most probably not needed
157- if (!propagator->propagateToDCABxByBz (refPoint, propTrack, 0.005 , o2::base::Propagator::MatCorrType::USEMatCorrLUT, &dca)) {
158- useThisTrack = false ;
138+ o2::track::TrackPar propTrack (track);
139+ if (propagator->propagateToDCABxByBz (refPoint, propTrack, 2 .f , o2::base::Propagator::MatCorrType::USEMatCorrLUT, &dca)) {
140+ const auto phi = o2::math_utils::to02PiGen (track.getPhi ());
141+ dcaHist->Fill (phi, dca[0 ]);
159142 }
160-
161- if (useThisTrack)
162- {
163- // ---| fill histos |---
164- const int type = (track.getQ2Pt () < 0 ) + 2 * track.hasCSideClustersOnly ();
165- const auto phi = o2::math_utils::to02PiGen (track.getPhi ());
166- mMapHist [fmt::format (" hDCAr_{}" , types[type]).data ()]->Fill (phi, dca[0 ]);
167- mMapHist [fmt::format (" hDCAz_{}" , types[type]).data ()]->Fill (phi, dca[1 ]);
143+ } else {
144+ static bool reported = false ;
145+ if (!reported) {
146+ LOGP (error, " o2::base::Propagator not properly initialized, MatLUT ({}) and / or Field ({}) missing, will not fill DCA histograms" , (void *)propagator->getMatLUT (), (void *)propagator->hasMagFieldSet ());
147+ reported = true ;
168148 }
149+ dcaHist->SetTitle (fmt::format (" DCAr {} o2::base::Propagator not properly initialized" , types[type]).data ());
150+ }
169151
170152 if (hasASideOnly == 1 ) {
171153 mMapHist [" hPhiAside" ]->Fill (phi);
0 commit comments