@@ -60,6 +60,7 @@ struct UpcCandProducer {
6060 Produces<o2::aod::UDCollisionsSels> eventCandidatesSels;
6161 Produces<o2::aod::UDCollisionsSelsCent> eventCandidatesSelsCent;
6262 Produces<o2::aod::UDCollisionsSelsFwd> eventCandidatesSelsFwd;
63+ Produces<o2::aod::UDCollisionSelExtras> eventCandidatesSelExtras;
6364
6465 Produces<o2::aod::UDZdcsReduced> udZdcsReduced;
6566
@@ -1240,7 +1241,7 @@ struct UpcCandProducer {
12401241 TBCs const & bcs,
12411242 o2::aod::Collisions const & collisions,
12421243 o2::aod::FT0s const & ft0s,
1243- o2::aod::FDDs const & /* fdds*/ ,
1244+ o2::aod::FDDs const & fdds,
12441245 o2::aod::FV0As const & fv0as,
12451246 o2::aod::Zdcs const & zdcs,
12461247 const o2::aod::McFwdTrackLabels* mcFwdTrackLabels)
@@ -1304,10 +1305,29 @@ struct UpcCandProducer {
13041305 mapGlobalBcWithZdc[globalBC] = zdc.globalIndex ();
13051306 }
13061307
1308+ std::map<uint64_t , int32_t > mapGlobalBcWithFDD{};
1309+ uint8_t twoLayersA = 0 ;
1310+ uint8_t twoLayersC = 0 ;
1311+ for (const auto & fdd : fdds) {
1312+ // get signal coincidence
1313+ for (int i = 0 ; i < 4 ; i++) {
1314+ if (fdd.chargeA ()[i + 4 ] > 0 && fdd.chargeA ()[i] > 0 )
1315+ twoLayersA++;
1316+ if (fdd.chargeC ()[i + 4 ] > 0 && fdd.chargeC ()[i] > 0 )
1317+ twoLayersC++;
1318+ }
1319+ // if no signal, continue
1320+ if ((twoLayersA == 0 ) && (twoLayersC == 0 ))
1321+ continue ;
1322+ uint64_t globalBC = fdd.bc_as <TBCs>().globalBC ();
1323+ mapGlobalBcWithFDD[globalBC] = fdd.globalIndex ();
1324+ }
1325+
13071326 auto nFT0s = mapGlobalBcWithT0A.size ();
13081327 auto nFV0As = mapGlobalBcWithV0A.size ();
13091328 auto nZdcs = mapGlobalBcWithZdc.size ();
13101329 auto nBcsWithMCH = bcsMatchedTrIdsMCH.size ();
1330+ auto nFDDs = mapGlobalBcWithFDD.size ();
13111331
13121332 // todo: calculate position of UD collision?
13131333 float dummyX = 0 .;
@@ -1356,6 +1376,8 @@ struct UpcCandProducer {
13561376 std::vector<float > amplitudesV0A{};
13571377 std::vector<int8_t > relBCsT0A{};
13581378 std::vector<int8_t > relBCsV0A{};
1379+ uint8_t chFT0A = 0 ;
1380+ uint8_t chFT0C = 0 ;
13591381 if (nFT0s > 0 ) {
13601382 uint64_t closestBcT0A = findClosestBC (globalBC, mapGlobalBcWithT0A);
13611383 int64_t distClosestBcT0A = globalBC - static_cast <int64_t >(closestBcT0A);
@@ -1370,8 +1392,11 @@ struct UpcCandProducer {
13701392 const auto & t0AmpsC = ft0.amplitudeC ();
13711393 fitInfo.ampFT0A = std::accumulate (t0AmpsA.begin (), t0AmpsA.end (), 0 .f );
13721394 fitInfo.ampFT0C = std::accumulate (t0AmpsC.begin (), t0AmpsC.end (), 0 .f );
1395+ chFT0A = ft0.amplitudeA ().size ();
1396+ chFT0C = ft0.amplitudeC ().size ();
13731397 fillAmplitudes (ft0s, mapGlobalBcWithT0A, amplitudesT0A, relBCsT0A, globalBC);
13741398 }
1399+ uint8_t chFV0A = 0 ;
13751400 if (nFV0As > 0 ) {
13761401 uint64_t closestBcV0A = findClosestBC (globalBC, mapGlobalBcWithV0A);
13771402 int64_t distClosestBcV0A = globalBC - static_cast <int64_t >(closestBcV0A);
@@ -1383,8 +1408,32 @@ struct UpcCandProducer {
13831408 fitInfo.timeFV0A = fv0a.time ();
13841409 const auto & v0Amps = fv0a.amplitude ();
13851410 fitInfo.ampFV0A = std::accumulate (v0Amps.begin (), v0Amps.end (), 0 .f );
1411+ chFV0A = fv0a.amplitude ().size ();
13861412 fillAmplitudes (fv0as, mapGlobalBcWithV0A, amplitudesV0A, relBCsV0A, globalBC);
13871413 }
1414+ uint8_t chFDDA = 0 ;
1415+ uint8_t chFDDC = 0 ;
1416+ if (nFDDs > 0 ) {
1417+ uint64_t closestBcFDD = findClosestBC (globalBC, mapGlobalBcWithFDD);
1418+ auto fddId = mapGlobalBcWithFDD.at (closestBcFDD);
1419+ auto fdd = fdds.iteratorAt (fddId);
1420+ fitInfo.timeFDDA = fdd.timeA ();
1421+ fitInfo.timeFDDC = fdd.timeC ();
1422+ fitInfo.ampFDDA = 0 ;
1423+ for (int i = 0 ; i < 8 ; i++)
1424+ fitInfo.ampFDDA += fdd.chargeA ()[i];
1425+ fitInfo.ampFDDC = 0 ;
1426+ for (int i = 0 ; i < 8 ; i++)
1427+ fitInfo.ampFDDC += fdd.chargeC ()[i];
1428+ fitInfo.triggerMaskFDD = fdd.triggerMask ();
1429+ // get signal coincidence
1430+ for (int i = 0 ; i < 4 ; i++) {
1431+ if (fdd.chargeA ()[i + 4 ] > 0 && fdd.chargeA ()[i] > 0 )
1432+ chFDDA++;
1433+ if (fdd.chargeC ()[i + 4 ] > 0 && fdd.chargeC ()[i] > 0 )
1434+ chFDDC++;
1435+ }
1436+ }
13881437 if (nZdcs > 0 ) {
13891438 auto itZDC = mapGlobalBcWithZdc.find (globalBC);
13901439 if (itZDC != mapGlobalBcWithZdc.end ()) {
@@ -1417,6 +1466,7 @@ struct UpcCandProducer {
14171466 fitInfo.BBFT0Apf , fitInfo.BBFT0Cpf , fitInfo.BGFT0Apf , fitInfo.BGFT0Cpf ,
14181467 fitInfo.BBFV0Apf , fitInfo.BGFV0Apf ,
14191468 fitInfo.BBFDDApf , fitInfo.BBFDDCpf , fitInfo.BGFDDApf , fitInfo.BGFDDCpf );
1469+ eventCandidatesSelExtras (chFT0A, chFT0C, chFDDA, chFDDC, chFV0A);
14201470 eventCandidatesSelsFwd (fitInfo.distClosestBcV0A ,
14211471 fitInfo.distClosestBcT0A ,
14221472 amplitudesT0A,
@@ -1435,6 +1485,7 @@ struct UpcCandProducer {
14351485 bcsMatchedTrIdsMCH.clear ();
14361486 mapGlobalBcWithT0A.clear ();
14371487 mapGlobalBcWithV0A.clear ();
1488+ mapGlobalBcWithFDD.clear ();
14381489 }
14391490
14401491 template <typename TBCs>
@@ -1444,7 +1495,7 @@ struct UpcCandProducer {
14441495 TBCs const & bcs,
14451496 o2::aod::Collisions const & collisions,
14461497 o2::aod::FT0s const & ft0s,
1447- o2::aod::FDDs const & /* fdds*/ ,
1498+ o2::aod::FDDs const & fdds,
14481499 o2::aod::FV0As const & fv0as,
14491500 o2::aod::Zdcs const & zdcs,
14501501 const o2::aod::McFwdTrackLabels* mcFwdTrackLabels)
@@ -1517,10 +1568,29 @@ struct UpcCandProducer {
15171568 mapGlobalBcWithZdc[globalBC] = zdc.globalIndex ();
15181569 }
15191570
1571+ std::map<uint64_t , int32_t > mapGlobalBcWithFDD{};
1572+ uint8_t twoLayersA = 0 ;
1573+ uint8_t twoLayersC = 0 ;
1574+ for (const auto & fdd : fdds) {
1575+ // get signal coincidence
1576+ for (int i = 0 ; i < 4 ; i++) {
1577+ if (fdd.chargeA ()[i + 4 ] > 0 && fdd.chargeA ()[i] > 0 )
1578+ twoLayersA++;
1579+ if (fdd.chargeC ()[i + 4 ] > 0 && fdd.chargeC ()[i] > 0 )
1580+ twoLayersC++;
1581+ }
1582+ // if no signal, continue
1583+ if ((twoLayersA == 0 ) && (twoLayersC == 0 ))
1584+ continue ;
1585+ uint64_t globalBC = fdd.bc_as <TBCs>().globalBC ();
1586+ mapGlobalBcWithFDD[globalBC] = fdd.globalIndex ();
1587+ }
1588+
15201589 auto nFT0s = mapGlobalBcWithT0A.size ();
15211590 auto nFV0As = mapGlobalBcWithV0A.size ();
15221591 auto nZdcs = mapGlobalBcWithZdc.size ();
15231592 auto nBcsWithMID = bcsMatchedTrIdsMID.size ();
1593+ auto nFDDs = mapGlobalBcWithFDD.size ();
15241594
15251595 // todo: calculate position of UD collision?
15261596 float dummyX = 0 .;
@@ -1566,6 +1636,8 @@ struct UpcCandProducer {
15661636 std::vector<float > amplitudesV0A{};
15671637 std::vector<int8_t > relBCsT0A{};
15681638 std::vector<int8_t > relBCsV0A{};
1639+ uint8_t chFT0A = 0 ;
1640+ uint8_t chFT0C = 0 ;
15691641 if (nFT0s > 0 ) {
15701642 uint64_t closestBcT0A = findClosestBC (globalBC, mapGlobalBcWithT0A);
15711643 int64_t distClosestBcT0A = globalBC - static_cast <int64_t >(closestBcT0A);
@@ -1580,8 +1652,11 @@ struct UpcCandProducer {
15801652 const auto & t0AmpsC = ft0.amplitudeC ();
15811653 fitInfo.ampFT0A = std::accumulate (t0AmpsA.begin (), t0AmpsA.end (), 0 .f );
15821654 fitInfo.ampFT0C = std::accumulate (t0AmpsC.begin (), t0AmpsC.end (), 0 .f );
1655+ chFT0A = ft0.amplitudeA ().size ();
1656+ chFT0C = ft0.amplitudeC ().size ();
15831657 fillAmplitudes (ft0s, mapGlobalBcWithT0A, amplitudesT0A, relBCsT0A, globalBC);
15841658 }
1659+ uint8_t chFV0A = 0 ;
15851660 if (nFV0As > 0 ) {
15861661 uint64_t closestBcV0A = findClosestBC (globalBC, mapGlobalBcWithV0A);
15871662 int64_t distClosestBcV0A = globalBC - static_cast <int64_t >(closestBcV0A);
@@ -1593,8 +1668,32 @@ struct UpcCandProducer {
15931668 fitInfo.timeFV0A = fv0a.time ();
15941669 const auto & v0Amps = fv0a.amplitude ();
15951670 fitInfo.ampFV0A = std::accumulate (v0Amps.begin (), v0Amps.end (), 0 .f );
1671+ chFV0A = fv0a.amplitude ().size ();
15961672 fillAmplitudes (fv0as, mapGlobalBcWithV0A, amplitudesV0A, relBCsV0A, globalBC);
15971673 }
1674+ uint8_t chFDDA = 0 ;
1675+ uint8_t chFDDC = 0 ;
1676+ if (nFDDs > 0 ) {
1677+ uint64_t closestBcFDD = findClosestBC (globalBC, mapGlobalBcWithFDD);
1678+ auto fddId = mapGlobalBcWithFDD.at (closestBcFDD);
1679+ auto fdd = fdds.iteratorAt (fddId);
1680+ fitInfo.timeFDDA = fdd.timeA ();
1681+ fitInfo.timeFDDC = fdd.timeC ();
1682+ fitInfo.ampFDDA = 0 ;
1683+ for (int i = 0 ; i < 8 ; i++)
1684+ fitInfo.ampFDDA += fdd.chargeA ()[i];
1685+ fitInfo.ampFDDC = 0 ;
1686+ for (int i = 0 ; i < 8 ; i++)
1687+ fitInfo.ampFDDC += fdd.chargeC ()[i];
1688+ fitInfo.triggerMaskFDD = fdd.triggerMask ();
1689+ // get signal coincidence
1690+ for (int i = 0 ; i < 4 ; i++) {
1691+ if (fdd.chargeA ()[i + 4 ] > 0 && fdd.chargeA ()[i] > 0 )
1692+ chFDDA++;
1693+ if (fdd.chargeC ()[i + 4 ] > 0 && fdd.chargeC ()[i] > 0 )
1694+ chFDDC++;
1695+ }
1696+ }
15981697 if (nZdcs > 0 ) {
15991698 auto itZDC = mapGlobalBcWithZdc.find (globalBC);
16001699 if (itZDC != mapGlobalBcWithZdc.end ()) {
@@ -1627,6 +1726,7 @@ struct UpcCandProducer {
16271726 fitInfo.BBFT0Apf , fitInfo.BBFT0Cpf , fitInfo.BGFT0Apf , fitInfo.BGFT0Cpf ,
16281727 fitInfo.BBFV0Apf , fitInfo.BGFV0Apf ,
16291728 fitInfo.BBFDDApf , fitInfo.BBFDDCpf , fitInfo.BGFDDApf , fitInfo.BGFDDCpf );
1729+ eventCandidatesSelExtras (chFT0A, chFT0C, chFDDA, chFDDC, chFV0A);
16301730 eventCandidatesSelsFwd (fitInfo.distClosestBcV0A ,
16311731 fitInfo.distClosestBcT0A ,
16321732 amplitudesT0A,
@@ -1645,6 +1745,7 @@ struct UpcCandProducer {
16451745 bcsMatchedTrIdsGlobal.clear ();
16461746 mapGlobalBcWithT0A.clear ();
16471747 mapGlobalBcWithV0A.clear ();
1748+ mapGlobalBcWithFDD.clear ();
16481749 }
16491750
16501751 // data processors
0 commit comments