@@ -123,7 +123,6 @@ struct kstarpbpb {
123123 Configurable<bool > fillRotation{" fillRotation" , true , " fill rotation" };
124124 Configurable<bool > same{" same" , true , " same event" };
125125 Configurable<bool > like{" like" , false , " like-sign" };
126- Configurable<bool > mix{" mix" , false , " mix" };
127126 Configurable<bool > fillOccupancy{" fillOccupancy" , false , " fill Occupancy" };
128127 Configurable<int > cfgOccupancyCut{" cfgOccupancyCut" , 500 , " Occupancy cut" };
129128 Configurable<bool > useWeight{" useWeight" , false , " use EP dep effi weight" };
@@ -161,9 +160,9 @@ struct kstarpbpb {
161160 AxisSpec resAxis = {6000 , -30 , 30 , " Res" };
162161 AxisSpec centAxis = {8 , 0 , 80 , " V0M (%)" };
163162 AxisSpec occupancyAxis = {occupancyBinning, " Occupancy" };
164-
165- histos.add (" hSparseV2SASameEvent_V2" , " hSparseV2SASameEvent_V2" , HistType::kTHnSparseF , {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality});
166-
163+ if (same) {
164+ histos.add (" hSparseV2SASameEvent_V2" , " hSparseV2SASameEvent_V2" , HistType::kTHnSparseF , {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality});
165+ }
167166 if (like) {
168167 histos.add (" hSparseV2SAlikeEventNN_V2" , " hSparseV2SAlikeEventNN_V2" , HistType::kTHnSparseF , {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality});
169168 histos.add (" hSparseV2SAlikeEventPP_V2" , " hSparseV2SAlikeEventPP_V2" , HistType::kTHnSparseF , {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality});
@@ -172,9 +171,8 @@ struct kstarpbpb {
172171 histos.add (" hRotation" , " hRotation" , kTH1F , {{360 , 0.0 , 2.0 * TMath::Pi ()}});
173172 histos.add (" hSparseV2SASameEventRotational_V2" , " hSparseV2SASameEventRotational_V2" , HistType::kTHnSparseF , {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality});
174173 }
175- if (mix) {
176- histos.add (" hSparseV2SAMixedEvent_V2" , " hSparseV2SAMixedEvent_V2" , HistType::kTHnSparseF , {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality});
177- }
174+
175+ histos.add (" hSparseV2SAMixedEvent_V2" , " hSparseV2SAMixedEvent_V2" , HistType::kTHnSparseF , {thnAxisInvMass, thnAxisPt, thnAxisV2, thnAxisCentrality});
178176
179177 if (additionalQAplots1) {
180178 histos.add (" hFTOCvsTPCSelected" , " Mult correlation FT0C vs. TPC after selection" , kTH2F , {{80 , 0 .0f , 80 .0f }, {100 , -0 .5f , 5999 .5f }});
@@ -514,6 +512,7 @@ struct kstarpbpb {
514512 if (!track1kaon || !track2pion) {
515513 continue ;
516514 }
515+
517516 if (useWeight) {
518517 if (track2.pt () < 10.0 && track2.pt () > 0.15 ) {
519518 weight2 = hweight->GetBinContent (hweight->FindBin (centrality, GetPhiInRange (track2.phi () - psiFT0C), track2.pt () + 0.000005 ));
@@ -534,11 +533,12 @@ struct kstarpbpb {
534533 if (totalweight <= 0.0005 ) {
535534 totalweight = 1.0 ;
536535 }
537-
538- if (useWeight) {
539- histos.fill (HIST (" hSparseV2SASameEvent_V2" ), KstarMother.M (), KstarMother.Pt (), v2, centrality, 1 / totalweight);
540- } else {
541- histos.fill (HIST (" hSparseV2SASameEvent_V2" ), KstarMother.M (), KstarMother.Pt (), v2, centrality);
536+ if (same) {
537+ if (useWeight) {
538+ histos.fill (HIST (" hSparseV2SASameEvent_V2" ), KstarMother.M (), KstarMother.Pt (), v2, centrality, 1 / totalweight);
539+ } else {
540+ histos.fill (HIST (" hSparseV2SASameEvent_V2" ), KstarMother.M (), KstarMother.Pt (), v2, centrality);
541+ }
542542 }
543543 if (fillRotation) {
544544 for (int nrotbkg = 0 ; nrotbkg < nBkgRotations; nrotbkg++) {
@@ -889,124 +889,65 @@ struct kstarpbpb {
889889 }
890890
891891 PROCESS_SWITCH (kstarpbpb, processlikeEvent, " Process like event" , false );
892- void processMixedEvent (EventCandidates const & collisions, TrackCandidates const & /* tracks*/ )
892+ void processMixedEvent (EventCandidates const & collisions, TrackCandidates const & tracks)
893893 {
894+
895+ auto tracksTuple = std::make_tuple (tracks);
894896 BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicityClass, axisEPAngle}, true };
895- for (auto const & [collision1, collision2] : o2::soa::selfCombinations (binningOnPositions, cfgNoMixedEvents, -1 , collisions, collisions)) {
896- if (!collision1.sel8 () || !collision2.sel8 ()) {
897- // printf("Mix = %d\n", 1);
898- continue ;
899- }
900- if (!collision1.triggereventep () || !collision2.triggereventep ()) {
901- // printf("Mix = %d\n", 2);
897+ SameKindPair<EventCandidates, TrackCandidates, BinningTypeVertexContributor> pair{binningOnPositions, cfgNoMixedEvents, -1 , collisions, tracksTuple, &cache};
898+ for (auto & [collision1, tracks1, collision2, tracks2] : pair) {
899+ if (!collision1.sel8 () || !collision1.triggereventep () || !collision1.selection_bit (aod::evsel::kNoTimeFrameBorder ) || !collision1.selection_bit (aod::evsel::kNoITSROFrameBorder ) || !collision1.selection_bit (aod::evsel::kNoSameBunchPileup ) || !collision1.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV ) || !collision1.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) {
902900 continue ;
903901 }
904- if (timFrameEvsel && (!collision1.selection_bit (aod::evsel::kNoTimeFrameBorder ) || !collision2.selection_bit (aod::evsel::kNoTimeFrameBorder ) || !collision1.selection_bit (aod::evsel::kNoITSROFrameBorder ) || !collision2.selection_bit (aod::evsel::kNoITSROFrameBorder ))) {
905- // printf("Mix = %d\n", 3);
902+ if (!collision2.sel8 () || !collision2.triggereventep () || !collision2.selection_bit (aod::evsel::kNoTimeFrameBorder ) || !collision2.selection_bit (aod::evsel::kNoITSROFrameBorder ) || !collision2.selection_bit (aod::evsel::kNoSameBunchPileup ) || !collision2.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV ) || !collision2.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard )) {
906903 continue ;
907904 }
908- if (additionalEvSel2 && (!collision1.selection_bit (aod::evsel::kNoSameBunchPileup ) || !collision1.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV ))) {
909- continue ;
910- }
911- if (additionalEvSel2 && (!collision2.selection_bit (aod::evsel::kNoSameBunchPileup ) || !collision2.selection_bit (aod::evsel::kIsGoodZvtxFT0vsPV ))) {
912- continue ;
913- }
914- if (additionalEvSel3 && (!collision1.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard ))) {
915- continue ;
916- }
917- if (additionalEvSel3 && (!collision2.selection_bit (o2::aod::evsel::kNoCollInTimeRangeStandard ))) {
918- continue ;
919- }
920- if (additionalEvselITS && !collision1.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
921- continue ;
922- }
923- if (additionalEvselITS && !collision2.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
905+ if (collision1.bcId () == collision2.bcId ()) {
924906 continue ;
925907 }
926908 int occupancy1 = collision1.trackOccupancyInTimeRange ();
927909 int occupancy2 = collision2.trackOccupancyInTimeRange ();
928- auto posThisColl = posTracks->sliceByCached (aod::track::collisionId, collision1.globalIndex (), cache);
929- auto negThisColl = negTracks->sliceByCached (aod::track::collisionId, collision2.globalIndex (), cache);
910+ if (fillOccupancy && occupancy1 >= cfgOccupancyCut && occupancy2 >= cfgOccupancyCut) // occupancy info is available for this collision (*)
911+ {
912+ continue ;
913+ }
930914 auto centrality = collision1.centFT0C ();
931915 auto centrality2 = collision2.centFT0C ();
932916 auto psiFT0C = collision1.psiFT0C ();
933917 auto QFT0C = collision1.qFT0C ();
934- bool track1pion = false ;
935- bool track1kaon = false ;
936- bool track2pion = false ;
937- bool track2kaon = false ;
938918 if (additionalEvsel && !eventSelected (collision1, centrality)) {
939- // printf("Mix = %d\n", 4);
940919 continue ;
941920 }
942921 if (additionalEvsel && !eventSelected (collision2, centrality2)) {
943- // printf("Mix = %d\n", 5);
944922 continue ;
945923 }
946- if (fillOccupancy && occupancy1 >= cfgOccupancyCut && occupancy2 >= cfgOccupancyCut) // occupancy info is available for this collision (*)
947- {
924+ if (additionalEvselITS && !collision1.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
948925 continue ;
949926 }
950- for (auto & [track1, track2] : o2::soa::combinations (o2::soa::CombinationsFullIndexPolicy (posThisColl, negThisColl))) {
927+ if (additionalEvselITS && !collision2.selection_bit (o2::aod::evsel::kIsGoodITSLayersAll )) {
928+ continue ;
929+ }
930+
931+ for (auto & [track1, track2] : o2::soa::combinations (o2::soa::CombinationsFullIndexPolicy (tracks1, tracks2))) {
951932 // track selection
952933 if (!selectionTrack (track1) || !selectionTrack (track2)) {
953934 // printf("Mix = %d\n", 6);
954935 continue ;
955936 }
956- if (ispTdepPID && !(selectionPIDNew (track1, 0 ) || selectionPIDNew (track1, 1 ) )) {
937+ if (ispTdepPID && !(selectionPIDNew (track1, 0 ))) {
957938 continue ;
958939 }
959- if (ispTdepPID && !(selectionPIDNew (track2, 1 ) || selectionPIDNew (track2, 0 ) )) {
940+ if (ispTdepPID && !(selectionPIDNew (track2, 1 ))) {
960941 continue ;
961942 }
962- if (!ispTdepPID && !(selectionPID (track1, 0 ) || selectionPID (track1, 1 ) )) {
943+ if (!ispTdepPID && !(selectionPID (track1, 0 ))) {
963944 continue ;
964945 }
965- if (!ispTdepPID && !(selectionPID (track2, 1 ) || selectionPID (track2, 0 ))) {
966- continue ;
967- }
968-
969- if (ispTdepPID) {
970- if (selectionPIDNew (track1, 1 ) && selectionPIDNew (track2, 0 )) {
971- track1pion = true ;
972- track2kaon = true ;
973- if (removefaketrak && isFakeKaon (track2, 0 )) {
974- continue ;
975- }
976- }
977- if (selectionPIDNew (track2, 1 ) && selectionPIDNew (track1, 0 )) {
978- track2pion = true ;
979- track1kaon = true ;
980- if (removefaketrak && isFakeKaon (track1, 0 )) {
981- continue ;
982- }
983- }
984- }
985- if (!ispTdepPID) {
986- if (selectionPID (track1, 1 ) && selectionPID (track2, 0 )) {
987- track1pion = true ;
988- track2kaon = true ;
989- if (removefaketrak && isFakeKaon (track2, 0 )) {
990- continue ;
991- }
992- }
993- if (selectionPID (track2, 1 ) && selectionPID (track1, 0 )) {
994- track2pion = true ;
995- track1kaon = true ;
996- if (removefaketrak && isFakeKaon (track1, 0 )) {
997- continue ;
998- }
999- }
1000- }
1001- if (track1kaon && track2pion) {
1002- daughter1 = ROOT::Math::PxPyPzMVector (track1.px (), track1.py (), track1.pz (), massKa);
1003- daughter2 = ROOT::Math::PxPyPzMVector (track2.px (), track2.py (), track2.pz (), massPi);
1004- } else if (track1pion && track2kaon) {
1005- daughter1 = ROOT::Math::PxPyPzMVector (track1.px (), track1.py (), track1.pz (), massPi);
1006- daughter2 = ROOT::Math::PxPyPzMVector (track2.px (), track2.py (), track2.pz (), massKa);
1007- } else {
946+ if (!ispTdepPID && !(selectionPID (track2, 1 ))) {
1008947 continue ;
1009948 }
949+ daughter1 = ROOT::Math::PxPyPzMVector (track1.px (), track1.py (), track1.pz (), massKa);
950+ daughter2 = ROOT::Math::PxPyPzMVector (track2.px (), track2.py (), track2.pz (), massPi);
1010951 KstarMother = daughter1 + daughter2;
1011952 if (TMath::Abs (KstarMother.Rapidity ()) > confRapidity) {
1012953 continue ;
@@ -1015,13 +956,11 @@ struct kstarpbpb {
1015956
1016957 v2 = TMath::Cos (2.0 * phiminuspsi) * QFT0C;
1017958
1018- if (mix) {
1019- histos.fill (HIST (" hSparseV2SAMixedEvent_V2" ), KstarMother.M (), KstarMother.Pt (), v2, centrality);
1020- }
959+ histos.fill (HIST (" hSparseV2SAMixedEvent_V2" ), KstarMother.M (), KstarMother.Pt (), v2, centrality);
1021960 }
1022961 }
1023962 }
1024- PROCESS_SWITCH (kstarpbpb, processMixedEvent, " Process Mixed event" , false );
963+ PROCESS_SWITCH (kstarpbpb, processMixedEvent, " Process Mixed event" , true );
1025964};
1026965WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
1027966{
0 commit comments