99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
1111//
12- // ========================
13- // \file photonconversionbuilder.cxx
14- // \brief this task produces photon data table with KFParticle.
15- //
16- // \author Daiki Sekihata <daiki.sekihata@cern.ch>, Tokyo
12+
13+ // / \file photonconversionbuilder.cxx
14+ // / \brief this task produces photon data table with KFParticle.
15+ // / \author Daiki Sekihata <daiki.sekihata@cern.ch>, Tokyo
1716
1817#include " PWGEM/Dilepton/Utils/PairUtilities.h"
1918#include " PWGEM/PhotonMeson/DataModel/gammaTables.h"
2221
2322#include " Common/Core/RecoDecay.h"
2423#include " Common/Core/TPCVDriftManager.h"
25- #include " Common/Core/TableHelper.h"
26- #include " Common/Core/TrackSelection.h"
2724#include " Common/Core/trackUtilities.h"
28- #include " Common/DataModel/TrackSelectionTables.h"
25+ #include " Common/DataModel/EventSelection.h"
26+ #include " Common/DataModel/PIDResponseTPC.h"
2927#include " Tools/KFparticle/KFUtilities.h"
3028
31- #include " CCDB/BasicCCDBManager.h"
32- #include " DataFormatsParameters/GRPMagField.h"
33- #include " DataFormatsParameters/GRPObject.h"
34- #include " DetectorsBase/GeometryManager.h"
35- #include " DetectorsBase/Propagator.h"
36- #include " Framework/ASoAHelpers.h"
37- #include " Framework/AnalysisDataModel.h"
38- #include " Framework/AnalysisTask.h"
39- #include " Framework/RunningWorkflowInfo.h"
40- #include " Framework/runDataProcessing.h"
41- #include " ReconstructionDataFormats/Track.h"
42-
43- #include " Math/Vector4D.h"
29+ #include < CCDB/BasicCCDBManager.h>
30+ #include < CommonConstants/MathConstants.h>
31+ #include < CommonConstants/PhysicsConstants.h>
32+ #include < DataFormatsParameters/GRPMagField.h>
33+ #include < DataFormatsParameters/GRPObject.h>
34+ #include < DetectorsBase/GeometryManager.h>
35+ #include < DetectorsBase/MatLayerCylSet.h>
36+ #include < DetectorsBase/Propagator.h>
37+ #include < Framework/AnalysisDataModel.h>
38+ #include < Framework/AnalysisHelpers.h>
39+ #include < Framework/AnalysisTask.h>
40+ #include < Framework/Configurable.h>
41+ #include < Framework/HistogramRegistry.h>
42+ #include < Framework/HistogramSpec.h>
43+ #include < Framework/InitContext.h>
44+ #include < Framework/runDataProcessing.h>
45+ #include < ReconstructionDataFormats/PID.h>
46+
47+ #include < Math/Vector4D.h> // IWYU pragma: keep
48+ #include < TPDGCode.h>
49+
50+ #include < KFPTrack.h>
51+ #include < KFPVertex.h>
52+ #include < KFParticle.h>
4453
4554#include < algorithm>
4655#include < array>
4756#include < cmath>
57+ #include < cstdint>
4858#include < cstdlib>
49- #include < iterator>
5059#include < map>
5160#include < set>
5261#include < string>
@@ -69,6 +78,12 @@ using MyCollisionsMC = soa::Join<MyCollisions, aod::McCollisionLabels>;
6978using MyTracksIU = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU, aod::pidTPCFullEl, aod::pidTPCFullPi>;
7079using MyTracksIUMC = soa::Join<MyTracksIU, aod::McTrackLabels, aod::mcTPCTuneOnData>;
7180
81+ enum MatCorrType {
82+ None = 0 ,
83+ TGeo = 1 ,
84+ LUT = 2
85+ };
86+
7287struct PhotonConversionBuilder {
7388 Produces<aod::V0PhotonsKF> v0photonskf;
7489 Produces<aod::V0Legs> v0legs;
@@ -152,7 +167,7 @@ struct PhotonConversionBuilder {
152167 {" V0/hConversionPointXY" , " conversion point in XY;X (cm);Y (cm)" , {HistType::kTH2F , {{400 , -100 .0f , 100 .0f }, {400 , -100 .f , 100 .f }}}},
153168 {" V0/hConversionPointRZ" , " conversion point in RZ;Z (cm);R_{xy} (cm)" , {HistType::kTH2F , {{200 , -100 .0f , 100 .0f }, {200 , 0 .f , 100 .f }}}},
154169 {" V0/hPt" , " pT of V0 at PV;p_{T,#gamma} (GeV/c)" , {HistType::kTH1F , {{1000 , 0 .0f , 10 .0f }}}},
155- {" V0/hEtaPhi" , " #eta vs. #varphi of V0 at PV;#varphi (rad.);#eta" , {HistType::kTH2F , {{72 , 0 .0f , 2 * M_PI }, {200 , -1 , +1 }}}},
170+ {" V0/hEtaPhi" , " #eta vs. #varphi of V0 at PV;#varphi (rad.);#eta" , {HistType::kTH2F , {{72 , 0 .0f , o2::constants::math::TwoPI }, {200 , -1 , +1 }}}},
156171 {" V0/hCosPA" , " cosine of pointing angle;cosine of pointing angle" , {HistType::kTH1F , {{100 , 0 .99f , 1 .f }}}},
157172 {" V0/hCosPA_Rxy" , " cosine of pointing angle;r_{xy} (cm);cosine of pointing angle" , {HistType::kTH2F , {{200 , 0 , 100 }, {100 , 0 .99f , 1 .f }}}},
158173 {" V0/hCosPAXY_Rxy" , " cosine of pointing angle;r_{xy} (cm);cosine of pointing angle" , {HistType::kTH2F , {{200 , 0 , 100 }, {100 , 0 .99f , 1 .f }}}},
@@ -170,7 +185,7 @@ struct PhotonConversionBuilder {
170185 {" V0/hPCA_diffX" , " PCA vs. trackiu X - R_{xy};distance btween 2 legs (cm);min trackiu X - R_{xy} (cm)" , {HistType::kTH2F , {{500 , 0 .0f , 5 .f }, {100 , -50.0 , 50 .0f }}}},
171186 {" V0/hPhiV" , " #phi_{V}; #phi_{V} (rad.)" , {HistType::kTH1F , {{500 , 0 .0f , 2 * M_PI}}}},
172187 {" V0Leg/hPt" , " pT of leg at SV;p_{T,e} (GeV/c)" , {HistType::kTH1F , {{1000 , 0 .0f , 10 .0f }}}},
173- {" V0Leg/hEtaPhi" , " #eta vs. #varphi of leg at SV;#varphi (rad.);#eta" , {HistType::kTH2F , {{72 , 0 .0f , 2 * M_PI }, {200 , -1 , +1 }}}},
188+ {" V0Leg/hEtaPhi" , " #eta vs. #varphi of leg at SV;#varphi (rad.);#eta" , {HistType::kTH2F , {{72 , 0 .0f , o2::constants::math::TwoPI }, {200 , -1 , +1 }}}},
174189 {" V0Leg/hRelDeltaPt" , " pT resolution;p_{T} (GeV/c);#Deltap_{T}/p_{T}" , {HistType::kTH2F , {{1000 , 0 .f , 10 .f }, {100 , 0 , 1 }}}},
175190 {" V0Leg/hDCAxyz" , " DCA xy vs. z to PV;DCA_{xy} (cm);DCA_{z} (cm)" , {HistType::kTH2F , {{200 , -50 .f , 50 .f }, {200 , -50 .f , +50 .f }}}},
176191 {" V0Leg/hdEdx_Pin" , " TPC dE/dx vs. p_{in};p_{in} (GeV/c);TPC dE/dx" , {HistType::kTH2F , {{1000 , 0 .f , 10 .f }, {200 , 0 .f , 200 .f }}}},
@@ -190,21 +205,21 @@ struct PhotonConversionBuilder {
190205 ccdb->setLocalObjectValidityChecking ();
191206 ccdb->setFatalWhenNull (false );
192207
193- if (useMatCorrType == 1 ) {
208+ if (useMatCorrType == MatCorrType::TGeo ) {
194209 LOGF (info, " TGeo correction requested, loading geometry" );
195210 if (!o2::base::GeometryManager::isGeometryLoaded ()) {
196211 ccdb->get <TGeoManager>(geoPath);
197212 }
198213 }
199- if (useMatCorrType == 2 ) {
214+ if (useMatCorrType == MatCorrType::LUT ) {
200215 LOGF (info, " LUT correction requested, loading LUT" );
201216 lut = o2::base::MatLayerCylSet::rectifyPtrFromFile (ccdb->get <o2::base::MatLayerCylSet>(lutPath));
202217 }
203218
204- if (useMatCorrType == 1 ) {
219+ if (useMatCorrType == MatCorrType::TGeo ) {
205220 matCorr = o2::base::Propagator::MatCorrType::USEMatCorrTGeo;
206221 }
207- if (useMatCorrType == 2 ) {
222+ if (useMatCorrType == MatCorrType::LUT ) {
208223 matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
209224 }
210225 }
@@ -467,8 +482,8 @@ struct PhotonConversionBuilder {
467482
468483 KFPTrack kfp_track_pos = createKFPTrackFromTrackParCov (pTrack, pos.sign (), pos.tpcNClsFound (), pos.tpcChi2NCl ());
469484 KFPTrack kfp_track_ele = createKFPTrackFromTrackParCov (nTrack, ele.sign (), ele.tpcNClsFound (), ele.tpcChi2NCl ());
470- KFParticle kfp_pos (kfp_track_pos, - 11 );
471- KFParticle kfp_ele (kfp_track_ele, 11 );
485+ KFParticle kfp_pos (kfp_track_pos, kPositron );
486+ KFParticle kfp_ele (kfp_track_ele, kElectron );
472487 const KFParticle* GammaDaughters[2 ] = {&kfp_pos, &kfp_ele};
473488
474489 KFParticle gammaKF;
@@ -553,7 +568,7 @@ struct PhotonConversionBuilder {
553568 gammaKF_PV.SetProductionVertex (KFPV);
554569 float v0pt = RecoDecay::sqrtSumOfSquares (gammaKF_PV.GetPx (), gammaKF_PV.GetPy ());
555570 float v0eta = RecoDecay::eta (std::array{gammaKF_PV.GetPx (), gammaKF_PV.GetPy (), gammaKF_PV.GetPz ()});
556- float v0phi = RecoDecay::phi (gammaKF_PV. GetPx (), gammaKF_PV. GetPy ()) > 0 . f ? RecoDecay::phi (gammaKF_PV.GetPx (), gammaKF_PV.GetPy ()) : RecoDecay::phi (gammaKF_PV. GetPx (), gammaKF_PV. GetPy ()) + TMath::TwoPi ( );
571+ float v0phi = RecoDecay::constrainAngle ( RecoDecay::phi (gammaKF_PV.GetPx (), gammaKF_PV.GetPy ()));
557572
558573 // KFParticle gammaKF_DecayVtx2 = gammaKF;
559574 // gammaKF_DecayVtx2.SetProductionVertex(KFPV);
@@ -657,18 +672,18 @@ struct PhotonConversionBuilder {
657672 registry.fill (HIST (" V0/hCosPAXY_Rxy" ), rxy, cospaXY_kf);
658673 registry.fill (HIST (" V0/hCosPARZ_Rxy" ), rxy, cospaRZ_kf);
659674
660- for (auto & leg : {kfp_pos_DecayVtx, kfp_ele_DecayVtx}) {
675+ for (const auto & leg : {kfp_pos_DecayVtx, kfp_ele_DecayVtx}) {
661676 float legpt = RecoDecay::sqrtSumOfSquares (leg.GetPx (), leg.GetPy ());
662677 float legeta = RecoDecay::eta (std::array{leg.GetPx (), leg.GetPy (), leg.GetPz ()});
663- float legphi = RecoDecay::phi (leg. GetPx (), leg. GetPy ()) > 0 . f ? RecoDecay::phi (leg.GetPx (), leg.GetPy ()) : RecoDecay::phi (leg. GetPx (), leg. GetPy ()) + TMath::TwoPi ( );
678+ float legphi = RecoDecay::constrainAngle ( RecoDecay::phi (leg.GetPx (), leg.GetPy ()));
664679 registry.fill (HIST (" V0Leg/hPt" ), legpt);
665680 registry.fill (HIST (" V0Leg/hEtaPhi" ), legphi, legeta);
666681 } // end of leg loop
667- for (auto & leg : {pos, ele}) {
682+ for (const auto & leg : {pos, ele}) {
668683 registry.fill (HIST (" V0Leg/hdEdx_Pin" ), leg.tpcInnerParam (), leg.tpcSignal ());
669684 registry.fill (HIST (" V0Leg/hTPCNsigmaEl" ), leg.tpcInnerParam (), leg.tpcNSigmaEl ());
670685 } // end of leg loop
671- for (auto & leg : {pTrack, nTrack}) {
686+ for (const auto & leg : {pTrack, nTrack}) {
672687 registry.fill (HIST (" V0Leg/hXZ" ), leg.getZ (), leg.getX ());
673688 registry.fill (HIST (" V0Leg/hRelDeltaPt" ), leg.getPt (), leg.getPt () * std::sqrt (leg.getSigma1Pt2 ()));
674689 } // end of leg loop
@@ -793,7 +808,7 @@ struct PhotonConversionBuilder {
793808 } // end of pca_map loop
794809 // LOGF(info, "pca_map.size() = %d", pca_map.size());
795810
796- for (auto & fullv0Id : stored_fullv0Ids) {
811+ for (const auto & fullv0Id : stored_fullv0Ids) {
797812 auto v0Id = std::get<0 >(fullv0Id);
798813 // auto collisionId = std::get<1>(fullv0Id);
799814 // auto posId = std::get<2>(fullv0Id);
@@ -812,7 +827,7 @@ struct PhotonConversionBuilder {
812827 fillV0Table<isMC, TBCs, TCollisions, TTracks>(v0, true );
813828 } // end of fullv0Id loop
814829
815- for (auto & collision : collisions) {
830+ for (const auto & collision : collisions) {
816831 if constexpr (isMC) {
817832 if (!collision.has_mcCollision ()) {
818833 continue ;
0 commit comments