@@ -56,7 +56,7 @@ using namespace o2::framework::expressions;
5656using namespace o2 ::constants::math;
5757
5858// define the filtered collisions and tracks
59- #define O2_DEFINE_CONFIGURABLE (NAME, TYPE, DEFAULT, HELP ) Configurable<TYPE > NAME {#NAME , DEFAULT , HELP };
59+ #define O2_DEFINE_CONFIGURABLE (NAME, TYPE, DEFAULT, HELP ) Configurable<TYPE > NAME {#NAME , ( DEFAULT ), ( HELP )}; // NOLINT(bugprone-macro-parentheses)
6060
6161struct FlowCorrelationsUpc {
6262 O2_DEFINE_CONFIGURABLE (cfgZVtxCut, float , 10 .0f , " Accepted z-vertex range" )
@@ -93,6 +93,10 @@ struct FlowCorrelationsUpc {
9393 O2_DEFINE_CONFIGURABLE (cfgIRMaxCut, double , 50 , " maximum interaction rate for UPC events" )
9494 O2_DEFINE_CONFIGURABLE (cfgZdcTime, bool , false , " choose zdc time cut" )
9595 O2_DEFINE_CONFIGURABLE (cfgZdcTimeCut, float , 2.0 , " zdc time cut" )
96+ O2_DEFINE_CONFIGURABLE (cfgSbp, bool , true , " choose sbp" )
97+ O2_DEFINE_CONFIGURABLE (cfgvtxITSTPC, bool , true , " choose vtxITSTPC" )
98+ O2_DEFINE_CONFIGURABLE (cfgItsROFb, bool , true , " choose itsROFb" )
99+ O2_DEFINE_CONFIGURABLE (cfgTfb, bool , true , " choose tfb" )
96100
97101 ConfigurableAxis axisVertex{" axisVertex" , {10 , -10 , 10 }, " vertex axis for histograms" };
98102 ConfigurableAxis axisEta{" axisEta" , {40 , -1 ., 1 .}, " eta axis for histograms" };
@@ -118,14 +122,14 @@ struct FlowCorrelationsUpc {
118122
119123 // make the filters and cuts.
120124 Filter trackFilter = (aod::udtrack::isPVContributor == true );
121- Filter collisionFilter = ( cfgGapSideMerge == true )
125+ Filter collisionFilter = cfgGapSideMerge
122126 ? ((aod::udcollision::gapSide == (uint8_t )0 || aod::udcollision::gapSide == (uint8_t )1 ) &&
123127 (aod::upcservice::truegapside == 0 || aod::upcservice::truegapside == 1 ))
124128 : ((aod::udcollision::gapSide == (uint8_t )cfgGapSide) &&
125129 (aod::upcservice::truegapside == cfgGapSide));
126130
127131 // Connect to ccdb
128- Service<ccdb::BasicCCDBManager> ccdb;
132+ Service<ccdb::BasicCCDBManager> ccdb{} ;
129133 Configurable<std::string> ccdbUrl{" ccdbUrl" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
130134
131135 // global variables
@@ -208,8 +212,9 @@ struct FlowCorrelationsUpc {
208212
209213 float dPhiStar = phi1 - phi2 - charge1 * fbSign * std::asin (0.075 * radius / pt1) + charge2 * fbSign * std::asin (0.075 * radius / pt2);
210214
211- if (dPhiStar > constants::math::PI )
215+ if (dPhiStar > constants::math::PI ) {
212216 dPhiStar = constants::math::TwoPI - dPhiStar;
217+ }
213218 return dPhiStar;
214219 }
215220
@@ -240,14 +245,18 @@ struct FlowCorrelationsUpc {
240245 int neutronClass = -1 ;
241246 float energyCommonZNA = collision.energyCommonZNA (), energyCommonZNC = collision.energyCommonZNC ();
242247 float timeZNA = collision.timeZNA (), timeZNC = collision.timeZNC ();
243- if (std::isinf (energyCommonZNA))
248+ if (std::isinf (energyCommonZNA)) {
244249 energyCommonZNA = -999 ;
245- if (std::isinf (energyCommonZNC))
250+ }
251+ if (std::isinf (energyCommonZNC)) {
246252 energyCommonZNC = -999 ;
247- if (std::isinf (timeZNA))
253+ }
254+ if (std::isinf (timeZNA)) {
248255 timeZNA = -999 ;
249- if (std::isinf (timeZNC))
256+ }
257+ if (std::isinf (timeZNC)) {
250258 timeZNC = -999 ;
259+ }
251260 registry.fill (HIST (" ZDCEnergy" ), energyCommonZNC, energyCommonZNA);
252261 registry.fill (HIST (" ZDCTime" ), timeZNC, timeZNA);
253262 if (std::abs (timeZNA) > cfgZdcTimeCut && std::abs (timeZNC) > cfgZdcTimeCut) {
@@ -289,19 +298,19 @@ struct FlowCorrelationsUpc {
289298 if (cfgIfVertex && std::abs (collision.posZ ()) > cfgZVtxCut) {
290299 return false ;
291300 }
292- if (!collision.vtxITSTPC ()) {
301+ if (cfgvtxITSTPC && !collision.vtxITSTPC ()) {
293302 return false ;
294303 }
295304
296- if (!collision.sbp ()) {
305+ if (cfgSbp && !collision.sbp ()) {
297306 return false ;
298307 }
299308
300- if (!collision.itsROFb ()) {
309+ if (cfgItsROFb && !collision.itsROFb ()) {
301310 return false ;
302311 }
303312
304- if (!collision.tfb ()) {
313+ if (cfgTfb && !collision.tfb ()) {
305314 return false ;
306315 }
307316
@@ -310,8 +319,13 @@ struct FlowCorrelationsUpc {
310319 }
311320
312321 if (cfgRctFlagEnabled) {
313- if (!isGoodRctFlag (collision)) // check RCT flags
322+ if (!isGoodRctFlag (collision)) { // check RCT flags
314323 return false ;
324+ }
325+ }
326+
327+ if (!zdcTimeCut (collision)) {
328+ return false ;
315329 }
316330
317331 if (!zdcTimeCut (collision)) {
@@ -322,7 +336,7 @@ struct FlowCorrelationsUpc {
322336 }
323337
324338 template <typename TTrack>
325- bool trackSelected (TTrack track)
339+ bool trackSelected (const TTrack& track)
326340 {
327341 // registry.fill(HIST("hTrackCount"), 0.5);
328342 auto momentum = std::array<double , 3 >{track.px (), track.py (), track.pz ()};
@@ -359,6 +373,7 @@ struct FlowCorrelationsUpc {
359373 }
360374 auto tpcClu = track.tpcNClsFindable () - track.tpcNClsFindableMinusFound ();
361375 if (tpcClu < cfgCutTPCclu) {
376+ // NOLINTNEXTLINE(readability-simplify-boolean-expr)
362377 return false ;
363378 }
364379 // registry.fill(HIST("hTrackCount"), 5.5);
@@ -370,7 +385,7 @@ struct FlowCorrelationsUpc {
370385 if (correctionsLoaded) {
371386 return ;
372387 }
373- if (cfgEfficiency.value .empty () == false ) {
388+ if (! cfgEfficiency.value .empty ()) {
374389 mEfficiency = ccdb->getForTimeStamp <TH3D >(cfgEfficiency, timestamp);
375390 if (mEfficiency == nullptr ) {
376391 LOGF (fatal, " Could not load efficiency histogram for trigger particles from %s" , cfgEfficiency.value .c_str ());
@@ -391,28 +406,31 @@ struct FlowCorrelationsUpc {
391406 } else {
392407 eff = 1.0 ;
393408 }
394- if (eff <= 0 )
409+ if (eff <= 0 ) {
395410 return false ;
411+ }
396412 weight_nue = 1 . / eff;
397413 return true ;
398414 }
399415 // fill multiple histograms
400416 template <typename TCollision, typename TTracks>
401- void fillYield (TCollision collision, TTracks tracks, float vtxz) // function to fill the yield and etaphi histograms.
417+ void fillYield (const TCollision& collision, const TTracks& tracks, float vtxz) // function to fill the yield and etaphi histograms.
402418 {
403419 registry.fill (HIST (" Nch" ), tracks.size ());
404420 registry.fill (HIST (" zVtx" ), collision.posZ ());
405421
406422 for (auto const & track1 : tracks) {
407- if (!trackSelected (track1))
423+ if (!trackSelected (track1)) {
408424 continue ;
425+ }
409426 auto momentum = std::array<double , 3 >{track1.px (), track1.py (), track1.pz ()};
410427 double pt = RecoDecay::pt (momentum);
411428 double phi = RecoDecay::phi (momentum);
412429 double eta = RecoDecay::eta (momentum);
413430 float weff = 1 .;
414- if (!getEfficiencyCorrection (weff, eta, pt, vtxz))
431+ if (!getEfficiencyCorrection (weff, eta, pt, vtxz)) {
415432 continue ;
433+ }
416434
417435 registry.fill (HIST (" Phi" ), phi);
418436 registry.fill (HIST (" Eta" ), eta);
@@ -423,7 +441,7 @@ struct FlowCorrelationsUpc {
423441 }
424442
425443 template <typename TTracks>
426- void fillCorrelations (TTracks tracks1, TTracks tracks2, float posZ, int system, int runnum, float vtxz, float eventWeight, double independent) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
444+ void fillCorrelations (const TTracks& tracks1, const TTracks& tracks2, float posZ, int system, int runnum, float vtxz, float eventWeight, double independent) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
427445 {
428446
429447 if (mEfficiency ) {
@@ -439,34 +457,38 @@ struct FlowCorrelationsUpc {
439457 }
440458 }
441459
442- int fSampleIndex = gRandom ->Uniform (0 , cfgSampleSize);
460+ const int fSampleIndex = static_cast < int >( gRandom ->Uniform (0 . , cfgSampleSize) );
443461
444462 // loop over all tracks
445463 for (auto const & track1 : tracks1) {
446- if (!trackSelected (track1))
464+ if (!trackSelected (track1)) {
447465 continue ;
466+ }
448467
449468 auto momentum1 = std::array<double , 3 >{track1.px (), track1.py (), track1.pz ()};
450469 double pt1 = RecoDecay::pt (momentum1);
451470 double phi1 = RecoDecay::phi (momentum1);
452471 double eta1 = RecoDecay::eta (momentum1);
453472
454- // 计算track1的权重
455473 float weff1 = 1 ., wacc1 = 1 .;
456474 if (system == SameEvent) {
457475 registry.fill (HIST (" Trig_hist" ), fSampleIndex , posZ, independent, pt1, eventWeight * weff1 * wacc1);
458476 }
459477
460478 for (auto const & track2 : tracks2) {
461- if (!trackSelected (track2))
479+ if (!trackSelected (track2)) {
462480 continue ;
481+ }
463482
464- if (track1.globalIndex () == track2.globalIndex ())
483+ if (track1.globalIndex () == track2.globalIndex ()) {
465484 continue ;
466- if (system == SameEvent && cfgUsePtOrder && pt1 <= track2.pt ())
485+ }
486+ if (system == SameEvent && cfgUsePtOrder && pt1 <= track2.pt ()) {
467487 continue ;
468- if (system == MixedEvent && cfgUsePtOrderInMixEvent && pt1 <= track2.pt ())
488+ }
489+ if (system == MixedEvent && cfgUsePtOrderInMixEvent && pt1 <= track2.pt ()) {
469490 continue ;
491+ }
470492
471493 auto momentum2 = std::array<double , 3 >{track2.px (), track2.py (), track2.pz ()};
472494 double pt2 = RecoDecay::pt (momentum2);
@@ -493,15 +515,20 @@ struct FlowCorrelationsUpc {
493515 bool bIsBelow = false ;
494516
495517 if (std::abs (dPhiStarLow) < kLimit || std::abs (dPhiStarHigh) < kLimit || dPhiStarLow * dPhiStarHigh < 0 ) {
496- for (double rad (cfgRadiusLow); rad < cfgRadiusHigh; rad += 0.01 ) {
518+ constexpr float kRadiusStep = 0 .01f ;
519+ const float radiusLow = cfgRadiusLow;
520+ const float radiusHigh = cfgRadiusHigh;
521+ for (int iRadius = 0 ; radiusLow + static_cast <float >(iRadius) * kRadiusStep < radiusHigh; ++iRadius) {
522+ const float rad = radiusLow + static_cast <float >(iRadius) * kRadiusStep ;
497523 double dPhiStar = getDPhiStar (track1, track2, rad, runnum, phi1, phi2);
498524 if (std::abs (dPhiStar) < kLimit ) {
499525 bIsBelow = true ;
500526 break ;
501527 }
502528 }
503- if (bIsBelow)
529+ if (bIsBelow) {
504530 continue ;
531+ }
505532 }
506533 }
507534
@@ -527,8 +554,9 @@ struct FlowCorrelationsUpc {
527554 auto currentRunNumber = collision.runNumber ();
528555 auto runDuration = ccdb->getRunDuration (currentRunNumber);
529556
530- if (!eventSelected (collision))
557+ if (!eventSelected (collision)) {
531558 return ;
559+ }
532560
533561 loadCorrections (runDuration.first );
534562
@@ -539,8 +567,9 @@ struct FlowCorrelationsUpc {
539567 double nTracksCorrected = 0 .;
540568
541569 for (const auto & track : tracks) {
542- if (!trackSelected (track))
570+ if (!trackSelected (track)) {
543571 continue ;
572+ }
544573
545574 auto momentum = std::array<double , 3 >{track.px (), track.py (), track.pz ()};
546575 double pt = RecoDecay::pt (momentum);
@@ -593,8 +622,9 @@ struct FlowCorrelationsUpc {
593622 tracks2.size () < cfgMinMult || tracks2.size () > cfgMaxMult) {
594623 continue ;
595624 }
596- if (!eventSelected (collision1) || !eventSelected (collision2))
625+ if (!eventSelected (collision1) || !eventSelected (collision2)) {
597626 continue ;
627+ }
598628
599629 auto runDuration1 = ccdb->getRunDuration (collision1.runNumber ());
600630 loadCorrections (runDuration1.first );
@@ -605,8 +635,9 @@ struct FlowCorrelationsUpc {
605635 double nTracksCorrected = 0 .;
606636
607637 for (const auto & track : tracks1) {
608- if (!trackSelected (track))
638+ if (!trackSelected (track)) {
609639 continue ;
640+ }
610641
611642 auto momentum = std::array<double , 3 >{track.px (), track.py (), track.pz ()};
612643 double pt = RecoDecay::pt (momentum);
0 commit comments