@@ -1013,7 +1013,7 @@ struct UccZdc {
10131013 aT0C += amplitude;
10141014 }
10151015 } else {
1016- return ;
1016+ continue ;
10171017 }
10181018
10191019 const double normT0M{(aT0A + aT0C) / arbScale};
@@ -1068,18 +1068,18 @@ struct UccZdc {
10681068
10691069 // Reject event if nchRaw less than a lower cutoff
10701070 if (nchRaw < minNchSel) {
1071- return ;
1071+ continue ;
10721072 }
10731073
1074- // Calculates the event weight, W_k
10751074 const int foundNchBin{cfg.hEfficiency ->GetXaxis ()->FindBin (nchRaw)};
10761075
1076+ // Calculates the event weight, W_k
10771077 for (const auto & track : groupedTracks) {
10781078 // Track Selection
10791079 if (track.eta () < minEta || track.eta () > maxEta) {
10801080 continue ;
10811081 }
1082- if (track.pt () < minPt || track.pt () > maxPt ) {
1082+ if (track.pt () < minPt || track.pt () > maxPtSpectra ) {
10831083 continue ;
10841084 }
10851085 if (!track.isGlobalTrack ()) {
@@ -1103,8 +1103,6 @@ struct UccZdc {
11031103 if (std::abs (charge) < kMinCharge ) {
11041104 continue ;
11051105 }
1106- // Is it a primary particle?
1107- // if (!particle.isPhysicalPrimary()) { continue; }
11081106
11091107 const double pt{static_cast <double >(track.pt ())};
11101108 const int foundPtBin{cfg.hEfficiency ->GetYaxis ()->FindBin (pt)};
@@ -1145,7 +1143,7 @@ struct UccZdc {
11451143 std::vector<float > vecFullEff;
11461144 std::vector<float > vecFDEqualOne;
11471145
1148- // Calculates the event weight, W_k
1146+ // calculates the true Nch
11491147 for (const auto & particle : mcParticles) {
11501148 if (particle.eta () < minEta || particle.eta () > maxEta) {
11511149 continue ;
@@ -1171,18 +1169,46 @@ struct UccZdc {
11711169 if (!particle.isPhysicalPrimary ()) {
11721170 continue ;
11731171 }
1174-
1175- float pt{particle.pt ()};
1176- pTsMC.emplace_back (pt);
1177- vecFullEff.emplace_back (1 .);
1178- vecFDEqualOne.emplace_back (1 .);
11791172 nchMC++;
11801173 }
11811174
11821175 if (nchMC < minNchSel) {
11831176 continue ;
11841177 }
11851178
1179+ // Calculates the event weight, W_k
1180+ for (const auto & particle : mcParticles) {
1181+ if (particle.eta () < minEta || particle.eta () > maxEta) {
1182+ continue ;
1183+ }
1184+ if (particle.pt () < minPt || particle.pt () > maxPtSpectra) {
1185+ continue ;
1186+ }
1187+
1188+ auto charge{0 .};
1189+ // Get the MC particle
1190+ auto * pdgParticle = pdg->GetParticle (particle.pdgCode ());
1191+ if (pdgParticle != nullptr ) {
1192+ charge = pdgParticle->Charge ();
1193+ } else {
1194+ continue ;
1195+ }
1196+
1197+ // Is it a charged particle?
1198+ if (std::abs (charge) < kMinCharge ) {
1199+ continue ;
1200+ }
1201+ // Is it a primary particle?
1202+ if (!particle.isPhysicalPrimary ()) {
1203+ continue ;
1204+ }
1205+
1206+ const float pt{particle.pt ()};
1207+ pTsMC.emplace_back (pt);
1208+ vecFullEff.emplace_back (1 .);
1209+ vecFDEqualOne.emplace_back (1 .);
1210+ }
1211+
11861212 double p1MC, p2MC, p3MC, p4MC, w1MC, w2MC, w3MC, w4MC;
11871213 p1MC = p2MC = p3MC = p4MC = w1MC = w2MC = w3MC = w4MC = 0.0 ;
11881214 getPTpowers (pTsMC, vecFullEff, vecFDEqualOne, p1MC, w1MC, p2MC, w2MC, p3MC, w3MC, p4MC, w4MC);
@@ -1207,7 +1233,6 @@ struct UccZdc {
12071233 } else { // Correction with the remaining half of the sample
12081234 registry.fill (HIST (" EvtsDivided" ), 1 );
12091235 // ----- MC reconstructed -----//
1210- // const auto& groupedTracks{simTracks.sliceBy(perCollision, collision.globalIndex())};
12111236 for (const auto & track : groupedTracks) {
12121237 // Track Selection
12131238 if (track.eta () < minEta || track.eta () > maxEta) {
@@ -1219,9 +1244,6 @@ struct UccZdc {
12191244 if (!track.isGlobalTrack ()) {
12201245 continue ;
12211246 }
1222- registry.fill (HIST (" ZposVsEta" ), collision.posZ (), track.eta ());
1223- registry.fill (HIST (" EtaVsPhi" ), track.eta (), track.phi ());
1224- registry.fill (HIST (" dcaXYvspT" ), track.dcaXY (), track.pt ());
12251247 nchRaw++;
12261248 }
12271249
@@ -1230,7 +1252,7 @@ struct UccZdc {
12301252 if (track.eta () < minEta || track.eta () > maxEta) {
12311253 continue ;
12321254 }
1233- if (track.pt () < minPt || track.pt () > maxPt ) {
1255+ if (track.pt () < minPt || track.pt () > maxPtSpectra ) {
12341256 continue ;
12351257 }
12361258 if (!track.isGlobalTrack ()) {
@@ -1254,8 +1276,13 @@ struct UccZdc {
12541276 if (std::abs (charge) < kMinCharge ) {
12551277 continue ;
12561278 }
1279+
12571280 // All charged particles
12581281 registry.fill (HIST (" Pt_all_ch" ), nchRaw, track.pt ());
1282+ registry.fill (HIST (" ZposVsEta" ), collision.posZ (), track.eta ());
1283+ registry.fill (HIST (" EtaVsPhi" ), track.eta (), track.phi ());
1284+ registry.fill (HIST (" dcaXYvspT" ), track.dcaXY (), track.pt ());
1285+
12591286 // Is it a primary particle?
12601287 if (!particle.isPhysicalPrimary ()) {
12611288 continue ;
@@ -1282,7 +1309,7 @@ struct UccZdc {
12821309 if (particle.eta () < minEta || particle.eta () > maxEta) {
12831310 continue ;
12841311 }
1285- if (particle.pt () < minPt || particle.pt () > maxPt ) {
1312+ if (particle.pt () < minPt || particle.pt () > maxPtSpectra ) {
12861313 continue ;
12871314 }
12881315
@@ -1364,7 +1391,7 @@ struct UccZdc {
13641391 std::vector<float > vecFD;
13651392 std::vector<float > vecEff;
13661393
1367- // Calculates the event weight, W_k
1394+ // Calculates the true Nch
13681395 for (const auto & particle : mcParticles) {
13691396 if (particle.eta () < minEta || particle.eta () > maxEta) {
13701397 continue ;
@@ -1390,18 +1417,45 @@ struct UccZdc {
13901417 if (!particle.isPhysicalPrimary ()) {
13911418 continue ;
13921419 }
1393-
1394- float pt{particle.pt ()};
1395- pTs.emplace_back (pt);
1396- vecEff.emplace_back (1 .);
1397- vecFD.emplace_back (1 .);
13981420 nchMult++;
13991421 }
14001422
14011423 if (nchMult < minNchSel) {
14021424 continue ;
14031425 }
1404- // printf("nchMult = %f | nchMC = %f | nchMult/nchMc = %f\n",nchMult,nchMC,nchMult/nchMC);
1426+
1427+ // Calculates the event weight, W_k
1428+ for (const auto & particle : mcParticles) {
1429+ if (particle.eta () < minEta || particle.eta () > maxEta) {
1430+ continue ;
1431+ }
1432+ if (particle.pt () < minPt || particle.pt () > maxPtSpectra) {
1433+ continue ;
1434+ }
1435+
1436+ auto charge{0 .};
1437+ // Get the MC particle
1438+ auto * pdgParticle = pdg->GetParticle (particle.pdgCode ());
1439+ if (pdgParticle != nullptr ) {
1440+ charge = pdgParticle->Charge ();
1441+ } else {
1442+ continue ;
1443+ }
1444+
1445+ // Is it a charged particle?
1446+ if (std::abs (charge) < kMinCharge ) {
1447+ continue ;
1448+ }
1449+ // Is it a primary particle?
1450+ if (!particle.isPhysicalPrimary ()) {
1451+ continue ;
1452+ }
1453+
1454+ const float pt{particle.pt ()};
1455+ pTs.emplace_back (pt);
1456+ vecEff.emplace_back (1 .);
1457+ vecFD.emplace_back (1 .);
1458+ }
14051459
14061460 double p1, p2, p3, p4, w1, w2, w3, w4;
14071461 p1 = p2 = p3 = p4 = w1 = w2 = w3 = w4 = 0.0 ;
@@ -1448,7 +1502,7 @@ struct UccZdc {
14481502 std::vector<float > vecFD;
14491503 std::vector<float > vecEff;
14501504
1451- // Calculates the uncorrected Nch multiplicity
1505+ // Calculates the uncorrected Nch
14521506 for (const auto & track : tracks) {
14531507 // Track Selection
14541508 if (!track.isGlobalTrack ()) {
@@ -1482,10 +1536,10 @@ struct UccZdc {
14821536 continue ;
14831537 }
14841538
1485- float pt{track.pt ()};
1539+ const float pt{track.pt ()};
14861540 double fdValue{1 .};
1487- int foundPtBin{cfg.hEfficiency ->GetYaxis ()->FindBin (pt)};
1488- double effValue{cfg.hEfficiency ->GetBinContent (foundNchBin, foundPtBin)};
1541+ const int foundPtBin{cfg.hEfficiency ->GetYaxis ()->FindBin (pt)};
1542+ const double effValue{cfg.hEfficiency ->GetBinContent (foundNchBin, foundPtBin)};
14891543
14901544 if (applyFD)
14911545 fdValue = cfg.hFeedDown ->GetBinContent (foundNchBin, foundPtBin);
@@ -1516,10 +1570,10 @@ struct UccZdc {
15161570 continue ;
15171571 }
15181572
1519- float pt{track.pt ()};
1573+ const float pt{track.pt ()};
15201574 double fdValue{1 .};
1521- int foundPtBin{cfg.hEfficiency ->GetYaxis ()->FindBin (pt)};
1522- double effValue{cfg.hEfficiency ->GetBinContent (foundNchBin, foundPtBin)};
1575+ const int foundPtBin{cfg.hEfficiency ->GetYaxis ()->FindBin (pt)};
1576+ const double effValue{cfg.hEfficiency ->GetBinContent (foundNchBin, foundPtBin)};
15231577
15241578 if (applyFD)
15251579 fdValue = cfg.hFeedDown ->GetBinContent (foundNchBin, foundPtBin);
@@ -1729,8 +1783,6 @@ struct UccZdc {
17291783
17301784 void loadCorrections (uint64_t timeStamp)
17311785 {
1732- // if (cfg.correctionsLoaded) return;
1733-
17341786 if (paTHEff.value .empty () == false ) {
17351787 cfg.hEfficiency = ccdb->getForTimeStamp <TH2F>(paTHEff, timeStamp);
17361788 if (cfg.hEfficiency == nullptr ) {
0 commit comments