4141#include < Framework/AnalysisDataModel.h>
4242#include < Framework/AnalysisHelpers.h>
4343#include < Framework/AnalysisTask.h>
44+ #include < Framework/Array2D.h>
4445#include < Framework/Configurable.h>
4546#include < Framework/HistogramRegistry.h>
47+ #include < Framework/HistogramSpec.h>
4648#include < Framework/InitContext.h>
4749#include < Framework/OutputObjHeader.h>
4850#include < Framework/runDataProcessing.h>
5153
5254#include < TH1.h>
5355#include < TH2.h>
56+ #include < TPDGCode.h>
5457
5558#include < KFParticle.h>
5659
5760#include < algorithm>
5861#include < array>
5962#include < cmath>
63+ #include < cstddef>
6064#include < cstdint>
6165#include < string>
66+ #include < utility>
6267#include < vector>
6368
6469using namespace o2 ;
@@ -75,26 +80,28 @@ using TracksMC = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU,
7580 aod::pidTPCFullPr, aod::pidTPCFullPi, aod::pidTPCFullDe,
7681 aod::TOFSignal, aod::TOFEvTime, aod::EvTimeTOFFT0ForTrack, aod::McTrackLabels>;
7782
78- constexpr double betheBlochDefault[1 ][6 ]{{-1 .e32 , -1 .e32 , -1 .e32 , -1 .e32 , -1 .e32 , -1 .e32 }};
83+ constexpr std::array<double , 6 > betheBlochDefault{-1 .e32 , -1 .e32 , -1 .e32 , -1 .e32 , -1 .e32 , -1 .e32 };
84+ constexpr double UseCCDBMagneticFieldThreshold = -990 .;
7985const std::vector<std::string> betheBlochParNames{" p0" , " p1" , " p2" , " p3" , " p4" , " resolution" };
8086const std::vector<std::string> particleName{" He3" };
81- o2::common::core::MetadataHelper metadataInfo;
8287
83- enum ZorroTrigger : size_t {
88+ enum ZorroTrigger : std:: size_t {
8489 kHe = 0 ,
8590 kTracked3Body ,
8691 kNZorroTriggers
8792};
8893} // namespace
8994
9095struct TrackedHypertritonRecoTask {
96+ o2::common::core::MetadataHelper metadataInfo{};
97+
9198 Produces<aod::DataHypCands> dataHypCands;
9299 Produces<aod::MCHypCands> mcHypCands;
93100 Produces<aod::Vtx3BodyDatas> vtx3BodyDatas;
94101 Produces<aod::Vtx3BodyCovs> vtx3BodyCovs;
95102 Produces<aod::McVtx3BodyDatas> mcVtx3BodyDatas;
96103
97- Service<o2::ccdb::BasicCCDBManager> ccdb;
104+ Service<o2::ccdb::BasicCCDBManager> ccdb{} ;
98105 HistogramRegistry registry{" registry" , {}, OutputObjHandlingPolicy::AnalysisObject};
99106 Zorro zorro;
100107 OutputObj<ZorroSummary> zorroSummary{" zorroSummary" };
@@ -105,10 +112,14 @@ struct TrackedHypertritonRecoTask {
105112 Configurable<std::string> zorroCCDBPath{" zorroCCDBPath" , " EventFiltering/Zorro/" , " Base path of the Zorro CCDB objects" };
106113 Configurable<int > zorroBCTolerance{" zorroBCTolerance" , 100 , " Zorro BC matching tolerance" };
107114
108- Configurable<std::string> ccdbUrl{" ccdb-url" , " http://alice-ccdb.cern.ch" , " CCDB URL" };
115+ Configurable<std::string> ccdbUrl{" ccdb-url" , " http://alice-ccdb.cern.ch" , " CCDB URL" }; // o2-linter: disable=name/configurable (Keep the standard CCDB option name.)
109116 Configurable<std::string> grpmagPath{" grpmagPath" , " GLO/Config/GRPMagField" , " CCDB path of the magnetic-field object" };
110- Configurable<double > bzInput{" bz" , -999 ., " Magnetic field in kG; values below -990 use CCDB" };
111- Configurable<bool > mcStoreBackground{" mc.storeBackground" , true , " Store reconstructed MC candidates not matched to a hypertriton" };
117+ Configurable<double > bzInput{" bz" , -999 ., " Magnetic field in kG; values below -990 use CCDB" }; // o2-linter: disable=name/configurable (Keep the established magnetic-field option name.)
118+
119+ struct : ConfigurableGroup {
120+ std::string prefix = " mc" ;
121+ Configurable<bool > storeBackground{" storeBackground" , true , " Store reconstructed MC candidates not matched to a hypertriton" };
122+ } mc;
112123
113124 struct : ConfigurableGroup {
114125 std::string prefix = " twoBody" ;
@@ -127,7 +138,7 @@ struct TrackedHypertritonRecoTask {
127138 Configurable<float > minDcaPiToPV{" minDcaPiToPV" , -1 .f , " Minimum absolute pion DCA to PV" };
128139 Configurable<float > minNSigmaHe{" minNSigmaHe" , -1 .e10f , " Minimum He TPC n-sigma" };
129140 Configurable<bool > compensatePIDinTracking{" compensatePIDinTracking" , true , " Correct the TPC inner parameter for charge-two PID in tracking" };
130- Configurable<LabeledArray<double >> betheBlochParams{" betheBlochParams" , {betheBlochDefault[ 0 ] , 1 , 6 , particleName, betheBlochParNames}, " TPC Bethe-Bloch parameters for He3" };
141+ Configurable<LabeledArray<double >> betheBlochParams{" betheBlochParams" , {betheBlochDefault. data () , 1 , 6 , particleName, betheBlochParNames}, " TPC Bethe-Bloch parameters for He3" };
131142 } twoBody;
132143
133144 struct : ConfigurableGroup {
@@ -307,7 +318,7 @@ struct TrackedHypertritonRecoTask {
307318 LOG (fatal) << " Missing magnetic-field object " << grpmagPath << " for timestamp " << bc.timestamp ();
308319 }
309320 o2::base::Propagator::initFieldFromGRP (grpmag);
310- bz = bzInput < - 990 . ? o2::base::Propagator::Instance ()->getNominalBz () : bzInput;
321+ bz = bzInput < UseCCDBMagneticFieldThreshold ? o2::base::Propagator::Instance ()->getNominalBz () : bzInput;
311322 o2::base::Propagator::Instance ()->setNominalBz (bz);
312323 fitter2Body.setBz (bz);
313324 builder3Body.fitterV0 .setBz (bz);
@@ -525,7 +536,7 @@ struct TrackedHypertritonRecoTask {
525536 }
526537
527538 template <typename TTrack, typename TCollision, typename TFillCandidate>
528- void buildTwoBody (TTrack const & heTrack, TTrack const & piTrack, TCollision const & collision, float trackedClSize, TFillCandidate& & fillCandidate)
539+ void buildTwoBody (TTrack const & heTrack, TTrack const & piTrack, TCollision const & collision, float trackedClSize, TFillCandidate const & fillCandidate)
529540 {
530541 auto heTrackCov = getTrackParCov (heTrack);
531542 auto piTrackCov = getTrackParCov (piTrack);
@@ -544,8 +555,8 @@ struct TrackedHypertritonRecoTask {
544555 std::array<float , 3 > piMomentum{};
545556 fitter2Body.getTrack (0 ).getPxPyPzGlo (heMomentum);
546557 fitter2Body.getTrack (1 ).getPxPyPzGlo (piMomentum);
547- for (auto & component : heMomentum) {
548- component *= 2 .f ;
558+ for (std:: size_t i = 0 ; i < heMomentum. size (); ++i ) {
559+ heMomentum[i] *= 2 .f ;
549560 }
550561 std::array<float , 3 > momentum{heMomentum[0 ] + piMomentum[0 ], heMomentum[1 ] + piMomentum[1 ], heMomentum[2 ] + piMomentum[2 ]};
551562 if (twoBody.useSelections && std::hypot (momentum[0 ], momentum[1 ]) < twoBody.minPt ) {
@@ -587,7 +598,7 @@ struct TrackedHypertritonRecoTask {
587598 beta = std::clamp (beta, 1 .e -4f , 1 .f - 1 .e -6f );
588599 tofMass = 2 .f * tpcMomentumHe * std::sqrt (1 .f / (beta * beta) - 1 .f );
589600 }
590- uint8_t flags = static_cast <uint8_t >((heTrack.pidForTracking () & 0xf ) << 4 );
601+ auto flags = static_cast <uint8_t >((heTrack.pidForTracking () & 0xf ) << 4 );
591602 flags |= static_cast <uint8_t >(piTrack.pidForTracking () & 0xf );
592603
593604 fillCandidate (collision.centFT0A (), collision.centFT0C (), collision.centFT0M (),
@@ -822,7 +833,7 @@ struct TrackedHypertritonRecoTask {
822833 }
823834
824835 const auto mcInfo = getTwoBodyMCInfo (heTrack, piTrack, collision, mcParticles);
825- if (!mcInfo.isSignal && !mcStoreBackground ) {
836+ if (!mcInfo.isSignal && !mc. storeBackground ) {
826837 continue ;
827838 }
828839 buildTwoBody (heTrack, piTrack, collision, trackedV0.itsClsSize (), [&](auto ... values) {
@@ -856,7 +867,7 @@ struct TrackedHypertritonRecoTask {
856867 continue ;
857868 }
858869 const auto mcInfo = getThreeBodyMCInfo (trackProton, trackPion, trackDeuteron, collision, mcParticles);
859- if (mcInfo.motherLabel < 0 && !mcStoreBackground ) {
870+ if (mcInfo.motherLabel < 0 && !mc. storeBackground ) {
860871 continue ;
861872 }
862873 fillThreeBodyMCTable (mcInfo);
@@ -970,6 +981,7 @@ struct TrackedHypertritonRecoTask {
970981
971982WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
972983{
984+ auto metadataInfo = o2::common::core::MetadataHelper{};
973985 metadataInfo.initMetadata (cfgc);
974- return WorkflowSpec{adaptAnalysisTask<TrackedHypertritonRecoTask>(cfgc)};
986+ return WorkflowSpec{adaptAnalysisTask<TrackedHypertritonRecoTask>(cfgc, std::move (metadataInfo) )};
975987}
0 commit comments