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 < Math/Vector4Dfwd.h>
49+ #include < TPDGCode.h>
50+
51+ #include < KFPTrack.h>
52+ #include < KFPVertex.h>
53+ #include < KFParticle.h>
4454
4555#include < algorithm>
4656#include < array>
4757#include < cmath>
58+ #include < cstdint>
4859#include < cstdlib>
49- #include < iterator>
5060#include < map>
5161#include < set>
5262#include < string>
@@ -69,6 +79,12 @@ using MyCollisionsMC = soa::Join<MyCollisions, aod::McCollisionLabels>;
6979using MyTracksIU = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU, aod::pidTPCFullEl, aod::pidTPCFullPi>;
7080using MyTracksIUMC = soa::Join<MyTracksIU, aod::McTrackLabels, aod::mcTPCTuneOnData>;
7181
82+ enum MatCorrType {
83+ None = 0 ,
84+ TGeo = 1 ,
85+ LUT = 2
86+ };
87+
7288struct PhotonConversionBuilder {
7389 Produces<aod::V0PhotonsKF> v0photonskf;
7490 Produces<aod::V0Legs> v0legs;
@@ -152,7 +168,7 @@ struct PhotonConversionBuilder {
152168 {" V0/hConversionPointXY" , " conversion point in XY;X (cm);Y (cm)" , {HistType::kTH2F , {{400 , -100 .0f , 100 .0f }, {400 , -100 .f , 100 .f }}}},
153169 {" V0/hConversionPointRZ" , " conversion point in RZ;Z (cm);R_{xy} (cm)" , {HistType::kTH2F , {{200 , -100 .0f , 100 .0f }, {200 , 0 .f , 100 .f }}}},
154170 {" 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 }}}},
171+ {" V0/hEtaPhi" , " #eta vs. #varphi of V0 at PV;#varphi (rad.);#eta" , {HistType::kTH2F , {{72 , 0 .0f , o2::constants::math::TwoPI }, {200 , -1 , +1 }}}},
156172 {" V0/hCosPA" , " cosine of pointing angle;cosine of pointing angle" , {HistType::kTH1F , {{100 , 0 .99f , 1 .f }}}},
157173 {" V0/hCosPA_Rxy" , " cosine of pointing angle;r_{xy} (cm);cosine of pointing angle" , {HistType::kTH2F , {{200 , 0 , 100 }, {100 , 0 .99f , 1 .f }}}},
158174 {" 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 +186,7 @@ struct PhotonConversionBuilder {
170186 {" 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 }}}},
171187 {" V0/hPhiV" , " #phi_{V}; #phi_{V} (rad.)" , {HistType::kTH1F , {{500 , 0 .0f , 2 * M_PI}}}},
172188 {" 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 }}}},
189+ {" V0Leg/hEtaPhi" , " #eta vs. #varphi of leg at SV;#varphi (rad.);#eta" , {HistType::kTH2F , {{72 , 0 .0f , o2::constants::math::TwoPI }, {200 , -1 , +1 }}}},
174190 {" V0Leg/hRelDeltaPt" , " pT resolution;p_{T} (GeV/c);#Deltap_{T}/p_{T}" , {HistType::kTH2F , {{1000 , 0 .f , 10 .f }, {100 , 0 , 1 }}}},
175191 {" 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 }}}},
176192 {" 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 +206,21 @@ struct PhotonConversionBuilder {
190206 ccdb->setLocalObjectValidityChecking ();
191207 ccdb->setFatalWhenNull (false );
192208
193- if (useMatCorrType == 1 ) {
209+ if (useMatCorrType == MatCorrType::TGeo ) {
194210 LOGF (info, " TGeo correction requested, loading geometry" );
195211 if (!o2::base::GeometryManager::isGeometryLoaded ()) {
196212 ccdb->get <TGeoManager>(geoPath);
197213 }
198214 }
199- if (useMatCorrType == 2 ) {
215+ if (useMatCorrType == MatCorrType::LUT ) {
200216 LOGF (info, " LUT correction requested, loading LUT" );
201217 lut = o2::base::MatLayerCylSet::rectifyPtrFromFile (ccdb->get <o2::base::MatLayerCylSet>(lutPath));
202218 }
203219
204- if (useMatCorrType == 1 ) {
220+ if (useMatCorrType == MatCorrType::TGeo ) {
205221 matCorr = o2::base::Propagator::MatCorrType::USEMatCorrTGeo;
206222 }
207- if (useMatCorrType == 2 ) {
223+ if (useMatCorrType == MatCorrType::LUT ) {
208224 matCorr = o2::base::Propagator::MatCorrType::USEMatCorrLUT;
209225 }
210226 }
@@ -467,8 +483,8 @@ struct PhotonConversionBuilder {
467483
468484 KFPTrack kfp_track_pos = createKFPTrackFromTrackParCov (pTrack, pos.sign (), pos.tpcNClsFound (), pos.tpcChi2NCl ());
469485 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 );
486+ KFParticle kfp_pos (kfp_track_pos, kPositron );
487+ KFParticle kfp_ele (kfp_track_ele, kElectron );
472488 const KFParticle* GammaDaughters[2 ] = {&kfp_pos, &kfp_ele};
473489
474490 KFParticle gammaKF;
@@ -553,7 +569,7 @@ struct PhotonConversionBuilder {
553569 gammaKF_PV.SetProductionVertex (KFPV);
554570 float v0pt = RecoDecay::sqrtSumOfSquares (gammaKF_PV.GetPx (), gammaKF_PV.GetPy ());
555571 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 ( );
572+ float v0phi = RecoDecay::constrainAngle ( RecoDecay::phi (gammaKF_PV.GetPx (), gammaKF_PV.GetPy ()));
557573
558574 // KFParticle gammaKF_DecayVtx2 = gammaKF;
559575 // gammaKF_DecayVtx2.SetProductionVertex(KFPV);
@@ -657,18 +673,18 @@ struct PhotonConversionBuilder {
657673 registry.fill (HIST (" V0/hCosPAXY_Rxy" ), rxy, cospaXY_kf);
658674 registry.fill (HIST (" V0/hCosPARZ_Rxy" ), rxy, cospaRZ_kf);
659675
660- for (auto & leg : {kfp_pos_DecayVtx, kfp_ele_DecayVtx}) {
676+ for (const auto & leg : {kfp_pos_DecayVtx, kfp_ele_DecayVtx}) {
661677 float legpt = RecoDecay::sqrtSumOfSquares (leg.GetPx (), leg.GetPy ());
662678 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 ( );
679+ float legphi = RecoDecay::constrainAngle ( RecoDecay::phi (leg.GetPx (), leg.GetPy ()));
664680 registry.fill (HIST (" V0Leg/hPt" ), legpt);
665681 registry.fill (HIST (" V0Leg/hEtaPhi" ), legphi, legeta);
666682 } // end of leg loop
667- for (auto & leg : {pos, ele}) {
683+ for (const auto & leg : {pos, ele}) {
668684 registry.fill (HIST (" V0Leg/hdEdx_Pin" ), leg.tpcInnerParam (), leg.tpcSignal ());
669685 registry.fill (HIST (" V0Leg/hTPCNsigmaEl" ), leg.tpcInnerParam (), leg.tpcNSigmaEl ());
670686 } // end of leg loop
671- for (auto & leg : {pTrack, nTrack}) {
687+ for (const auto & leg : {pTrack, nTrack}) {
672688 registry.fill (HIST (" V0Leg/hXZ" ), leg.getZ (), leg.getX ());
673689 registry.fill (HIST (" V0Leg/hRelDeltaPt" ), leg.getPt (), leg.getPt () * std::sqrt (leg.getSigma1Pt2 ()));
674690 } // end of leg loop
@@ -793,7 +809,7 @@ struct PhotonConversionBuilder {
793809 } // end of pca_map loop
794810 // LOGF(info, "pca_map.size() = %d", pca_map.size());
795811
796- for (auto & fullv0Id : stored_fullv0Ids) {
812+ for (const auto & fullv0Id : stored_fullv0Ids) {
797813 auto v0Id = std::get<0 >(fullv0Id);
798814 // auto collisionId = std::get<1>(fullv0Id);
799815 // auto posId = std::get<2>(fullv0Id);
@@ -812,7 +828,7 @@ struct PhotonConversionBuilder {
812828 fillV0Table<isMC, TBCs, TCollisions, TTracks>(v0, true );
813829 } // end of fullv0Id loop
814830
815- for (auto & collision : collisions) {
831+ for (const auto & collision : collisions) {
816832 if constexpr (isMC) {
817833 if (!collision.has_mcCollision ()) {
818834 continue ;
0 commit comments