@@ -215,9 +215,8 @@ struct decay3bodyBuilder {
215215 HistogramRegistry registry{" registry" , {}};
216216
217217 // hypothesis
218- Configurable<int > motherhyp{" motherhyp" , 0 , " hypothesis of the 3body decayed particle" }; // corresponds to hyp3body
219- int bachelorcharge = 1 ; // to be updated in Init base on the hypothesis
220- // o2::aod::pidtofgeneric::TofPidNewCollision<ColwithEvTimes::iterator, TrackExtPIDIUwithEvTimes::iterator> bachelorTOFPID; // to be updated in Init base on the hypothesis
218+ Configurable<int > motherhyp{" motherhyp" , 0 , " hypothesis of the 3body decayed particle" }; // corresponds to hyp3body
219+ int bachelorcharge = 1 ; // to be updated in Init base on the hypothesis
221220 o2::aod::pidtofgeneric::TofPidNewCollision<TrackExtPIDIUwithEvTimes::iterator> bachelorTOFPID; // to be updated in Init base on the hypothesis
222221
223222 // Selection criteria
@@ -316,7 +315,6 @@ struct decay3bodyBuilder {
316315 Configurable<float > emTpcPidNsigmaCut{" emTpcPidNsigmaCut" , 5 , " emTpcPidNsigmaCut" };
317316 } EMTrackSel;
318317
319- Preslice<TrackExtPIDIUwithEvTimes> tracksperCol = aod::track::collisionId;
320318 SliceCache cache;
321319 ConfigurableAxis axisPosZ{" axisPosZ" , {40 , -10 , 10 }, " Mixing bins - posZ" };
322320 ConfigurableAxis axisCentrality{" axisCentrality" , {10 , 0 , 100 }, " Mixing bins - centrality" };
@@ -403,7 +401,7 @@ struct decay3bodyBuilder {
403401 fitter3body.setMatCorrType (matCorr);
404402
405403 // Add histograms separately for different process functions
406- if (doprocessRun3 == true || doprocessRun3Reduced || doprocessRun3EM == true || doprocessRun3EMLikeSign == true ) {
404+ if (doprocessRun3 == true || doprocessRun3Reduced || doprocessRun3ReducedEM == true ) {
407405 registry.add (" hEventCounter" , " hEventCounter" , HistType::kTH1F , {{1 , 0 .0f , 1 .0f }});
408406 auto hVtx3BodyCounter = registry.add <TH1>(" hVtx3BodyCounter" , " hVtx3BodyCounter" , HistType::kTH1F , {{6 , 0 .0f , 6 .0f }});
409407 hVtx3BodyCounter->GetXaxis ()->SetBinLabel (1 , " Total" );
@@ -1478,30 +1476,28 @@ struct decay3bodyBuilder {
14781476 } // end buildVtx3BodyDataTableKFParticle
14791477
14801478 // ------------------------------------------------------------------
1481- void processRun3 (ColwithEvTimes const & collisions, TrackExtPIDIUwithEvTimes const & /* tracksIU */ , aod::Decay3Bodys const & decay3bodys, aod::BCsWithTimestamps const &)
1479+ void processRun3 (ColwithEvTimes const & collisions, aod::Decay3Bodys const & decay3bodys, TrackExtPIDIUwithEvTimes const & , aod::BCsWithTimestamps const &)
14821480 {
14831481 vtxCandidates.clear ();
14841482
1485- for (const auto & collision : collisions) {
1483+ registry.fill (HIST (" hEventCounter" ), 0.5 , collisions.size ());
1484+
1485+ for (const auto & d3body : decay3bodys) {
1486+ auto t0 = d3body.track0_as <TrackExtPIDIUwithEvTimes>();
1487+ auto t1 = d3body.track1_as <TrackExtPIDIUwithEvTimes>();
1488+ auto t2 = d3body.track2_as <TrackExtPIDIUwithEvTimes>();
1489+ auto collision = d3body.collision_as <ColwithEvTimes>();
14861490 auto bc = collision.bc_as <aod::BCsWithTimestamps>();
14871491 initCCDB (bc);
1488- registry.fill (HIST (" hEventCounter" ), 0.5 );
1489-
1490- const auto & d3bodys_thisCollision = decay3bodys.sliceBy (perCollision, collision.globalIndex ());
1491- for (const auto & d3body : d3bodys_thisCollision) {
1492- auto t0 = d3body.template track0_as <TrackExtPIDIUwithEvTimes>();
1493- auto t1 = d3body.template track1_as <TrackExtPIDIUwithEvTimes>();
1494- auto t2 = d3body.template track2_as <TrackExtPIDIUwithEvTimes>();
1495-
1496- // Recalculate the TOF PID
1497- double tofNSigmaBach = -999 ;
1498- if (t2.has_collision () && t2.hasTOF ()) {
1499- auto originalcol = t2.template collision_as <ColwithEvTimes>();
1500- tofNSigmaBach = bachelorTOFPID.GetTOFNSigma (t2, originalcol, collision);
1501- }
15021492
1503- fillVtxCand<ColwithEvTimes>(collision, t0, t1, t2, d3body.globalIndex (), bachelorcharge, tofNSigmaBach);
1493+ // Recalculate the TOF PID
1494+ double tofNSigmaBach = -999 ;
1495+ if (t2.has_collision () && t2.hasTOF ()) {
1496+ auto originalcol = t2.template collision_as <ColwithEvTimes>();
1497+ tofNSigmaBach = bachelorTOFPID.GetTOFNSigma (t2, originalcol, collision);
15041498 }
1499+
1500+ fillVtxCand<ColwithEvTimes>(collision, t0, t1, t2, d3body.globalIndex (), bachelorcharge, tofNSigmaBach);
15051501 }
15061502
15071503 for (const auto & candVtx : vtxCandidates) {
@@ -1511,7 +1507,7 @@ struct decay3bodyBuilder {
15111507 PROCESS_SWITCH (decay3bodyBuilder, processRun3, " Produce DCA fitter decay3body tables" , true );
15121508
15131509 // ------------------------------------------------------------------
1514- void processRun3Reduced (aod::ReducedCollisions const & collisions, aod::ReducedTracksIU const &, aod:: ReducedDecay3Bodys const & decay3bodys, aod::BCsWithTimestamps const &)
1510+ void processRun3Reduced (aod::ReducedCollisions const & collisions, aod::ReducedDecay3Bodys const & decay3bodys, aod::ReducedTracksIU const &)
15151511 {
15161512 vtxCandidates.clear ();
15171513
@@ -1520,13 +1516,10 @@ struct decay3bodyBuilder {
15201516 int lastRunNumber = -1 ;
15211517
15221518 for (const auto & d3body : decay3bodys) {
1523- auto t0 = d3body.template track0_as <aod::ReducedTracksIU>();
1524- auto t1 = d3body.template track1_as <aod::ReducedTracksIU>();
1525- auto t2 = d3body.template track2_as <aod::ReducedTracksIU>();
1526- auto collision = d3body.template collision_as <aod::ReducedCollisions>();
1527- // auto bc = collision.bc_as<aod::BCsWithTimestamps>();
1528- // initCCDB(bc);
1529- // set magnetic field only when run number changes
1519+ auto t0 = d3body.track0_as <aod::ReducedTracksIU>();
1520+ auto t1 = d3body.track1_as <aod::ReducedTracksIU>();
1521+ auto t2 = d3body.track2_as <aod::ReducedTracksIU>();
1522+ auto collision = d3body.collision_as <aod::ReducedCollisions>();
15301523 if (collision.runNumber () != lastRunNumber) {
15311524 initCCDBReduced (collision.runNumber ());
15321525 lastRunNumber = collision.runNumber (); // Update the last run number
@@ -1543,106 +1536,37 @@ struct decay3bodyBuilder {
15431536
15441537 // ------------------------------------------------------------------
15451538 // Event-mixing background
1546- void processRun3EM (FullCols const & collisions, TrackExtPIDIUwithEvTimes const & tracksIU , aod::BCsWithTimestamps const &)
1539+ void processRun3ReducedEM (ReducedCollisionsMultsCents const &, aod::ReducedDecay3Bodys const &, aod::ReducedTracksIU const &)
15471540 {
1548-
15491541 vtxCandidates.clear ();
15501542
1551- auto tracksTuple = std::make_tuple (tracksIU);
15521543 BinningType binningEvent{{axisPosZ, axisCentrality}, true };
1553- SameKindPair<FullCols, TrackExtPIDIUwithEvTimes, BinningType> pair{binningEvent, EMTrackSel.nUseMixedEvent , -1 , collisions, tracksTuple, &cache};
1554-
1555- Partition<TrackExtPIDIUwithEvTimes> candProtons = aod::track::signed1Pt > 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minProtonPt && aod::track::pt <= EMTrackSel.maxProtonPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClsproton && nabs (aod::pidtpc::tpcNSigmaPr) <= EMTrackSel.emTpcPidNsigmaCut ;
1556- Partition<TrackExtPIDIUwithEvTimes> candAntiProtons = aod::track::signed1Pt < 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minProtonPt && aod::track::pt <= EMTrackSel.maxProtonPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClsproton && nabs (aod::pidtpc::tpcNSigmaPr) <= EMTrackSel.emTpcPidNsigmaCut ;
1557- Partition<TrackExtPIDIUwithEvTimes> candPionPlus = aod::track::signed1Pt > 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minPionPt && aod::track::pt <= EMTrackSel.maxPionPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClspion && nabs (aod::pidtpc::tpcNSigmaPi) <= EMTrackSel.emTpcPidNsigmaCut ;
1558- Partition<TrackExtPIDIUwithEvTimes> candPionMinus = aod::track::signed1Pt < 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minPionPt && aod::track::pt <= EMTrackSel.maxPionPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClspion && nabs (aod::pidtpc::tpcNSigmaPi) <= EMTrackSel.emTpcPidNsigmaCut ;
1559- Partition<TrackExtPIDIUwithEvTimes> candBachelors = aod::track::signed1Pt > 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minDeuteronPt && aod::track::pt <= EMTrackSel.maxDeuteronPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClsbachelor && nabs (aod::pidtpc::tpcNSigmaDe) <= EMTrackSel.emTpcPidNsigmaCut ;
1560- Partition<TrackExtPIDIUwithEvTimes> candAntiBachelors = aod::track::signed1Pt < 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minDeuteronPt && aod::track::pt <= EMTrackSel.maxDeuteronPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClsbachelor && nabs (aod::pidtpc::tpcNSigmaDe) <= EMTrackSel.emTpcPidNsigmaCut ;
1561- candProtons.bindTable (tracksIU);
1562- candPionPlus.bindTable (tracksIU);
1563- candAntiProtons.bindTable (tracksIU);
1564- candPionMinus.bindTable (tracksIU);
1565- candBachelors.bindTable (tracksIU);
1566- candAntiBachelors.bindTable (tracksIU);
1567-
1568- for (const auto & [c1, tracks1, c2, tracks2] : pair) {
1569- if (EMTrackSel.em_event_sel8_selection && (!c1.sel8 () || !c2.sel8 ())) {
1570- continue ;
1571- }
1572- auto bc = c1.bc_as <aod::BCsWithTimestamps>();
1573- initCCDB (bc);
1574- auto protons = candProtons->sliceByCached (aod::track::collisionId, c1.globalIndex (), cache);
1575- auto pionsplus = candPionPlus->sliceByCached (aod::track::collisionId, c1.globalIndex (), cache);
1576- auto antiprotons = candAntiProtons->sliceByCached (aod::track::collisionId, c1.globalIndex (), cache);
1577- auto pionsminus = candPionMinus->sliceByCached (aod::track::collisionId, c1.globalIndex (), cache);
1578- auto bachelors = candBachelors->sliceByCached (aod::track::collisionId, c2.globalIndex (), cache);
1579- auto antibachelors = candAntiBachelors->sliceByCached (aod::track::collisionId, c2.globalIndex (), cache);
1580-
1581- for (auto const & [tpos, tneg, tbach] : o2::soa::combinations (o2::soa::CombinationsFullIndexPolicy (protons, pionsminus, bachelors))) {
1582- double tofNSigmaBach = bachelorTOFPID.GetTOFNSigma (tbach); // Recalculate the TOF PID
1583- fillVtxCand<FullCols>(c1, tpos, tneg, tbach, -1 , bachelorcharge, tofNSigmaBach);
1584- }
1585- for (auto const & [tpos, tneg, tbach] : o2::soa::combinations (o2::soa::CombinationsFullIndexPolicy (pionsplus, antiprotons, antibachelors))) {
1586- double tofNSigmaBach = bachelorTOFPID.GetTOFNSigma (tbach); // Recalculate the TOF PID
1587- fillVtxCand<FullCols>(c1, tpos, tneg, tbach, -1 , bachelorcharge, tofNSigmaBach);
1588- }
1589- }
1590-
1591- // Aviod break of preslice in following workflow
1592- std::sort (vtxCandidates.begin (), vtxCandidates.end (), [](const vtxCandidate a, const vtxCandidate b) {
1593- return a.collisionId < b.collisionId ;
1594- });
1544+ SameKindPair<ReducedCollisionsMultsCents, aod::ReducedDecay3Bodys, BinningType> pair{binningEvent, EMTrackSel.nUseMixedEvent , -1 , &cache};
15951545
1596- for (const auto & candVtx : vtxCandidates) {
1597- fillVtx3BodyTable (candVtx);
1598- }
1599- }
1600- PROCESS_SWITCH (decay3bodyBuilder, processRun3EM, " Produce event-mix background" , false );
1601-
1602- // ------------------------------------------------------------------
1603- // Event-mixing background + like-sign (to aviod deuteron with wrong collisionId)
1604- void processRun3EMLikeSign (FullCols const & collisions, TrackExtPIDIUwithEvTimes const & tracksIU, aod::BCsWithTimestamps const &)
1605- {
1546+ int lastRunNumber = -1 ;
16061547
1607- vtxCandidates.clear ();
1548+ for (const auto & [c0, decay3bodys0, c1, decay3bodys1] : pair) {
1549+ for (auto & [d3body0, d3body1] : combinations (soa::CombinationsFullIndexPolicy (decay3bodys0, decay3bodys1))) {
1550+ auto tpos0 = d3body0.track0_as <aod::ReducedTracksIU>();
1551+ auto tneg0 = d3body0.track1_as <aod::ReducedTracksIU>();
1552+ auto tbach0 = d3body0.track2_as <aod::ReducedTracksIU>();
1553+ auto tpos1 = d3body1.track0_as <aod::ReducedTracksIU>();
1554+ auto tneg1 = d3body1.track1_as <aod::ReducedTracksIU>();
1555+ auto tbach1 = d3body1.track2_as <aod::ReducedTracksIU>();
1556+
1557+ if (c0.runNumber () != lastRunNumber) {
1558+ initCCDBReduced (c0.runNumber ());
1559+ lastRunNumber = c0.runNumber (); // Update the last run number
1560+ LOG (debug) << " CCDB initialized for run " << lastRunNumber;
1561+ }
1562+ fillVtxCand<FullCols>(c0, tpos0, tneg0, tbach1, -1 , bachelorcharge, tbach1.tofNSigmaDe ());
16081563
1609- auto tracksTuple = std::make_tuple (tracksIU);
1610- BinningType binningEvent{{axisPosZ, axisCentrality}, true };
1611- SameKindPair<FullCols, TrackExtPIDIUwithEvTimes, BinningType> pair{binningEvent, 5 , -1 , collisions, tracksTuple, &cache};
1612-
1613- Partition<TrackExtPIDIUwithEvTimes> candProtons = aod::track::signed1Pt > 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minProtonPt && aod::track::pt <= EMTrackSel.maxProtonPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClsproton && nabs (aod::pidtpc::tpcNSigmaPr) <= EMTrackSel.emTpcPidNsigmaCut ;
1614- Partition<TrackExtPIDIUwithEvTimes> candPionPlus = aod::track::signed1Pt > 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minPionPt && aod::track::pt <= EMTrackSel.maxPionPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClspion && nabs (aod::pidtpc::tpcNSigmaPi) <= EMTrackSel.emTpcPidNsigmaCut ;
1615- Partition<TrackExtPIDIUwithEvTimes> candAntiProtons = aod::track::signed1Pt < 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minProtonPt && aod::track::pt <= EMTrackSel.maxProtonPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClsproton && nabs (aod::pidtpc::tpcNSigmaPr) <= EMTrackSel.emTpcPidNsigmaCut ;
1616- Partition<TrackExtPIDIUwithEvTimes> candPionMinus = aod::track::signed1Pt < 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minPionPt && aod::track::pt <= EMTrackSel.maxPionPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClspion && nabs (aod::pidtpc::tpcNSigmaPi) <= EMTrackSel.emTpcPidNsigmaCut ;
1617- Partition<TrackExtPIDIUwithEvTimes> candBachelors = aod::track::signed1Pt > 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minDeuteronPt && aod::track::pt <= EMTrackSel.maxDeuteronPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClsbachelor && nabs (aod::pidtpc::tpcNSigmaDe) <= EMTrackSel.emTpcPidNsigmaCut ;
1618- Partition<TrackExtPIDIUwithEvTimes> candAntiBachelors = aod::track::signed1Pt < 0 .f && nabs (aod::track::eta) <= EMTrackSel.etacut && aod::track::pt >= EMTrackSel.minDeuteronPt && aod::track::pt <= EMTrackSel.maxDeuteronPt && aod::track::tpcNClsFindable >= (uint8_t )EMTrackSel.mintpcNClsbachelor && nabs (aod::pidtpc::tpcNSigmaDe) <= EMTrackSel.emTpcPidNsigmaCut ;
1619- candProtons.bindTable (tracksIU);
1620- candPionPlus.bindTable (tracksIU);
1621- candAntiProtons.bindTable (tracksIU);
1622- candPionMinus.bindTable (tracksIU);
1623- candBachelors.bindTable (tracksIU);
1624- candAntiBachelors.bindTable (tracksIU);
1625-
1626- for (const auto & [c1, tracks1, c2, tracks2] : pair) {
1627- if (EMTrackSel.em_event_sel8_selection && (!c1.sel8 () || !c2.sel8 ())) {
1628- continue ;
1629- }
1630- auto bc = c1.bc_as <aod::BCsWithTimestamps>();
1631- initCCDB (bc);
1632- auto protons = candProtons->sliceByCached (aod::track::collisionId, c1.globalIndex (), cache);
1633- auto pionsplus = candPionPlus->sliceByCached (aod::track::collisionId, c1.globalIndex (), cache);
1634- auto antiprotons = candAntiProtons->sliceByCached (aod::track::collisionId, c1.globalIndex (), cache);
1635- auto pionsminus = candPionMinus->sliceByCached (aod::track::collisionId, c1.globalIndex (), cache);
1636- auto bachelors = candBachelors->sliceByCached (aod::track::collisionId, c2.globalIndex (), cache);
1637- auto antibachelors = candAntiBachelors->sliceByCached (aod::track::collisionId, c2.globalIndex (), cache);
1638-
1639- for (auto const & [tpos, tneg, tbach] : o2::soa::combinations (o2::soa::CombinationsFullIndexPolicy (protons, pionsminus, antibachelors))) {
1640- double tofNSigmaBach = bachelorTOFPID.GetTOFNSigma (tbach); // Recalculate the TOF PID
1641- fillVtxCand<FullCols>(c1, tpos, tneg, tbach, -1 , bachelorcharge, tofNSigmaBach);
1642- }
1643- for (auto const & [tpos, tneg, tbach] : o2::soa::combinations (o2::soa::CombinationsFullIndexPolicy (pionsplus, antiprotons, bachelors))) {
1644- double tofNSigmaBach = bachelorTOFPID.GetTOFNSigma (tbach); // Recalculate the TOF PID
1645- fillVtxCand<FullCols>(c1, tpos, tneg, tbach, -1 , bachelorcharge, tofNSigmaBach);
1564+ if (c1.runNumber () != lastRunNumber) {
1565+ initCCDBReduced (c1.runNumber ());
1566+ lastRunNumber = c1.runNumber (); // Update the last run number
1567+ LOG (debug) << " CCDB initialized for run " << lastRunNumber;
1568+ }
1569+ fillVtxCand<FullCols>(c1, tpos1, tneg1, tbach0, -1 , bachelorcharge, tbach0.tofNSigmaDe ());
16461570 }
16471571 }
16481572
@@ -1655,7 +1579,8 @@ struct decay3bodyBuilder {
16551579 fillVtx3BodyTable (candVtx);
16561580 }
16571581 }
1658- PROCESS_SWITCH (decay3bodyBuilder, processRun3EMLikeSign, " Produce event-mix background with like-sign method" , false );
1582+ PROCESS_SWITCH (decay3bodyBuilder, processRun3ReducedEM, " Produce event-mix background" , false );
1583+
16591584 // ------------------------------------------------------------------
16601585
16611586 void processRun3withKFParticle (ColwithEvTimes const & collisions, TrackExtPIDIUwithEvTimes const &, aod::Decay3Bodys const & decay3bodys, aod::BCsWithTimestamps const &)
@@ -2014,10 +1939,10 @@ struct decay3bodyLabelBuilder {
20141939
20151940 Configurable<float > TpcPidNsigmaCut{" TpcPidNsigmaCut" , 5 , " TpcPidNsigmaCut" };
20161941
2017- void processDoNotBuildLabels (aod::Collisions::iterator const &)
1942+ void processDoNotBuildLabels (aod::Decay3BodyDataLink const &) // is it possible to have none parameter?
20181943 {
20191944 // dummy process function - should not be required in the future
2020- }
1945+ };
20211946 PROCESS_SWITCH (decay3bodyLabelBuilder, processDoNotBuildLabels, " Do not produce MC label tables" , true );
20221947
20231948 void processBuildLabels (aod::Decay3BodysLinked const & decay3bodys, aod::Vtx3BodyDatas const & vtx3bodydatas, MCLabeledTracksIU const &, aod::McParticles const &)
0 commit comments