4040#include < TH1.h>
4141#include < TH3.h>
4242#include < TRandom3.h>
43- #include < TString.h>
4443
4544#include < array>
4645#include < chrono>
@@ -57,7 +56,7 @@ using namespace o2::framework::expressions;
5756using namespace o2 ::constants::math;
5857
5958// define the filtered collisions and tracks
60- #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)
6160
6261struct FlowCorrelationsUpc {
6362 O2_DEFINE_CONFIGURABLE (cfgZVtxCut, float , 10 .0f , " Accepted z-vertex range" )
@@ -94,6 +93,10 @@ struct FlowCorrelationsUpc {
9493 O2_DEFINE_CONFIGURABLE (cfgIRMaxCut, double , 50 , " maximum interaction rate for UPC events" )
9594 O2_DEFINE_CONFIGURABLE (cfgZdcTime, bool , false , " choose zdc time cut" )
9695 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" )
97100
98101 ConfigurableAxis axisVertex{" axisVertex" , {10 , -10 , 10 }, " vertex axis for histograms" };
99102 ConfigurableAxis axisEta{" axisEta" , {40 , -1 ., 1 .}, " eta axis for histograms" };
@@ -119,7 +122,7 @@ struct FlowCorrelationsUpc {
119122
120123 // make the filters and cuts.
121124 Filter trackFilter = (aod::udtrack::isPVContributor == true );
122- Filter collisionFilter = ( cfgGapSideMerge == true )
125+ Filter collisionFilter = cfgGapSideMerge
123126 ? ((aod::udcollision::gapSide == (uint8_t )0 || aod::udcollision::gapSide == (uint8_t )1 ) &&
124127 (aod::upcservice::truegapside == 0 || aod::upcservice::truegapside == 1 ))
125128 : ((aod::udcollision::gapSide == (uint8_t )cfgGapSide) &&
@@ -209,8 +212,9 @@ struct FlowCorrelationsUpc {
209212
210213 float dPhiStar = phi1 - phi2 - charge1 * fbSign * std::asin (0.075 * radius / pt1) + charge2 * fbSign * std::asin (0.075 * radius / pt2);
211214
212- if (dPhiStar > constants::math::PI )
215+ if (dPhiStar > constants::math::PI ) {
213216 dPhiStar = constants::math::TwoPI - dPhiStar;
217+ }
214218 return dPhiStar;
215219 }
216220
@@ -241,14 +245,18 @@ struct FlowCorrelationsUpc {
241245 int neutronClass = -1 ;
242246 float energyCommonZNA = collision.energyCommonZNA (), energyCommonZNC = collision.energyCommonZNC ();
243247 float timeZNA = collision.timeZNA (), timeZNC = collision.timeZNC ();
244- if (std::isinf (energyCommonZNA))
248+ if (std::isinf (energyCommonZNA)) {
245249 energyCommonZNA = -999 ;
246- if (std::isinf (energyCommonZNC))
250+ }
251+ if (std::isinf (energyCommonZNC)) {
247252 energyCommonZNC = -999 ;
248- if (std::isinf (timeZNA))
253+ }
254+ if (std::isinf (timeZNA)) {
249255 timeZNA = -999 ;
250- if (std::isinf (timeZNC))
256+ }
257+ if (std::isinf (timeZNC)) {
251258 timeZNC = -999 ;
259+ }
252260 registry.fill (HIST (" ZDCEnergy" ), energyCommonZNC, energyCommonZNA);
253261 registry.fill (HIST (" ZDCTime" ), timeZNC, timeZNA);
254262 if (std::abs (timeZNA) > cfgZdcTimeCut && std::abs (timeZNC) > cfgZdcTimeCut) {
@@ -290,19 +298,19 @@ struct FlowCorrelationsUpc {
290298 if (cfgIfVertex && std::abs (collision.posZ ()) > cfgZVtxCut) {
291299 return false ;
292300 }
293- if (!collision.vtxITSTPC ()) {
301+ if (cfgvtxITSTPC && !collision.vtxITSTPC ()) {
294302 return false ;
295303 }
296304
297- if (!collision.sbp ()) {
305+ if (cfgSbp && !collision.sbp ()) {
298306 return false ;
299307 }
300308
301- if (!collision.itsROFb ()) {
309+ if (cfgItsROFb && !collision.itsROFb ()) {
302310 return false ;
303311 }
304312
305- if (!collision.tfb ()) {
313+ if (cfgTfb && !collision.tfb ()) {
306314 return false ;
307315 }
308316
@@ -311,8 +319,9 @@ struct FlowCorrelationsUpc {
311319 }
312320
313321 if (cfgRctFlagEnabled) {
314- if (!isGoodRctFlag (collision)) // check RCT flags
322+ if (!isGoodRctFlag (collision)) { // check RCT flags
315323 return false ;
324+ }
316325 }
317326
318327 if (!zdcTimeCut (collision)) {
@@ -323,7 +332,7 @@ struct FlowCorrelationsUpc {
323332 }
324333
325334 template <typename TTrack>
326- bool trackSelected (TTrack track)
335+ bool trackSelected (const TTrack& track)
327336 {
328337 // registry.fill(HIST("hTrackCount"), 0.5);
329338 auto momentum = std::array<double , 3 >{track.px (), track.py (), track.pz ()};
@@ -371,7 +380,7 @@ struct FlowCorrelationsUpc {
371380 if (correctionsLoaded) {
372381 return ;
373382 }
374- if (cfgEfficiency.value .empty () == false ) {
383+ if (! cfgEfficiency.value .empty ()) {
375384 mEfficiency = ccdb->getForTimeStamp <TH3D >(cfgEfficiency, timestamp);
376385 if (mEfficiency == nullptr ) {
377386 LOGF (fatal, " Could not load efficiency histogram for trigger particles from %s" , cfgEfficiency.value .c_str ());
@@ -392,28 +401,31 @@ struct FlowCorrelationsUpc {
392401 } else {
393402 eff = 1.0 ;
394403 }
395- if (eff <= 0 )
404+ if (eff <= 0 ) {
396405 return false ;
406+ }
397407 weight_nue = 1 . / eff;
398408 return true ;
399409 }
400410 // fill multiple histograms
401411 template <typename TCollision, typename TTracks>
402- void fillYield (TCollision collision, TTracks tracks, float vtxz) // function to fill the yield and etaphi histograms.
412+ void fillYield (const TCollision& collision, const TTracks& tracks, float vtxz) // function to fill the yield and etaphi histograms.
403413 {
404414 registry.fill (HIST (" Nch" ), tracks.size ());
405415 registry.fill (HIST (" zVtx" ), collision.posZ ());
406416
407417 for (auto const & track1 : tracks) {
408- if (!trackSelected (track1))
418+ if (!trackSelected (track1)) {
409419 continue ;
420+ }
410421 auto momentum = std::array<double , 3 >{track1.px (), track1.py (), track1.pz ()};
411422 double pt = RecoDecay::pt (momentum);
412423 double phi = RecoDecay::phi (momentum);
413424 double eta = RecoDecay::eta (momentum);
414425 float weff = 1 .;
415- if (!getEfficiencyCorrection (weff, eta, pt, vtxz))
426+ if (!getEfficiencyCorrection (weff, eta, pt, vtxz)) {
416427 continue ;
428+ }
417429
418430 registry.fill (HIST (" Phi" ), phi);
419431 registry.fill (HIST (" Eta" ), eta);
@@ -424,7 +436,7 @@ struct FlowCorrelationsUpc {
424436 }
425437
426438 template <typename TTracks>
427- 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
439+ 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
428440 {
429441
430442 if (mEfficiency ) {
@@ -440,12 +452,13 @@ struct FlowCorrelationsUpc {
440452 }
441453 }
442454
443- int fSampleIndex = gRandom ->Uniform (0 , cfgSampleSize);
455+ const int fSampleIndex = static_cast < int >( gRandom ->Uniform (0 . , cfgSampleSize) );
444456
445457 // loop over all tracks
446458 for (auto const & track1 : tracks1) {
447- if (!trackSelected (track1))
459+ if (!trackSelected (track1)) {
448460 continue ;
461+ }
449462
450463 auto momentum1 = std::array<double , 3 >{track1.px (), track1.py (), track1.pz ()};
451464 double pt1 = RecoDecay::pt (momentum1);
@@ -459,15 +472,19 @@ struct FlowCorrelationsUpc {
459472 }
460473
461474 for (auto const & track2 : tracks2) {
462- if (!trackSelected (track2))
475+ if (!trackSelected (track2)) {
463476 continue ;
477+ }
464478
465- if (track1.globalIndex () == track2.globalIndex ())
479+ if (track1.globalIndex () == track2.globalIndex ()) {
466480 continue ;
467- if (system == SameEvent && cfgUsePtOrder && pt1 <= track2.pt ())
481+ }
482+ if (system == SameEvent && cfgUsePtOrder && pt1 <= track2.pt ()) {
468483 continue ;
469- if (system == MixedEvent && cfgUsePtOrderInMixEvent && pt1 <= track2.pt ())
484+ }
485+ if (system == MixedEvent && cfgUsePtOrderInMixEvent && pt1 <= track2.pt ()) {
470486 continue ;
487+ }
471488
472489 auto momentum2 = std::array<double , 3 >{track2.px (), track2.py (), track2.pz ()};
473490 double pt2 = RecoDecay::pt (momentum2);
@@ -494,15 +511,20 @@ struct FlowCorrelationsUpc {
494511 bool bIsBelow = false ;
495512
496513 if (std::abs (dPhiStarLow) < kLimit || std::abs (dPhiStarHigh) < kLimit || dPhiStarLow * dPhiStarHigh < 0 ) {
497- for (double rad (cfgRadiusLow); rad < cfgRadiusHigh; rad += 0.01 ) {
514+ constexpr float kRadiusStep = 0 .01f ;
515+ const float radiusLow = cfgRadiusLow;
516+ const float radiusHigh = cfgRadiusHigh;
517+ for (int iRadius = 0 ; radiusLow + static_cast <float >(iRadius) * kRadiusStep < radiusHigh; ++iRadius) {
518+ const float rad = radiusLow + static_cast <float >(iRadius) * kRadiusStep ;
498519 double dPhiStar = getDPhiStar (track1, track2, rad, runnum, phi1, phi2);
499520 if (std::abs (dPhiStar) < kLimit ) {
500521 bIsBelow = true ;
501522 break ;
502523 }
503524 }
504- if (bIsBelow)
525+ if (bIsBelow) {
505526 continue ;
527+ }
506528 }
507529 }
508530
@@ -528,8 +550,9 @@ struct FlowCorrelationsUpc {
528550 auto currentRunNumber = collision.runNumber ();
529551 auto runDuration = ccdb->getRunDuration (currentRunNumber);
530552
531- if (!eventSelected (collision))
553+ if (!eventSelected (collision)) {
532554 return ;
555+ }
533556
534557 loadCorrections (runDuration.first );
535558
@@ -540,8 +563,9 @@ struct FlowCorrelationsUpc {
540563 double nTracksCorrected = 0 .;
541564
542565 for (const auto & track : tracks) {
543- if (!trackSelected (track))
566+ if (!trackSelected (track)) {
544567 continue ;
568+ }
545569
546570 auto momentum = std::array<double , 3 >{track.px (), track.py (), track.pz ()};
547571 double pt = RecoDecay::pt (momentum);
@@ -594,8 +618,9 @@ struct FlowCorrelationsUpc {
594618 tracks2.size () < cfgMinMult || tracks2.size () > cfgMaxMult) {
595619 continue ;
596620 }
597- if (!eventSelected (collision1) || !eventSelected (collision2))
621+ if (!eventSelected (collision1) || !eventSelected (collision2)) {
598622 continue ;
623+ }
599624
600625 auto runDuration1 = ccdb->getRunDuration (collision1.runNumber ());
601626 loadCorrections (runDuration1.first );
@@ -606,8 +631,9 @@ struct FlowCorrelationsUpc {
606631 double nTracksCorrected = 0 .;
607632
608633 for (const auto & track : tracks1) {
609- if (!trackSelected (track))
634+ if (!trackSelected (track)) {
610635 continue ;
636+ }
611637
612638 auto momentum = std::array<double , 3 >{track.px (), track.py (), track.pz ()};
613639 double pt = RecoDecay::pt (momentum);
0 commit comments