@@ -130,7 +130,7 @@ struct JetFinderHFQATask {
130130 registry.add (" h_jet_phat_weighted" , " jet #hat{p};#hat{p} (GeV/#it{c});entries" , {HistType::kTH1F , {{350 , 0 , 350 }}});
131131 }
132132
133- if (doprocessJetsRhoAreaSubData) {
133+ if (doprocessJetsRhoAreaSubData || doprocessJetsRhoAreaSubMCD ) {
134134
135135 registry.add (" h_jet_pt_rhoareasubtracted" , " jet pT;#it{p}_{T,jet} (GeV/#it{c});entries" , {HistType::kTH1F , {{400 , -200 ., 200 .}}});
136136 registry.add (" h_jet_eta_rhoareasubtracted" , " jet #eta;#eta_{jet};entries" , {HistType::kTH1F , {{100 , -1.0 , 1.0 }}});
@@ -188,7 +188,7 @@ struct JetFinderHFQATask {
188188 registry.add (" h2_centrality_rhom" , " ;centrality; #it{rho}_{m} (GeV/area)" , {HistType::kTH2F , {{1100 , 0 ., 110 .}, {100 , 0 ., 100.0 }}});
189189 }
190190
191- if (doprocessRandomCone ) {
191+ if (doprocessRandomConeData || doprocessRandomConeMCD ) {
192192 registry.add (" h2_centrality_rhorandomcone" , " ; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);" , {HistType::kTH2F , {{1100 , 0 ., 110 .}, {800 , -400.0 , 400.0 }}});
193193 registry.add (" h2_centrality_rhorandomconewithoutleadingjet" , " ; centrality; #it{p}_{T,random cone} - #it{area, random cone} * #it{rho} (GeV/c);" , {HistType::kTH2F , {{1100 , 0 ., 110 .}, {800 , -400.0 , 400.0 }}});
194194 }
@@ -918,6 +918,61 @@ struct JetFinderHFQATask {
918918 }
919919 }
920920
921+ template <typename T, typename U, typename V, typename M, typename N>
922+ void randomCone (T const & collision, U const & jets, V const & candidates, M const & bkgRhos, N const & tracks)
923+ {
924+
925+ if (!jetderiveddatautilities::selectCollision (collision, eventSelection)) {
926+ return ;
927+ }
928+ for (auto const & candidate : candidates) {
929+ auto bkgRho = jetcandidateutilities::slicedPerCandidate (bkgRhos, candidate, perD0CandidateRhos, perLcCandidateRhos, perBplusCandidateRhos, perDielectronCandidateRhos).iteratorAt (0 );
930+ TRandom3 randomNumber (0 );
931+ float randomConeEta = randomNumber.Uniform (trackEtaMin + randomConeR, trackEtaMax - randomConeR);
932+ float randomConePhi = randomNumber.Uniform (0.0 , 2 * M_PI);
933+ float randomConePt = 0 ;
934+ for (auto const & track : tracks) {
935+ if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
936+ float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-M_PI));
937+ float dEta = track.eta () - randomConeEta;
938+ if (TMath::Sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
939+ randomConePt += track.pt ();
940+ }
941+ }
942+ }
943+ registry.fill (HIST (" h2_centrality_rhorandomcone" ), collision.centrality (), randomConePt - M_PI * randomConeR * randomConeR * bkgRho.rho ());
944+
945+ // removing the leading jet from the random cone
946+ if (jets.size () > 0 ) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet
947+ float dPhiLeadingJet = RecoDecay::constrainAngle (jets.iteratorAt (0 ).phi () - randomConePhi, static_cast <float >(-M_PI));
948+ float dEtaLeadingJet = jets.iteratorAt (0 ).eta () - randomConeEta;
949+
950+ bool jetWasInCone = false ;
951+ while (TMath::Sqrt (dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt (0 ).r () / 100.0 + randomConeR) {
952+ jetWasInCone = true ;
953+ randomConeEta = randomNumber.Uniform (trackEtaMin + randomConeR, trackEtaMax - randomConeR);
954+ randomConePhi = randomNumber.Uniform (0.0 , 2 * M_PI);
955+ dPhiLeadingJet = RecoDecay::constrainAngle (jets.iteratorAt (0 ).phi () - randomConePhi, static_cast <float >(-M_PI));
956+ dEtaLeadingJet = jets.iteratorAt (0 ).eta () - randomConeEta;
957+ }
958+ if (jetWasInCone) {
959+ randomConePt = 0.0 ;
960+ for (auto const & track : tracks) {
961+ if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
962+ float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-M_PI));
963+ float dEta = track.eta () - randomConeEta;
964+ if (TMath::Sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
965+ randomConePt += track.pt ();
966+ }
967+ }
968+ }
969+ }
970+ }
971+ registry.fill (HIST (" h2_centrality_rhorandomconewithoutleadingjet" ), collision.centrality (), randomConePt - M_PI * randomConeR * randomConeR * bkgRho.rho ());
972+ break ; // currently only fills it for the first candidate in the event (not pT ordered). Jet is pT ordered so results for excluding leading jet might not be as expected
973+ }
974+ }
975+
921976 void processDummy (JetCollisions const &)
922977 {
923978 }
@@ -957,6 +1012,26 @@ struct JetFinderHFQATask {
9571012 }
9581013 PROCESS_SWITCH (JetFinderHFQATask, processJetsRhoAreaSubData, " jet finder HF QA for rho-area subtracted jets" , false );
9591014
1015+ void processJetsRhoAreaSubMCD (soa::Filtered<JetCollisions>::iterator const & collision,
1016+ BkgRhoTable const & bkgRhos,
1017+ JetTableMCDJoined const & jets,
1018+ CandidateTableMCD const &,
1019+ JetTracks const &)
1020+ {
1021+ for (auto const & jet : jets) {
1022+ if (!jetfindingutilities::isInEtaAcceptance (jet, jetEtaMin, jetEtaMax, trackEtaMin, trackEtaMax)) {
1023+ continue ;
1024+ }
1025+ if (!isAcceptedJet<JetTracks, CandidateTableMCD>(jet)) {
1026+ continue ;
1027+ }
1028+ auto const jetCandidate = jet.template candidates_first_as <CandidateTableMCD>();
1029+ auto bkgRho = jetcandidateutilities::slicedPerCandidate (bkgRhos, jetCandidate, perD0CandidateRhos, perLcCandidateRhos, perBplusCandidateRhos, perDielectronCandidateRhos).iteratorAt (0 );
1030+ fillRhoAreaSubtractedHistograms<typename JetTableMCDJoined::iterator, CandidateTableMCD>(jet, collision.centrality (), bkgRho.rho ());
1031+ }
1032+ }
1033+ PROCESS_SWITCH (JetFinderHFQATask, processJetsRhoAreaSubMCD, " jet finder HF QA for rho-area subtracted mcd jets" , false );
1034+
9601035 void processEvtWiseConstSubJetsData (soa::Filtered<JetCollisions>::iterator const & collision, JetTableDataSubJoined const & jets, CandidateTableData const &, JetTracksDataSub const &)
9611036 {
9621037 for (auto const & jet : jets) {
@@ -1442,59 +1517,17 @@ struct JetFinderHFQATask {
14421517 }
14431518 PROCESS_SWITCH (JetFinderHFQATask, processRho, " QA for rho-area subtracted jets" , false );
14441519
1445- void processRandomCone (soa::Filtered<JetCollisions>::iterator const & collision, JetTableDataSubJoined const & jets, CandidateTableData const & candidates, BkgRhoTable const & bkgRhos, soa::Filtered<JetTracks> const & tracks)
1520+ void processRandomConeData (soa::Filtered<JetCollisions>::iterator const & collision, JetTableDataJoined const & jets, CandidateTableData const & candidates, BkgRhoTable const & bkgRhos, soa::Filtered<JetTracks> const & tracks)
14461521 {
1447- if (!jetderiveddatautilities::selectCollision (collision, eventSelection)) {
1448- return ;
1449- }
1450- for (auto const & candidate : candidates) {
1451- auto bkgRho = jetcandidateutilities::slicedPerCandidate (bkgRhos, candidate, perD0CandidateRhos, perLcCandidateRhos, perBplusCandidateRhos, perDielectronCandidateRhos).iteratorAt (0 );
1452- TRandom3 randomNumber (0 );
1453- float randomConeEta = randomNumber.Uniform (trackEtaMin + randomConeR, trackEtaMax - randomConeR);
1454- float randomConePhi = randomNumber.Uniform (0.0 , 2 * M_PI);
1455- float randomConePt = 0 ;
1456- for (auto const & track : tracks) {
1457- if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
1458- float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-M_PI));
1459- float dEta = track.eta () - randomConeEta;
1460- if (TMath::Sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
1461- randomConePt += track.pt ();
1462- }
1463- }
1464- }
1465- registry.fill (HIST (" h2_centrality_rhorandomcone" ), collision.centrality (), randomConePt - M_PI * randomConeR * randomConeR * bkgRho.rho ());
1466-
1467- // removing the leading jet from the random cone
1468- if (jets.size () > 0 ) { // if there are no jets in the acceptance (from the jetfinder cuts) then there can be no leading jet
1469- float dPhiLeadingJet = RecoDecay::constrainAngle (jets.iteratorAt (0 ).phi () - randomConePhi, static_cast <float >(-M_PI));
1470- float dEtaLeadingJet = jets.iteratorAt (0 ).eta () - randomConeEta;
1522+ randomCone (collision, jets, candidates, bkgRhos, tracks);
1523+ }
1524+ PROCESS_SWITCH (JetFinderHFQATask, processRandomConeData, " QA for random cone estimation of background fluctuations in data" , false );
14711525
1472- bool jetWasInCone = false ;
1473- while (TMath::Sqrt (dEtaLeadingJet * dEtaLeadingJet + dPhiLeadingJet * dPhiLeadingJet) < jets.iteratorAt (0 ).r () / 100.0 + randomConeR) {
1474- jetWasInCone = true ;
1475- randomConeEta = randomNumber.Uniform (trackEtaMin + randomConeR, trackEtaMax - randomConeR);
1476- randomConePhi = randomNumber.Uniform (0.0 , 2 * M_PI);
1477- dPhiLeadingJet = RecoDecay::constrainAngle (jets.iteratorAt (0 ).phi () - randomConePhi, static_cast <float >(-M_PI));
1478- dEtaLeadingJet = jets.iteratorAt (0 ).eta () - randomConeEta;
1479- }
1480- if (jetWasInCone) {
1481- randomConePt = 0.0 ;
1482- for (auto const & track : tracks) {
1483- if (jetderiveddatautilities::selectTrack (track, trackSelection)) {
1484- float dPhi = RecoDecay::constrainAngle (track.phi () - randomConePhi, static_cast <float >(-M_PI));
1485- float dEta = track.eta () - randomConeEta;
1486- if (TMath::Sqrt (dEta * dEta + dPhi * dPhi) < randomConeR) {
1487- randomConePt += track.pt ();
1488- }
1489- }
1490- }
1491- }
1492- }
1493- registry.fill (HIST (" h2_centrality_rhorandomconewithoutleadingjet" ), collision.centrality (), randomConePt - M_PI * randomConeR * randomConeR * bkgRho.rho ());
1494- break ; // currently only fills it for the first candidate in the event (not pT ordered). Jet is pT ordered so results for excluding leading jet might not be as expected
1495- }
1526+ void processRandomConeMCD (soa::Filtered<JetCollisions>::iterator const & collision, JetTableMCDJoined const & jets, CandidateTableMCD const & candidates, BkgRhoTable const & bkgRhos, soa::Filtered<JetTracks> const & tracks)
1527+ {
1528+ randomCone (collision, jets, candidates, bkgRhos, tracks);
14961529 }
1497- PROCESS_SWITCH (JetFinderHFQATask, processRandomCone , " QA for random cone estimation of background fluctuations" , false );
1530+ PROCESS_SWITCH (JetFinderHFQATask, processRandomConeMCD , " QA for random cone estimation of background fluctuations in mcd " , false );
14981531
14991532 void processCandidates (soa::Filtered<JetCollisions>::iterator const & collision, CandidateTableData const & candidates)
15001533 {
0 commit comments