ATLAS Offline Software
TrigHitDVHypoAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 
4  * Trigger Hypo Tool, that is aimed at triggering displaced vertex
5  * author Kunihiro Nagano <kunihiro.nagano@cern.ch> - KEK
6 */
7 #include "TrigHitDVHypoAlg.h"
8 #include "AthViews/ViewHelper.h"
10 #include "GaudiKernel/SystemOfUnits.h"
12 #include "GaudiKernel/PhysicalConstants.h"
14 
16 #include "CxxUtils/phihelper.h"
18 
19 #include <vector>
20 #include <unordered_map>
21 
36 
37 using xAOD::JetContainer;
38 
39 // ------------------------------------------------------------------------------------------------
40 // ------------------------------------------------------------------------------------------------
41 
43  ISvcLocator* pSvcLocator ) :
44  ::HypoBase( name, pSvcLocator ),
45  m_lumiBlockMuTool("LumiBlockMuTool/LumiBlockMuTool")
46 {}
47 
48 // ------------------------------------------------------------------------------------------------
49 // ------------------------------------------------------------------------------------------------
50 
52 {
53  m_tools_lowest_jetEt = 1000;
55  CHECK( m_hypoTools.retrieve() );
56  for ( auto & tool: m_hypoTools ) {
57  ATH_MSG_VERBOSE( "+++++ Hypo Tool name: " << tool->name() );
58  std::cmatch results;
59  if( std::regex_search(tool->name().c_str(),results,std::regex("hitdvjet(\\d+)_(\\w+)_")) ) {
60  std::string sth = results[1].str();
61  std::string swp = results[2].str();
62  ATH_MSG_VERBOSE( " thres = " << sth << ", wp = " << swp );
63  int thres = std::stoi(sth);
64  if( thres < m_tools_lowest_jetEt ) m_tools_lowest_jetEt = thres;
65  if( swp == "loose" && m_tools_loosest_wp >= 1 ) m_tools_loosest_wp = 1;
66  if( swp == "medium" && m_tools_loosest_wp >= 2 ) m_tools_loosest_wp = 2;
67  if( swp == "tight" && m_tools_loosest_wp >= 3 ) m_tools_loosest_wp = 3;
68  }
69  }
70  ATH_MSG_DEBUG( "Lowest jetEt used in hypo tools = " << m_tools_lowest_jetEt << " (GeV)" );
71  ATH_MSG_DEBUG( "Loosest WP used in hypo tools = " << m_tools_loosest_wp << " (loose=1,medium=2,tight=3)");
72  // loose : eta<2.0, SP seed=true, BDT eff=0.9
73  // medium: eta<2.0, SP seed=false, BDT eff=0.75
74  // tight : eta<1.0, SP seed=false, BDT eff=0.75
75 
76  CHECK( m_jetsKey.initialize() );
77  CHECK( m_hitDVKey.initialize());
78  CHECK( m_tracksKey.initialize());
81 
82  if ( !m_monTool.empty() ) CHECK( m_monTool.retrieve() );
83 
85  ATH_CHECK(m_spacePointTool.retrieve() );
86 
87 
88  for (auto& reader : m_tmva_reader) {
89  // Create two instances with same variables
90  auto tmva = std::array{std::make_unique<TMVA::Reader>( "!Color:!Silent" ),
91  std::make_unique<TMVA::Reader>( "!Color:!Silent" )};
92  for (auto& t : tmva) {
93  t->AddVariable("n_track_qual", &reader.n_track_qual);
94  t->AddVariable("ly0_sp_frac", &reader.ly0_sp_frac);
95  t->AddVariable("ly1_sp_frac", &reader.ly1_sp_frac);
96  t->AddVariable("ly2_sp_frac", &reader.ly2_sp_frac);
97  t->AddVariable("ly3_sp_frac", &reader.ly3_sp_frac);
98  t->AddVariable("ly4_sp_frac", &reader.ly4_sp_frac);
99  t->AddVariable("ly5_sp_frac", &reader.ly5_sp_frac);
100  t->AddVariable("ly6_sp_frac", &reader.ly6_sp_frac);
101  t->AddVariable("ly7_sp_frac", &reader.ly7_sp_frac);
102  };
103  reader.tmva_0eta1 = std::move(tmva[0]);
104  reader.tmva_1eta2 = std::move(tmva[1]);
105 
106  // --- Book the MVA methods specific to eta range
107  const std::string tuningVer = "v22a"; // "v21a";
108  const std::string methodName = "BDT method";
109 
110  const std::string weightfile_0eta1 = PathResolver::find_calib_file(
111  "TrigHitDVHypo/HitDV.BDT.weights.0eta1." + tuningVer + ".xml");
112  const std::string weightfile_1eta2 = PathResolver::find_calib_file(
113  "TrigHitDVHypo/HitDV.BDT.weights.1eta2." + tuningVer + ".xml");
114  ATH_MSG_DEBUG("opening weightfile = " << weightfile_0eta1);
115  ATH_MSG_DEBUG("opening weightfile = " << weightfile_1eta2);
116  reader.tmva_0eta1->BookMVA(methodName, weightfile_0eta1);
117  reader.tmva_1eta2->BookMVA(methodName, weightfile_1eta2);
118  }
119 
120  return StatusCode::SUCCESS;
121 }
122 
123 // ------------------------------------------------------------------------------------------------
124 // ------------------------------------------------------------------------------------------------
125 
126 StatusCode TrigHitDVHypoAlg::execute( const EventContext& context ) const
127 {
128 
129  const TrigRoiDescriptor roi = TrigRoiDescriptor(0, -4.5, 4.5, 0, -M_PI, M_PI, 0, -168.0, 168.0);
130  std::vector<TrigSiSpacePointBase> convertedSpacePoints;
131  convertedSpacePoints.reserve(5000);
132  int mnt_roi_nSPsPIX;
133  int mnt_roi_nSPsSCT;
134  ATH_CHECK(m_spacePointTool->getSpacePoints(roi, convertedSpacePoints, mnt_roi_nSPsPIX, mnt_roi_nSPsSCT, context));
135 
136  // monitoring
137  auto mon_n_dvtrks = Monitored::Scalar<int>( "n_dvtrks", 0 );
138  auto mon_n_dvsps = Monitored::Scalar<int>( "n_dvsps", 0 );
139  auto mon_n_jetseeds = Monitored::Scalar<int>( "n_jetseeds", 0 );
140  auto mon_n_jetseedsdel= Monitored::Scalar<int>( "n_jetseedsdel",0 );
141  auto mon_n_spseeds = Monitored::Scalar<int>( "n_spseeds", 0 );
142  auto mon_n_spseedsdel = Monitored::Scalar<int>( "n_spseedsdel", 0 );
143  auto mon_average_mu = Monitored::Scalar<float>( "average_mu", 0.);
144  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 );
145 
146  // previous decisions
147  ATH_MSG_DEBUG( "Retrieving pervious decision: \"" << decisionInput().key() << "\"" );
148  auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context );
149  ATH_CHECK( previousDecisionsHandle.isValid() );
150 
151  ATH_MSG_DEBUG( "Running with " << previousDecisionsHandle->size() << " previous decisions" );
152  if( previousDecisionsHandle->size()!=1 ) {
153  ATH_MSG_ERROR( "Previous decision handle size is not 1. It is" << previousDecisionsHandle->size() );
154  return StatusCode::FAILURE;
155  }
156  const Decision * previousDecision = previousDecisionsHandle->at(0);
157 
158  TrigCompositeUtils::DecisionIDContainer previousDecisionIDs;
159  TrigCompositeUtils::decisionIDs(previousDecision, previousDecisionIDs);
160  ATH_MSG_DEBUG( "IDs of active legs:" );
161  for(auto decisionID: previousDecisionIDs) { ATH_MSG_DEBUG( " " << decisionID ); }
162 
163  // new output decisions
164  ATH_MSG_DEBUG( "Creating new output decision handle" );
166  auto outputDecisions = outputHandle.ptr();
167 
168  // input objects
169 
170  // jets
171  auto jetsHandle = SG::makeHandle(m_jetsKey, context );
172  ATH_CHECK( jetsHandle.isValid() );
173  ATH_MSG_DEBUG( "jet handle size: " << jetsHandle->size() );
174 
175  const xAOD::JetContainer* jetsContainer = jetsHandle.get();
176  if( jetsContainer == nullptr ) {
177  ATH_MSG_ERROR( "ERROR Cannot get jet container" );
178  return StatusCode::FAILURE;
179  }
180  bool isJetEtPassToolsCut = false;
181  float jetEtaToolsCut = 2.0;
182  if( m_tools_loosest_wp >= 3 ) jetEtaToolsCut = 1.0;
183  for ( const xAOD::Jet* jet : *jetsContainer ) {
184  float jet_pt = static_cast<float>(jet->pt() / Gaudi::Units::GeV );
185  float jet_eta = static_cast<float>(jet->eta());
186  if( jet_pt >= m_tools_lowest_jetEt && std::abs(jet_eta)<=jetEtaToolsCut ) {
187  isJetEtPassToolsCut = true;
188  break;
189  }
190  }
191 
192  auto tracks = SG::makeHandle( m_tracksKey, context );
193  ATH_CHECK(tracks.isValid());
194 
195  std::vector<HitDVSeed> hitDVSeedsContainer;
196  std::vector<HitDVTrk> hitDVTrksContainer;
197  std::vector<HitDVSpacePoint> hitDVSPsContainer;
198 
199 
200  ATH_CHECK( findHitDV(context, convertedSpacePoints, *tracks, hitDVSeedsContainer, hitDVTrksContainer, hitDVSPsContainer) );
201 
202  mon_n_dvtrks = hitDVTrksContainer.size();
203  mon_n_dvsps = hitDVSPsContainer.size();
204  const unsigned int N_MAX_SP_STORED = 100000;
205  bool isSPOverflow = false;
206  if( hitDVSPsContainer.size() >= N_MAX_SP_STORED ) isSPOverflow = true;
207  ATH_MSG_DEBUG( "hitDVSP size=" << mon_n_dvsps );
208 
209  // average mu
210  float averageMu = 0;
211  if( m_isMC ) {
212  if( m_lumiBlockMuTool ) {
213  averageMu = static_cast<float>(m_lumiBlockMuTool->averageInteractionsPerCrossing());
214  ATH_MSG_DEBUG( "offline averageMu = " << averageMu );
215  }
216  }
217  else {
219  averageMu = lcd.cptr()->lbAverageInteractionsPerCrossing();
220  ATH_MSG_DEBUG( "online averageMu = " << averageMu );
221  }
222  mon_average_mu = averageMu;
223 
224  // find seeds based on HLT jets
225  std::vector<float> jetSeeds_pt;
226  std::vector<float> jetSeeds_eta;
227  std::vector<float> jetSeeds_phi;
228  ATH_CHECK( findJetSeeds(jetsContainer, m_jetSeed_ptMin, m_jetSeed_etaMax, jetSeeds_pt, jetSeeds_eta, jetSeeds_phi) );
229  int n_alljetseeds = jetSeeds_eta.size();
230  ATH_CHECK( selectSeedsNearby(hitDVSeedsContainer, jetSeeds_eta, jetSeeds_phi, jetSeeds_pt) );
231  mon_n_jetseeds = jetSeeds_eta.size();
232  mon_n_jetseedsdel = n_alljetseeds - jetSeeds_eta.size();
233 
234  // find seeds based on SP frac itself
235  std::vector<float> spSeeds_eta;
236  std::vector<float> spSeeds_phi;
237  std::vector<float> void_pt;
238  int n_allspseeds = 0;
239  if( m_tools_loosest_wp <= 1 ) {
240  ATH_CHECK( findSPSeeds(context, hitDVSPsContainer, spSeeds_eta, spSeeds_phi) );
241  n_allspseeds = spSeeds_eta.size();
242  ATH_CHECK( selectSeedsNearby(hitDVSeedsContainer, spSeeds_eta, spSeeds_phi, void_pt) );
243  mon_n_spseeds = spSeeds_eta.size();
244  mon_n_spseedsdel = n_allspseeds - spSeeds_eta.size();
245  }
246  else {
247  mon_n_spseeds = 0;
248  mon_n_spseedsdel = 0;
249  }
250 
251  // output EDM object
252  auto hitDVContainer = std::make_unique<xAOD::TrigCompositeContainer>();
253  auto hitDVContainerAux = std::make_unique<xAOD::TrigCompositeAuxContainer>();
254  hitDVContainer->setStore(hitDVContainerAux.get());
255 
256  xAOD::TrigCompositeContainer* dvContainer = hitDVContainer.get();
257  std::vector<TrigHitDVHypoTool::HitDVHypoInfo> hitDVHypoInputs;
258  std::unordered_map<Decision*, size_t> mapDecIdx;
259 
260  // calculate BDT and create hitDVContainer EDM
261  if( isJetEtPassToolsCut ) {
262  const float preselBDTthreshold = -0.6;
263 
264  int n_passed_jet = 0;
265  int seed_type = SeedType::HLTJet;
266  ATH_CHECK( calculateBDT(context, hitDVSPsContainer, hitDVTrksContainer, jetSeeds_pt, jetSeeds_eta, jetSeeds_phi, preselBDTthreshold, seed_type, dvContainer, n_passed_jet) );
267 
268  int n_passed_sp = 0;
269  if( m_tools_loosest_wp <= 1 ) {
270  seed_type = SeedType::SP;
271  ATH_CHECK( calculateBDT(context, hitDVSPsContainer, hitDVTrksContainer, void_pt, spSeeds_eta, spSeeds_phi, preselBDTthreshold, seed_type, dvContainer, n_passed_sp) );
272  }
273 
274  ATH_MSG_DEBUG( "nr of dv container / jet-seeded / sp-seed candidates = " << dvContainer->size() << " / " << n_passed_jet << " / " << n_passed_sp );
275 
276  // Prepare inputs to HypoTool
277  for ( auto dv : *dvContainer ) {
278  Decision* newDecision = TrigCompositeUtils::newDecisionIn( outputDecisions, previousDecision, TrigCompositeUtils::hypoAlgNodeName(), context);
279  mapDecIdx.emplace( newDecision, dv->index() );
280  TrigHitDVHypoTool::HitDVHypoInfo hypoInfo{ newDecision, isSPOverflow, averageMu, dv, previousDecisionIDs };
281  hitDVHypoInputs.push_back( hypoInfo );
282  }
283  }
284 
285  // monitor
286  ATH_CHECK( doMonitor(dvContainer) );
287 
288  // Loop over all hypoToolinputs and get their decisions
289  for ( auto & tool: m_hypoTools ) {
290  ATH_MSG_DEBUG( "+++++ Now computing decision for " << tool->name() );
291  ATH_CHECK( tool->decide( hitDVHypoInputs ) );
292  }
293 
294  // record hitDV object
296  ATH_CHECK( hitDVHandle.record( std::move( hitDVContainer ), std::move( hitDVContainerAux ) ) );
297  ATH_MSG_DEBUG( "recorded hitDV object to SG" );
298 
299  DecisionContainer::iterator it = outputDecisions->begin();
300  while(it != outputDecisions->end()) {
301  ATH_MSG_DEBUG( "+++++ outputDecision: " << *it << " +++++" );
302  if ( allFailed( *it ) ) {
303  ATH_MSG_DEBUG( "---> all failed, erasing" );
304  it = outputDecisions->erase(it);
305  } else {
306  ATH_MSG_DEBUG( "---> not all failed" );
307 
308  // Link hitDV object
309  auto decision = *it;
310  size_t idx = mapDecIdx.at(*it);
311 
313  ATH_CHECK( dvEL.isValid() );
314 
315  ATH_CHECK( decision->setObjectLink<xAOD::TrigCompositeContainer>(featureString(), dvEL) );
316 
317  ATH_MSG_DEBUG(*decision);
318  ++it;
319  }
320  }
321 
322  //
323  ATH_CHECK( hypoBaseOutputProcessing(outputHandle) );
324 
325  //
326  return StatusCode::SUCCESS;
327 }
328 
329 // ------------------------------------------------------------------------------------------------
330 // ------------------------------------------------------------------------------------------------
331 
332 float TrigHitDVHypoAlg::deltaR2(float eta_1, float phi_1, float eta_2, float phi_2) const {
333  float dPhi = CxxUtils::wrapToPi(phi_1 - phi_2);
334  float dEta = eta_1 - eta_2;
335  return (dPhi*dPhi)+(dEta*dEta);
336 }
337 
338 // ------------------------------------------------------------------------------------------------
339 // ------------------------------------------------------------------------------------------------
340 
342 {
343  float abseta = std::fabs(eta);
344 
345  // if Pixel/SCT barrel, layer number is as it is
346  if( 0<=layer && layer <=7 ) {
347  ATH_MSG_VERBOSE("layer=" << layer << ", eta=" << abseta);
348  return layer;
349  }
350 
351  // for Pixel/SCT endcap, assign layer number of 0-7 depending on eta range
352 
353  int base = 0;
354 
355  //
356  const float PixBR6limit = 1.29612;
357  const float PixBR5limit = 1.45204;
358  const float PixBR4limit = 1.64909;
359  const float PixBR3limit = 1.90036;
360  const float PixBR2limit = 2.2146;
361 
362  // Pixel Endcap #1
363  base = 8;
364  if( layer==base || layer==(base+12) ) {
365  ATH_MSG_VERBOSE("Pix EC1, eta=" << abseta);
366  if( abseta > PixBR2limit ) return 2;
367  return 3;
368  }
369 
370  // Pixel Endcap #2
371  base = 9;
372  if( layer==base || layer==(base+12) ) {
373  ATH_MSG_VERBOSE("Pix EC2, eta=" << abseta);
374  if( abseta > PixBR2limit ) return 2;
375  return 3;
376  }
377 
378  // Pixel Endcap #3
379  base = 10;
380  if( layer==base || layer==(base+12) ) {
381  ATH_MSG_VERBOSE("Pix EC3, eta=" << abseta);
382  return 3;
383  }
384 
385  // SCT Endcap #1
386  base = 11;
387  if( layer==base || layer==(base+12) ) {
388  ATH_MSG_VERBOSE("Sct EC1, eta=" << abseta);
389  if( abseta < PixBR6limit ) return 7;
390  else if( abseta < PixBR5limit ) return 6;
391  return 5;
392  }
393 
394  // SCT Endcap #2
395  base = 12;
396  if( layer==base || layer==(base+12) ) {
397  ATH_MSG_VERBOSE("Sct EC2, eta=" << abseta);
398  if( abseta < PixBR5limit ) return 7;
399  else if( abseta < PixBR4limit ) return 6;
400  return 4;
401  }
402 
403  // SCT Endcap #3
404  base = 13;
405  if( layer==base || layer==(base+12) ) {
406  ATH_MSG_VERBOSE("Sct EC3, eta=" << abseta);
407  if( abseta < PixBR4limit ) return 7;
408  return 5;
409  }
410 
411  // SCT Endcap #4
412  base = 14;
413  if( layer==base || layer==(base+12) ) {
414  ATH_MSG_VERBOSE("Sct EC4, eta=" << abseta);
415  if( abseta < PixBR4limit ) return 6;
416  else if( abseta < PixBR3limit ) return 6;
417  return 4;
418  }
419 
420  // SCT Endcap #5
421  base = 15;
422  if( layer==base || layer==(base+12) ) {
423  ATH_MSG_VERBOSE("Sct EC5, eta=" << abseta);
424  if( abseta < PixBR3limit ) return 7;
425  return 5;
426  }
427 
428  // SCT Endcap #6
429  base = 16;
430  if( layer==base || layer==(base+12) ) {
431  ATH_MSG_VERBOSE("Sct EC6, eta=" << abseta);
432  if( abseta < PixBR3limit ) return 6;
433  return 4;
434  }
435 
436  // SCT Endcap #7
437  base = 17;
438  if( layer==base || layer==(base+12) ) {
439  ATH_MSG_VERBOSE("Sct EC7, eta=" << abseta);
440  if( abseta < PixBR3limit ) return 7;
441  return 5;
442  }
443 
444  // SCT Endcap #8
445  base = 18;
446  if( layer==base || layer==(base+12) ) {
447  ATH_MSG_VERBOSE("Sct EC8, eta=" << abseta);
448  if( abseta < PixBR3limit ) return 7;
449  return 6;
450  }
451 
452  // SCT Endcap #9
453  base = 19;
454  if( layer==base || layer==(base+12) ) {
455  ATH_MSG_VERBOSE("Sct EC9, eta=" << abseta);
456  return 7;
457  }
458 
459  return 0;
460 }
461 
462 // ------------------------------------------------------------------------------------------------
463 // ------------------------------------------------------------------------------------------------
464 
466 {
467  std::vector<float> mnt_eta1_ly0_spfr;
468  std::vector<float> mnt_eta1_ly1_spfr;
469  std::vector<float> mnt_eta1_ly2_spfr;
470  std::vector<float> mnt_eta1_ly3_spfr;
471  std::vector<float> mnt_eta1_ly4_spfr;
472  std::vector<float> mnt_eta1_ly5_spfr;
473  std::vector<float> mnt_eta1_ly6_spfr;
474  std::vector<float> mnt_eta1_ly7_spfr;
475  std::vector<int> mnt_eta1_n_qtrk;
476  std::vector<float> mnt_eta1_bdtscore;
477  std::vector<float> mnt_1eta2_ly0_spfr;
478  std::vector<float> mnt_1eta2_ly1_spfr;
479  std::vector<float> mnt_1eta2_ly2_spfr;
480  std::vector<float> mnt_1eta2_ly3_spfr;
481  std::vector<float> mnt_1eta2_ly4_spfr;
482  std::vector<float> mnt_1eta2_ly5_spfr;
483  std::vector<float> mnt_1eta2_ly6_spfr;
484  std::vector<float> mnt_1eta2_ly7_spfr;
485  std::vector<int> mnt_1eta2_n_qtrk;
486  std::vector<float> mnt_1eta2_bdtscore;
487  auto mon_eta1_ly0_spfr = Monitored::Collection("eta1_ly0_spfr", mnt_eta1_ly0_spfr);
488  auto mon_eta1_ly1_spfr = Monitored::Collection("eta1_ly1_spfr", mnt_eta1_ly1_spfr);
489  auto mon_eta1_ly2_spfr = Monitored::Collection("eta1_ly2_spfr", mnt_eta1_ly2_spfr);
490  auto mon_eta1_ly3_spfr = Monitored::Collection("eta1_ly3_spfr", mnt_eta1_ly3_spfr);
491  auto mon_eta1_ly4_spfr = Monitored::Collection("eta1_ly4_spfr", mnt_eta1_ly4_spfr);
492  auto mon_eta1_ly5_spfr = Monitored::Collection("eta1_ly5_spfr", mnt_eta1_ly5_spfr);
493  auto mon_eta1_ly6_spfr = Monitored::Collection("eta1_ly6_spfr", mnt_eta1_ly6_spfr);
494  auto mon_eta1_ly7_spfr = Monitored::Collection("eta1_ly7_spfr", mnt_eta1_ly7_spfr);
495  auto mon_eta1_n_qtrk = Monitored::Collection("eta1_n_qtrk", mnt_eta1_n_qtrk);
496  auto mon_eta1_bdtscore = Monitored::Collection("eta1_bdtscore", mnt_eta1_bdtscore);
497  auto mon_1eta2_ly0_spfr = Monitored::Collection("1eta2_ly0_spfr", mnt_1eta2_ly0_spfr);
498  auto mon_1eta2_ly1_spfr = Monitored::Collection("1eta2_ly1_spfr", mnt_1eta2_ly1_spfr);
499  auto mon_1eta2_ly2_spfr = Monitored::Collection("1eta2_ly2_spfr", mnt_1eta2_ly2_spfr);
500  auto mon_1eta2_ly3_spfr = Monitored::Collection("1eta2_ly3_spfr", mnt_1eta2_ly3_spfr);
501  auto mon_1eta2_ly4_spfr = Monitored::Collection("1eta2_ly4_spfr", mnt_1eta2_ly4_spfr);
502  auto mon_1eta2_ly5_spfr = Monitored::Collection("1eta2_ly5_spfr", mnt_1eta2_ly5_spfr);
503  auto mon_1eta2_ly6_spfr = Monitored::Collection("1eta2_ly6_spfr", mnt_1eta2_ly6_spfr);
504  auto mon_1eta2_ly7_spfr = Monitored::Collection("1eta2_ly7_spfr", mnt_1eta2_ly7_spfr);
505  auto mon_1eta2_n_qtrk = Monitored::Collection("1eta2_n_qtrk", mnt_1eta2_n_qtrk);
506  auto mon_1eta2_bdtscore = Monitored::Collection("1eta2_bdtscore", mnt_1eta2_bdtscore);
507  auto monitorIt = Monitored::Group( m_monTool,
508  mon_eta1_ly0_spfr, mon_eta1_ly1_spfr, mon_eta1_ly2_spfr, mon_eta1_ly3_spfr,
509  mon_eta1_ly4_spfr, mon_eta1_ly5_spfr, mon_eta1_ly6_spfr, mon_eta1_ly7_spfr,
510  mon_eta1_n_qtrk, mon_eta1_bdtscore,
511  mon_1eta2_ly0_spfr, mon_1eta2_ly1_spfr, mon_1eta2_ly2_spfr, mon_1eta2_ly3_spfr,
512  mon_1eta2_ly4_spfr, mon_1eta2_ly5_spfr, mon_1eta2_ly6_spfr, mon_1eta2_ly7_spfr,
513  mon_1eta2_n_qtrk, mon_1eta2_bdtscore);
514 
515  //
516  for ( auto dv : *dvContainer ) {
517  int seed_type = dv->getDetail<int> ("hitDV_seed_type");
518  // do not fill sp-seeded candidates
519  if( seed_type == SeedType::SP ) continue;
520  float seed_eta = dv->getDetail<float>("hitDV_seed_eta");
521  int n_track_qual= dv->getDetail<int> ("hitDV_n_track_qual");
522  float bdt_score = dv->getDetail<float>("hitDV_bdt_score");
523  float ly0_sp_frac = dv->getDetail<float>("hitDV_ly0_sp_frac");
524  float ly1_sp_frac = dv->getDetail<float>("hitDV_ly1_sp_frac");
525  float ly2_sp_frac = dv->getDetail<float>("hitDV_ly2_sp_frac");
526  float ly3_sp_frac = dv->getDetail<float>("hitDV_ly3_sp_frac");
527  float ly4_sp_frac = dv->getDetail<float>("hitDV_ly4_sp_frac");
528  float ly5_sp_frac = dv->getDetail<float>("hitDV_ly5_sp_frac");
529  float ly6_sp_frac = dv->getDetail<float>("hitDV_ly6_sp_frac");
530  float ly7_sp_frac = dv->getDetail<float>("hitDV_ly7_sp_frac");
531  if( std::abs(seed_eta) < 1.0 ) {
532  mnt_eta1_ly0_spfr.push_back(ly0_sp_frac);
533  mnt_eta1_ly1_spfr.push_back(ly1_sp_frac);
534  mnt_eta1_ly2_spfr.push_back(ly2_sp_frac);
535  mnt_eta1_ly3_spfr.push_back(ly3_sp_frac);
536  mnt_eta1_ly4_spfr.push_back(ly4_sp_frac);
537  mnt_eta1_ly5_spfr.push_back(ly5_sp_frac);
538  mnt_eta1_ly6_spfr.push_back(ly6_sp_frac);
539  mnt_eta1_ly7_spfr.push_back(ly7_sp_frac);
540  mnt_eta1_n_qtrk.push_back(n_track_qual);
541  mnt_eta1_bdtscore.push_back(bdt_score);
542  }
543  else if( std::abs(seed_eta) < 2.0 ) {
544  mnt_1eta2_ly0_spfr.push_back(ly0_sp_frac);
545  mnt_1eta2_ly1_spfr.push_back(ly1_sp_frac);
546  mnt_1eta2_ly2_spfr.push_back(ly2_sp_frac);
547  mnt_1eta2_ly3_spfr.push_back(ly3_sp_frac);
548  mnt_1eta2_ly4_spfr.push_back(ly4_sp_frac);
549  mnt_1eta2_ly5_spfr.push_back(ly5_sp_frac);
550  mnt_1eta2_ly6_spfr.push_back(ly6_sp_frac);
551  mnt_1eta2_ly7_spfr.push_back(ly7_sp_frac);
552  mnt_1eta2_n_qtrk.push_back(n_track_qual);
553  mnt_1eta2_bdtscore.push_back(bdt_score);
554  }
555  }
556 
557  //
558  return StatusCode::SUCCESS;
559 }
560 
561 // ------------------------------------------------------------------------------------------------
562 // ------------------------------------------------------------------------------------------------
563 
564 StatusCode TrigHitDVHypoAlg::calculateBDT(const EventContext& context,
565  const std::vector<HitDVSpacePoint>& spsContainer,
566  const std::vector<HitDVTrk>& trksContainer,
567  const std::vector<float>& seeds_pt,
568  const std::vector<float>& seeds_eta, const std::vector<float>& seeds_phi,
569  const float& cutBDTthreshold, const int seed_type,
570  xAOD::TrigCompositeContainer* dvContainer, int& n_passed) const
571 {
572  if( seeds_eta.size() != seeds_phi.size() ) return StatusCode::SUCCESS;
573  n_passed = 0;
574 
575  for(unsigned int iseed=0; iseed<seeds_eta.size(); iseed++) {
576 
577  float seed_eta = seeds_eta[iseed];
578  float seed_phi = seeds_phi[iseed];
579 
580  ATH_MSG_VERBOSE("+++++ seed eta: " << seed_eta << ", phi:" << seed_phi << " +++++");
581 
582  // loop on space points
583  const int N_LAYER = 8;
584  const float DR_SQUARED_TO_REF_CUT = 0.16; // const float DR_TO_REF_CUT = 0.4;
585 
586  int n_sp_injet = 0;
587  int n_sp_injet_usedByTrk = 0;
588  int v_n_sp_injet[N_LAYER];
589  int v_n_sp_injet_usedByTrk[N_LAYER];
590  for(int i=0; i<N_LAYER; i++) { v_n_sp_injet[i]=0; v_n_sp_injet_usedByTrk[i]=0; }
591 
592  for ( const auto & spData : spsContainer ) {
593  // match within dR
594  float sp_eta = spData.eta;
595  float sp_phi = spData.phi;
596  float dR2 = deltaR2(sp_eta,sp_phi,seed_eta,seed_phi);
597  if( dR2 > DR_SQUARED_TO_REF_CUT ) continue;
598 
599  //
600  int sp_layer = (int)spData.layer;
601  int sp_trkid = (int)spData.usedTrkId;
602  bool isUsedByTrk = (sp_trkid != -1);
603 
604  int ilayer = getSPLayer(sp_layer,sp_eta);
605 
606  if( ilayer<=7 ) { // Pixel barrel or Sct barrel
607  n_sp_injet++;
608  v_n_sp_injet[ilayer]++;
609  if( isUsedByTrk ) {
610  n_sp_injet_usedByTrk++;
611  v_n_sp_injet_usedByTrk[ilayer]++;
612  }
613  }
614  }
615  ATH_MSG_VERBOSE("nr of SPs in jet: usedByTrk / all = " << n_sp_injet_usedByTrk << " / " << n_sp_injet);
616  float v_ly_sp_frac[N_LAYER];
617  for(int i=0; i<N_LAYER; i++) {
618  float frac = 0.;
619  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]);
620  v_ly_sp_frac[i] = frac;
621  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]);
622  }
623 
624  // loop on tracks
625  const float TRK_PT_GEV_CUT = 2.0;
626 
627  unsigned int n_qtrk_injet = 0;
628  for ( const auto& trk : trksContainer ) {
629  float trk_ptGeV = trk.pt;
630  trk_ptGeV /= Gaudi::Units::GeV;
631  if( trk_ptGeV < TRK_PT_GEV_CUT ) continue;
632  float dR2 = deltaR2(trk.eta,trk.phi,seed_eta,seed_phi);
633  if( dR2 > DR_SQUARED_TO_REF_CUT ) continue;
634  n_qtrk_injet++;
635  }
636  ATH_MSG_DEBUG("nr of all / quality tracks matched = " << trksContainer.size() << " / " << n_qtrk_injet);
637 
638  // evaluate BDT
639  bool isSeedOutOfRange = false;
640  if( n_qtrk_injet == 0 ) {
641  isSeedOutOfRange = true;
642  for(int i=0; i<N_LAYER; i++) {
643  if( std::fabs(v_ly_sp_frac[i]) > 1e-3 ) {
644  isSeedOutOfRange = false; break;
645  }
646  }
647  }
648  float bdt_score = -2.0;
649  if( ! isSeedOutOfRange ) {
650  auto& reader = *m_tmva_reader.get(context);
651  reader.n_track_qual = static_cast<float>(n_qtrk_injet);
652  reader.ly0_sp_frac = v_ly_sp_frac[0];
653  reader.ly1_sp_frac = v_ly_sp_frac[1];
654  reader.ly2_sp_frac = v_ly_sp_frac[2];
655  reader.ly3_sp_frac = v_ly_sp_frac[3];
656  reader.ly4_sp_frac = v_ly_sp_frac[4];
657  reader.ly5_sp_frac = v_ly_sp_frac[5];
658  reader.ly6_sp_frac = v_ly_sp_frac[6];
659  reader.ly7_sp_frac = v_ly_sp_frac[7];
660 
661  if ( std::abs(seed_eta) < 1 ) {
662  bdt_score = reader.tmva_0eta1->EvaluateMVA("BDT method");
663  } else if ( std::abs(seed_eta) < 2 ) {
664  bdt_score = reader.tmva_1eta2->EvaluateMVA("BDT method");
665  }
666  }
667 
668  // BDT threshold
669  if( bdt_score < cutBDTthreshold ) continue;
670 
671  // passed selection
672  ATH_MSG_VERBOSE("Passed selection");
673  n_passed++;
674 
675  // create EDM object
677  dv->makePrivateStore();
678  dvContainer->push_back(dv);
679 
680  float seed_pt = 0;
681  if ( seed_type == SeedType::HLTJet ) seed_pt = seeds_pt[iseed];
682  dv->setDetail<float>("hitDV_seed_pt", seed_pt);
683  dv->setDetail<float>("hitDV_seed_eta", seed_eta);
684  dv->setDetail<float>("hitDV_seed_phi", seed_phi);
685  dv->setDetail<int> ("hitDV_seed_type", seed_type);
686  dv->setDetail<int> ("hitDV_n_track_qual", n_qtrk_injet);
687  dv->setDetail<float>("hitDV_ly0_sp_frac", v_ly_sp_frac[0]);
688  dv->setDetail<float>("hitDV_ly1_sp_frac", v_ly_sp_frac[1]);
689  dv->setDetail<float>("hitDV_ly2_sp_frac", v_ly_sp_frac[2]);
690  dv->setDetail<float>("hitDV_ly3_sp_frac", v_ly_sp_frac[3]);
691  dv->setDetail<float>("hitDV_ly4_sp_frac", v_ly_sp_frac[4]);
692  dv->setDetail<float>("hitDV_ly5_sp_frac", v_ly_sp_frac[5]);
693  dv->setDetail<float>("hitDV_ly6_sp_frac", v_ly_sp_frac[6]);
694  dv->setDetail<float>("hitDV_ly7_sp_frac", v_ly_sp_frac[7]);
695  dv->setDetail<float>("hitDV_bdt_score", bdt_score);
696 
697  ATH_MSG_VERBOSE("Created a new entry EDM");
698  }
699  ATH_MSG_DEBUG("nr of BDT passed = " << n_passed);
700 
701  //
702  return StatusCode::SUCCESS;
703 }
704 
705 // ------------------------------------------------------------------------------------------------
706 // ------------------------------------------------------------------------------------------------
707 
708 StatusCode TrigHitDVHypoAlg::findJetSeeds(const xAOD::JetContainer* jetsContainer, const float cutJetPt, const float cutJetEta,
709  std::vector<float>& jetSeeds_pt, std::vector<float>& jetSeeds_eta, std::vector<float>& jetSeeds_phi) const
710 {
711  std::vector<float> mnt_jet_pt;
712  std::vector<float> mnt_jet_eta;
713  auto mon_jet_pt = Monitored::Collection("jet_pt", mnt_jet_pt);
714  auto mon_jet_eta = Monitored::Collection("jet_eta", mnt_jet_eta);
715  auto monitorIt = Monitored::Group( m_monTool, mon_jet_pt, mon_jet_eta );
716 
717  ATH_MSG_VERBOSE("looking for jet seed with pt cut=" << cutJetPt << ", eta cut=" << cutJetEta);
718  for ( const xAOD::Jet* jet : *jetsContainer ) {
719  float jet_pt = static_cast<float>(jet->pt() / Gaudi::Units::GeV );
720  if( jet_pt < cutJetPt ) {
721  ATH_MSG_VERBOSE("Fails jet pt cut, pt = " << jet_pt);
722  continue;
723  }
724  mnt_jet_pt.push_back(jet_pt);
725  float jet_eta = static_cast<float>(jet->eta());
726  mnt_jet_eta.push_back(jet_eta);
727  if( std::fabs(jet_eta) > cutJetEta ) {
728  ATH_MSG_VERBOSE("Fails jet eta cut, eta = " << jet_eta);
729  continue;
730  }
731  float jet_phi = static_cast<float>(jet->phi());
732  jetSeeds_pt.push_back(jet_pt);
733  jetSeeds_eta.push_back(jet_eta);
734  jetSeeds_phi.push_back(jet_phi);
735  }
736  ATH_MSG_VERBOSE("nr of jet seeds=" << jetSeeds_eta.size());
737 
738  return StatusCode::SUCCESS;
739 }
740 
741 // ------------------------------------------------------------------------------------------------
742 // ------------------------------------------------------------------------------------------------
743 
744 StatusCode TrigHitDVHypoAlg::findSPSeeds( const EventContext& ctx, const std::vector<HitDVSpacePoint>& spsContainer,
745  std::vector<float>& seeds_eta, std::vector<float>& seeds_phi ) const
746 {
747  seeds_eta.clear();
748  seeds_phi.clear();
749 
750  const int NBINS_ETA = 50;
751  const float ETA_MIN = -2.5;
752  const float ETA_MAX = 2.5;
753 
754  const int NBINS_PHI = 80;
755  const float PHI_MIN = -4.0;
756  const float PHI_MAX = 4.0;
757 
758  char hname[64];
759 
760  unsigned int slotnr = ctx.slot();
761  unsigned int subSlotnr = ctx.subSlot();
762 
763  sprintf(hname,"hitdv_s%u_ss%u_ly6_h2_nsp",slotnr,subSlotnr);
764  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);
765  sprintf(hname,"hitdv_s%u_ss%u_ly7_h2_nsp",slotnr,subSlotnr);
766  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);
767 
768  sprintf(hname,"hitdv_s%u_ss%u_ly6_h2_nsp_notrk",slotnr,subSlotnr);
769  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);
770  sprintf(hname,"hitdv_s%u_ss%u_ly7_h2_nsp_notrk",slotnr,subSlotnr);
771  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);
772 
773  for ( const auto& spData : spsContainer ) {
774  int16_t sp_layer = spData.layer;
775  float sp_eta = spData.eta;
776  int ilayer = getSPLayer(sp_layer,sp_eta);
777  if( ilayer<6 ) continue;
778 
779  int sp_trkid = (int)spData.usedTrkId;
780  bool isUsedByTrk = (sp_trkid != -1);
781  float sp_phi = spData.phi;
782 
783  bool fill_out_of_pi = false;
784  float sp_phi2 = 0;
785  if( sp_phi < 0 ) {
786  sp_phi2 = 2*TMath::Pi() + sp_phi;
787  if( sp_phi2 < PHI_MAX ) fill_out_of_pi = true;
788  }
789  else {
790  sp_phi2 = -2*TMath::Pi() + sp_phi;
791  if( PHI_MIN < sp_phi2 ) fill_out_of_pi = true;
792  }
793  if( ilayer==6 ) {
794  ly6_h2_nsp->Fill(sp_eta,sp_phi);
795  if( fill_out_of_pi ) ly6_h2_nsp->Fill(sp_eta,sp_phi2);
796  if( ! isUsedByTrk ) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi);
797  if( ! isUsedByTrk && fill_out_of_pi) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
798  }
799  if( ilayer==7 ) {
800  ly7_h2_nsp->Fill(sp_eta,sp_phi);
801  if( fill_out_of_pi ) ly7_h2_nsp->Fill(sp_eta,sp_phi2);
802  if( ! isUsedByTrk ) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi);
803  if( ! isUsedByTrk && fill_out_of_pi) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
804  }
805  }
806 
807  ATH_MSG_VERBOSE("looking for ly6/ly6 doublet seeds");
808 
809  // (idx, sort/weight, eta, phi)
810  std::vector<std::tuple<int,float,float,float>> QT;
811 
812  for(int ly6_ieta=1; ly6_ieta<=NBINS_ETA; ly6_ieta++) {
813  float ly6_eta = (ly6_h2_nsp->GetXaxis()->GetBinLowEdge(ly6_ieta) + ly6_h2_nsp->GetXaxis()->GetBinUpEdge(ly6_ieta))/2.0;
814  for(int ly6_iphi=1; ly6_iphi<=NBINS_PHI; ly6_iphi++) {
815  float ly6_phi = (ly6_h2_nsp->GetYaxis()->GetBinLowEdge(ly6_iphi) + ly6_h2_nsp->GetYaxis()->GetBinUpEdge(ly6_iphi))/2.0;
816 
817  float ly6_nsp = ly6_h2_nsp ->GetBinContent(ly6_ieta,ly6_iphi);
818  float ly6_nsp_notrk = ly6_h2_nsp_notrk->GetBinContent(ly6_ieta,ly6_iphi);
819  float ly6_frac = ( ly6_nsp > 0 ) ? ly6_nsp_notrk / ly6_nsp : 0;
820  if( ly6_nsp < 10 || ly6_frac < 0.85 ) continue;
821 
822  float ly7_frac_max = 0;
823  float ly7_eta_max = 0;
824  float ly7_phi_max = 0;
825  for(int ly7_ieta=std::max(1,ly6_ieta-1); ly7_ieta<std::min(NBINS_ETA,ly6_ieta+1); ly7_ieta++) {
826  for(int ly7_iphi=std::max(1,ly6_iphi-1); ly7_iphi<=std::min(NBINS_PHI,ly6_iphi+1); ly7_iphi++) {
827  float ly7_nsp = ly7_h2_nsp ->GetBinContent(ly7_ieta,ly7_iphi);
828  float ly7_nsp_notrk = ly7_h2_nsp_notrk->GetBinContent(ly7_ieta,ly7_iphi);
829  float ly7_frac = ( ly7_nsp > 0 ) ? ly7_nsp_notrk / ly7_nsp : 0;
830  if( ly7_nsp < 10 ) continue;
831  if( ly7_frac > ly7_frac_max ) {
832  ly7_frac_max = ly7_frac;
833  ly7_eta_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_ieta) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_ieta))/2.0;
834  ly7_phi_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_iphi) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_iphi))/2.0;
835  }
836  }
837  }
838  if( ly7_frac_max < 0.85 ) continue;
839  //
840  float wsum = ly6_frac + ly7_frac_max;
841  float weta = (ly6_eta*ly6_frac + ly7_eta_max*ly7_frac_max) / wsum;
842  float wphi = (ly6_phi*ly6_frac + ly7_phi_max*ly7_frac_max) / wsum;
843  float w = wsum / 2.0;
844  QT.push_back(std::make_tuple(-1,w,weta,wphi));
845  }
846  }
847  ATH_MSG_VERBOSE("nr of ly6/ly7 doublet candidate seeds=" << QT.size() << ", doing clustering...");
848 
849  // sort
850  std::sort(QT.begin(), QT.end(),
851  [](const std::tuple<int,float,float,float>& lhs, const std::tuple<int,float,float,float>& rhs) {
852  return std::get<1>(lhs) > std::get<1>(rhs); } );
853 
854  // clustering
855  const double CLUSTCUT_DIST_SQUARED = 0.04; // const double CLUSTCUT_DIST = 0.2;
856  const double CLUSTCUT_SEED_FRAC = 0.9;
857 
858  std::vector<float> seeds_wsum;
859 
860  for(unsigned int i=0; i<QT.size(); i++) {
861  float phi = std::get<3>(QT[i]);
862  float eta = std::get<2>(QT[i]);
863  float w = std::get<1>(QT[i]);
864  if(i==0) {
865  seeds_eta.push_back(w*eta); seeds_phi.push_back(w*phi);
866  seeds_wsum.push_back(w);
867  continue;
868  }
869  const int IDX_INITIAL = 100;
870  float dist2_min = 100.0;
871  int idx_min = IDX_INITIAL;
872  for(unsigned j=0; j<seeds_eta.size(); j++) {
873  float ceta = seeds_eta[j]/seeds_wsum[j];
874  float cphi = seeds_phi[j]/seeds_wsum[j];
875  // intentionally calculate in this way as phi is defined beyond -Pi/Pi (no boundary)
876  float deta = std::fabs(ceta-eta);
877  float dphi = std::fabs(cphi-phi);
878  float dist2 = dphi*dphi+deta*deta;
879  if( dist2 < dist2_min ) {
880  dist2_min = dist2;
881  idx_min = j;
882  }
883  }
884  int match_idx = IDX_INITIAL;
885  if( idx_min != IDX_INITIAL ) {
886  if( dist2_min < CLUSTCUT_DIST_SQUARED ) { match_idx = idx_min; }
887  }
888  if( match_idx == IDX_INITIAL ) {
889  if( w > CLUSTCUT_SEED_FRAC && dist2_min > CLUSTCUT_DIST_SQUARED ) {
890  seeds_eta.push_back(w*eta); seeds_phi.push_back(w*phi);
891  seeds_wsum.push_back(w);
892  }
893  continue;
894  }
895  float new_eta = seeds_eta[match_idx] + w*eta;
896  float new_phi = seeds_phi[match_idx] + w*phi;
897  float new_wsum = seeds_wsum[match_idx] + w;
898  seeds_eta[match_idx] = new_eta;
899  seeds_phi[match_idx] = new_phi;
900  seeds_wsum[match_idx] = new_wsum;
901  }
902  QT.clear();
903  for(unsigned int i=0; i<seeds_eta.size(); i++) {
904  float eta = seeds_eta[i] / seeds_wsum[i];
905  float phi = seeds_phi[i] / seeds_wsum[i];
906  seeds_eta[i] = eta;
907  seeds_phi[i] = phi;
908  if( phi < -TMath::Pi() ) phi = 2*TMath::Pi() + phi;
909  if( phi > TMath::Pi() ) phi = -2*TMath::Pi() + phi;
910  seeds_phi[i] = phi;
911  }
912  ATH_MSG_VERBOSE("after clustering, nr of seeds = " << seeds_eta.size());
913 
914  // delete overlap (can happen at phi=-Pi/Pi bounadry)
915  std::vector<unsigned int> idx_to_delete;
916  for(unsigned int i=0; i<seeds_eta.size(); i++) {
917  if( std::find(idx_to_delete.begin(),idx_to_delete.end(),i) != idx_to_delete.end() ) continue;
918  float eta_i = seeds_eta[i];
919  float phi_i = seeds_phi[i];
920  for(unsigned int j=i+1; j<seeds_eta.size(); j++) {
921  if( std::find(idx_to_delete.begin(),idx_to_delete.end(),j) != idx_to_delete.end() ) continue;
922  float eta_j = seeds_eta[j];
923  float phi_j = seeds_phi[j];
924  float dR2 = deltaR2(eta_i,phi_i,eta_j,phi_j);
925  if( dR2 < CLUSTCUT_DIST_SQUARED ) idx_to_delete.push_back(j);
926  }
927  }
928  ATH_MSG_VERBOSE("nr of duplicated seeds to be removed = " << idx_to_delete.size());
929  if( idx_to_delete.size() > 0 ) {
930  std::sort(idx_to_delete.begin(),idx_to_delete.end());
931  for(unsigned int j=idx_to_delete.size(); j>0; j--) {
932  unsigned int idx = idx_to_delete[j-1];
933  seeds_eta.erase(seeds_eta.begin()+idx);
934  seeds_phi.erase(seeds_phi.begin()+idx);
935  }
936  }
937 
938  ATH_MSG_VERBOSE("nr of ly6/ly7 seeds=" << seeds_eta.size());
939 
940  // return
941  return StatusCode::SUCCESS;
942 }
943 
944 // ------------------------------------------------------------------------------------------------
945 // ------------------------------------------------------------------------------------------------
946 
947 StatusCode TrigHitDVHypoAlg::selectSeedsNearby(const std::vector<HitDVSeed>& hitDVSeedsContainer,
948  std::vector<float>& jetSeeds_eta, std::vector<float>& jetSeeds_phi, std::vector<float>& jetSeeds_pt) const
949 {
950  std::vector<unsigned int> idx_to_delete;
951  for(unsigned int idx=0; idx<jetSeeds_eta.size(); ++idx) {
952  const float DR_SQUARED_CUT_TO_FTFSEED = 0.09; // const float DR_CUT_TO_FTFSEED = 0.3;
953  float eta = jetSeeds_eta[idx];
954  float phi = jetSeeds_phi[idx];
955  float dR2min = 9999;
956  for ( const auto& seed : hitDVSeedsContainer ) {
957  float dR2 = deltaR2(eta,phi,seed.eta,seed.phi);
958  if( dR2 < dR2min ) dR2min = dR2;
959  }
960  if( dR2min > DR_SQUARED_CUT_TO_FTFSEED ) idx_to_delete.push_back(idx);
961  }
962  if( idx_to_delete.size() > 0 ) {
963  std::sort(idx_to_delete.begin(),idx_to_delete.end());
964  for(unsigned int j=idx_to_delete.size(); j>0; j--) {
965  unsigned int idx = idx_to_delete[j-1];
966  jetSeeds_eta.erase(jetSeeds_eta.begin()+idx);
967  jetSeeds_phi.erase(jetSeeds_phi.begin()+idx);
968  if( jetSeeds_pt.size() > 0 ) jetSeeds_pt.erase(jetSeeds_pt.begin()+idx);
969  }
970  }
971  return StatusCode::SUCCESS;
972 }
973 
974 // ------------------------------------------------------------------------------------------------
975 // ------------------------------------------------------------------------------------------------
976 
977 StatusCode TrigHitDVHypoAlg::findSPSeeds( const EventContext& ctx,
978  const std::vector<float>& v_sp_eta, const std::vector<float>& v_sp_phi,
979  const std::vector<int>& v_sp_layer, const std::vector<int>& v_sp_usedTrkId,
980  std::vector<float>& seeds_eta, std::vector<float>& seeds_phi ) const
981 {
982  const int NBINS_ETA = 50;
983  const float ETA_MIN = -2.5;
984  const float ETA_MAX = 2.5;
985 
986  const int NBINS_PHI = 80;
987  const float PHI_MIN = -4.0;
988  const float PHI_MAX = 4.0;
989 
990  char hname[64];
991 
992  unsigned int slotnr = ctx.slot();
993  unsigned int subSlotnr = ctx.subSlot();
994 
995  sprintf(hname,"ftf_s%u_ss%u_ly6_h2_nsp",slotnr,subSlotnr);
996  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);
997  sprintf(hname,"ftf_s%u_ss%u_ly7_h2_nsp",slotnr,subSlotnr);
998  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);
999 
1000  sprintf(hname,"ftf_s%u_ss%u_ly6_h2_nsp_notrk",slotnr,subSlotnr);
1001  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);
1002  sprintf(hname,"ftf_s%u_ss%u_ly7_h2_nsp_notrk",slotnr,subSlotnr);
1003  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);
1004 
1005  for(unsigned int iSeed=0; iSeed<v_sp_eta.size(); ++iSeed) {
1006 
1007  int sp_layer = v_sp_layer[iSeed];
1008  float sp_eta = v_sp_eta[iSeed];
1009  int ilayer = getSPLayer(sp_layer,sp_eta);
1010  if( ilayer<6 ) continue;
1011 
1012  int sp_trkid = v_sp_usedTrkId[iSeed];
1013  bool isUsedByTrk = (sp_trkid != -1);
1014  float sp_phi = v_sp_phi[iSeed];
1015 
1016  bool fill_out_of_pi = false;
1017  float sp_phi2 = 0;
1018  if( sp_phi < 0 ) {
1019  sp_phi2 = 2*TMath::Pi() + sp_phi;
1020  if( sp_phi2 < PHI_MAX ) fill_out_of_pi = true;
1021  }
1022  else {
1023  sp_phi2 = -2*TMath::Pi() + sp_phi;
1024  if( PHI_MIN < sp_phi2 ) fill_out_of_pi = true;
1025  }
1026  if( ilayer==6 ) {
1027  ly6_h2_nsp->Fill(sp_eta,sp_phi);
1028  if( fill_out_of_pi ) ly6_h2_nsp->Fill(sp_eta,sp_phi2);
1029  if( ! isUsedByTrk ) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi);
1030  if( ! isUsedByTrk && fill_out_of_pi) ly6_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
1031  }
1032  if( ilayer==7 ) {
1033  ly7_h2_nsp->Fill(sp_eta,sp_phi);
1034  if( fill_out_of_pi ) ly7_h2_nsp->Fill(sp_eta,sp_phi2);
1035  if( ! isUsedByTrk ) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi);
1036  if( ! isUsedByTrk && fill_out_of_pi) ly7_h2_nsp_notrk->Fill(sp_eta,sp_phi2);
1037  }
1038  }
1039 
1040  ATH_MSG_VERBOSE("looking for ly6/ly6 doublet seeds");
1041 
1042  // (idx, sort/weight, eta, phi)
1043  std::vector<std::tuple<int,float,float,float>> QT;
1044 
1045  for(int ly6_ieta=1; ly6_ieta<=NBINS_ETA; ly6_ieta++) {
1046  float ly6_eta = (ly6_h2_nsp->GetXaxis()->GetBinLowEdge(ly6_ieta) + ly6_h2_nsp->GetXaxis()->GetBinUpEdge(ly6_ieta))/2.0;
1047  for(int ly6_iphi=1; ly6_iphi<=NBINS_PHI; ly6_iphi++) {
1048  float ly6_phi = (ly6_h2_nsp->GetYaxis()->GetBinLowEdge(ly6_iphi) + ly6_h2_nsp->GetYaxis()->GetBinUpEdge(ly6_iphi))/2.0;
1049 
1050  float ly6_nsp = ly6_h2_nsp ->GetBinContent(ly6_ieta,ly6_iphi);
1051  float ly6_nsp_notrk = ly6_h2_nsp_notrk->GetBinContent(ly6_ieta,ly6_iphi);
1052  float ly6_frac = ( ly6_nsp > 0 ) ? ly6_nsp_notrk / ly6_nsp : 0;
1053  if( ly6_nsp < 10 || ly6_frac < 0.85 ) continue;
1054 
1055  float ly7_frac_max = 0;
1056  float ly7_eta_max = 0;
1057  float ly7_phi_max = 0;
1058  for(int ly7_ieta=std::max(1,ly6_ieta-1); ly7_ieta<std::min(NBINS_ETA,ly6_ieta+1); ly7_ieta++) {
1059  for(int ly7_iphi=std::max(1,ly6_iphi-1); ly7_iphi<=std::min(NBINS_PHI,ly6_iphi+1); ly7_iphi++) {
1060  float ly7_nsp = ly7_h2_nsp ->GetBinContent(ly7_ieta,ly7_iphi);
1061  float ly7_nsp_notrk = ly7_h2_nsp_notrk->GetBinContent(ly7_ieta,ly7_iphi);
1062  float ly7_frac = ( ly7_nsp > 0 ) ? ly7_nsp_notrk / ly7_nsp : 0;
1063  if( ly7_nsp < 10 ) continue;
1064  if( ly7_frac > ly7_frac_max ) {
1065  ly7_frac_max = ly7_frac;
1066  ly7_eta_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_ieta) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_ieta))/2.0;
1067  ly7_phi_max = (ly7_h2_nsp->GetXaxis()->GetBinLowEdge(ly7_iphi) + ly7_h2_nsp->GetXaxis()->GetBinUpEdge(ly7_iphi))/2.0;
1068  }
1069  }
1070  }
1071  if( ly7_frac_max < 0.85 ) continue;
1072  //
1073  float wsum = ly6_frac + ly7_frac_max;
1074  float weta = (ly6_eta*ly6_frac + ly7_eta_max*ly7_frac_max) / wsum;
1075  float wphi = (ly6_phi*ly6_frac + ly7_phi_max*ly7_frac_max) / wsum;
1076  float w = wsum / 2.0;
1077  QT.push_back(std::make_tuple(-1,w,weta,wphi));
1078  }
1079  }
1080  ATH_MSG_VERBOSE("nr of ly6/ly7 doublet candidate seeds=" << QT.size() << ", doing clustering...");
1081 
1082  // sort
1083  std::sort(QT.begin(), QT.end(),
1084  [](const std::tuple<int,float,float,float>& lhs, const std::tuple<int,float,float,float>& rhs) {
1085  return std::get<1>(lhs) > std::get<1>(rhs); } );
1086 
1087  // clustering
1088  const double CLUSTCUT_DIST_SQUARED = 0.04; // const double CLUSTCUT_DIST = 0.2;
1089  const double CLUSTCUT_SEED_FRAC = 0.9;
1090 
1091  std::vector<float> seeds_wsum;
1092 
1093  for(unsigned int i=0; i<QT.size(); i++) {
1094  float phi = std::get<3>(QT[i]);
1095  float eta = std::get<2>(QT[i]);
1096  float w = std::get<1>(QT[i]);
1097  if(i==0) {
1098  seeds_eta.push_back(w*eta); seeds_phi.push_back(w*phi);
1099  seeds_wsum.push_back(w);
1100  continue;
1101  }
1102  const int IDX_INITIAL = 100;
1103  float dist2_min = 100.0;
1104  int idx_min = IDX_INITIAL;
1105  for(unsigned j=0; j<seeds_eta.size(); j++) {
1106  float ceta = seeds_eta[j]/seeds_wsum[j];
1107  float cphi = seeds_phi[j]/seeds_wsum[j];
1108  // intentionally calculate in this way as phi is defined beyond -Pi/Pi (no boundary)
1109  float deta = std::fabs(ceta-eta);
1110  float dphi = std::fabs(cphi-phi);
1111  float dist2 = dphi*dphi+deta*deta;
1112  if( dist2 < dist2_min ) {
1113  dist2_min = dist2;
1114  idx_min = j;
1115  }
1116  }
1117  int match_idx = IDX_INITIAL;
1118  if( idx_min != IDX_INITIAL ) {
1119  if( dist2_min < CLUSTCUT_DIST_SQUARED ) { match_idx = idx_min; }
1120  }
1121  if( match_idx == IDX_INITIAL ) {
1122  if( w > CLUSTCUT_SEED_FRAC && dist2_min > CLUSTCUT_DIST_SQUARED ) {
1123  seeds_eta.push_back(w*eta); seeds_phi.push_back(w*phi);
1124  seeds_wsum.push_back(w);
1125  }
1126  continue;
1127  }
1128  float new_eta = seeds_eta[match_idx] + w*eta;
1129  float new_phi = seeds_phi[match_idx] + w*phi;
1130  float new_wsum = seeds_wsum[match_idx] + w;
1131  seeds_eta[match_idx] = new_eta;
1132  seeds_phi[match_idx] = new_phi;
1133  seeds_wsum[match_idx] = new_wsum;
1134  }
1135  QT.clear();
1136  for(unsigned int i=0; i<seeds_eta.size(); i++) {
1137  float eta = seeds_eta[i] / seeds_wsum[i];
1138  float phi = seeds_phi[i] / seeds_wsum[i];
1139  seeds_eta[i] = eta;
1140  seeds_phi[i] = phi;
1141  if( phi < -TMath::Pi() ) phi = 2*TMath::Pi() + phi;
1142  if( phi > TMath::Pi() ) phi = -2*TMath::Pi() + phi;
1143  seeds_phi[i] = phi;
1144  }
1145  ATH_MSG_VERBOSE("after clustering, nr of seeds = " << seeds_eta.size());
1146 
1147  // delete overlap (can happen at phi=-Pi/Pi bounadry)
1148  std::vector<unsigned int> idx_to_delete;
1149  for(unsigned int i=0; i<seeds_eta.size(); i++) {
1150  if( std::find(idx_to_delete.begin(),idx_to_delete.end(),i) != idx_to_delete.end() ) continue;
1151  float eta_i = seeds_eta[i];
1152  float phi_i = seeds_phi[i];
1153  for(unsigned int j=i+1; j<seeds_eta.size(); j++) {
1154  if( std::find(idx_to_delete.begin(),idx_to_delete.end(),j) != idx_to_delete.end() ) continue;
1155  float eta_j = seeds_eta[j];
1156  float phi_j = seeds_phi[j];
1157  float dR2 = deltaR2(eta_i,phi_i,eta_j,phi_j);
1158  if( dR2 < CLUSTCUT_DIST_SQUARED ) idx_to_delete.push_back(j);
1159  }
1160  }
1161  ATH_MSG_VERBOSE("nr of duplicated seeds to be removed = " << idx_to_delete.size());
1162  if( idx_to_delete.size() > 0 ) {
1163  std::sort(idx_to_delete.begin(),idx_to_delete.end());
1164  for(unsigned int j=idx_to_delete.size(); j>0; j--) {
1165  unsigned int idx = idx_to_delete[j-1];
1166  seeds_eta.erase(seeds_eta.begin()+idx);
1167  seeds_phi.erase(seeds_phi.begin()+idx);
1168  }
1169  }
1170 
1171  ATH_MSG_VERBOSE("nr of ly6/ly7 seeds=" << seeds_eta.size());
1172 
1173  // return
1174  return StatusCode::SUCCESS;
1175 }
1176 
1177 StatusCode TrigHitDVHypoAlg::findHitDV(const EventContext& ctx, const std::vector<TrigSiSpacePointBase>& convertedSpacePoints,
1178  const DataVector<Trk::Track>& tracks, std::vector<HitDVSeed>& hitDVSeedsContainer,
1179  std::vector<HitDVTrk>& hitDVTrksContainer,
1180  std::vector<HitDVSpacePoint>& hitDVSPsContainer) const
1181 {
1182  std::vector<int> v_dvtrk_id;
1183  std::vector<float> v_dvtrk_pt;
1184  std::vector<float> v_dvtrk_eta;
1185  std::vector<float> v_dvtrk_phi;
1186  std::vector<int> v_dvtrk_n_hits_inner;
1187  std::vector<int> v_dvtrk_n_hits_pix;
1188  std::vector<int> v_dvtrk_n_hits_sct;
1189  std::vector<float> v_dvtrk_a0beam;
1190  std::unordered_map<Identifier, int> umap_fittedTrack_identifier;
1191  int fittedTrack_id = -1;
1192 
1193  static constexpr float TRKCUT_PTGEV_HITDV = 0.5;
1194 
1195  for (const auto track: tracks) {
1196  float shift_x = 0; float shift_y = 0;
1197  if(m_useBeamSpot) {
1199  FTF::getBeamSpotShift(shift_x, shift_y, **beamSpotHandle);
1200  }
1201  trackInfo theTrackInfo;
1202  bool igt = FTF::isGoodTrackUTT(track, theTrackInfo, shift_x, shift_y, TRKCUT_PTGEV_HITDV);
1203  if (not igt) {continue;}
1204 
1205  fittedTrack_id++;
1206  ATH_MSG_DEBUG("Selected track pT = " << theTrackInfo.ptGeV << " GeV");
1207 
1208 
1210  m = track->measurementsOnTrack()->begin(),
1211  me = track->measurementsOnTrack()->end ();
1212  for(; m!=me; ++m ) {
1213  const Trk::PrepRawData* prd = ((const Trk::RIO_OnTrack*)(*m))->prepRawData();
1214  if( prd == nullptr ) continue;
1215  Identifier id_prd = prd->identify();
1216  if( umap_fittedTrack_identifier.find(id_prd) == umap_fittedTrack_identifier.end() ) {
1217  umap_fittedTrack_identifier.insert(std::make_pair(id_prd,fittedTrack_id));
1218  }
1219  }
1220  float phi = track->perigeeParameters()->parameters()[Trk::phi];
1221  v_dvtrk_id.push_back(fittedTrack_id);
1222  v_dvtrk_pt.push_back(theTrackInfo.ptGeV*Gaudi::Units::GeV);
1223  v_dvtrk_eta.push_back(theTrackInfo.eta);
1224  v_dvtrk_phi.push_back(phi);
1225  v_dvtrk_n_hits_inner.push_back(theTrackInfo.n_hits_inner);
1226  v_dvtrk_n_hits_pix.push_back(theTrackInfo.n_hits_pix);
1227  v_dvtrk_n_hits_sct.push_back(theTrackInfo.n_hits_sct);
1228  v_dvtrk_a0beam.push_back(theTrackInfo.a0beam);
1229  }
1230  ATH_MSG_DEBUG("Nr of selected tracks / all = " << fittedTrack_id << " / " << tracks.size());
1231  ATH_MSG_DEBUG("Nr of Identifiers used by selected tracks = " << umap_fittedTrack_identifier.size());
1232 
1233  // space points
1234  int n_sp = 0;
1235  int n_sp_usedByTrk = 0;
1236 
1237  std::unordered_map<Identifier, int> umap_sp_identifier;
1238  umap_sp_identifier.reserve(1.3*convertedSpacePoints.size());//up to 2 Identifiers per spacepoint, end up with 1.3 from measurements
1239 
1240  auto add_to_sp_map = [&](const Trk::PrepRawData* prd) {
1241  if (prd) {
1242  Identifier id_prd = prd->identify();
1243  if( umap_sp_identifier.find(id_prd) == umap_sp_identifier.end() ) {
1244  umap_sp_identifier.insert(std::make_pair(id_prd,-1));
1245  }
1246  }
1247  };
1248 
1249  for(unsigned int iSp=0; iSp<convertedSpacePoints.size(); ++iSp) {
1250  bool isPix = convertedSpacePoints[iSp].isPixel();
1251  bool isSct = convertedSpacePoints[iSp].isSCT();
1252  if( ! isPix && ! isSct ) continue;
1253  const Trk::SpacePoint* sp = convertedSpacePoints[iSp].offlineSpacePoint();
1254  add_to_sp_map(sp->clusterList().first);
1255  add_to_sp_map(sp->clusterList().second);
1256  }
1257  int n_id_usedByTrack = 0;
1258  for(auto it=umap_sp_identifier.begin(); it!=umap_sp_identifier.end(); ++it) {
1259  Identifier id_sp = it->first;
1260  if( umap_fittedTrack_identifier.find(id_sp) != umap_fittedTrack_identifier.end() ) {
1261  umap_sp_identifier[id_sp] = umap_fittedTrack_identifier[id_sp];
1262  ++n_id_usedByTrack;
1263  }
1264  }
1265  ATH_MSG_DEBUG("Nr of SPs / Identifiers (all) / Identifiers (usedByTrack) = " << convertedSpacePoints.size() << " / " << umap_sp_identifier.size() << " / " << n_id_usedByTrack);
1266 
1267  auto sp_map_used_id = [&](const Trk::PrepRawData* prd) {
1268  int usedTrack_id = -1;
1269  if (prd) {
1270  Identifier id_prd = prd->identify();
1271  if( umap_sp_identifier.find(id_prd) != umap_sp_identifier.end() ) {
1272  usedTrack_id = umap_sp_identifier[id_prd];
1273  }
1274  }
1275  return usedTrack_id;
1276  };
1277 
1278  std::vector<float> v_sp_eta;
1279  v_sp_eta.reserve(convertedSpacePoints.size());
1280  std::vector<float> v_sp_r;
1281  v_sp_r.reserve(convertedSpacePoints.size());
1282  std::vector<float> v_sp_phi;
1283  v_sp_phi.reserve(convertedSpacePoints.size());
1284  std::vector<int> v_sp_layer;
1285  v_sp_layer.reserve(convertedSpacePoints.size());
1286  std::vector<bool> v_sp_isPix;
1287  v_sp_isPix.reserve(convertedSpacePoints.size());
1288  std::vector<bool> v_sp_isSct;
1289  v_sp_isSct.reserve(convertedSpacePoints.size());
1290  std::vector<int> v_sp_usedTrkId;
1291  v_sp_usedTrkId.reserve(convertedSpacePoints.size());
1292 
1293  for(const auto& sp : convertedSpacePoints) {
1294  bool isPix = sp.isPixel();
1295  bool isSct = sp.isSCT();
1296  if( ! isPix && ! isSct ) continue;
1297  const Trk::SpacePoint* osp = sp.offlineSpacePoint();
1298 
1299  int usedTrack_id = -1;
1300  int usedTrack_id_first = sp_map_used_id(osp->clusterList().first);
1301  if (usedTrack_id_first != -1) {
1302  usedTrack_id = usedTrack_id_first;
1303  }
1304  int usedTrack_id_second = sp_map_used_id(osp->clusterList().second);
1305  if (usedTrack_id_second != -1) {
1306  usedTrack_id = usedTrack_id_second;
1307  }
1308 
1309  //
1310  n_sp++;
1311  if( usedTrack_id != -1 ) n_sp_usedByTrk++;
1312  int layer = sp.layer();
1313  float sp_r = sp.r();
1314 
1315  const Amg::Vector3D& pos_sp = osp->globalPosition();//Go back to globalPosition to get the non-shifted spacepoint positions
1316  float sp_eta = pos_sp.eta();
1317  float sp_phi = pos_sp.phi();
1318 
1319  v_sp_eta.push_back(sp_eta);
1320  v_sp_r.push_back(sp_r);
1321  v_sp_phi.push_back(sp_phi);
1322  v_sp_layer.push_back(layer);
1323  v_sp_isPix.push_back(isPix);
1324  v_sp_isSct.push_back(isSct);
1325  v_sp_usedTrkId.push_back(usedTrack_id);
1326 
1327  ATH_MSG_VERBOSE("+++ SP eta / phi / layer / ixPix / usedTrack_id = " << sp_eta << " / " << sp_phi << " / " << layer << " / " << isPix << " / " << usedTrack_id);
1328 
1329  }
1330  ATH_MSG_DEBUG("Nr of SPs / all = " << n_sp << " / " << convertedSpacePoints.size());
1331  ATH_MSG_DEBUG("Nr of SPs used by selected tracks = " << n_sp_usedByTrk);
1332 
1333  // Seed
1334  std::vector<float> v_seeds_eta;
1335  std::vector<float> v_seeds_phi;
1336  std::vector<int16_t> v_seeds_type;
1337 
1338  if( m_doHitDV_Seeding ) {
1339 
1340  // add L1 Jet seeds
1341  const unsigned int L1JET_ET_CUT = 30;
1342 
1343  auto recJetRoiCollectionHandle = SG::makeHandle( m_recJetRoiCollectionKey, ctx );
1344  const DataVector<LVL1::RecJetRoI> *recJetRoiCollection = recJetRoiCollectionHandle.cptr();
1345  if (!recJetRoiCollectionHandle.isValid()){
1346  ATH_MSG_ERROR("ReadHandle for DataVector<LVL1::RecJetRoI> key:" << m_recJetRoiCollectionKey.key() << " isn't Valid");
1347  return StatusCode::FAILURE;
1348  }
1349  for (size_t size=0; size<recJetRoiCollection->size(); ++size){
1350  const LVL1::RecJetRoI* recRoI = recJetRoiCollection->at(size);
1351  if( recRoI == nullptr ) continue;
1352  bool isSeed = false;
1353  for( const unsigned int thrMapping : recRoI->thresholdsPassed()) {
1354  double thrValue = recRoI->triggerThreshold(thrMapping) * Gaudi::Units::GeV;
1355  if( thrValue >= L1JET_ET_CUT ) {
1356  isSeed = true;
1357  break;
1358  }
1359  }
1360  if( ! isSeed ) continue;
1361  // Convert to ATLAS phi convention: see RoIResultToAOD.cxx
1362  float roiPhi = recRoI->phi();
1363  if( roiPhi > TMath::Pi() ) roiPhi -= 2 * TMath::Pi();
1364  v_seeds_eta.push_back(recRoI->eta());
1365  v_seeds_phi.push_back(roiPhi);
1366  v_seeds_type.push_back(0); // L1_J:0
1367  }
1368  ATH_MSG_DEBUG("Nr of L1_J" << L1JET_ET_CUT << " seeds = " << v_seeds_eta.size());
1369 
1370  // space-point based (unseeded mode)
1371  std::vector<float> v_spseeds_eta;
1372  std::vector<float> v_spseeds_phi;
1373  ATH_CHECK( findSPSeeds(ctx, v_sp_eta, v_sp_phi, v_sp_layer, v_sp_usedTrkId, v_spseeds_eta, v_spseeds_phi) );
1374  ATH_MSG_DEBUG("Nr of SP seeds = " << v_spseeds_eta.size());
1375  for(size_t idx=0; idx<v_spseeds_eta.size(); ++idx) {
1376  v_seeds_eta.push_back(v_spseeds_eta[idx]);
1377  v_seeds_phi.push_back(v_spseeds_phi[idx]);
1378  v_seeds_type.push_back(1); // SP: 1
1379  }
1380  ATH_MSG_DEBUG("Nr of SP + L1_J" << L1JET_ET_CUT << " seeds = " << v_seeds_eta.size());
1381  }
1382 
1383  // fill objects
1384 
1385  // seeds
1386  const int N_MAX_SEEDS = 200;
1387  int n_seeds = std::min(N_MAX_SEEDS,(int)v_seeds_eta.size());
1388  hitDVSeedsContainer.reserve(n_seeds);
1389  for(auto iSeed=0; iSeed < n_seeds; ++iSeed) {
1390  HitDVSeed seed;
1391  seed.eta = v_seeds_eta[iSeed];
1392  seed.phi = v_seeds_phi[iSeed];
1393  seed.type = v_seeds_type[iSeed];
1394  hitDVSeedsContainer.push_back(seed);
1395  }
1396 
1397  // track
1398  const float TRKCUT_DELTA_R_TO_SEED = 1.0;
1399  hitDVTrksContainer.reserve(v_dvtrk_pt.size());
1400  for(unsigned int iTrk=0; iTrk<v_dvtrk_pt.size(); ++iTrk) {
1401  float trk_eta = v_dvtrk_eta[iTrk];
1402  float trk_phi = v_dvtrk_phi[iTrk];
1403  if( m_doHitDV_Seeding ) {
1404  bool isNearSeed = false;
1405  for (unsigned int iSeed=0; iSeed<v_seeds_eta.size(); ++iSeed) {
1406  float seed_eta = v_seeds_eta[iSeed];
1407  float seed_phi = v_seeds_phi[iSeed];
1408  float dR2 = deltaR2(trk_eta,trk_phi,seed_eta,seed_phi);
1409  if( dR2 <= TRKCUT_DELTA_R_TO_SEED*TRKCUT_DELTA_R_TO_SEED ) { isNearSeed = true; break; }
1410  }
1411  if( ! isNearSeed ) continue;
1412  }
1413  HitDVTrk hitDVTrk;
1414  hitDVTrk.id = v_dvtrk_id[iTrk];
1415  hitDVTrk.pt = v_dvtrk_pt[iTrk];
1416  hitDVTrk.eta = v_dvtrk_eta[iTrk];
1417  hitDVTrk.phi = v_dvtrk_phi[iTrk];
1418  hitDVTrk.n_hits_inner = v_dvtrk_n_hits_inner[iTrk];
1419  hitDVTrk.n_hits_pix = v_dvtrk_n_hits_pix[iTrk];
1420  hitDVTrk.n_hits_sct = v_dvtrk_n_hits_sct[iTrk];
1421  hitDVTrk.a0beam = v_dvtrk_a0beam[iTrk];
1422 
1423  hitDVTrksContainer.push_back(hitDVTrk);
1424  }
1425 
1426  // space points
1427  const float SPCUT_DELTA_R_TO_SEED = 1.0;
1428  const size_t n_sp_max = std::min<size_t>(100000, v_sp_eta.size());
1429  size_t n_sp_stored = 0;
1430 
1431  hitDVSPsContainer.reserve(n_sp_max);
1432 
1433  for(size_t iSp=0; iSp<v_sp_eta.size(); ++iSp) {
1434  if( m_doHitDV_Seeding ) {
1435  const float sp_eta = v_sp_eta[iSp];
1436  const float sp_phi = v_sp_phi[iSp];
1437  bool isNearSeed = false;
1438  for (size_t iSeed=0; iSeed<v_seeds_eta.size(); ++iSeed) {
1439  const float seed_eta = v_seeds_eta[iSeed];
1440  const float seed_phi = v_seeds_phi[iSeed];
1441  const float dR2 = deltaR2(sp_eta, sp_phi, seed_eta, seed_phi);
1442  if( dR2 <= SPCUT_DELTA_R_TO_SEED*SPCUT_DELTA_R_TO_SEED ) { isNearSeed = true; break; }
1443  }
1444  if( ! isNearSeed ) continue;
1445  }
1446  if( n_sp_stored >= n_sp_max ) break;
1447  HitDVSpacePoint hitDVSP;
1448  hitDVSP.eta = v_sp_eta[iSp];
1449  hitDVSP.r = v_sp_r[iSp];
1450  hitDVSP.phi = v_sp_phi[iSp];
1451  hitDVSP.layer = v_sp_layer[iSp];
1452  hitDVSP.isPix = v_sp_isPix[iSp];
1453  hitDVSP.isSct = v_sp_isSct[iSp];
1454  hitDVSP.usedTrkId = v_sp_usedTrkId[iSp];
1455  hitDVSPsContainer.push_back(hitDVSP);
1456  ++n_sp_stored;
1457  }
1458  ATH_MSG_DEBUG("Nr of SPs stored = " << n_sp_stored);
1459 
1460  return StatusCode::SUCCESS;
1461 }
TrigHitDVHypoAlg::calculateBDT
StatusCode calculateBDT(const EventContext &, const std::vector< HitDVSpacePoint > &, const std::vector< HitDVTrk > &, const std::vector< float > &, const std::vector< float > &, const std::vector< float > &, const float &, const int, xAOD::TrigCompositeContainer *, int &) const
Definition: TrigHitDVHypoAlg.cxx:564
Trk::SpacePoint::clusterList
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:127
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
HitDVSpacePoint::isPix
bool isPix
Definition: TrigHitDVHypoAlg.h:57
LVL1::RecJetRoI::triggerThreshold
unsigned int triggerThreshold(unsigned int thresh) const
returns the value of the trigger threshold for the threshold passed.
Definition: RecJetRoI.cxx:379
base
std::string base
Definition: hcg.cxx:78
PathResolver::find_calib_file
static std::string find_calib_file(const std::string &logical_file_name)
Definition: PathResolver.cxx:384
Trk::SpacePoint
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:35
TrigHitDVHypoAlg::TrigHitDVHypoAlg
TrigHitDVHypoAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigHitDVHypoAlg.cxx:42
HitDVTrk::n_hits_inner
int16_t n_hits_inner
Definition: TrigHitDVHypoAlg.h:46
trackInfo::ptGeV
float ptGeV
Definition: TrigInDetUtils.h:15
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
trackInfo::n_hits_inner
int n_hits_inner
Definition: TrigInDetUtils.h:14
HitDVSpacePoint::r
float r
Definition: TrigHitDVHypoAlg.h:54
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
max
#define max(a, b)
Definition: cfImp.cxx:41
HLTSeedingRoIToolDefs::roiPhi
constexpr float roiPhi(const AnyRoIPointer &roi)
Definition: HLTSeedingRoIToolDefs.h:167
PlotCalibFromCool.dv
dv
Definition: PlotCalibFromCool.py:762
LVL1::RecJetRoI
This class defines the reconstructed em/tau hadron ROI.
Definition: RecJetRoI.h:39
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
TrigCompositeUtils::DecisionContainer
xAOD::TrigCompositeContainer DecisionContainer
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigCompositeContainer.h:21
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
FTF::isGoodTrackUTT
bool isGoodTrackUTT(const Trk::Track *track, trackInfo &theTrackInfo, const float shift_x, const float shift_y, float trkcut_ptgev)
Definition: TrigInDetUtils.cxx:4
TrigCompositeUtils.h
TrigHitDVHypoAlg::m_spacePointTool
ToolHandle< ITrigSpacePointConversionTool > m_spacePointTool
Definition: TrigHitDVHypoAlg.h:72
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
xAOD::TrigComposite
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:16
Trk::SpacePoint::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
Interface method to get the global Position.
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:146
TrigL2MuonSA::N_LAYER
constexpr int N_LAYER
Definition: MuonRoad.h:17
HitDVSpacePoint
Definition: TrigHitDVHypoAlg.h:52
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:272
TrigCompositeUtils::newDecisionIn
Decision * newDecisionIn(DecisionContainer *dc, const std::string &name)
Helper method to create a Decision object, place it in the container and return a pointer to it.
Definition: TrigCompositeUtilsRoot.cxx:46
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
TrigCompositeUtils::hypoAlgNodeName
const std::string & hypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:906
CxxUtils::wrapToPi
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition: phihelper.h:24
LVL1::RecJetRoI::thresholdsPassed
std::vector< unsigned int > thresholdsPassed() const
returns a vector of thresholds passed.
Definition: RecJetRoI.cxx:352
skel.it
it
Definition: skel.GENtoEVGEN.py:423
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TrigHitDVHypoAlg::m_useBeamSpot
bool m_useBeamSpot
Definition: TrigHitDVHypoAlg.h:131
DataVector::get
const T * get(size_type n) const
Access an element, as an rvalue.
HypoBase::decisionInput
const SG::ReadHandleKey< TrigCompositeUtils::DecisionContainer > & decisionInput() const
methods for derived classes to access handles of the base class input other read/write handles may be...
Definition: HypoBase.cxx:16
TrigHitDVHypoAlg::m_tools_loosest_wp
int m_tools_loosest_wp
Definition: TrigHitDVHypoAlg.h:128
TrigHitDVHypoAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigHitDVHypoAlg.h:96
TrigCompositeUtils::createAndStore
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
Definition: TrigCompositeUtilsRoot.cxx:30
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits #ifndef XAOD_AN...
Definition: TrigRoiDescriptor.h:56
FTF::getBeamSpotShift
void getBeamSpotShift(float &shift_x, float &shift_y, const InDet::BeamSpotData &beamSpotHandle)
Definition: TrigInDetUtils.cxx:30
HitDVTrk::phi
float phi
Definition: TrigHitDVHypoAlg.h:45
HitDVTrk::pt
float pt
Definition: TrigHitDVHypoAlg.h:43
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HitDVSeed
Definition: TrigHitDVHypoAlg.h:35
ViewHelper.h
xAOD::int16_t
setScaleOne setStatusOne setSaturated int16_t
Definition: gFexGlobalRoI_v1.cxx:55
HypoBase::decisionOutput
const SG::WriteHandleKey< TrigCompositeUtils::DecisionContainer > & decisionOutput() const
methods for derived classes to access handles of the base class output other read/write handles may b...
Definition: HypoBase.cxx:20
TrigHitDVHypoAlg::m_recJetRoiCollectionKey
SG::ReadHandleKey< DataVector< LVL1::RecJetRoI > > m_recJetRoiCollectionKey
Definition: TrigHitDVHypoAlg.h:137
HitDVTrk::a0beam
float a0beam
Definition: TrigHitDVHypoAlg.h:49
Monitored::Collection
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
Definition: MonitoredCollection.h:38
TrigHitDVHypoAlg::m_jetSeed_etaMax
Gaudi::Property< float > m_jetSeed_etaMax
Definition: TrigHitDVHypoAlg.h:88
TrigHitDVHypoTool::HitDVHypoInfo
Definition: TrigHitDVHypoTool.h:35
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
HitDVTrk::n_hits_pix
int16_t n_hits_pix
Definition: TrigHitDVHypoAlg.h:47
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TrigInDetUtils.h
trackInfo::eta
float eta
Definition: TrigInDetUtils.h:15
TrigHitDVHypoAlg::deltaR2
float deltaR2(float, float, float, float) const
Definition: TrigHitDVHypoAlg.cxx:332
HitDVSpacePoint::phi
float phi
Definition: TrigHitDVHypoAlg.h:55
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
TrigHitDVHypoAlg::m_doHitDV_Seeding
bool m_doHitDV_Seeding
Definition: TrigHitDVHypoAlg.h:135
trackInfo::n_hits_pix
int n_hits_pix
Definition: TrigInDetUtils.h:14
perfmonmt-refit.idx_min
idx_min
Definition: perfmonmt-refit.py:83
TrigHitDVHypoAlg::selectSeedsNearby
StatusCode selectSeedsNearby(const std::vector< HitDVSeed > &hitDVSeedsContainer, std::vector< float > &jetSeeds_eta, std::vector< float > &jetSeeds_phi, std::vector< float > &jetSeeds_pt) const
Definition: TrigHitDVHypoAlg.cxx:947
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HitDVTrk::n_hits_sct
int16_t n_hits_sct
Definition: TrigHitDVHypoAlg.h:48
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
HypoBase::hypoBaseOutputProcessing
StatusCode hypoBaseOutputProcessing(SG::WriteHandle< TrigCompositeUtils::DecisionContainer > &outputHandle, MSG::Level lvl=MSG::DEBUG) const
Base class function to be called once slice specific code has finished. Handles debug printing and va...
Definition: HypoBase.cxx:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
checkxAOD.frac
frac
Definition: Tools/PyUtils/bin/checkxAOD.py:256
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:530
TrigHitDVHypoAlg::m_lumiBlockMuTool
ToolHandle< ILumiBlockMuTool > m_lumiBlockMuTool
Definition: TrigHitDVHypoAlg.h:81
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ETA_MAX
#define ETA_MAX
Definition: InDetGlobalMotherMonTool.h:20
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
trackInfo::n_hits_sct
int n_hits_sct
Definition: TrigInDetUtils.h:14
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
TrigHitDVHypoAlg::doMonitor
StatusCode doMonitor(const xAOD::TrigCompositeContainer *) const
Definition: TrigHitDVHypoAlg.cxx:465
TrigHitDVHypoAlg::m_beamSpotKey
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Definition: TrigHitDVHypoAlg.h:138
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
trackInfo
Definition: TrigInDetUtils.h:13
TH2F::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:425
TrigCompositeUtils::DecisionAuxContainer
xAOD::TrigCompositeAuxContainer DecisionAuxContainer
Definition: TrigCompositeAuxContainer.h:20
ITrigSpacePointConversionTool.h
min
#define min(a, b)
Definition: cfImp.cxx:40
TrigHitDVHypoAlg.h
lumiFormat.array
array
Definition: lumiFormat.py:98
Trk::PrepRawData
Definition: PrepRawData.h:62
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:886
keylayer_zslicemap.isPix
isPix
Definition: keylayer_zslicemap.py:127
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
PathResolver.h
TrigHitDVHypoAlg::findJetSeeds
StatusCode findJetSeeds(const xAOD::JetContainer *, const float, const float, std::vector< float > &, std::vector< float > &, std::vector< float > &) const
Definition: TrigHitDVHypoAlg.cxx:708
trackInfo::a0beam
float a0beam
Definition: TrigInDetUtils.h:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TrigHitDVHypoAlg::m_tracksKey
SG::ReadHandleKey< TrackCollection > m_tracksKey
Definition: TrigHitDVHypoAlg.h:78
HypoBase
Hypothesis algorithms take the output of reco algorithms and the decision from the preceeding InputMa...
Definition: HypoBase.h:13
TrigCompositeUtils::Decision
xAOD::TrigComposite Decision
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:20
LuminosityCondData::lbAverageInteractionsPerCrossing
float lbAverageInteractionsPerCrossing() const
Definition: LuminosityCondData.cxx:26
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
TrigHitDVHypoAlg::execute
virtual StatusCode execute(const EventContext &context) const override
Definition: TrigHitDVHypoAlg.cxx:126
HitDVTrk::eta
float eta
Definition: TrigHitDVHypoAlg.h:44
phihelper.h
Helper for azimuthal angle calculations.
TrigHitDVHypoAlg::m_jetsKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetsKey
Definition: TrigHitDVHypoAlg.h:76
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TrigHitDVHypoAlg::m_hitDVKey
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_hitDVKey
Definition: TrigHitDVHypoAlg.h:77
python.ami.results
def results
Definition: ami.py:386
TrigHitDVHypoAlg::initialize
virtual StatusCode initialize() override
Definition: TrigHitDVHypoAlg.cxx:51
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
TrigHitDVHypoAlg::m_lumiDataKey
SG::ReadCondHandleKey< LuminosityCondData > m_lumiDataKey
Definition: TrigHitDVHypoAlg.h:83
TrigHitDVHypoAlg::m_isMC
Gaudi::Property< bool > m_isMC
Definition: TrigHitDVHypoAlg.h:85
HitDVSpacePoint::layer
int16_t layer
Definition: TrigHitDVHypoAlg.h:56
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
TrigCompositeUtils::linkToPrevious
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
Definition: TrigCompositeUtilsRoot.cxx:139
TrigCompositeUtils::LinkInfo
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition: LinkInfo.h:28
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
TrigHitDVHypoAlg::m_jetSeed_ptMin
Gaudi::Property< float > m_jetSeed_ptMin
Definition: TrigHitDVHypoAlg.h:87
TrigCompositeUtils::findLink
LinkInfo< T > findLink(const Decision *start, const std::string &linkName, const bool suppressMultipleLinksWarning=false)
Perform a recursive search for ElementLinks of type T and name 'linkName', starting from Decision obj...
HitDVSpacePoint::eta
float eta
Definition: TrigHitDVHypoAlg.h:53
TrigHitDVHypoAlg::findSPSeeds
StatusCode findSPSeeds(const EventContext &, const std::vector< HitDVSpacePoint > &, std::vector< float > &, std::vector< float > &) const
Definition: TrigHitDVHypoAlg.cxx:744
TrigCompositeUtils::allFailed
bool allFailed(const Decision *d)
return true if there is no positive decision stored
Definition: TrigCompositeUtilsRoot.cxx:103
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
HitDVSpacePoint::usedTrkId
int16_t usedTrkId
Definition: TrigHitDVHypoAlg.h:59
Trk::phi
@ phi
Definition: ParamDefs.h:81
Trk::jet_phi
@ jet_phi
Definition: JetVtxParamDefs.h:28
TrigRoiDescriptor
Athena::TPCnvVers::Current TrigRoiDescriptor
Definition: TrigSteeringEventTPCnv.cxx:68
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition: JetContainer.h:17
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
LVL1::RecJetRoI::eta
virtual double eta() const
returns eta coord of ROI
Definition: RecJetRoI.cxx:253
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
TrigHitDVHypoAlg::m_hypoTools
ToolHandleArray< TrigHitDVHypoTool > m_hypoTools
Definition: TrigHitDVHypoAlg.h:73
collisions.reader
reader
read the goodrunslist xml file(s)
Definition: collisions.py:22
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
TrigHitDVHypoAlg::findHitDV
StatusCode findHitDV(const EventContext &ctx, const std::vector< TrigSiSpacePointBase > &convertedSpacePoints, const DataVector< Trk::Track > &tracks, std::vector< HitDVSeed > &hitDVSeedsContainer, std::vector< HitDVTrk > &hitDVTrksContainer, std::vector< HitDVSpacePoint > &hitDVSPContainer) const
Definition: TrigHitDVHypoAlg.cxx:1177
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:525
TrigHitDVHypoAlg::m_tools_lowest_jetEt
int m_tools_lowest_jetEt
Definition: TrigHitDVHypoAlg.h:127
HitDVTrk::id
int id
Definition: TrigHitDVHypoAlg.h:42
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
xAOD::thrValue
thrValue
Definition: MuonRoI_v1.cxx:54
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
TrigCompositeUtils::viewString
const std::string & viewString()
Definition: TrigCompositeUtilsRoot.cxx:882
HitDVSpacePoint::isSct
bool isSct
Definition: TrigHitDVHypoAlg.h:58
HitDVTrk
Definition: TrigHitDVHypoAlg.h:41
TrigHitDVHypoAlg::getSPLayer
int getSPLayer(int, float) const
Definition: TrigHitDVHypoAlg.cxx:341
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition: ReadCondHandle.h:67
LVL1::RecJetRoI::phi
virtual double phi() const
returns phi coord of ROI
Definition: RecJetRoI.cxx:243