1212// / \file flowEventPlane.cxx
1313// / \brief Flow calculation using event plane.
1414// / \author Yash Patley <yash.patley@cern.ch>
15+ // / Samta Arora <Samta.arora@cern.ch>
1516
1617#include " PWGLF/DataModel/LFStrangenessTables.h"
1718
@@ -72,8 +73,8 @@ DECLARE_SOA_COLUMN(Vy, vy, float);
7273DECLARE_SOA_COLUMN (Vz, vz, float );
7374DECLARE_SOA_COLUMN (ZnaEnergyCommon, znaEnergyCommon, float );
7475DECLARE_SOA_COLUMN (ZncEnergyCommon, zncEnergyCommon, float );
75- DECLARE_SOA_COLUMN (ZnaEnergy, znaEnergy, float [ 4 ] );
76- DECLARE_SOA_COLUMN (ZncEnergy, zncEnergy, float [ 4 ] );
76+ DECLARE_SOA_COLUMN (ZnaEnergy, znaEnergy, std::vector< float > );
77+ DECLARE_SOA_COLUMN (ZncEnergy, zncEnergy, std::vector< float > );
7778} // namespace colspcalib
7879DECLARE_SOA_TABLE (ColSpCalib, " AOD" , " COLSPCALIB" , o2::soa::Index<>,
7980 colspcalib::RunNumber,
@@ -150,11 +151,6 @@ enum ParticleType {
150151 kNPart
151152};
152153
153- enum ResoType {
154- kPhi0 = 0 ,
155- kKStar
156- };
157-
158154enum V0Type {
159155 kK0S = 0 ,
160156 kLambda ,
@@ -247,8 +243,11 @@ struct SpCalibTableProducer {
247243 posZ = collision.posZ ();
248244
249245 auto zdc = bc.zdc ();
250- auto znaEnergy = zdc.energySectorZNA ();
251- auto zncEnergy = zdc.energySectorZNC ();
246+ std::vector<float > znaEnergy, zncEnergy;
247+ for (int i = 0 ; i < 4 ; ++i) {
248+ znaEnergy.push_back (zdc.energySectorZNA ()[i]);
249+ zncEnergy.push_back (zdc.energySectorZNC ()[i]);
250+ }
252251 auto znaEnergyCommon = zdc.energyCommonZNA ();
253252 auto zncEnergyCommon = zdc.energyCommonZNC ();
254253
@@ -260,10 +259,7 @@ struct SpCalibTableProducer {
260259 // Fill collision table
261260 histos.fill (HIST (" hCent" ), cent);
262261 histos.fill (HIST (" hVz" ), posZ);
263- colSpCalibTable (runNum, timestamp, cent, posX, posY, posZ, znaEnergyCommon, zncEnergyCommon, znaEnergy.data (), zncEnergy.data ());
264-
265- // Done
266- return ;
262+ colSpCalibTable (runNum, timestamp, cent, posX, posY, posZ, znaEnergyCommon, zncEnergyCommon, znaEnergy, zncEnergy);
267263 }
268264
269265 using BCsRun3 = soa::Join<aod::BCsWithTimestamps, aod::Run3MatchedToBCSparse>;
@@ -349,13 +345,13 @@ struct SpectatorPlaneTableProducer {
349345 Configurable<float > cProtonPtCut{" cProtonPtCut" , 1.1 , " Proton TPC pT cutoff" };
350346
351347 // Initialize CCDB Service
352- Service<o2::ccdb::BasicCCDBManager> ccdbService;
348+ Service<o2::ccdb::BasicCCDBManager> ccdbService{} ;
353349
354350 // Histogram registry: an object to hold your histograms
355351 HistogramRegistry histos{" histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
356352
357353 // Global objects
358- const float zdcDenThrs = 1e-4 ;
354+ float zdcDenThrs = 1e-4 ;
359355 float cent = 0 ., mult = 0 .;
360356 float posX = 0 ., posY = 0 ., posZ = 0 .;
361357 std::vector<std::vector<std::string>> vCoarseCorrHistNames = {
@@ -372,11 +368,11 @@ struct SpectatorPlaneTableProducer {
372368
373369 // Container for histograms
374370 struct CorrectionHistContainer {
375- TProfile* hVx;
376- TProfile* hVy;
377- std::array<TH2F *, 2 > hGainCalib;
378- std::array<std::array<std::array<THnSparseF*, 1 >, 4 >, 14 > vCoarseCorrHist;
379- std::array<std::array<std::array<TProfile*, 4 >, 4 >, 14 > vFineCorrHist;
371+ TProfile* hVx = nullptr ;
372+ TProfile* hVy = nullptr ;
373+ std::array<TH2F *, 2 > hGainCalib{} ;
374+ std::array<std::array<std::array<THnSparseF*, 1 >, 4 >, 14 > vCoarseCorrHist{} ;
375+ std::array<std::array<std::array<TProfile*, 4 >, 4 >, 14 > vFineCorrHist{} ;
380376 } CorrectionHistContainer;
381377
382378 // Run number
@@ -520,16 +516,16 @@ struct SpectatorPlaneTableProducer {
520516 if (cRecentVxVy) {
521517 std::string ccdbPath = static_cast <std::string>(cCcdbPath) + " /VxVyRecent" + " /Run" + std::to_string (cRunNum);
522518 auto ccdbObj = ccdbService->getForTimeStamp <TList>(ccdbPath, nolaterthan.value );
523- CorrectionHistContainer.hVx = reinterpret_cast <TProfile*>(ccdbObj->FindObject (" hVx" ));
524- CorrectionHistContainer.hVy = reinterpret_cast <TProfile*>(ccdbObj->FindObject (" hVy" ));
519+ CorrectionHistContainer.hVx = dynamic_cast <TProfile*>(ccdbObj->FindObject (" hVx" ));
520+ CorrectionHistContainer.hVy = dynamic_cast <TProfile*>(ccdbObj->FindObject (" hVy" ));
525521 }
526522
527523 // Load ZDC gain calibration
528524 if (cDoGainCalib) {
529525 std::string ccdbPath = static_cast <std::string>(cCcdbPath) + " /GainCalib" + " /Run" + std::to_string (cRunNum);
530526 auto ccdbObj = ccdbService->getForTimeStamp <TList>(ccdbPath, nolaterthan.value );
531- CorrectionHistContainer.hGainCalib [0 ] = reinterpret_cast <TH2F *>(ccdbObj->FindObject (" hZNASignal" ));
532- CorrectionHistContainer.hGainCalib [1 ] = reinterpret_cast <TH2F *>(ccdbObj->FindObject (" hZNCSignal" ));
527+ CorrectionHistContainer.hGainCalib [0 ] = dynamic_cast <TH2F *>(ccdbObj->FindObject (" hZNASignal" ));
528+ CorrectionHistContainer.hGainCalib [1 ] = dynamic_cast <TH2F *>(ccdbObj->FindObject (" hZNCSignal" ));
533529 }
534530
535531 // Load shift corrections for ZDC Q-Vectors
@@ -570,9 +566,9 @@ struct SpectatorPlaneTableProducer {
570566 int cntry = 0 ;
571567 for (auto const & y : x) {
572568 if (corrType == kFineCorr ) {
573- CorrectionHistContainer.vFineCorrHist [i][cntrx][cntry] = reinterpret_cast <TProfile*>(ccdbObject->FindObject (y.c_str ()));
569+ CorrectionHistContainer.vFineCorrHist [i][cntrx][cntry] = dynamic_cast <TProfile*>(ccdbObject->FindObject (y.c_str ()));
574570 } else {
575- CorrectionHistContainer.vCoarseCorrHist [i][cntrx][cntry] = reinterpret_cast <THnSparseF*>(ccdbObject->FindObject (y.c_str ()));
571+ CorrectionHistContainer.vCoarseCorrHist [i][cntrx][cntry] = dynamic_cast <THnSparseF*>(ccdbObject->FindObject (y.c_str ()));
576572 }
577573 ++cntry;
578574 }
@@ -597,7 +593,7 @@ struct SpectatorPlaneTableProducer {
597593 std::vector<float > getAvgCorrFactors (int const & itr, CorrectionType const & corrType, std::array<float , 4 > const & vCollParam)
598594 {
599595 std::vector<float > vAvgOutput = {0 ., 0 ., 0 ., 0 .};
600- int binarray[ 4 ] ;
596+ std::array< int , 4 > binarray{} ;
601597 if (corrType == kCoarseCorr ) {
602598 int cntrx = 0 ;
603599 for (auto const & v : CorrectionHistContainer.vCoarseCorrHist [itr]) {
@@ -606,7 +602,7 @@ struct SpectatorPlaneTableProducer {
606602 binarray[kVx ] = h->GetAxis (kVx )->FindBin (vCollParam[kVx ]);
607603 binarray[kVy ] = h->GetAxis (kVy )->FindBin (vCollParam[kVy ]);
608604 binarray[kVz ] = h->GetAxis (kVz )->FindBin (vCollParam[kVz ]);
609- vAvgOutput[cntrx] += h->GetBinContent (h->GetBin (binarray));
605+ vAvgOutput[cntrx] += h->GetBinContent (h->GetBin (binarray. data () ));
610606 }
611607 ++cntrx;
612608 }
@@ -755,8 +751,8 @@ struct SpectatorPlaneTableProducer {
755751 histos.fill (HIST (" Event/hVz" ), vCollParam[kVz ]);
756752
757753 auto alphaZDC = 0.395 ;
758- const double x[ 4 ] = {-1.75 , 1.75 , -1.75 , 1.75 };
759- const double y[ 4 ] = {-1.75 , -1.75 , 1.75 , 1.75 };
754+ std::array< double , 4 > x = {-1.75 , 1.75 , -1.75 , 1.75 };
755+ std::array< double , 4 > y = {-1.75 , -1.75 , 1.75 , 1.75 };
760756
761757 // Calculate X and Y
762758 float znaXNum = 0 ., znaYNum = 0 ., zncXNum = 0 ., zncYNum = 0 .;
@@ -847,19 +843,20 @@ struct SpectatorPlaneTableProducer {
847843 std::vector<float > vPtCut = {cPionPtCut, cKaonPtCut, cProtonPtCut};
848844 std::vector<float > vTpcNsig = {std::abs (track.tpcNSigmaPi ()), std::abs (track.tpcNSigmaKa ()), std::abs (track.tpcNSigmaPr ())};
849845 std::vector<float > vTofNsig = {std::abs (track.tofNSigmaPi ()), std::abs (track.tofNSigmaKa ()), std::abs (track.tofNSigmaPr ())};
850- bool retFlag = false ;
851846
852- if (partType == kPi && checkTrackPid<kPi , kKa , kPr >(vPtCut[kPi ], track.pt (), vTpcNsig, vTofNsig, track.hasTOF ())) {
853- retFlag = true ;
854- } else if (partType == kKa && checkTrackPid<kKa , kPi , kPr >(vPtCut[kKa ], track.pt (), vTpcNsig, vTofNsig, track.hasTOF ())) {
855- retFlag = true ;
856- } else if (partType == kPr && checkTrackPid<kPr , kPi , kKa >(vPtCut[kPr ], track.pt (), vTpcNsig, vTofNsig, track.hasTOF ())) {
857- retFlag = true ;
858- } else {
859- return false ;
847+ if (partType == kPi ) {
848+ return checkTrackPid<kPi , kKa , kPr >(vPtCut[kPi ], track.pt (), vTpcNsig, vTofNsig, track.hasTOF ());
860849 }
861850
862- return retFlag;
851+ if (partType == kKa ) {
852+ return checkTrackPid<kKa , kPi , kPr >(vPtCut[kKa ], track.pt (), vTpcNsig, vTofNsig, track.hasTOF ());
853+ }
854+
855+ if (partType == kPr ) {
856+ return checkTrackPid<kPr , kPi , kKa >(vPtCut[kPr ], track.pt (), vTpcNsig, vTofNsig, track.hasTOF ());
857+ }
858+
859+ return false ;
863860 }
864861
865862 using BCsRun3 = soa::Join<aod::BCsWithTimestamps, aod::Run3MatchedToBCSparse>;
@@ -968,8 +965,6 @@ struct FlowEventPlane {
968965 // Global objects
969966 float cent = 0 .;
970967 std::array<float , 4 > vSP = {0 ., 0 ., 0 ., 0 .};
971- std::map<ResoType, std::array<float , 2 >> mResoDauMass = {{kPhi0 , {MassKaonCharged, MassKaonCharged}}, {kKStar , {MassPionCharged, MassKaonCharged}}};
972- std::map<ResoType, float > mResoMass = {{kPhi0 , MassPhi}, {kKStar , MassKaonCharged}};
973968
974969 void init (InitContext const &)
975970 {
@@ -1094,7 +1089,7 @@ struct FlowEventPlane {
10941089 float ux = 0 ., uy = 0 ., v1a = 0 ., v1c = 0 .;
10951090 float tpcNsigma = 0 ., tofNsigma = 0 .;
10961091 for (auto const & track : tracks) {
1097- static constexpr std::string_view SubDir[] = {" Pion/" , " Kaon/" , " Proton/" };
1092+ static constexpr auto SubDir = std::array {" Pion/" , " Kaon/" , " Proton/" };
10981093 if (part == kPi && track.pt () > cMinPtPi) {
10991094 tpcNsigma = track.tpcNSigmaPi ();
11001095 tofNsigma = track.tofNSigmaPi ();
@@ -1178,17 +1173,13 @@ struct FlowEventPlane {
11781173 break ;
11791174 }
11801175
1181- if (std::abs (tpcNSigmaDau1) >= cTpcNsigmaCut || std::abs (tpcNSigmaDau2) >= cTpcNsigmaCut) {
1182- return false ;
1183- }
1184-
1185- return true ;
1176+ return (std::abs (tpcNSigmaDau1) < cTpcNsigmaCut && std::abs (tpcNSigmaDau2) < cTpcNsigmaCut);
11861177 }
11871178
11881179 template <V0Type part, typename C, typename V, typename T>
11891180 void fillV0QAHist (C const & col, V const & v0, T const &)
11901181 {
1191- static constexpr std::string_view SubDir[] = {" V0/K0Short/QA/" , " V0/Lambda/QA/" , " V0/AntiLambda/QA/" };
1182+ static constexpr auto SubDir = std::array {" V0/K0Short/QA/" , " V0/Lambda/QA/" , " V0/AntiLambda/QA/" };
11921183
11931184 // daugthers
11941185 auto postrack = v0.template posTrack_as <T>();
@@ -1219,21 +1210,11 @@ struct FlowEventPlane {
12191210 histos.fill (HIST (SubDir[part]) + HIST (" hNegNsigPiVsP" ), negtrack.tpcInnerParam (), negtrack.tpcNSigmaPi ());
12201211 }
12211212
1222- template <ResoType rt, typename T>
1213+ template <typename T>
12231214 void getResoFlow (T const & tracks1, T const & tracks2, std::array<float , 4 > const & vSP)
12241215 {
12251216 float ux = 0 ., uy = 0 ., v1a = 0 ., v1c = 0 .;
1226- std::array<float , 2 > vMassDau = mResoDauMass .at (rt);
1227- for (auto const & [track1, track2] : soa::combinations (soa::CombinationsFullIndexPolicy (tracks1, tracks2))) {
1228- // Discard same track
1229- if (track1.index () == track2.index ()) {
1230- continue ;
1231- }
1232-
1233- // Discard same charge track
1234- if (track1.sign () == track2.sign ()) {
1235- continue ;
1236- }
1217+ for (auto const & [track1, track2] : soa::combinations (soa::CombinationsStrictlyUpperIndexPolicy (tracks1, tracks2))) {
12371218
12381219 // Apply pseudo-rapidity acceptance
12391220 std::array<float , 3 > v = {track1.px () + track2.px (), track1.py () + track2.py (), track1.pz () + track2.pz ()};
@@ -1243,7 +1224,7 @@ struct FlowEventPlane {
12431224
12441225 // Reconstruct resonance
12451226 float p = RecoDecay::p ((track1.px () + track2.px ()), (track1.py () + track2.py ()), (track1.pz () + track2.pz ()));
1246- float e = RecoDecay::e (track1.px (), track1.py (), track1.pz (), vMassDau[ 0 ] ) + RecoDecay::e (track2.px (), track2.py (), track2.pz (), vMassDau[ 1 ] );
1227+ float e = RecoDecay::e (track1.px (), track1.py (), track1.pz (), MassKaonCharged ) + RecoDecay::e (track2.px (), track2.py (), track2.pz (), MassKaonCharged );
12471228 float m = std::sqrt (RecoDecay::m2 (p, e));
12481229
12491230 // Get directed flow
@@ -1252,29 +1233,17 @@ struct FlowEventPlane {
12521233 v1a = ux * vSP[kXa ] + uy * vSP[kYa ];
12531234 v1c = ux * vSP[kXc ] + uy * vSP[kYc ];
12541235
1255- // Histograms
1256- static constexpr std::string_view SubDir[] = {" Reso/Phi/" , " Reso/KStar/" };
1257-
12581236 // Fill signal histogram
1259- histos.fill (HIST (SubDir[rt]) + HIST (" hSigCentEtaInvMass" ), cent, RecoDecay::eta (v), m);
1260- histos.fill (HIST (SubDir[rt]) + HIST (" Sig/hQuA" ), cent, RecoDecay::eta (v), m, v1a);
1261- histos.fill (HIST (SubDir[rt]) + HIST (" Sig/hQuC" ), cent, RecoDecay::eta (v), m, v1c);
1262-
1263- // Get background
1264- p = RecoDecay::p ((track1.px () - track2.px ()), (track1.py () - track2.py ()), (track1.pz () - track2.pz ()));
1265- m = std::sqrt (RecoDecay::m2 (p, e));
1266- v[0 ] = track1.px () - track2.px ();
1267- v[1 ] = track1.py () - track2.py ();
1268- v[2 ] = track1.pz () - track2.pz ();
1269- ux = std::cos (RecoDecay::phi (v));
1270- uy = std::sin (RecoDecay::phi (v));
1271- v1a = ux * vSP[kXa ] + uy * vSP[kYa ];
1272- v1c = ux * vSP[kXc ] + uy * vSP[kYc ];
1273-
1274- // Fill bkg histogram
1275- histos.fill (HIST (SubDir[rt]) + HIST (" hBkgCentEtaInvMass" ), cent, RecoDecay::eta (v), m);
1276- histos.fill (HIST (SubDir[rt]) + HIST (" Bkg/hQuA" ), cent, RecoDecay::eta (v), m, v1a);
1277- histos.fill (HIST (SubDir[rt]) + HIST (" Bkg/hQuC" ), cent, RecoDecay::eta (v), m, v1c);
1237+ if (track1.sign () != track2.sign ()) {
1238+ histos.fill (HIST (" Reso/Phi/hSigCentEtaInvMass" ), cent, RecoDecay::eta (v), m);
1239+ histos.fill (HIST (" Reso/Phi/Sig/hQuA" ), cent, RecoDecay::eta (v), m, v1a);
1240+ histos.fill (HIST (" Reso/Phi/Sig/hQuC" ), cent, RecoDecay::eta (v), m, v1c);
1241+ } else {
1242+ // Fill bkg histogram
1243+ histos.fill (HIST (" Reso/Phi/hBkgCentEtaInvMass" ), cent, RecoDecay::eta (v), m);
1244+ histos.fill (HIST (" Reso/Phi/Bkg/hQuA" ), cent, RecoDecay::eta (v), m, v1a);
1245+ histos.fill (HIST (" Reso/Phi/Bkg/hQuC" ), cent, RecoDecay::eta (v), m, v1c);
1246+ }
12781247 }
12791248 }
12801249
@@ -1355,7 +1324,7 @@ struct FlowEventPlane {
13551324 auto kaonTracks = kaonTrackPartition->sliceByCached (aod::track::collisionId, collision.globalIndex (), cache);
13561325
13571326 // Resonance flow
1358- getResoFlow< kPhi0 > (kaonTracks, kaonTracks, vSP);
1327+ getResoFlow (kaonTracks, kaonTracks, vSP);
13591328 }
13601329 PROCESS_SWITCH (FlowEventPlane, processResoFlow, " Resonance flow process" , false );
13611330
0 commit comments