@@ -69,6 +69,7 @@ struct UccZdc {
6969
7070 static constexpr float kCollEnergy {2.68 };
7171 static constexpr float kZero {0 .};
72+ static constexpr float kOne {1 .};
7273 static constexpr float kMinCharge {3 .f };
7374
7475 // Configurables Event Selection
@@ -86,6 +87,7 @@ struct UccZdc {
8687 Configurable<bool > applyEff{" applyEff" , true , " Apply track-by-track efficiency correction" };
8788 Configurable<bool > applyFD{" applyFD" , false , " Apply track-by-track feed down correction" };
8889 Configurable<bool > correctNch{" correctNch" , true , " Correct also Nch" };
90+ Configurable<bool > skipRecoColGTOne{" skipRecoColGTOne" , true , " Remove collisions if reconstructed more than once" };
8991
9092 // Event selection
9193 Configurable<float > posZcut{" posZcut" , +10.0 , " z-vertex position cut" };
@@ -167,8 +169,6 @@ struct UccZdc {
167169 HistogramRegistry registry{" registry" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
168170 Service<ccdb::BasicCCDBManager> ccdb;
169171
170- TH1F* fd = nullptr ;
171-
172172 void init (InitContext const &)
173173 {
174174 // define axes you want to use
@@ -322,10 +322,10 @@ struct UccZdc {
322322 // This avoids that users can replace objects **while** a train is running
323323 ccdb->setCreatedNotAfter (ccdbNoLaterThan.value );
324324 // Feed Down is the same for all runs -> use a global object
325- fd = ccdb->getForTimeStamp <TH1F>(paTHFD.value , ccdbNoLaterThan.value );
326- if (!fd) {
327- LOGF (fatal, " Feed Down object not found!" );
328- }
325+ // fd = ccdb->getForTimeStamp<TH1F>(paTHFD.value,ccdbNoLaterThan.value);
326+ // if (!fd) {
327+ // LOGF(fatal, "Feed Down object not found!");
328+ // }
329329 }
330330
331331 template <typename CheckCol>
@@ -709,10 +709,15 @@ struct UccZdc {
709709 return ;
710710 }
711711
712+ auto feedDown = ccdb->getForTimeStamp <TH2F>(paTHFD.value , foundBC.timestamp ());
713+ if (!feedDown) {
714+ return ;
715+ }
716+
717+ double nchMult{0 .};
712718 std::vector<float > pTs;
713719 std::vector<float > vecFD;
714720 std::vector<float > vecEff;
715- std::vector<float > vecOneOverEff;
716721
717722 // Calculates the Nch multiplicity
718723 for (const auto & track : tracks) {
@@ -727,17 +732,19 @@ struct UccZdc {
727732 float pt{track.pt ()};
728733 int foundNchBin{efficiency->GetXaxis ()->FindBin (glbTracks)};
729734 int foundPtBin{efficiency->GetYaxis ()->FindBin (pt)};
730- float effValue{1.0 };
735+ float effValue{1 .};
736+ float fdValue{1 .};
731737 if (applyEff) {
732738 effValue = efficiency->GetBinContent (foundNchBin, foundPtBin);
733739 }
734- if (effValue > 0 .) {
735- vecOneOverEff.emplace_back (1 . / effValue);
740+ if (applyFD) {
741+ fdValue = feedDown->GetBinContent (foundNchBin, foundPtBin);
742+ }
743+ if ((effValue > 0 .) && (fdValue > 0 .)) {
744+ nchMult += (std::pow (effValue, -1 .) * fdValue);
736745 }
737746 }
738747
739- double nchMult{0 .};
740- nchMult = std::accumulate (vecOneOverEff.begin (), vecOneOverEff.end (), 0 );
741748 if (!applyEff)
742749 nchMult = static_cast <double >(glbTracks);
743750 if (applyEff && !correctNch)
@@ -766,7 +773,7 @@ struct UccZdc {
766773 float fdValue{1 .};
767774 if (applyEff) {
768775 effValue = efficiency->GetBinContent (foundNchBin, foundPtBin);
769- fdValue = fd ->GetBinContent (fd-> FindBin (pt) );
776+ fdValue = feedDown ->GetBinContent (foundNchBin, foundPtBin );
770777 }
771778 if (applyEff && !applyFD) {
772779 fdValue = 1.0 ;
@@ -861,12 +868,18 @@ struct UccZdc {
861868
862869 double nchRaw{0 .};
863870 double nchMult{0 .};
871+ double nchMC{0 };
864872 double normT0M{0 .};
865873 normT0M = (aT0A + aT0C) / 100 .;
866874
867875 registry.fill (HIST (" zPos" ), collision.posZ ());
868876 registry.fill (HIST (" zPosMC" ), mccollision.posZ ());
869877 registry.fill (HIST (" hEventCounterMC" ), EvCutLabel::VtxZ);
878+
879+ if (skipRecoColGTOne && (collisions.size () > kOne )) {
880+ continue ;
881+ }
882+
870883 registry.fill (HIST (" nRecColvsCent" ), collisions.size (), collision.centFT0C ());
871884
872885 const auto & cent{collision.centFT0C ()};
@@ -882,11 +895,15 @@ struct UccZdc {
882895 return ;
883896 }
884897
898+ auto feedDown = ccdb->getForTimeStamp <TH2F>(paTHFD.value , foundBC.timestamp ());
899+ if (!feedDown) {
900+ return ;
901+ }
902+
885903 std::vector<double > pTs;
886904 std::vector<double > vecFD;
887905 std::vector<double > vecEff;
888- std::vector<double > vecOneOverEffXFD;
889- // std::vector<float> wIs;
906+
890907 const auto & groupedTracks{simTracks.sliceBy (perCollision, collision.globalIndex ())};
891908
892909 // Calculates the event's Nch to evaluate the efficiency
@@ -946,16 +963,16 @@ struct UccZdc {
946963
947964 if (applyEff) {
948965 effValue = efficiency->GetBinContent (foundNchBin, foundPtBin);
949- fdValue = fd ->GetBinContent (fd-> FindBin (pt) );
966+ fdValue = feedDown ->GetBinContent (foundNchBin, foundPtBin );
950967 }
951968 if ((effValue > 0 .) && (fdValue > 0 .)) {
952969 pTs.emplace_back (pt);
953970 vecEff.emplace_back (effValue);
954971 vecFD.emplace_back (fdValue);
955- vecOneOverEffXFD. emplace_back (fdValue / effValue);
972+ nchMult += ( std::pow ( effValue, - 1.0 ) * fdValue );
956973 }
957974 }
958- nchMult = std::accumulate (vecOneOverEffXFD. begin (), vecOneOverEffXFD. end (), 0 );
975+
959976 if (nchMult < minNchSel) {
960977 return ;
961978 }
@@ -1019,13 +1036,13 @@ struct UccZdc {
10191036 pTsMC.emplace_back (pt);
10201037 vecFullEff.emplace_back (1 .);
10211038 vecFDEqualOne.emplace_back (1 .);
1039+ nchMC++;
10221040 }
10231041
1024- double nchMC{0 };
1025- nchMC = std::accumulate (vecFullEff.begin (), vecFullEff.end (), 0 );
10261042 if (nchMC < minNchSel) {
10271043 continue ;
10281044 }
1045+ // printf("nchMult = %f | nchMC = %f | nchMult/nchMc = %f\n",nchMult,nchMC,nchMult/nchMC);
10291046
10301047 double p1MC, p2MC, p3MC, p4MC, w1MC, w2MC, w3MC, w4MC;
10311048 p1MC = p2MC = p3MC = p4MC = w1MC = w2MC = w3MC = w4MC = 0.0 ;
0 commit comments