@@ -2067,6 +2067,7 @@ struct AnalysisDileptonTrack {
20672067 Configurable<bool > fConfigPublishTripletTable {" cfgPublishTripletTable" , false , " Publish the triplet tables, BmesonCandidates" };
20682068 Configurable<bool > fConfigApplyMassEC {" cfgApplyMassEC" , false , " Apply fit mass for sideband for the energy correlator study" };
20692069 Configurable<std::vector<int >> fConfigSavelessevents {" cfgSavelessevents" , std::vector<int >{1 , 0 }, " Save less events for the energy correlator study" };
2070+ Configurable<std::vector<float >> fConfigTransRange {" cfgTransRange" , std::vector<float >{0.333333 , 0.666667 }, " Transverse region for the energy correlstor analysis" };
20702071 } fConfigOptions ;
20712072
20722073 struct : ConfigurableGroup {
@@ -2133,6 +2134,7 @@ struct AnalysisDileptonTrack {
21332134 {
21342135 cout << " AnalysisDileptonTrack::init() called" << endl;
21352136 bool isBarrel = context.mOptions .get <bool >(" processBarrel" );
2137+ bool isBarrelME = context.mOptions .get <bool >(" processBarrelMixedEvent" );
21362138 // bool isBarrelAsymmetric = context.mOptions.get<bool>("processDstarToD0Pi");
21372139 // bool isMuon = context.mOptions.get<bool>("processMuonSkimmed");
21382140 bool isMCGen = context.mOptions .get <bool >(" processMCGen" );
@@ -2395,6 +2397,9 @@ struct AnalysisDileptonTrack {
23952397 DefineHistograms (fHistMan , Form (" DileptonTrack_%s_%s" , pairLegCutName.Data (), fTrackCutNames [iCutTrack].Data ()), fConfigOptions .fConfigHistogramSubgroups .value .data ());
23962398 for (auto & sig : fRecMCSignals ) {
23972399 DefineHistograms (fHistMan , Form (" DileptonTrackMCMatched_%s_%s_%s" , pairLegCutName.Data (), fTrackCutNames [iCutTrack].Data (), sig->GetName ()), fConfigOptions .fConfigHistogramSubgroups .value .data ());
2400+ if (isBarrelME) {
2401+ DefineHistograms (fHistMan , Form (" DileptonTrackMCMatchedME_%s_%s_%s" , pairLegCutName.Data (), fTrackCutNames [iCutTrack].Data (), sig->GetName ()), fConfigOptions .fConfigHistogramSubgroups .value .data ());
2402+ }
23982403 }
23992404
24002405 if (!cfgPairing_strCommonTrackCuts.IsNull ()) {
@@ -2588,7 +2593,8 @@ struct AnalysisDileptonTrack {
25882593 auto trackMC = track.mcParticle ();
25892594 // for the energy correlator analysis
25902595 auto motherParticle = lepton1MC.template mothers_first_as <McParticles>();
2591- VarManager::FillEnergyCorrelator (dilepton, track, fValuesHadron , fConfigOptions .fConfigApplyMassEC );
2596+ std::vector<float > fTransRange = fConfigOptions .fConfigTransRange ;
2597+ VarManager::FillEnergyCorrelator (dilepton, track, fValuesHadron , fTransRange [0 ], fTransRange [1 ], fConfigOptions .fConfigApplyMassEC );
25922598 VarManager::FillEnergyCorrelatorsMCUnfolding<VarManager::kJpsiHadronMass >(dilepton, track, motherParticle, trackMC, fValuesHadron );
25932599 mcDecision = 0 ;
25942600 isig = 0 ;
@@ -2804,6 +2810,112 @@ struct AnalysisDileptonTrack {
28042810 cout << " AnalysisDileptonTrack::processBarrel() completed" << endl;
28052811 }
28062812
2813+ void processBarrelMixedEvent (soa::Filtered<MyEventsHashSelected>& events,
2814+ BCsWithTimestamps const & bcs,
2815+ soa::Join<aod::TrackAssoc, aod::BarrelTrackCuts> const & assocs,
2816+ MyBarrelTracksWithCov const & tracks, soa::Filtered<MyDielectronCandidates> const & dileptons,
2817+ McCollisions const & /* mcEvents*/ , McParticles const & /* mcTracks*/ )
2818+ {
2819+ if (events.size () == 0 ) {
2820+ return ;
2821+ }
2822+ if (fCurrentRun != bcs.begin ().runNumber ()) { // start: runNumber
2823+ initParamsFromCCDB (bcs.begin ().timestamp ());
2824+ fCurrentRun = bcs.begin ().runNumber ();
2825+ } // end: runNumber
2826+ // loop over two event comibnations
2827+ for (auto & [event1, event2] : selfCombinations (fHashBin , fConfigOptions .fConfigMixingDepth .value , -1 , events, events)) {
2828+ // fill event quantities
2829+ if (!event1.isEventSelected_bit (0 ) || !event2.isEventSelected_bit (0 )) {
2830+ continue ;
2831+ }
2832+ std::vector<int > fSavelessevents = fConfigOptions .fConfigSavelessevents ;
2833+ if (fSavelessevents [0 ] > 1 && event1.globalIndex () % fSavelessevents [0 ] == fSavelessevents [1 ]) {
2834+ continue ;
2835+ }
2836+ // get the dilepton slice for event1
2837+ auto evDileptons = dileptons.sliceBy (dielectronsPerCollision, event1.globalIndex ());
2838+ evDileptons.bindExternalIndices (&events);
2839+
2840+ // get the track associations slice for event2
2841+ auto evAssocs = assocs.sliceBy (trackAssocsPerCollision, event2.globalIndex ());
2842+ evAssocs.bindExternalIndices (&events);
2843+
2844+ uint32_t mcDecision = static_cast <uint32_t >(0 );
2845+ size_t isig = 0 ;
2846+
2847+ // loop over dileptons
2848+ for (auto dilepton : evDileptons) {
2849+ // get full track info of tracks based on the index
2850+ auto lepton1 = tracks.rawIteratorAt (dilepton.index0Id ());
2851+ auto lepton2 = tracks.rawIteratorAt (dilepton.index1Id ());
2852+ if (!lepton1.has_mcParticle () || !lepton2.has_mcParticle ()) {
2853+ continue ;
2854+ }
2855+ auto lepton1MC = lepton1.mcParticle ();
2856+ auto lepton2MC = lepton2.mcParticle ();
2857+ // Check that the dilepton has zero charge
2858+ if (dilepton.sign () != 0 ) {
2859+ continue ;
2860+ }
2861+ // dilepton rap cut
2862+ float rap = dilepton.rap ();
2863+ if (fConfigMCOptions .fConfigUseMCRapcut && abs (rap) > fConfigOptions .fConfigDileptonRapCutAbs ) {
2864+ continue ;
2865+ }
2866+
2867+ // loop over associations
2868+ for (auto & assoc : evAssocs) {
2869+
2870+ // check that this track fulfills at least one of the specified cuts
2871+ uint32_t trackSelection = (assoc.isBarrelSelected_raw () & fTrackCutBitMap );
2872+ if (!trackSelection) {
2873+ continue ;
2874+ }
2875+
2876+ // get the track from this association
2877+ // auto track = assoc.template track_as<TTracks>();
2878+ auto track = tracks.rawIteratorAt (assoc.trackId ());
2879+ // check that this track is not included in the current dilepton
2880+ if (track.globalIndex () == dilepton.index0Id () || track.globalIndex () == dilepton.index1Id ()) {
2881+ continue ;
2882+ }
2883+
2884+ if (!track.has_mcParticle ()) {
2885+ continue ;
2886+ }
2887+ auto trackMC = track.mcParticle ();
2888+ // for the energy correlator analysis
2889+ auto motherParticle = lepton1MC.template mothers_first_as <McParticles>();
2890+ VarManager::FillEnergyCorrelatorsMCUnfolding<VarManager::kJpsiHadronMass >(dilepton, track, motherParticle, trackMC, VarManager::fgValues);
2891+ mcDecision = 0 ;
2892+ isig = 0 ;
2893+ for (auto sig = fRecMCSignals .begin (); sig != fRecMCSignals .end (); sig++, isig++) {
2894+ if ((*sig)->CheckSignal (true , lepton1MC, lepton2MC, trackMC)) {
2895+ mcDecision |= (static_cast <uint32_t >(1 ) << isig);
2896+ }
2897+ }
2898+
2899+ // loop over dilepton leg cuts and track cuts and fill histograms separately for each combination
2900+ for (int icut = 0 ; icut < fNCuts ; icut++) {
2901+ if (!dilepton.filterMap_bit (icut)) {
2902+ continue ;
2903+ }
2904+ for (uint32_t iTrackCut = 0 ; iTrackCut < fTrackCutNames .size (); iTrackCut++) {
2905+ if (trackSelection & (static_cast <uint32_t >(1 ) << iTrackCut)) {
2906+ for (uint32_t isig = 0 ; isig < fRecMCSignals .size (); isig++) {
2907+ if (mcDecision & (static_cast <uint32_t >(1 ) << isig)) {
2908+ fHistMan ->FillHistClass (Form (" DileptonTrackMCMatchedME_%s_%s_%s" , fLegCutNames [icut].Data (), fTrackCutNames [iTrackCut].Data (), fRecMCSignals [isig]->GetName ()), VarManager::fgValues);
2909+ }
2910+ }
2911+ }
2912+ }
2913+ }
2914+ } // end for (assocs)
2915+ } // end for (dileptons)
2916+ } // end event loop
2917+ }
2918+
28072919 /* void processDstarToD0Pi(soa::Filtered<MyEventsSelected> const& events, BCsWithTimestamps const& bcs,
28082920 soa::Filtered<soa::Join<aod::TrackAssoc, aod::BarrelTrackCuts>> const& assocs,
28092921 MyBarrelTracksWithCov const& tracks, soa::Filtered<MyDitrackCandidates> const& ditracks,
@@ -2823,7 +2935,7 @@ struct AnalysisDileptonTrack {
28232935 runDileptonHadron<VarManager::kDstarToD0KPiPi, gkEventFillMapWithCov, gkTrackFillMapWithCov>(event, groupedBarrelAssocs, tracks, groupedDitracks, mcEvents, mcTracks);
28242936 }
28252937 }
2826- */
2938+ */
28272939 /*
28282940 Preslice<aod::ReducedMuonsAssoc> muonAssocsPerCollision = aod::reducedtrack_association::reducedeventId;
28292941 Preslice<MyDimuonCandidates> dimuonsPerCollision = aod::reducedpair::reducedeventId;
@@ -2964,7 +3076,8 @@ struct AnalysisDileptonTrack {
29643076 }
29653077 if (t2_raw.getGenStatusCode () <= 0 )
29663078 continue ;
2967- VarManager::FillEnergyCorrelatorsMC<THadronMassType>(t1_raw, t2_raw, VarManager::fgValues);
3079+ std::vector<float > fTransRange = fConfigOptions .fConfigTransRange ;
3080+ VarManager::FillEnergyCorrelatorsMC<THadronMassType>(t1_raw, t2_raw, VarManager::fgValues, fTransRange [0 ], fTransRange [1 ]);
29683081 for (auto & sig : fGenMCSignals ) {
29693082 if (sig->CheckSignal (true , t1_raw)) {
29703083 fHistMan ->FillHistClass (Form (" MCTruthEenergyCorrelators_%s" , sig->GetName ()), VarManager::fgValues);
@@ -3096,6 +3209,7 @@ struct AnalysisDileptonTrack {
30963209 }
30973210
30983211 PROCESS_SWITCH (AnalysisDileptonTrack, processBarrel, " Run barrel dilepton-track pairing, using skimmed data" , false );
3212+ PROCESS_SWITCH (AnalysisDileptonTrack, processBarrelMixedEvent, " Run barrel dilepton-hadron mixed event pairing" , false );
30993213 // PROCESS_SWITCH(AnalysisDileptonTrack, processDstarToD0Pi, "Run barrel pairing of D0 daughters with pion candidate, using skimmed data", false);
31003214 // PROCESS_SWITCH(AnalysisDileptonTrack, processMuonSkimmed, "Run muon dilepton-track pairing, using skimmed data", false);
31013215 PROCESS_SWITCH (AnalysisDileptonTrack, processMCGen, " Loop over MC particle stack and fill generator level histograms" , false );
0 commit comments