10 #include "GaudiKernel/SystemOfUnits.h"
12 #include "GaudiKernel/PhysicalConstants.h"
21 #include <unordered_map>
44 ISvcLocator* pSvcLocator ) :
46 m_lumiBlockMuTool(
"LumiBlockMuTool/LumiBlockMuTool")
61 std::string sth =
results[1].str();
62 std::string swp =
results[2].str();
64 int thres = std::stoi(sth);
89 for (
auto&
reader : m_tmva_reader) {
91 auto tmva =
std::array{std::make_unique<TMVA::Reader>(
"!Color:!Silent" ),
92 std::make_unique<TMVA::Reader>(
"!Color:!Silent" )};
93 for (
auto&
t : tmva) {
94 t->AddVariable(
"n_track_qual", &
reader.n_track_qual);
95 t->AddVariable(
"ly0_sp_frac", &
reader.ly0_sp_frac);
96 t->AddVariable(
"ly1_sp_frac", &
reader.ly1_sp_frac);
97 t->AddVariable(
"ly2_sp_frac", &
reader.ly2_sp_frac);
98 t->AddVariable(
"ly3_sp_frac", &
reader.ly3_sp_frac);
99 t->AddVariable(
"ly4_sp_frac", &
reader.ly4_sp_frac);
100 t->AddVariable(
"ly5_sp_frac", &
reader.ly5_sp_frac);
101 t->AddVariable(
"ly6_sp_frac", &
reader.ly6_sp_frac);
102 t->AddVariable(
"ly7_sp_frac", &
reader.ly7_sp_frac);
104 reader.tmva_0eta1 = std::move(tmva[0]);
105 reader.tmva_1eta2 = std::move(tmva[1]);
108 const std::string tuningVer =
"v22a";
109 const std::string methodName =
"BDT method";
112 "TrigHitDVHypo/HitDV.BDT.weights.0eta1." + tuningVer +
".xml");
114 "TrigHitDVHypo/HitDV.BDT.weights.1eta2." + tuningVer +
".xml");
117 reader.tmva_0eta1->BookMVA(methodName, weightfile_0eta1);
118 reader.tmva_1eta2->BookMVA(methodName, weightfile_1eta2);
121 return StatusCode::SUCCESS;
131 std::vector<TrigSiSpacePointBase> convertedSpacePoints;
132 convertedSpacePoints.reserve(5000);
145 auto monitorIt =
Monitored::Group(
m_monTool, mon_n_dvtrks, mon_n_dvsps, mon_n_jetseeds, mon_n_jetseedsdel, mon_n_spseeds, mon_n_spseedsdel, mon_average_mu );
150 ATH_CHECK( previousDecisionsHandle.isValid() );
152 ATH_MSG_DEBUG(
"Running with " << previousDecisionsHandle->size() <<
" previous decisions" );
153 if( previousDecisionsHandle->size()!=1 ) {
154 ATH_MSG_ERROR(
"Previous decision handle size is not 1. It is" << previousDecisionsHandle->size() );
155 return StatusCode::FAILURE;
157 const Decision * previousDecision = previousDecisionsHandle->at(0);
162 for(
auto decisionID: previousDecisionIDs) {
ATH_MSG_DEBUG(
" " << decisionID ); }
167 auto outputDecisions = outputHandle.
ptr();
177 if( jetsContainer ==
nullptr ) {
179 return StatusCode::FAILURE;
181 bool isJetEtPassToolsCut =
false;
182 float jetEtaToolsCut = 2.0;
186 float jet_eta =
static_cast<float>(
jet->eta());
188 isJetEtPassToolsCut =
true;
196 std::vector<HitDVSeed> hitDVSeedsContainer;
197 std::vector<HitDVTrk> hitDVTrksContainer;
198 std::vector<HitDVSpacePoint> hitDVSPsContainer;
201 ATH_CHECK(
findHitDV(context, convertedSpacePoints, *tracks, hitDVSeedsContainer, hitDVTrksContainer, hitDVSPsContainer) );
203 mon_n_dvtrks = hitDVTrksContainer.size();
204 mon_n_dvsps = hitDVSPsContainer.size();
205 const unsigned int N_MAX_SP_STORED = 100000;
206 bool isSPOverflow =
false;
207 if( hitDVSPsContainer.size() >= N_MAX_SP_STORED ) isSPOverflow =
true;
214 averageMu =
static_cast<float>(
m_lumiBlockMuTool->averageInteractionsPerCrossing(context));
223 mon_average_mu = averageMu;
226 std::vector<float> jetSeeds_pt;
227 std::vector<float> jetSeeds_eta;
228 std::vector<float> jetSeeds_phi;
230 int n_alljetseeds = jetSeeds_eta.size();
232 mon_n_jetseeds = jetSeeds_eta.size();
233 mon_n_jetseedsdel = n_alljetseeds - jetSeeds_eta.size();
236 std::vector<float> spSeeds_eta;
237 std::vector<float> spSeeds_phi;
238 std::vector<float> void_pt;
239 int n_allspseeds = 0;
242 n_allspseeds = spSeeds_eta.size();
244 mon_n_spseeds = spSeeds_eta.size();
245 mon_n_spseedsdel = n_allspseeds - spSeeds_eta.size();
249 mon_n_spseedsdel = 0;
253 auto hitDVContainer = std::make_unique<xAOD::TrigCompositeContainer>();
254 auto hitDVContainerAux = std::make_unique<xAOD::TrigCompositeAuxContainer>();
255 hitDVContainer->setStore(hitDVContainerAux.get());
258 std::vector<TrigHitDVHypoTool::HitDVHypoInfo> hitDVHypoInputs;
259 std::unordered_map<Decision*, size_t> mapDecIdx;
262 if( isJetEtPassToolsCut ) {
263 const float preselBDTthreshold = -0.6;
265 int n_passed_jet = 0;
266 int seed_type = SeedType::HLTJet;
267 ATH_CHECK(
calculateBDT(context, hitDVSPsContainer, hitDVTrksContainer, jetSeeds_pt, jetSeeds_eta, jetSeeds_phi, preselBDTthreshold, seed_type, dvContainer, n_passed_jet) );
271 seed_type = SeedType::SP;
272 ATH_CHECK(
calculateBDT(context, hitDVSPsContainer, hitDVTrksContainer, void_pt, spSeeds_eta, spSeeds_phi, preselBDTthreshold, seed_type, dvContainer, n_passed_sp) );
275 ATH_MSG_DEBUG(
"nr of dv container / jet-seeded / sp-seed candidates = " << dvContainer->
size() <<
" / " << n_passed_jet <<
" / " << n_passed_sp );
278 for (
auto dv : *dvContainer ) {
280 mapDecIdx.emplace( newDecision,
dv->index() );
282 hitDVHypoInputs.push_back( hypoInfo );
297 ATH_CHECK( hitDVHandle.
record( std::move( hitDVContainer ), std::move( hitDVContainerAux ) ) );
301 while(
it != outputDecisions->end()) {
305 it = outputDecisions->erase(
it);
311 size_t idx = mapDecIdx.at(*
it);
327 return StatusCode::SUCCESS;
335 float dEta = eta_1 - eta_2;
344 float abseta = std::fabs(
eta);
357 const float PixBR6limit = 1.29612;
358 const float PixBR5limit = 1.45204;
359 const float PixBR4limit = 1.64909;
360 const float PixBR3limit = 1.90036;
361 const float PixBR2limit = 2.2146;
367 if( abseta > PixBR2limit )
return 2;
375 if( abseta > PixBR2limit )
return 2;
390 if( abseta < PixBR6limit )
return 7;
391 else if( abseta < PixBR5limit )
return 6;
399 if( abseta < PixBR5limit )
return 7;
400 else if( abseta < PixBR4limit )
return 6;
408 if( abseta < PixBR4limit )
return 7;
416 if( abseta < PixBR4limit )
return 6;
417 else if( abseta < PixBR3limit )
return 6;
425 if( abseta < PixBR3limit )
return 7;
433 if( abseta < PixBR3limit )
return 6;
441 if( abseta < PixBR3limit )
return 7;
449 if( abseta < PixBR3limit )
return 7;
468 std::vector<float> mnt_eta1_ly0_spfr;
469 std::vector<float> mnt_eta1_ly1_spfr;
470 std::vector<float> mnt_eta1_ly2_spfr;
471 std::vector<float> mnt_eta1_ly3_spfr;
472 std::vector<float> mnt_eta1_ly4_spfr;
473 std::vector<float> mnt_eta1_ly5_spfr;
474 std::vector<float> mnt_eta1_ly6_spfr;
475 std::vector<float> mnt_eta1_ly7_spfr;
476 std::vector<int> mnt_eta1_n_qtrk;
477 std::vector<float> mnt_eta1_bdtscore;
478 std::vector<float> mnt_1eta2_ly0_spfr;
479 std::vector<float> mnt_1eta2_ly1_spfr;
480 std::vector<float> mnt_1eta2_ly2_spfr;
481 std::vector<float> mnt_1eta2_ly3_spfr;
482 std::vector<float> mnt_1eta2_ly4_spfr;
483 std::vector<float> mnt_1eta2_ly5_spfr;
484 std::vector<float> mnt_1eta2_ly6_spfr;
485 std::vector<float> mnt_1eta2_ly7_spfr;
486 std::vector<int> mnt_1eta2_n_qtrk;
487 std::vector<float> mnt_1eta2_bdtscore;
509 mon_eta1_ly0_spfr, mon_eta1_ly1_spfr, mon_eta1_ly2_spfr, mon_eta1_ly3_spfr,
510 mon_eta1_ly4_spfr, mon_eta1_ly5_spfr, mon_eta1_ly6_spfr, mon_eta1_ly7_spfr,
511 mon_eta1_n_qtrk, mon_eta1_bdtscore,
512 mon_1eta2_ly0_spfr, mon_1eta2_ly1_spfr, mon_1eta2_ly2_spfr, mon_1eta2_ly3_spfr,
513 mon_1eta2_ly4_spfr, mon_1eta2_ly5_spfr, mon_1eta2_ly6_spfr, mon_1eta2_ly7_spfr,
514 mon_1eta2_n_qtrk, mon_1eta2_bdtscore);
517 for (
auto dv : *dvContainer ) {
518 int seed_type =
dv->getDetail<
int> (
"hitDV_seed_type");
520 if( seed_type == SeedType::SP )
continue;
521 float seed_eta =
dv->getDetail<
float>(
"hitDV_seed_eta");
522 int n_track_qual=
dv->getDetail<
int> (
"hitDV_n_track_qual");
523 float bdt_score =
dv->getDetail<
float>(
"hitDV_bdt_score");
524 float ly0_sp_frac =
dv->getDetail<
float>(
"hitDV_ly0_sp_frac");
525 float ly1_sp_frac =
dv->getDetail<
float>(
"hitDV_ly1_sp_frac");
526 float ly2_sp_frac =
dv->getDetail<
float>(
"hitDV_ly2_sp_frac");
527 float ly3_sp_frac =
dv->getDetail<
float>(
"hitDV_ly3_sp_frac");
528 float ly4_sp_frac =
dv->getDetail<
float>(
"hitDV_ly4_sp_frac");
529 float ly5_sp_frac =
dv->getDetail<
float>(
"hitDV_ly5_sp_frac");
530 float ly6_sp_frac =
dv->getDetail<
float>(
"hitDV_ly6_sp_frac");
531 float ly7_sp_frac =
dv->getDetail<
float>(
"hitDV_ly7_sp_frac");
532 if( std::abs(seed_eta) < 1.0 ) {
533 mnt_eta1_ly0_spfr.push_back(ly0_sp_frac);
534 mnt_eta1_ly1_spfr.push_back(ly1_sp_frac);
535 mnt_eta1_ly2_spfr.push_back(ly2_sp_frac);
536 mnt_eta1_ly3_spfr.push_back(ly3_sp_frac);
537 mnt_eta1_ly4_spfr.push_back(ly4_sp_frac);
538 mnt_eta1_ly5_spfr.push_back(ly5_sp_frac);
539 mnt_eta1_ly6_spfr.push_back(ly6_sp_frac);
540 mnt_eta1_ly7_spfr.push_back(ly7_sp_frac);
541 mnt_eta1_n_qtrk.push_back(n_track_qual);
542 mnt_eta1_bdtscore.push_back(bdt_score);
544 else if( std::abs(seed_eta) < 2.0 ) {
545 mnt_1eta2_ly0_spfr.push_back(ly0_sp_frac);
546 mnt_1eta2_ly1_spfr.push_back(ly1_sp_frac);
547 mnt_1eta2_ly2_spfr.push_back(ly2_sp_frac);
548 mnt_1eta2_ly3_spfr.push_back(ly3_sp_frac);
549 mnt_1eta2_ly4_spfr.push_back(ly4_sp_frac);
550 mnt_1eta2_ly5_spfr.push_back(ly5_sp_frac);
551 mnt_1eta2_ly6_spfr.push_back(ly6_sp_frac);
552 mnt_1eta2_ly7_spfr.push_back(ly7_sp_frac);
553 mnt_1eta2_n_qtrk.push_back(n_track_qual);
554 mnt_1eta2_bdtscore.push_back(bdt_score);
559 return StatusCode::SUCCESS;
566 const std::vector<HitDVSpacePoint>& spsContainer,
567 const std::vector<HitDVTrk>& trksContainer,
568 const std::vector<float>& seeds_pt,
569 const std::vector<float>& seeds_eta,
const std::vector<float>& seeds_phi,
570 const float& cutBDTthreshold,
const int seed_type,
573 if( seeds_eta.size() != seeds_phi.size() )
return StatusCode::SUCCESS;
576 for(
unsigned int iseed=0; iseed<seeds_eta.size(); iseed++) {
578 float seed_eta = seeds_eta[iseed];
579 float seed_phi = seeds_phi[iseed];
581 ATH_MSG_VERBOSE(
"+++++ seed eta: " << seed_eta <<
", phi:" << seed_phi <<
" +++++");
585 const float DR_SQUARED_TO_REF_CUT = 0.16;
588 int n_sp_injet_usedByTrk = 0;
590 int v_n_sp_injet_usedByTrk[
N_LAYER];
591 for(
int i=0;
i<
N_LAYER;
i++) { v_n_sp_injet[
i]=0; v_n_sp_injet_usedByTrk[
i]=0; }
593 for (
const auto & spData : spsContainer ) {
595 float sp_eta = spData.eta;
596 float sp_phi = spData.phi;
597 float dR2 =
deltaR2(sp_eta,sp_phi,seed_eta,seed_phi);
598 if( dR2 > DR_SQUARED_TO_REF_CUT )
continue;
601 int sp_layer = (
int)spData.layer;
602 int sp_trkid = (
int)spData.usedTrkId;
603 bool isUsedByTrk = (sp_trkid != -1);
609 v_n_sp_injet[ilayer]++;
611 n_sp_injet_usedByTrk++;
612 v_n_sp_injet_usedByTrk[ilayer]++;
616 ATH_MSG_VERBOSE(
"nr of SPs in jet: usedByTrk / all = " << n_sp_injet_usedByTrk <<
" / " << n_sp_injet);
620 if( v_n_sp_injet[
i] > 0 )
frac = 1.0 -
static_cast<float>(v_n_sp_injet_usedByTrk[
i]) /
static_cast<float>(v_n_sp_injet[
i]);
621 v_ly_sp_frac[
i] =
frac;
622 ATH_MSG_VERBOSE(
"Layer " <<
i <<
": frac=" << v_ly_sp_frac[
i] <<
", n used / all = " << v_n_sp_injet_usedByTrk[
i] <<
" / " << v_n_sp_injet[
i]);
626 const float TRK_PT_GEV_CUT = 2.0;
628 unsigned int n_qtrk_injet = 0;
629 for (
const auto& trk : trksContainer ) {
630 float trk_ptGeV = trk.pt;
632 if( trk_ptGeV < TRK_PT_GEV_CUT )
continue;
633 float dR2 =
deltaR2(trk.eta,trk.phi,seed_eta,seed_phi);
634 if( dR2 > DR_SQUARED_TO_REF_CUT )
continue;
637 ATH_MSG_DEBUG(
"nr of all / quality tracks matched = " << trksContainer.size() <<
" / " << n_qtrk_injet);
640 bool isSeedOutOfRange =
false;
641 if( n_qtrk_injet == 0 ) {
642 isSeedOutOfRange =
true;
644 if( std::fabs(v_ly_sp_frac[
i]) > 1
e-3 ) {
645 isSeedOutOfRange =
false;
break;
649 float bdt_score = -2.0;
650 if( ! isSeedOutOfRange ) {
651 auto&
reader = *m_tmva_reader.get(context);
652 reader.n_track_qual =
static_cast<float>(n_qtrk_injet);
653 reader.ly0_sp_frac = v_ly_sp_frac[0];
654 reader.ly1_sp_frac = v_ly_sp_frac[1];
655 reader.ly2_sp_frac = v_ly_sp_frac[2];
656 reader.ly3_sp_frac = v_ly_sp_frac[3];
657 reader.ly4_sp_frac = v_ly_sp_frac[4];
658 reader.ly5_sp_frac = v_ly_sp_frac[5];
659 reader.ly6_sp_frac = v_ly_sp_frac[6];
660 reader.ly7_sp_frac = v_ly_sp_frac[7];
662 if ( std::abs(seed_eta) < 1 ) {
663 bdt_score =
reader.tmva_0eta1->EvaluateMVA(
"BDT method");
664 }
else if ( std::abs(seed_eta) < 2 ) {
665 bdt_score =
reader.tmva_1eta2->EvaluateMVA(
"BDT method");
670 if( bdt_score < cutBDTthreshold )
continue;
678 dv->makePrivateStore();
682 if ( seed_type == SeedType::HLTJet ) seed_pt = seeds_pt[iseed];
683 dv->setDetail<
float>(
"hitDV_seed_pt", seed_pt);
684 dv->setDetail<
float>(
"hitDV_seed_eta", seed_eta);
685 dv->setDetail<
float>(
"hitDV_seed_phi", seed_phi);
686 dv->setDetail<
int> (
"hitDV_seed_type", seed_type);
687 dv->setDetail<
int> (
"hitDV_n_track_qual", n_qtrk_injet);
688 dv->setDetail<
float>(
"hitDV_ly0_sp_frac", v_ly_sp_frac[0]);
689 dv->setDetail<
float>(
"hitDV_ly1_sp_frac", v_ly_sp_frac[1]);
690 dv->setDetail<
float>(
"hitDV_ly2_sp_frac", v_ly_sp_frac[2]);
691 dv->setDetail<
float>(
"hitDV_ly3_sp_frac", v_ly_sp_frac[3]);
692 dv->setDetail<
float>(
"hitDV_ly4_sp_frac", v_ly_sp_frac[4]);
693 dv->setDetail<
float>(
"hitDV_ly5_sp_frac", v_ly_sp_frac[5]);
694 dv->setDetail<
float>(
"hitDV_ly6_sp_frac", v_ly_sp_frac[6]);
695 dv->setDetail<
float>(
"hitDV_ly7_sp_frac", v_ly_sp_frac[7]);
696 dv->setDetail<
float>(
"hitDV_bdt_score", bdt_score);
703 return StatusCode::SUCCESS;
710 std::vector<float>& jetSeeds_pt, std::vector<float>& jetSeeds_eta, std::vector<float>& jetSeeds_phi)
const
712 std::vector<float> mnt_jet_pt;
713 std::vector<float> mnt_jet_eta;
718 ATH_MSG_VERBOSE(
"looking for jet seed with pt cut=" << cutJetPt <<
", eta cut=" << cutJetEta);
721 if( jet_pt < cutJetPt ) {
725 mnt_jet_pt.push_back(jet_pt);
726 float jet_eta =
static_cast<float>(
jet->eta());
727 mnt_jet_eta.push_back(jet_eta);
728 if( std::fabs(jet_eta) > cutJetEta ) {
732 float jet_phi =
static_cast<float>(
jet->phi());
733 jetSeeds_pt.push_back(jet_pt);
734 jetSeeds_eta.push_back(jet_eta);
735 jetSeeds_phi.push_back(
jet_phi);
739 return StatusCode::SUCCESS;
746 std::vector<float>& seeds_eta, std::vector<float>& seeds_phi )
const
751 const int NBINS_ETA = 50;
752 const float ETA_MIN = -2.5;
753 const float ETA_MAX = 2.5;
755 const int NBINS_PHI = 80;
756 const float PHI_MIN = -4.0;
757 const float PHI_MAX = 4.0;
761 unsigned int slotnr = ctx.slot();
762 unsigned int subSlotnr = ctx.subSlot();
764 sprintf(
hname,
"hitdv_s%u_ss%u_ly6_h2_nsp",slotnr,subSlotnr);
765 std::unique_ptr<TH2F> ly6_h2_nsp = std::make_unique<TH2F>(
hname,
hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
766 sprintf(
hname,
"hitdv_s%u_ss%u_ly7_h2_nsp",slotnr,subSlotnr);
767 std::unique_ptr<TH2F> ly7_h2_nsp = std::make_unique<TH2F>(
hname,
hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
769 sprintf(
hname,
"hitdv_s%u_ss%u_ly6_h2_nsp_notrk",slotnr,subSlotnr);
770 std::unique_ptr<TH2F> ly6_h2_nsp_notrk = std::make_unique<TH2F>(
hname,
hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
771 sprintf(
hname,
"hitdv_s%u_ss%u_ly7_h2_nsp_notrk",slotnr,subSlotnr);
772 std::unique_ptr<TH2F> ly7_h2_nsp_notrk = std::make_unique<TH2F>(
hname,
hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
774 for (
const auto& spData : spsContainer ) {
775 int16_t sp_layer = spData.layer;
776 float sp_eta = spData.eta;
778 if( ilayer<6 )
continue;
780 int sp_trkid = (
int)spData.usedTrkId;
781 bool isUsedByTrk = (sp_trkid != -1);
782 float sp_phi = spData.phi;
784 bool fill_out_of_pi =
false;
787 sp_phi2 = 2*TMath::Pi() + sp_phi;
788 if( sp_phi2 < PHI_MAX ) fill_out_of_pi =
true;
791 sp_phi2 = -2*TMath::Pi() + sp_phi;
792 if( PHI_MIN < sp_phi2 ) fill_out_of_pi =
true;
795 ly6_h2_nsp->Fill(sp_eta,sp_phi);
796 if( fill_out_of_pi ) ly6_h2_nsp->Fill(sp_eta,sp_phi2);
797 if( ! isUsedByTrk ) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi);
798 if( ! isUsedByTrk && fill_out_of_pi) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
801 ly7_h2_nsp->Fill(sp_eta,sp_phi);
802 if( fill_out_of_pi ) ly7_h2_nsp->Fill(sp_eta,sp_phi2);
803 if( ! isUsedByTrk ) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi);
804 if( ! isUsedByTrk && fill_out_of_pi) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
811 std::vector<std::tuple<int,float,float,float>> QT;
813 for(
int ly6_ieta=1; ly6_ieta<=NBINS_ETA; ly6_ieta++) {
814 float ly6_eta = (ly6_h2_nsp->GetXaxis()->GetBinLowEdge(ly6_ieta) + ly6_h2_nsp->GetXaxis()->GetBinUpEdge(ly6_ieta))/2.0;
815 for(
int ly6_iphi=1; ly6_iphi<=NBINS_PHI; ly6_iphi++) {
816 float ly6_phi = (ly6_h2_nsp->GetYaxis()->GetBinLowEdge(ly6_iphi) + ly6_h2_nsp->GetYaxis()->GetBinUpEdge(ly6_iphi))/2.0;
818 float ly6_nsp = ly6_h2_nsp ->GetBinContent(ly6_ieta,ly6_iphi);
819 float ly6_nsp_notrk = ly6_h2_nsp_notrk->GetBinContent(ly6_ieta,ly6_iphi);
820 float ly6_frac = ( ly6_nsp > 0 ) ? ly6_nsp_notrk / ly6_nsp : 0;
821 if( ly6_nsp < 10 || ly6_frac < 0.85 )
continue;
823 float ly7_frac_max = 0;
824 float ly7_eta_max = 0;
825 float ly7_phi_max = 0;
826 for(
int ly7_ieta=
std::max(1,ly6_ieta-1); ly7_ieta<
std::min(NBINS_ETA,ly6_ieta+1); ly7_ieta++) {
827 for(
int ly7_iphi=
std::max(1,ly6_iphi-1); ly7_iphi<=
std::min(NBINS_PHI,ly6_iphi+1); ly7_iphi++) {
828 float ly7_nsp = ly7_h2_nsp ->GetBinContent(ly7_ieta,ly7_iphi);
829 float ly7_nsp_notrk = ly7_h2_nsp_notrk->GetBinContent(ly7_ieta,ly7_iphi);
830 float ly7_frac = ( ly7_nsp > 0 ) ? ly7_nsp_notrk / ly7_nsp : 0;
831 if( ly7_nsp < 10 )
continue;
832 if( ly7_frac > ly7_frac_max ) {
833 ly7_frac_max = ly7_frac;
834 ly7_eta_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_ieta) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_ieta))/2.0;
835 ly7_phi_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_iphi) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_iphi))/2.0;
839 if( ly7_frac_max < 0.85 )
continue;
841 float wsum = ly6_frac + ly7_frac_max;
842 float weta = (ly6_eta*ly6_frac + ly7_eta_max*ly7_frac_max) / wsum;
843 float wphi = (ly6_phi*ly6_frac + ly7_phi_max*ly7_frac_max) / wsum;
844 float w = wsum / 2.0;
845 QT.push_back(std::make_tuple(-1,
w,weta,wphi));
848 ATH_MSG_VERBOSE(
"nr of ly6/ly7 doublet candidate seeds=" << QT.size() <<
", doing clustering...");
851 std::sort(QT.begin(), QT.end(),
852 [](
const std::tuple<int,float,float,float>& lhs,
const std::tuple<int,float,float,float>& rhs) {
853 return std::get<1>(lhs) > std::get<1>(rhs); } );
856 const double CLUSTCUT_DIST_SQUARED = 0.04;
857 const double CLUSTCUT_SEED_FRAC = 0.9;
859 std::vector<float> seeds_wsum;
861 for(
unsigned int i=0;
i<QT.size();
i++) {
862 float phi = std::get<3>(QT[
i]);
863 float eta = std::get<2>(QT[
i]);
864 float w = std::get<1>(QT[
i]);
866 seeds_eta.push_back(
w*
eta); seeds_phi.push_back(
w*
phi);
867 seeds_wsum.push_back(
w);
870 const int IDX_INITIAL = 100;
871 float dist2_min = 100.0;
873 for(
unsigned j=0; j<seeds_eta.size(); j++) {
874 float ceta = seeds_eta[j]/seeds_wsum[j];
875 float cphi = seeds_phi[j]/seeds_wsum[j];
877 float deta = std::fabs(ceta-
eta);
878 float dphi = std::fabs(cphi-
phi);
879 float dist2 = dphi*dphi+deta*deta;
880 if( dist2 < dist2_min ) {
885 int match_idx = IDX_INITIAL;
887 if( dist2_min < CLUSTCUT_DIST_SQUARED ) { match_idx =
idx_min; }
889 if( match_idx == IDX_INITIAL ) {
890 if(
w > CLUSTCUT_SEED_FRAC && dist2_min > CLUSTCUT_DIST_SQUARED ) {
891 seeds_eta.push_back(
w*
eta); seeds_phi.push_back(
w*
phi);
892 seeds_wsum.push_back(
w);
896 float new_eta = seeds_eta[match_idx] +
w*
eta;
897 float new_phi = seeds_phi[match_idx] +
w*
phi;
898 float new_wsum = seeds_wsum[match_idx] +
w;
899 seeds_eta[match_idx] = new_eta;
900 seeds_phi[match_idx] = new_phi;
901 seeds_wsum[match_idx] = new_wsum;
904 for(
unsigned int i=0;
i<seeds_eta.size();
i++) {
905 float eta = seeds_eta[
i] / seeds_wsum[
i];
906 float phi = seeds_phi[
i] / seeds_wsum[
i];
909 if(
phi < -TMath::Pi() )
phi = 2*TMath::Pi() +
phi;
910 if(
phi > TMath::Pi() )
phi = -2*TMath::Pi() +
phi;
913 ATH_MSG_VERBOSE(
"after clustering, nr of seeds = " << seeds_eta.size());
916 std::vector<unsigned int> idx_to_delete;
917 for(
unsigned int i=0;
i<seeds_eta.size();
i++) {
918 if(
std::find(idx_to_delete.begin(),idx_to_delete.end(),
i) != idx_to_delete.end() )
continue;
919 float eta_i = seeds_eta[
i];
920 float phi_i = seeds_phi[
i];
921 for(
unsigned int j=
i+1; j<seeds_eta.size(); j++) {
922 if(
std::find(idx_to_delete.begin(),idx_to_delete.end(),j) != idx_to_delete.end() )
continue;
923 float eta_j = seeds_eta[j];
924 float phi_j = seeds_phi[j];
925 float dR2 =
deltaR2(eta_i,phi_i,eta_j,phi_j);
926 if( dR2 < CLUSTCUT_DIST_SQUARED ) idx_to_delete.push_back(j);
929 ATH_MSG_VERBOSE(
"nr of duplicated seeds to be removed = " << idx_to_delete.size());
930 if( idx_to_delete.size() > 0 ) {
931 std::sort(idx_to_delete.begin(),idx_to_delete.end());
932 for(
unsigned int j=idx_to_delete.size(); j>0; j--) {
933 unsigned int idx = idx_to_delete[j-1];
934 seeds_eta.erase(seeds_eta.begin()+
idx);
935 seeds_phi.erase(seeds_phi.begin()+
idx);
942 return StatusCode::SUCCESS;
949 std::vector<float>& jetSeeds_eta, std::vector<float>& jetSeeds_phi, std::vector<float>& jetSeeds_pt)
const
951 std::vector<unsigned int> idx_to_delete;
952 for(
unsigned int idx=0;
idx<jetSeeds_eta.size(); ++
idx) {
953 const float DR_SQUARED_CUT_TO_FTFSEED = 0.09;
954 float eta = jetSeeds_eta[
idx];
955 float phi = jetSeeds_phi[
idx];
957 for (
const auto& seed : hitDVSeedsContainer ) {
959 if( dR2 < dR2min ) dR2min = dR2;
961 if( dR2min > DR_SQUARED_CUT_TO_FTFSEED ) idx_to_delete.push_back(
idx);
963 if( idx_to_delete.size() > 0 ) {
964 std::sort(idx_to_delete.begin(),idx_to_delete.end());
965 for(
unsigned int j=idx_to_delete.size(); j>0; j--) {
966 unsigned int idx = idx_to_delete[j-1];
967 jetSeeds_eta.erase(jetSeeds_eta.begin()+
idx);
968 jetSeeds_phi.erase(jetSeeds_phi.begin()+
idx);
969 if( jetSeeds_pt.size() > 0 ) jetSeeds_pt.erase(jetSeeds_pt.begin()+
idx);
972 return StatusCode::SUCCESS;
979 const std::vector<float>& v_sp_eta,
const std::vector<float>& v_sp_phi,
980 const std::vector<int>& v_sp_layer,
const std::vector<int>& v_sp_usedTrkId,
981 std::vector<float>& seeds_eta, std::vector<float>& seeds_phi )
const
983 const int NBINS_ETA = 50;
984 const float ETA_MIN = -2.5;
985 const float ETA_MAX = 2.5;
987 const int NBINS_PHI = 80;
988 const float PHI_MIN = -4.0;
989 const float PHI_MAX = 4.0;
993 unsigned int slotnr = ctx.slot();
994 unsigned int subSlotnr = ctx.subSlot();
996 sprintf(
hname,
"ftf_s%u_ss%u_ly6_h2_nsp",slotnr,subSlotnr);
997 std::unique_ptr<TH2F> ly6_h2_nsp = std::make_unique<TH2F>(
hname,
hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
998 sprintf(
hname,
"ftf_s%u_ss%u_ly7_h2_nsp",slotnr,subSlotnr);
999 std::unique_ptr<TH2F> ly7_h2_nsp = std::make_unique<TH2F>(
hname,
hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
1001 sprintf(
hname,
"ftf_s%u_ss%u_ly6_h2_nsp_notrk",slotnr,subSlotnr);
1002 std::unique_ptr<TH2F> ly6_h2_nsp_notrk = std::make_unique<TH2F>(
hname,
hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
1003 sprintf(
hname,
"ftf_s%u_ss%u_ly7_h2_nsp_notrk",slotnr,subSlotnr);
1004 std::unique_ptr<TH2F> ly7_h2_nsp_notrk = std::make_unique<TH2F>(
hname,
hname,NBINS_ETA,ETA_MIN,ETA_MAX,NBINS_PHI,PHI_MIN,PHI_MAX);
1006 for(
unsigned int iSeed=0; iSeed<v_sp_eta.size(); ++iSeed) {
1008 int sp_layer = v_sp_layer[iSeed];
1009 float sp_eta = v_sp_eta[iSeed];
1011 if( ilayer<6 )
continue;
1013 int sp_trkid = v_sp_usedTrkId[iSeed];
1014 bool isUsedByTrk = (sp_trkid != -1);
1015 float sp_phi = v_sp_phi[iSeed];
1017 bool fill_out_of_pi =
false;
1020 sp_phi2 = 2*TMath::Pi() + sp_phi;
1021 if( sp_phi2 < PHI_MAX ) fill_out_of_pi =
true;
1024 sp_phi2 = -2*TMath::Pi() + sp_phi;
1025 if( PHI_MIN < sp_phi2 ) fill_out_of_pi =
true;
1028 ly6_h2_nsp->Fill(sp_eta,sp_phi);
1029 if( fill_out_of_pi ) ly6_h2_nsp->Fill(sp_eta,sp_phi2);
1030 if( ! isUsedByTrk ) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi);
1031 if( ! isUsedByTrk && fill_out_of_pi) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
1034 ly7_h2_nsp->Fill(sp_eta,sp_phi);
1035 if( fill_out_of_pi ) ly7_h2_nsp->Fill(sp_eta,sp_phi2);
1036 if( ! isUsedByTrk ) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi);
1037 if( ! isUsedByTrk && fill_out_of_pi) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
1044 std::vector<std::tuple<int,float,float,float>> QT;
1046 for(
int ly6_ieta=1; ly6_ieta<=NBINS_ETA; ly6_ieta++) {
1047 float ly6_eta = (ly6_h2_nsp->GetXaxis()->GetBinLowEdge(ly6_ieta) + ly6_h2_nsp->GetXaxis()->GetBinUpEdge(ly6_ieta))/2.0;
1048 for(
int ly6_iphi=1; ly6_iphi<=NBINS_PHI; ly6_iphi++) {
1049 float ly6_phi = (ly6_h2_nsp->GetYaxis()->GetBinLowEdge(ly6_iphi) + ly6_h2_nsp->GetYaxis()->GetBinUpEdge(ly6_iphi))/2.0;
1051 float ly6_nsp = ly6_h2_nsp ->GetBinContent(ly6_ieta,ly6_iphi);
1052 float ly6_nsp_notrk = ly6_h2_nsp_notrk->GetBinContent(ly6_ieta,ly6_iphi);
1053 float ly6_frac = ( ly6_nsp > 0 ) ? ly6_nsp_notrk / ly6_nsp : 0;
1054 if( ly6_nsp < 10 || ly6_frac < 0.85 )
continue;
1056 float ly7_frac_max = 0;
1057 float ly7_eta_max = 0;
1058 float ly7_phi_max = 0;
1059 for(
int ly7_ieta=
std::max(1,ly6_ieta-1); ly7_ieta<
std::min(NBINS_ETA,ly6_ieta+1); ly7_ieta++) {
1060 for(
int ly7_iphi=
std::max(1,ly6_iphi-1); ly7_iphi<=
std::min(NBINS_PHI,ly6_iphi+1); ly7_iphi++) {
1061 float ly7_nsp = ly7_h2_nsp ->GetBinContent(ly7_ieta,ly7_iphi);
1062 float ly7_nsp_notrk = ly7_h2_nsp_notrk->GetBinContent(ly7_ieta,ly7_iphi);
1063 float ly7_frac = ( ly7_nsp > 0 ) ? ly7_nsp_notrk / ly7_nsp : 0;
1064 if( ly7_nsp < 10 )
continue;
1065 if( ly7_frac > ly7_frac_max ) {
1066 ly7_frac_max = ly7_frac;
1067 ly7_eta_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_ieta) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_ieta))/2.0;
1068 ly7_phi_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_iphi) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_iphi))/2.0;
1072 if( ly7_frac_max < 0.85 )
continue;
1074 float wsum = ly6_frac + ly7_frac_max;
1075 float weta = (ly6_eta*ly6_frac + ly7_eta_max*ly7_frac_max) / wsum;
1076 float wphi = (ly6_phi*ly6_frac + ly7_phi_max*ly7_frac_max) / wsum;
1077 float w = wsum / 2.0;
1078 QT.push_back(std::make_tuple(-1,
w,weta,wphi));
1081 ATH_MSG_VERBOSE(
"nr of ly6/ly7 doublet candidate seeds=" << QT.size() <<
", doing clustering...");
1084 std::sort(QT.begin(), QT.end(),
1085 [](
const std::tuple<int,float,float,float>& lhs,
const std::tuple<int,float,float,float>& rhs) {
1086 return std::get<1>(lhs) > std::get<1>(rhs); } );
1089 const double CLUSTCUT_DIST_SQUARED = 0.04;
1090 const double CLUSTCUT_SEED_FRAC = 0.9;
1092 std::vector<float> seeds_wsum;
1094 for(
unsigned int i=0;
i<QT.size();
i++) {
1095 float phi = std::get<3>(QT[
i]);
1096 float eta = std::get<2>(QT[
i]);
1097 float w = std::get<1>(QT[
i]);
1099 seeds_eta.push_back(
w*
eta); seeds_phi.push_back(
w*
phi);
1100 seeds_wsum.push_back(
w);
1103 const int IDX_INITIAL = 100;
1104 float dist2_min = 100.0;
1106 for(
unsigned j=0; j<seeds_eta.size(); j++) {
1107 float ceta = seeds_eta[j]/seeds_wsum[j];
1108 float cphi = seeds_phi[j]/seeds_wsum[j];
1110 float deta = std::fabs(ceta-
eta);
1111 float dphi = std::fabs(cphi-
phi);
1112 float dist2 = dphi*dphi+deta*deta;
1113 if( dist2 < dist2_min ) {
1118 int match_idx = IDX_INITIAL;
1119 if(
idx_min != IDX_INITIAL ) {
1120 if( dist2_min < CLUSTCUT_DIST_SQUARED ) { match_idx =
idx_min; }
1122 if( match_idx == IDX_INITIAL ) {
1123 if(
w > CLUSTCUT_SEED_FRAC && dist2_min > CLUSTCUT_DIST_SQUARED ) {
1124 seeds_eta.push_back(
w*
eta); seeds_phi.push_back(
w*
phi);
1125 seeds_wsum.push_back(
w);
1129 float new_eta = seeds_eta[match_idx] +
w*
eta;
1130 float new_phi = seeds_phi[match_idx] +
w*
phi;
1131 float new_wsum = seeds_wsum[match_idx] +
w;
1132 seeds_eta[match_idx] = new_eta;
1133 seeds_phi[match_idx] = new_phi;
1134 seeds_wsum[match_idx] = new_wsum;
1137 for(
unsigned int i=0;
i<seeds_eta.size();
i++) {
1138 float eta = seeds_eta[
i] / seeds_wsum[
i];
1139 float phi = seeds_phi[
i] / seeds_wsum[
i];
1142 if(
phi < -TMath::Pi() )
phi = 2*TMath::Pi() +
phi;
1143 if(
phi > TMath::Pi() )
phi = -2*TMath::Pi() +
phi;
1146 ATH_MSG_VERBOSE(
"after clustering, nr of seeds = " << seeds_eta.size());
1149 std::vector<unsigned int> idx_to_delete;
1150 for(
unsigned int i=0;
i<seeds_eta.size();
i++) {
1151 if(
std::find(idx_to_delete.begin(),idx_to_delete.end(),
i) != idx_to_delete.end() )
continue;
1152 float eta_i = seeds_eta[
i];
1153 float phi_i = seeds_phi[
i];
1154 for(
unsigned int j=
i+1; j<seeds_eta.size(); j++) {
1155 if(
std::find(idx_to_delete.begin(),idx_to_delete.end(),j) != idx_to_delete.end() )
continue;
1156 float eta_j = seeds_eta[j];
1157 float phi_j = seeds_phi[j];
1158 float dR2 =
deltaR2(eta_i,phi_i,eta_j,phi_j);
1159 if( dR2 < CLUSTCUT_DIST_SQUARED ) idx_to_delete.push_back(j);
1162 ATH_MSG_VERBOSE(
"nr of duplicated seeds to be removed = " << idx_to_delete.size());
1163 if( idx_to_delete.size() > 0 ) {
1164 std::sort(idx_to_delete.begin(),idx_to_delete.end());
1165 for(
unsigned int j=idx_to_delete.size(); j>0; j--) {
1166 unsigned int idx = idx_to_delete[j-1];
1167 seeds_eta.erase(seeds_eta.begin()+
idx);
1168 seeds_phi.erase(seeds_phi.begin()+
idx);
1175 return StatusCode::SUCCESS;
1180 std::vector<HitDVTrk>& hitDVTrksContainer,
1181 std::vector<HitDVSpacePoint>& hitDVSPsContainer)
const
1183 std::vector<int> v_dvtrk_id;
1184 std::vector<float> v_dvtrk_pt;
1185 std::vector<float> v_dvtrk_eta;
1186 std::vector<float> v_dvtrk_phi;
1187 std::vector<int> v_dvtrk_n_hits_inner;
1188 std::vector<int> v_dvtrk_n_hits_pix;
1189 std::vector<int> v_dvtrk_n_hits_sct;
1190 std::vector<float> v_dvtrk_a0beam;
1191 std::unordered_map<Identifier, int> umap_fittedTrack_identifier;
1192 int fittedTrack_id = -1;
1194 static constexpr
float TRKCUT_PTGEV_HITDV = 0.5;
1196 for (
const auto track: tracks) {
1197 float shift_x = 0;
float shift_y = 0;
1204 if (not igt) {
continue;}
1211 m =
track->measurementsOnTrack()->begin(),
1212 me =
track->measurementsOnTrack()->end ();
1213 for(;
m!=me; ++
m ) {
1215 if( prd ==
nullptr )
continue;
1217 if( umap_fittedTrack_identifier.find(id_prd) == umap_fittedTrack_identifier.end() ) {
1218 umap_fittedTrack_identifier.insert(std::make_pair(id_prd,fittedTrack_id));
1222 v_dvtrk_id.push_back(fittedTrack_id);
1224 v_dvtrk_eta.push_back(theTrackInfo.
eta);
1225 v_dvtrk_phi.push_back(
phi);
1226 v_dvtrk_n_hits_inner.push_back(theTrackInfo.
n_hits_inner);
1227 v_dvtrk_n_hits_pix.push_back(theTrackInfo.
n_hits_pix);
1228 v_dvtrk_n_hits_sct.push_back(theTrackInfo.
n_hits_sct);
1229 v_dvtrk_a0beam.push_back(theTrackInfo.
a0beam);
1231 ATH_MSG_DEBUG(
"Nr of selected tracks / all = " << fittedTrack_id <<
" / " << tracks.size());
1232 ATH_MSG_DEBUG(
"Nr of Identifiers used by selected tracks = " << umap_fittedTrack_identifier.size());
1236 int n_sp_usedByTrk = 0;
1238 std::unordered_map<Identifier, int> umap_sp_identifier;
1239 umap_sp_identifier.reserve(1.3*convertedSpacePoints.size());
1244 if( umap_sp_identifier.find(id_prd) == umap_sp_identifier.end() ) {
1245 umap_sp_identifier.insert(std::make_pair(id_prd,-1));
1250 for(
unsigned int iSp=0; iSp<convertedSpacePoints.size(); ++iSp) {
1251 bool isPix = convertedSpacePoints[iSp].isPixel();
1252 bool isSct = convertedSpacePoints[iSp].isSCT();
1253 if( !
isPix && ! isSct )
continue;
1254 const Trk::SpacePoint* sp = convertedSpacePoints[iSp].offlineSpacePoint();
1258 int n_id_usedByTrack = 0;
1259 for(
auto it=umap_sp_identifier.begin();
it!=umap_sp_identifier.end(); ++
it) {
1261 if( umap_fittedTrack_identifier.find(id_sp) != umap_fittedTrack_identifier.end() ) {
1262 umap_sp_identifier[id_sp] = umap_fittedTrack_identifier[id_sp];
1266 ATH_MSG_DEBUG(
"Nr of SPs / Identifiers (all) / Identifiers (usedByTrack) = " << convertedSpacePoints.size() <<
" / " << umap_sp_identifier.size() <<
" / " << n_id_usedByTrack);
1269 int usedTrack_id = -1;
1272 if( umap_sp_identifier.find(id_prd) != umap_sp_identifier.end() ) {
1273 usedTrack_id = umap_sp_identifier[id_prd];
1276 return usedTrack_id;
1279 std::vector<float> v_sp_eta;
1280 v_sp_eta.reserve(convertedSpacePoints.size());
1281 std::vector<float> v_sp_r;
1282 v_sp_r.reserve(convertedSpacePoints.size());
1283 std::vector<float> v_sp_phi;
1284 v_sp_phi.reserve(convertedSpacePoints.size());
1285 std::vector<int> v_sp_layer;
1286 v_sp_layer.reserve(convertedSpacePoints.size());
1287 std::vector<bool> v_sp_isPix;
1288 v_sp_isPix.reserve(convertedSpacePoints.size());
1289 std::vector<bool> v_sp_isSct;
1290 v_sp_isSct.reserve(convertedSpacePoints.size());
1291 std::vector<int> v_sp_usedTrkId;
1292 v_sp_usedTrkId.reserve(convertedSpacePoints.size());
1294 for(
const auto& sp : convertedSpacePoints) {
1295 bool isPix = sp.isPixel();
1296 bool isSct = sp.isSCT();
1297 if( !
isPix && ! isSct )
continue;
1300 int usedTrack_id = -1;
1301 int usedTrack_id_first = sp_map_used_id(osp->
clusterList().first);
1302 if (usedTrack_id_first != -1) {
1303 usedTrack_id = usedTrack_id_first;
1305 int usedTrack_id_second = sp_map_used_id(osp->
clusterList().second);
1306 if (usedTrack_id_second != -1) {
1307 usedTrack_id = usedTrack_id_second;
1312 if( usedTrack_id != -1 ) n_sp_usedByTrk++;
1313 int layer = sp.layer();
1314 float sp_r = sp.r();
1317 float sp_eta = pos_sp.eta();
1318 float sp_phi = pos_sp.phi();
1320 v_sp_eta.push_back(sp_eta);
1321 v_sp_r.push_back(sp_r);
1322 v_sp_phi.push_back(sp_phi);
1323 v_sp_layer.push_back(
layer);
1324 v_sp_isPix.push_back(
isPix);
1325 v_sp_isSct.push_back(isSct);
1326 v_sp_usedTrkId.push_back(usedTrack_id);
1328 ATH_MSG_VERBOSE(
"+++ SP eta / phi / layer / ixPix / usedTrack_id = " << sp_eta <<
" / " << sp_phi <<
" / " <<
layer <<
" / " <<
isPix <<
" / " << usedTrack_id);
1331 ATH_MSG_DEBUG(
"Nr of SPs / all = " << n_sp <<
" / " << convertedSpacePoints.size());
1332 ATH_MSG_DEBUG(
"Nr of SPs used by selected tracks = " << n_sp_usedByTrk);
1335 std::vector<float> v_seeds_eta;
1336 std::vector<float> v_seeds_phi;
1337 std::vector<int16_t> v_seeds_type;
1342 const unsigned int L1JET_ET_CUT = 27;
1346 if (!jetRoiCollectionHandle.isValid()){
1348 return StatusCode::FAILURE;
1352 if( jetRoI ==
nullptr )
continue;
1354 if( jetRoI->
et() >= L1JET_ET_CUT ) {
1355 v_seeds_eta.push_back(jetRoI->
eta());
1356 v_seeds_phi.push_back(jetRoI->
phi());
1357 v_seeds_type.push_back(0);
1360 ATH_MSG_DEBUG(
"Nr of L1_J" << L1JET_ET_CUT <<
" seeds = " << v_seeds_eta.size());
1363 std::vector<float> v_spseeds_eta;
1364 std::vector<float> v_spseeds_phi;
1365 ATH_CHECK(
findSPSeeds(ctx, v_sp_eta, v_sp_phi, v_sp_layer, v_sp_usedTrkId, v_spseeds_eta, v_spseeds_phi) );
1367 for(
size_t idx=0;
idx<v_spseeds_eta.size(); ++
idx) {
1368 v_seeds_eta.push_back(v_spseeds_eta[
idx]);
1369 v_seeds_phi.push_back(v_spseeds_phi[
idx]);
1370 v_seeds_type.push_back(1);
1372 ATH_MSG_DEBUG(
"Nr of SP + L1_J" << L1JET_ET_CUT <<
" seeds = " << v_seeds_eta.size());
1378 const int N_MAX_SEEDS = 200;
1379 int n_seeds =
std::min(N_MAX_SEEDS,(
int)v_seeds_eta.size());
1380 hitDVSeedsContainer.reserve(n_seeds);
1381 for(
auto iSeed=0; iSeed < n_seeds; ++iSeed) {
1383 seed.eta = v_seeds_eta[iSeed];
1384 seed.phi = v_seeds_phi[iSeed];
1385 seed.type = v_seeds_type[iSeed];
1386 hitDVSeedsContainer.push_back(seed);
1390 const float TRKCUT_DELTA_R_TO_SEED = 1.0;
1391 hitDVTrksContainer.reserve(v_dvtrk_pt.size());
1392 for(
unsigned int iTrk=0; iTrk<v_dvtrk_pt.size(); ++iTrk) {
1393 float trk_eta = v_dvtrk_eta[iTrk];
1394 float trk_phi = v_dvtrk_phi[iTrk];
1396 bool isNearSeed =
false;
1397 for (
unsigned int iSeed=0; iSeed<v_seeds_eta.size(); ++iSeed) {
1398 float seed_eta = v_seeds_eta[iSeed];
1399 float seed_phi = v_seeds_phi[iSeed];
1400 float dR2 =
deltaR2(trk_eta,trk_phi,seed_eta,seed_phi);
1401 if( dR2 <= TRKCUT_DELTA_R_TO_SEED*TRKCUT_DELTA_R_TO_SEED ) { isNearSeed =
true;
break; }
1403 if( ! isNearSeed )
continue;
1406 hitDVTrk.
id = v_dvtrk_id[iTrk];
1407 hitDVTrk.
pt = v_dvtrk_pt[iTrk];
1408 hitDVTrk.
eta = v_dvtrk_eta[iTrk];
1409 hitDVTrk.
phi = v_dvtrk_phi[iTrk];
1411 hitDVTrk.
n_hits_pix = v_dvtrk_n_hits_pix[iTrk];
1412 hitDVTrk.
n_hits_sct = v_dvtrk_n_hits_sct[iTrk];
1413 hitDVTrk.
a0beam = v_dvtrk_a0beam[iTrk];
1415 hitDVTrksContainer.push_back(hitDVTrk);
1419 const float SPCUT_DELTA_R_TO_SEED = 1.0;
1420 const size_t n_sp_max = std::min<size_t>(100000, v_sp_eta.size());
1421 size_t n_sp_stored = 0;
1423 hitDVSPsContainer.reserve(n_sp_max);
1425 for(
size_t iSp=0; iSp<v_sp_eta.size(); ++iSp) {
1427 const float sp_eta = v_sp_eta[iSp];
1428 const float sp_phi = v_sp_phi[iSp];
1429 bool isNearSeed =
false;
1430 for (
size_t iSeed=0; iSeed<v_seeds_eta.size(); ++iSeed) {
1431 const float seed_eta = v_seeds_eta[iSeed];
1432 const float seed_phi = v_seeds_phi[iSeed];
1433 const float dR2 =
deltaR2(sp_eta, sp_phi, seed_eta, seed_phi);
1434 if( dR2 <= SPCUT_DELTA_R_TO_SEED*SPCUT_DELTA_R_TO_SEED ) { isNearSeed =
true;
break; }
1436 if( ! isNearSeed )
continue;
1438 if( n_sp_stored >= n_sp_max )
break;
1440 hitDVSP.
eta = v_sp_eta[iSp];
1441 hitDVSP.
r = v_sp_r[iSp];
1442 hitDVSP.
phi = v_sp_phi[iSp];
1443 hitDVSP.
layer = v_sp_layer[iSp];
1444 hitDVSP.
isPix = v_sp_isPix[iSp];
1445 hitDVSP.
isSct = v_sp_isSct[iSp];
1446 hitDVSP.
usedTrkId = v_sp_usedTrkId[iSp];
1447 hitDVSPsContainer.push_back(hitDVSP);
1452 return StatusCode::SUCCESS;