ATLAS Offline Software
Loading...
Searching...
No Matches
SiSpacePointsSeedMaker_HeavyIon.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6// Implementation file for class SiSpacePointsSeedMaker_HeavyIon
8// (c) ATLAS Detector software
10// AlgTool used for TRT_DriftCircleOnTrack object production
12// Version 1.0 21/04/2004 I.Gavrilenko
14
16
17#include <cmath>
18
19#include <iomanip>
20#include <ostream>
21
23// Constructor
25
27(const std::string& t, const std::string& n, const IInterface* p)
28 : base_class(t, n, p)
29{
30}
31
33// Initialisation
35
37{
38 StatusCode sc = AlgTool::initialize();
39
41 ATH_CHECK(m_spacepointsSCT.initialize(m_sct));
43
44 // Get beam geometry
45 //
46 ATH_CHECK(m_beamSpotKey.initialize());
47
48 ATH_CHECK( m_fieldCondObjInputKey.initialize());
49
50 // Build framework
51 //
53
54 // Get output print level
55 //
56 m_outputlevel = msg().level()-MSG::DEBUG;
57 if (m_outputlevel<=0) {
60 data.nprint=0;
61 dump(data, msg(MSG::DEBUG));
62 }
63
64 m_initialized = true;
65
66 return sc;
67}
68
70// Finalize
72
74{
75 return AlgTool::finalize();
76}
77
79// Initialize tool for new event
81
82void InDet::SiSpacePointsSeedMaker_HeavyIon::newEvent(const EventContext& ctx, EventData& data, int) const
83{
84 if (not data.initialized) initializeEventData(data);
85
86 data.trigger = false;
87 if (!m_pixel && !m_sct) return;
88 erase(data);
90
91 double f[3], gP[3] ={10.,10.,0.};
92
94
95 // Get field cache object
97 const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
98 if (fieldCondObj == nullptr) {
99 ATH_MSG_ERROR("SiSpacePointsSeedMaker_HeavyIon: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key());
100 return;
101 }
102 fieldCondObj->getInitializedCache (fieldCache);
103
104 if (fieldCache.solenoidOn()) {
105 fieldCache.getFieldZR(gP,f);
106
107 data.K = 2./(300.*f[2]);
108 } else {
109 data.K = 2./(300.* 5. );
110 }
111
112 data.i_spforseed = data.l_spforseed.begin();
113
114 float irstep = 1./m_r_rstep;
115 int irmax = m_r_size-1 ;
116
117 // Get pixels space points containers from store gate
118 //
119 if (m_pixel) {
120
122 if (spacepointsPixel.isValid()) {
123
124 for (const SpacePointCollection* spc: *spacepointsPixel) {
125 for (const Trk::SpacePoint* sp: *spc) {
126 float r = sp->r();
127 if (r < 43. || r>=m_r_rmax) continue;
129 int ir = static_cast<int>(sps->radius()*irstep);
130 if (ir>irmax) ir = irmax;
131 data.r_Sorted[ir].push_back(sps);
132 ++data.r_map[ir];
133 if (data.r_map[ir]==1) data.r_index[data.nr++] = ir;
134 ++data.ns;
135 }
136 }
137 }
138 }
139
140 // Get sct space points containers from store gate
141 //
142 if (m_sct) {
143
145 if (spacepointsSCT.isValid()) {
146
147 for (const SpacePointCollection* spc: *spacepointsSCT) {
148 for (const Trk::SpacePoint* sp: *spc) {
149 float r = sp->r();
150 if (r<0. || r>=m_r_rmax) continue;
152 int ir = static_cast<int>(sps->radius()*irstep);
153 if (ir>irmax) ir = irmax;
154 data.r_Sorted[ir].push_back(sps);
155 ++data.r_map[ir];
156 if (data.r_map[ir]==1) data.r_index[data.nr++] = ir;
157 ++data.ns;
158 }
159 }
160 }
161 }
163}
164
166// Initialize tool for new region
168
170(const EventContext& ctx, EventData& data,
171 const std::vector<IdentifierHash>& vPixel, const std::vector<IdentifierHash>& vSCT) const
172{
173 if (not data.initialized) initializeEventData(data);
174
175 data.trigger = false;
176 if (!m_pixel && !m_sct) return;
177 erase(data);
178
180
181 double f[3], gP[3] ={10.,10.,0.};
182
183 MagField::AtlasFieldCache fieldCache;
184
185 // Get field cache object
187 const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
188 if (fieldCondObj == nullptr) {
189 ATH_MSG_ERROR("SiSpacePointsSeedMaker_HeavyIon: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key());
190 return;
191 }
192 fieldCondObj->getInitializedCache (fieldCache);
193
194 if (fieldCache.solenoidOn()) {
195 fieldCache.getFieldZR(gP, f);
196
197 data.K = 2./(300.*f[2]);
198 } else {
199 data.K = 2./(300.* 5.);
200 }
201
202 data.i_spforseed = data.l_spforseed.begin();
203
204 float irstep = 1./m_r_rstep;
205 int irmax = m_r_size-1;
206
207 // Get pixels space points containers from store gate
208 //
209 if (m_pixel && !vPixel.empty()) {
210
212 if (spacepointsPixel.isValid()) {
213
214 // Loop through all trigger collections
215 //
216 for (const IdentifierHash& l: vPixel) {
217 const auto *w = spacepointsPixel->indexFindPtr(l);
218 if (w==nullptr) continue;
219 for (const Trk::SpacePoint* sp: *w) {
220 float r = sp->r();
221 if (r<0. || r>=m_r_rmax) continue;
223 int ir = static_cast<int>(sps->radius()*irstep);
224 if (ir>irmax) ir = irmax;
225 data.r_Sorted[ir].push_back(sps);
226 ++data.r_map[ir];
227 if (data.r_map[ir]==1) data.r_index[data.nr++] = ir;
228 ++data.ns;
229 }
230 }
231 }
232 }
233
234 // Get sct space points containers from store gate
235 //
236 if (m_sct && !vSCT.empty()) {
237
239 if (spacepointsSCT.isValid()) {
240
241 // Loop through all trigger collections
242 //
243 for (const IdentifierHash& l: vSCT) {
244 const auto *w = spacepointsSCT->indexFindPtr(l);
245 if (w==nullptr) continue;
246 for (const Trk::SpacePoint* sp: *w) {
247 float r = sp->r();
248 if (r<0. || r>=m_r_rmax) continue;
250 int ir = static_cast<int>(sps->radius()*irstep);
251 if (ir>irmax) ir = irmax;
252 data.r_Sorted[ir].push_back(sps);
253 ++data.r_map[ir];
254 if (data.r_map[ir]==1) data.r_index[data.nr++] = ir;
255 ++data.ns;
256 }
257 }
258 }
259 }
261}
262
264// Initialize tool for new region
266
268(const EventContext& ctx, EventData& data,
269 const std::vector<IdentifierHash>& vPixel, const std::vector<IdentifierHash>& vSCT,
270 const IRoiDescriptor&) const
271{
272 newRegion(ctx, data, vPixel, vSCT);
273}
274
276// Methods to initilize different strategies of seeds production
277// with two space points with or without vertex constraint
279
280void InDet::SiSpacePointsSeedMaker_HeavyIon::find2Sp(EventData& data, const std::list<Trk::Vertex>& lv) const
281{
282 if (not data.initialized) initializeEventData(data);
283
284 data.izvertex = not lv.empty();
285
286 int mode = 0;
287 if (lv.begin()!=lv.end()) mode = 1;
288 bool newv = newVertices(data, lv);
289
290 if (newv || !data.state || data.nspoint!=2 || data.mode!=mode || data.nlist) {
291
292 data.i_seede = data.l_seeds.begin();
293 data.state = 1 ;
294 data.nspoint = 2 ;
295 data.nlist = 0 ;
296 data.mode = mode;
297 data.endlist = true;
298 data.fvNmin = 0 ;
299 data.fNmin = 0 ;
300 data.zMin = 0 ;
302 }
303 data.i_seed = data.l_seeds.begin();
304
305 if (m_outputlevel<=0) {
306 data.nprint=1;
307 dump(data, msg(MSG::DEBUG));
308 }
309}
310
312// Methods to initilize different strategies of seeds production
313// with three space points with or without vertex constraint
315
316void InDet::SiSpacePointsSeedMaker_HeavyIon::find3Sp(const EventContext&, EventData& data, const std::list<Trk::Vertex>& lv) const
317{
318 if (not data.initialized) initializeEventData(data);
319
320 data.izvertex = not lv.empty();
321
322 int mode = 2;
323 if (lv.begin()!=lv.end()) mode = 3;
324 bool newv = newVertices(data, lv);
325
326 if (newv || !data.state || data.nspoint!=3 || data.mode!=mode || data.nlist) {
327
328 data.i_seede = data.l_seeds.begin();
329 data.state = 1 ;
330 data.nspoint = 3 ;
331 data.nlist = 0 ;
332 data.mode = mode ;
333 data.endlist = true ;
334 data.fvNmin = 0 ;
335 data.fNmin = 0 ;
336 data.zMin = 0 ;
338 }
339 data.i_seed = data.l_seeds.begin();
340
341 if (m_outputlevel<=0) {
342 data.nprint=1;
343 dump(data, msg(MSG::DEBUG));
344 }
345}
346
347void InDet::SiSpacePointsSeedMaker_HeavyIon::find3Sp(const EventContext& ctx, EventData& data, const std::list<Trk::Vertex>& lv, const double*) const
348{
349 find3Sp(ctx, data, lv);
350}
351
353// Methods to initilize different strategies of seeds production
354// with variable number space points with or without vertex constraint
355// Variable means (2,3,4,....) any number space points
357
358void InDet::SiSpacePointsSeedMaker_HeavyIon::findVSp(const EventContext&, EventData& data, const std::list<Trk::Vertex>& lv) const
359{
360 if (not data.initialized) initializeEventData(data);
361
362 int mode = 5;
363 if (lv.begin()!=lv.end()) mode = 6;
364 bool newv = newVertices(data, lv);
365
366 if (newv || !data.state || data.nspoint!=4 || data.mode!=mode || data.nlist) {
367 data.i_seede = data.l_seeds.begin();
368 data.state = 1 ;
369 data.nspoint = 4 ;
370 data.nlist = 0 ;
371 data.mode = mode ;
372 data.endlist = true ;
373 data.fvNmin = 0 ;
374 data.fNmin = 0 ;
375 data.zMin = 0 ;
377 }
378 data.i_seed = data.l_seeds.begin();
379
380 if (m_outputlevel<=0) {
381 data.nprint=1;
382 dump(data, msg(MSG::DEBUG));
383 }
384}
385
387// Dumps relevant information into the MsgStream
389
391{
392 if (not data.initialized) initializeEventData(data);
393
394 if (data.nprint) return dumpEvent(data, out);
395 return dumpConditions(data, out);
396}
397
399// Dumps conditions information into the MsgStream
401
403{
404 int n = 42-m_spacepointsPixel.key().size();
405 std::string s2; for (int i=0; i<n; ++i) s2.append(" "); s2.append("|");
406 n = 42-m_spacepointsSCT.key().size();
407 std::string s3; for (int i=0; i<n; ++i) s3.append(" "); s3.append("|");
408 n = 42-m_spacepointsOverlap.key().size();
409 std::string s4; for (int i=0; i<n; ++i) s4.append(" "); s4.append("|");
410 n = 42-m_beamSpotKey.key().size();
411 std::string s5; for (int i=0; i<n; ++i) s5.append(" "); s5.append("|");
412
413
414 out<<"|---------------------------------------------------------------------|"
415 <<endmsg;
416 out<<"| Pixel space points | "<<m_spacepointsPixel.key() <<s2
417 <<endmsg;
418 out<<"| SCT space points | "<<m_spacepointsSCT.key()<<s3
419 <<endmsg;
420 out<<"| Overlap space points | "<<m_spacepointsOverlap.key()<<s4
421 <<endmsg;
422 out<<"| BeamConditionsService | "<<m_beamSpotKey.key()<<s5
423 <<endmsg;
424 out<<"| usePixel | "
425 <<std::setw(12)<<m_pixel
426 <<" |"<<endmsg;
427 out<<"| useSCT | "
428 <<std::setw(12)<<m_sct
429 <<" |"<<endmsg;
430 out<<"| maxSize | "
431 <<std::setw(12)<<m_maxsize
432 <<" |"<<endmsg;
433 out<<"| maxSizeSP | "
434 <<std::setw(12)<<m_maxsizeSP
435 <<" |"<<endmsg;
436 out<<"| pTmin (mev) | "
437 <<std::setw(12)<<std::setprecision(5)<<m_ptmin
438 <<" |"<<endmsg;
439 out<<"| |eta| <= | "
440 <<std::setw(12)<<std::setprecision(5)<<m_etamax
441 <<" |"<<endmsg;
442 out<<"| max radius SP | "
443 <<std::setw(12)<<std::setprecision(5)<<m_r_rmax
444 <<" |"<<endmsg;
445 out<<"| radius step | "
446 <<std::setw(12)<<std::setprecision(5)<<m_r_rstep
447 <<" |"<<endmsg;
448 out<<"| min Z-vertex position | "
449 <<std::setw(12)<<std::setprecision(5)<<m_zmin
450 <<" |"<<endmsg;
451 out<<"| max Z-vertex position | "
452 <<std::setw(12)<<std::setprecision(5)<<m_zmax
453 <<" |"<<endmsg;
454 out<<"| min radius first SP(2) | "
455 <<std::setw(12)<<std::setprecision(5)<<m_r1minv
456 <<" |"<<endmsg;
457 out<<"| min radius second SP(2) | "
458 <<std::setw(12)<<std::setprecision(5)<<m_r2minv
459 <<" |"<<endmsg;
460 out<<"| max radius first SP(2) | "
461 <<std::setw(12)<<std::setprecision(5)<<m_r1maxv
462 <<" |"<<endmsg;
463 out<<"| max radius second SP(2) | "
464 <<std::setw(12)<<std::setprecision(5)<<m_r2maxv
465 <<" |"<<endmsg;
466 out<<"| min space points dR | "
467 <<std::setw(12)<<std::setprecision(5)<<m_drmin
468 <<" |"<<endmsg;
469 out<<"| max space points dR | "
470 <<std::setw(12)<<std::setprecision(5)<<m_drmax
471 <<" |"<<endmsg;
472 out<<"| max dZ impact | "
473 <<std::setw(12)<<std::setprecision(5)<<m_dzver
474 <<" |"<<endmsg;
475 out<<"| max dZ/dR impact | "
476 <<std::setw(12)<<std::setprecision(5)<<m_dzdrver
477 <<" |"<<endmsg;
478 out<<"| max impact | "
479 <<std::setw(12)<<std::setprecision(5)<<m_diver
480 <<" |"<<endmsg;
481 out<<"| max impact pps | "
482 <<std::setw(12)<<std::setprecision(5)<<m_diverpps
483 <<" |"<<endmsg;
484 out<<"| max impact sss | "
485 <<std::setw(12)<<std::setprecision(5)<<m_diversss
486 <<" |"<<endmsg;
487 out<<"|---------------------------------------------------------------------|"
488 <<endmsg;
489 out<<"| Beam X center | "
490 <<std::setw(12)<<std::setprecision(5)<<data.xbeam[0]
491 <<" |"<<endmsg;
492 out<<"| Beam Y center | "
493 <<std::setw(12)<<std::setprecision(5)<<data.ybeam[0]
494 <<" |"<<endmsg;
495 out<<"| Beam Z center | "
496 <<std::setw(12)<<std::setprecision(5)<<data.zbeam[0]
497 <<" |"<<endmsg;
498 out<<"| Beam X-axis direction | "
499 <<std::setw(12)<<std::setprecision(5)<<data.xbeam[1]
500 <<std::setw(12)<<std::setprecision(5)<<data.xbeam[2]
501 <<std::setw(12)<<std::setprecision(5)<<data.xbeam[3]
502 <<" |"<<endmsg;
503 out<<"| Beam Y-axis direction | "
504 <<std::setw(12)<<std::setprecision(5)<<data.ybeam[1]
505 <<std::setw(12)<<std::setprecision(5)<<data.ybeam[2]
506 <<std::setw(12)<<std::setprecision(5)<<data.ybeam[3]
507 <<" |"<<endmsg;
508 out<<"| Beam Z-axis direction | "
509 <<std::setw(12)<<std::setprecision(5)<<data.zbeam[1]
510 <<std::setw(12)<<std::setprecision(5)<<data.zbeam[2]
511 <<std::setw(12)<<std::setprecision(5)<<data.zbeam[3]
512 <<" |"<<endmsg;
513 out<<"|---------------------------------------------------------------------|"
514 <<endmsg;
515 return out;
516}
517
519// Dumps event information into the MsgStream
521
523{
524 out<<"|---------------------------------------------------------------------|"
525 <<endmsg;
526 out<<"| data.ns | "
527 <<std::setw(12)<<data.ns
528 <<" |"<<endmsg;
529 out<<"| data.nsaz | "
530 <<std::setw(12)<<data.nsaz
531 <<" |"<<endmsg;
532 out<<"| data.nsazv | "
533 <<std::setw(12)<<data.nsazv
534 <<" |"<<endmsg;
535 out<<"| seeds | "
536 <<std::setw(12)<<data.l_seeds.size()
537 <<" |"<<endmsg;
538 out<<"|---------------------------------------------------------------------|"
539 <<endmsg;
540 return out;
541}
542
544// Find next set space points
546
548{
549 if (data.endlist) return;
550
551 data.i_seede = data.l_seeds.begin();
552 if (data.mode==0 || data.mode==1) production2Sp(data);
553 else if (data.mode==2 || data.mode==3) production3Sp(data);
554 else if (data.mode==5 || data.mode==6) production3Sp(data);
555
556 data.i_seed = data.l_seeds.begin();
557 ++data.nlist;
558}
559
561// New and old list vertices comparison
563
564bool InDet::SiSpacePointsSeedMaker_HeavyIon::newVertices(EventData& data, const std::list<Trk::Vertex>& lV) const
565{
566 unsigned int s1 = data.l_vertex.size();
567 unsigned int s2 = lV.size();
568
569 if (s1==0 && s2==0) return false;
570
571 data.l_vertex.clear();
572
573 for (const Trk::Vertex& v: lV) {
574 data.l_vertex.insert(static_cast<float>(v.position().z()));
575 if (data.l_vertex.size() >= m_maxNumberVertices) break;
576 }
577 return false;
578}
579
581// Initiate frame work for seed generator
583
585{
586 m_ptmin = std::max( std::abs(m_ptmin), float(100.*m_fieldScale));
587 m_etamax = std::abs(m_etamax) ;
588 m_dzdrmax = 1.f/std::tan(2.f*std::atan(exp(-m_etamax)));
590 m_COF = 134*.05*9. ;
591 m_ipt = 1.f/std::abs(.9f*m_ptmin) ;
592 m_ipt2 = m_ipt*m_ipt ;
593
594 // Build radius sorted containers
595 //
596 m_r_size = static_cast<int>((m_r_rmax+.1)/m_r_rstep);
597
598 // Build radius-azimuthal sorted containers
599 //
600 constexpr float pi2 = 2.*M_PI;
601 const int NFmax = SizeRF;
602 const float sFmax = static_cast<float>(NFmax)/pi2;
603 const float sFmin = 100./60.;
604
606 if (m_sF > sFmax ) m_sF = sFmax;
607 else if (m_sF < sFmin) m_sF = sFmin;
608 m_fNmax = static_cast<int>(pi2*m_sF);
609 if (m_fNmax >=NFmax) m_fNmax = NFmax-1;
610
611 // Build radius-azimuthal-Z sorted containers for Z-vertices
612 //
613 const int NFtmax = SizeRFV;
614 const float sFvmax = static_cast<float>(NFtmax)/pi2;
615 m_sFv = m_ptmin/m_fieldScale /120.f;
616 if (m_sFv > sFvmax) m_sFv = sFvmax;
617 m_fvNmax = static_cast<int>(pi2*m_sFv);
618 if (m_fvNmax>=NFtmax) m_fvNmax = NFtmax-1;
619
620 // Build maps for radius-azimuthal-Z sorted collections
621 //
622 for (int f=0; f<=m_fNmax; ++f) {
623 int fb = f-1;
624 if (fb<0) fb = m_fNmax;
625 int ft = f+1;
626 if (ft>m_fNmax) ft = 0;
627
628 // For each azimuthal region loop through all Z regions
629 //
630 for (int z=0; z<SizeZ; ++z) {
631 int a = f *SizeZ+z;
632 int b = fb*SizeZ+z;
633 int c = ft*SizeZ+z;
634 m_rfz_b [a] = 3; m_rfz_t [a] = 3;
635 m_rfz_ib[a][0] = a; m_rfz_it[a][0] = a;
636 m_rfz_ib[a][1] = b; m_rfz_it[a][1] = b;
637 m_rfz_ib[a][2] = c; m_rfz_it[a][2] = c;
638 if (z==5) {
639 m_rfz_t [a] = 9 ;
640 m_rfz_it[a][3] = a+1;
641 m_rfz_it[a][4] = b+1;
642 m_rfz_it[a][5] = c+1;
643 m_rfz_it[a][6] = a-1;
644 m_rfz_it[a][7] = b-1;
645 m_rfz_it[a][8] = c-1;
646 } else if (z> 5) {
647 m_rfz_b [a] = 6 ;
648 m_rfz_ib[a][3] = a-1;
649 m_rfz_ib[a][4] = b-1;
650 m_rfz_ib[a][5] = c-1;
651 if (z<10) {
652 m_rfz_t [a] = 6 ;
653 m_rfz_it[a][3] = a+1;
654 m_rfz_it[a][4] = b+1;
655 m_rfz_it[a][5] = c+1;
656 }
657 } else {
658 m_rfz_b [a] = 6 ;
659 m_rfz_ib[a][3] = a+1;
660 m_rfz_ib[a][4] = b+1;
661 m_rfz_ib[a][5] = c+1;
662 if (z>0) {
663 m_rfz_t [a] = 6 ;
664 m_rfz_it[a][3] = a-1;
665 m_rfz_it[a][4] = b-1;
666 m_rfz_it[a][5] = c-1;
667 }
668 }
669 if (z==3) {
670 m_rfz_b[a] = 9;
671 m_rfz_ib[a][6] = a+2;
672 m_rfz_ib[a][7] = b+2;
673 m_rfz_ib[a][8] = c+2;
674 } else if (z==7) {
675 m_rfz_b[a] = 9;
676 m_rfz_ib[a][6] = a-2;
677 m_rfz_ib[a][7] = b-2;
678 m_rfz_ib[a][8] = c-2;
679 }
680 }
681 }
682
683 // Build maps for radius-azimuthal-Z sorted collections for Z
684 //
685 for (int f=0; f<=m_fvNmax; ++f) {
686 int fb = f-1; if (fb<0 ) fb=m_fvNmax;
687 int ft = f+1; if (ft>m_fvNmax) ft=0;
688
689 // For each azimuthal region loop through central Z regions
690 //
691 for (int z=0; z<SizeZV; ++z) {
692 int a = f *SizeZV+z;
693 int b = fb*SizeZV+z;
694 int c = ft*SizeZV+z;
695 m_rfzv_n[a] = 3;
696 m_rfzv_i[a][0] = a;
697 m_rfzv_i[a][1] = b;
698 m_rfzv_i[a][2] = c;
699 if (z>1) {
700 m_rfzv_n[a] = 6;
701 m_rfzv_i[a][3] = a-1;
702 m_rfzv_i[a][4] = b-1;
703 m_rfzv_i[a][5] = c-1;
704 } else if (z<1) {
705 m_rfzv_n[a] = 6;
706 m_rfzv_i[a][3] = a+1;
707 m_rfzv_i[a][4] = b+1;
708 m_rfzv_i[a][5] = c+1;
709 }
710 }
711 }
712}
713
715// Initiate beam frame work for seed generator
717
719{
721
722 const Amg::Vector3D& cb = beamSpotHandle->beamPos();
723 double tx = std::tan(beamSpotHandle->beamTilt(0));
724 double ty = std::tan(beamSpotHandle->beamTilt(1));
725
726 double ph = atan2(ty,tx);
727 double th = acos(1./sqrt(1.+tx*tx+ty*ty));
728 double sint = sin(th);
729 double cost = cos(th);
730 double sinp = sin(ph);
731 double cosp = cos(ph);
732
733 data.xbeam[0] = static_cast<float>(cb.x()) ;
734 data.xbeam[1] = static_cast<float>(cost*cosp*cosp+sinp*sinp);
735 data.xbeam[2] = static_cast<float>(cost*sinp*cosp-sinp*cosp);
736 data.xbeam[3] =-static_cast<float>(sint*cosp );
737
738 data.ybeam[0] = static_cast<float>(cb.y()) ;
739 data.ybeam[1] = static_cast<float>(cost*cosp*sinp-sinp*cosp);
740 data.ybeam[2] = static_cast<float>(cost*sinp*sinp+cosp*cosp);
741 data.ybeam[3] =-static_cast<float>(sint*sinp );
742
743 data.zbeam[0] = static_cast<float>(cb.z()) ;
744 data.zbeam[1] = static_cast<float>(sint*cosp) ;
745 data.zbeam[2] = static_cast<float>(sint*sinp) ;
746 data.zbeam[3] = static_cast<float>(cost) ;
747}
748
750// Initiate beam frame work for seed generator
752
754(EventData& data, const Trk::SpacePoint*const& sp,float* r)
755{
756 r[0] = static_cast<float>(sp->globalPosition().x())-data.xbeam[0];
757 r[1] = static_cast<float>(sp->globalPosition().y())-data.ybeam[0];
758 r[2] = static_cast<float>(sp->globalPosition().z())-data.zbeam[0];
759}
760
762// Initiate space points seed maker
764
766{
767 constexpr float pi2 = 2.*M_PI;
768 std::vector<InDet::SiSpacePointForSeed*>::iterator r;
769
770 for (int i=0; i<m_r_size; ++i) {
771 if (!data.r_map[i]) continue;
772 r = data.r_Sorted[i].begin();
773
774 while (r!=data.r_Sorted[i].end()) {
775
776 // Azimuthal angle sort
777 //
778 float F = (*r)->phi();
779 if (F<0.) F+=pi2;
780
781 int f = static_cast<int>(F*m_sF);
782 if (f < 0) f = m_fNmax;
783 else if (f > m_fNmax) f = 0;
784
785 int z;
786 float Z = (*r)->z();
787
788 // Azimuthal angle and Z-coordinate sort
789 //
790 if (Z>0.) {
791 Z< 250.?z=5:Z< 450.?z=6:Z< 925.?z=7:Z< 1400.?z=8:Z< 2500.?z=9:z=10;
792 } else {
793 Z>-250.?z=5:Z>-450.?z=4:Z>-925.?z=3:Z>-1400.?z=2:Z>-2500.?z=1:z= 0;
794 }
795 int n = f*SizeZ+z;
796 ++data.nsaz;
797 data.rfz_Sorted[n].push_back(*r);
798 if (!data.rfz_map[n]++) data.rfz_index[data.nrfz++] = n;
799
800 if ((*r)->spacepoint->clusterList().second == 0 && z>=3 && z<=7) {
801 z<=4 ? z=0 : z>=6 ? z=2 : z=1;
802
803 // Azimuthal angle and Z-coordinate sort for fast vertex search
804 //
805 f = static_cast<int>(F*m_sFv);
806 if (f < 0) f += m_fvNmax;
807 else if (f> m_fvNmax) f -= m_fvNmax;
808 n = f*SizeZV+z;
809 ++data.nsazv;
810 data.rfzv_Sorted[n].push_back(*r);
811 if (!data.rfzv_map[n]++) data.rfzv_index[data.nrfzv++] = n;
812 }
813 r = data.r_Sorted[i].erase(r);
814 }
815 data.r_map[i] = 0;
816 }
817 data.nr = 0;
818 data.state = 0;
819}
820
822// Erase space point information
824
826{
827 for (int i=0; i<data.nr; ++i) {
828 int n = data.r_index[i];
829 data.r_map[n] = 0;
830 data.r_Sorted[n].clear();
831 }
832
833 for (int i=0; i<data.nrfz; ++i) {
834 int n = data.rfz_index[i];
835 data.rfz_map[n] = 0;
836 data.rfz_Sorted[n].clear();
837 }
838
839 for (int i=0; i<data.nrfzv; ++i) {
840 int n = data.rfzv_index[i];
841 data.rfzv_map[n] = 0;
842 data.rfzv_Sorted[n].clear();
843 }
844 data.state = 0;
845 data.ns = 0;
846 data.nsaz = 0;
847 data.nsazv = 0;
848 data.nr = 0;
849 data.nrfz = 0;
850 data.nrfzv = 0;
851}
852
854// 2 space points seeds production
856
858{
859 if (data.nsazv<2) return;
860
861 std::vector<InDet::SiSpacePointForSeed*>::iterator r0,r0e,r,re;
862 int nseed = 0;
863
864 // Loop thorugh all azimuthal regions
865 //
866 for (int f=data.fvNmin; f<=m_fvNmax; ++f) {
867
868 // For each azimuthal region loop through Z regions
869 //
870 int z = 0;
871 if (!data.endlist) z = data.zMin;
872 for (; z<SizeZV; ++z) {
873 int a = f*SizeZV+z;
874 if (!data.rfzv_map[a]) continue;
875 r0 = data.rfzv_Sorted[a].begin();
876 r0e = data.rfzv_Sorted[a].end ();
877
878 if (!data.endlist) {
879 r0 = data.rMin;
880 data.endlist = true;
881 }
882
883 // Loop through trigger space points
884 //
885 for (; r0!=r0e; ++r0) {
886 float X = (*r0)->x();
887 float Y = (*r0)->y();
888 float R = (*r0)->radius();
889 if (R<m_r2minv) continue;
890 if (R>m_r2maxv) break;
891 float Z = (*r0)->z();
892 float ax = X/R;
893 float ay = Y/R;
894
895 // Bottom links production
896 //
897 int NB = m_rfzv_n[a];
898 for (int i=0; i<NB; ++i) {
899 int an = m_rfzv_i[a][i];
900 if (!data.rfzv_map[an]) continue;
901
902 r = data.rfzv_Sorted[an].begin();
903 re = data.rfzv_Sorted[an].end ();
904
905 for (; r!=re; ++r) {
906 float Rb =(*r)->radius();
907 if (Rb<m_r1minv) continue;
908 if (Rb>m_r1maxv) break;
909 float dR = R-Rb;
910 if (dR<m_drminv) break;
911 if (dR>m_drmax) continue;
912 float dZ = Z-(*r)->z();
913 float Tz = dZ/dR;
914 if (Tz<m_dzdrmin || Tz>m_dzdrmax) continue;
915 float Zo = Z-R*Tz;
916
917 // Comparison with vertices Z coordinates
918 //
919 if (!isZCompatible(data, Zo, Rb, Tz)) continue;
920
921 // Momentum cut
922 //
923 float dx =(*r)->x()-X;
924 float dy =(*r)->y()-Y;
925 float x = dx*ax+dy*ay ;
926 float y =-dx*ay+dy*ax ;
927 float xy = x*x+y*y ; if (xy == 0.) continue;
928 float r2 = 1./xy ;
929 float Ut = x*r2 ;
930 float Vt = y*r2 ;
931 float UR = Ut*R+1. ; if (UR == 0.) continue;
932 float A = Vt*R/UR ;
933 float B = Vt-A*Ut ;
934 if (std::abs(B*data.K) > m_ipt*std::sqrt(1.f+A*A)) continue;
935 ++nseed;
936 newSeed(data, (*r)->spacepoint, (*r0)->spacepoint,Zo);
937 }
938 }
939 if (nseed < m_maxsize) continue;
940 data.endlist=false;
941 data.rMin = (++r0);
942 data.fvNmin=f;
943 data.zMin=z;
944 return;
945 }
946 }
947 }
948 data.endlist = true;
949}
950
952// Production 3 space points seeds
954
956{
957 if (data.nsaz<3) return;
958
959 const int ZI[SizeZ] = {5,6,7,8,9,10,4,3,2,1,0};
960 std::vector<InDet::SiSpacePointForSeed*>::iterator rt[9],rte[9],rb[9],rbe[9];
961 int nseed = 0;
962
963 // Loop thorugh all azimuthal regions
964 //
965 for (int f=data.fNmin; f<=m_fNmax; ++f) {
966 // For each azimuthal region loop through all Z regions
967 //
968 int z = 0;
969 if (!data.endlist) z = data.zMin;
970
971 for (; z<SizeZ; ++z) {
972 int a = f*SizeZ+ZI[z];
973 if (!data.rfz_map[a]) continue;
974 int NB = 0, NT = 0;
975 for (int i=0; i<m_rfz_b[a]; ++i) {
976 int an = m_rfz_ib[a][i];
977 if (!data.rfz_map[an]) continue;
978 rb [NB] = data.rfz_Sorted[an].begin();
979 rbe[NB++] = data.rfz_Sorted[an].end();
980 }
981 for (int i=0; i<m_rfz_t[a]; ++i) {
982 int an = m_rfz_it[a][i];
983 if (!data.rfz_map[an]) continue;
984 rt [NT] = data.rfz_Sorted[an].begin();
985 rte[NT++] = data.rfz_Sorted[an].end();
986 }
987 if (data.izvertex) {
988 production3Sp(data, rb, rbe, rt, rte, NB, NT, nseed);
989 } else {
990 production3SpNoVertex(data, rb, rbe, rt, rte, NB, NT, nseed);
991 }
992 if (!data.endlist) {
993 data.fNmin=f;
994 data.zMin = z;
995 return;
996 }
997 }
998 }
999 data.endlist = true;
1000}
1001
1003// Production 3 space points seeds for full scan
1005
1007(EventData& data,
1008 std::vector<InDet::SiSpacePointForSeed*>::iterator* rb ,
1009 std::vector<InDet::SiSpacePointForSeed*>::iterator* rbe,
1010 std::vector<InDet::SiSpacePointForSeed*>::iterator* rt ,
1011 std::vector<InDet::SiSpacePointForSeed*>::iterator* rte,
1012 int NB, int NT, int& nseed) const
1013{
1014 std::vector<InDet::SiSpacePointForSeed*>::iterator r0=rb[0],r;
1015 if (!data.endlist) {r0 = data.rMin; data.endlist = true;}
1016
1017 // Loop through all trigger space points
1018 //
1019 for (; r0!=rbe[0]; ++r0) {
1020 data.nOneSeeds = 0;
1021 data.mapOneSeeds.erase(data.mapOneSeeds.begin(), data.mapOneSeeds.end());
1022
1023 float R = (*r0)->radius();
1024
1025 const Trk::SpacePoint* SP0 = (*r0)->spacepoint;
1026 if (SP0->clusterList().second) break;
1027
1028 const Trk::Surface* sur0 = (*r0)->sur();
1029 float X = (*r0)->x() ;
1030 float Y = (*r0)->y() ;
1031 float Z = (*r0)->z() ;
1032 int Nb = 0 ;
1033
1034 // Bottom links production
1035 //
1036 for (int i=0; i<NB; ++i) {
1037 for (r=rb[i]; r!=rbe[i]; ++r) {
1038 float Rb =(*r)->radius();
1039 float dR = R-Rb;
1040 if (dR > m_drmax) {rb[i]=r; continue;}
1041 if (dR < m_drmin) break;
1042 if ((*r)->sur()==sur0) continue;
1043
1044 float Tz = (Z-(*r)->z())/dR;
1045
1046 if (Tz < m_dzdrmin || Tz > m_dzdrmax) continue;
1047
1048 // Comparison with vertices Z coordinates
1049 //
1050 float Zo = Z-R*Tz;
1051 if (!isZCompatible(data, Zo, Rb, Tz)) continue;
1052 data.SP[Nb] = (*r);
1053 if (++Nb==m_maxsizeSP) goto breakb;
1054 }
1055 }
1056 breakb:
1057 if (!Nb || Nb==m_maxsizeSP) continue;
1058 int Nt = Nb;
1059
1060 // Top links production
1061 //
1062 for (int i=0; i<NT; ++i) {
1063 for (r=rt[i]; r!=rte[i]; ++r) {
1064 float Rt =(*r)->radius();
1065 float dR = Rt-R;
1066 if (dR<m_drmin) {
1067 rt[i]=r;
1068 continue;
1069 }
1070 if (dR>m_drmax) break;
1071 if ( (*r)->sur()==sur0) continue;
1072
1073 float Tz = ((*r)->z()-Z)/dR;
1074
1075 if (Tz < m_dzdrmin || Tz > m_dzdrmax) continue;
1076
1077 // Comparison with vertices Z coordinates
1078 //
1079 float Zo = Z-R*Tz;
1080 if (!isZCompatible(data, Zo, R ,Tz)) continue;
1081 data.SP[Nt] = (*r);
1082 if (++Nt==m_maxsizeSP) goto breakt;
1083 }
1084 }
1085
1086 breakt:
1087 if (!(Nt-Nb)) continue;
1088
1089 float covr0 = (*r0)->covr();
1090 float covz0 = (*r0)->covz();
1091
1092 float ax = X/R;
1093 float ay = Y/R;
1094
1095 for (int i=0; i<Nt; ++i) {
1097
1098 float dx = sp->x()-X ;
1099 float dy = sp->y()-Y ;
1100 float dz = sp->z()-Z ;
1101 float x = dx*ax+dy*ay ;
1102 float y =-dx*ay+dy*ax ;
1103 float r2 = 1.f/(x*x+y*y);
1104 float dr = std::sqrt(r2) ;
1105 float tz = dz*dr ;
1106 if (i < Nb) tz = -tz;
1107
1108 data.Tz[i] = tz ;
1109 data.Zo[i] = Z-R*tz ;
1110 data.R [i] = dr ;
1111 data.U [i] = x*r2 ;
1112 data.V [i] = y*r2 ;
1113 data.Er[i] = (covz0+sp->covz()+tz*tz*(covr0+sp->covr()))*r2;
1114 }
1115
1116 float imc = m_diver ;
1117 float ipt2 = m_ipt2 ;
1118 float K = data.K ;
1119 float K2 = K*K ;
1120 float COF = m_COF ;
1121 float ipt2K = ipt2/K2 ;
1122 float ipt2C = ipt2*COF ;
1123 float COFK = COF*K2 ;
1124 covr0 *= 2. ;
1125 covz0 *= 2. ;
1126
1127 //
1128 for (int b=0; b<Nb; ++b) {
1129 const Trk::SpacePoint* SPb = data.SP[b]->spacepoint;
1130
1131 float Zob = data.Zo[b] ;
1132 float Tzb = data.Tz[b] ;
1133 float Rb2r = data.R [b]*covr0;
1134 float Rb2z = data.R [b]*covz0;
1135 float Erb = data.Er[b] ;
1136 float Vb = data.V [b] ;
1137 float Ub = data.U [b] ;
1138 float Tzb2 = (1.f+Tzb*Tzb) ;
1139 float CSA = Tzb2*COFK ;
1140 float ICSA = Tzb2*ipt2C ;
1141 float dZ = dZVertexMin(data, Zob);
1142 float Iz = (dZ*dZ)/Tzb2 ;
1143
1144 for (int t=Nb; t<Nt; ++t) {
1145 float Ts = .5f*(Tzb+data.Tz[t]) ;
1146 float dt = Tzb-data.Tz[t] ;
1147 float dT = dt*dt-Erb-data.Er[t]-data.R[t]*(Ts*Ts*Rb2r+Rb2z);
1148 if ( dT > ICSA) continue;
1149 float dU = data.U[t]-Ub; if (dU == 0.) continue ;
1150 float A = (data.V[t]-Vb)/dU ;
1151 float S2 = 1.f+A*A ;
1152 float B = Vb-A*Ub ;
1153 float B2 = B*B ;
1154 if (B2 > ipt2K*S2 || dT*S2 > B2*CSA) continue;
1155 float Im = std::abs((A-B*R)*R) ;
1156
1157 if ( Im > imc ) continue;
1158 Im = Im*Im+Iz;
1159 newOneSeed(data, SPb, SP0, data.SP[t]->spacepoint, Zob, Im);
1160 }
1161 }
1162 nseed += data.mapOneSeeds.size();
1163 fillSeeds(data);
1164 if (nseed>=m_maxsize) {
1165 data.endlist=false;
1166 ++r0;
1167 data.rMin = r0;
1168 return;
1169 }
1170 }
1171}
1172
1173
1175// Production 3 space points seeds for full scan without vertex information
1177
1179(EventData& data,
1180 std::vector<InDet::SiSpacePointForSeed*>::iterator* rb ,
1181 std::vector<InDet::SiSpacePointForSeed*>::iterator* rbe,
1182 std::vector<InDet::SiSpacePointForSeed*>::iterator* rt ,
1183 std::vector<InDet::SiSpacePointForSeed*>::iterator* rte,
1184 int NB, int NT, int& nseed) const
1185{
1186 std::vector<InDet::SiSpacePointForSeed*>::iterator r0=rb[0],r;
1187 if (!data.endlist) {
1188 r0 = data.rMin;
1189 data.endlist = true;
1190 }
1191
1192 // Loop through all trigger space points
1193 //
1194 for (; r0!=rbe[0]; ++r0) {
1195 data.nOneSeeds = 0;
1196 data.mapOneSeeds.erase(data.mapOneSeeds.begin(), data.mapOneSeeds.end());
1197
1198 float R = (*r0)->radius();
1199
1200 const Trk::SpacePoint* SP0 = (*r0)->spacepoint;
1201
1202 bool pix = true;
1203 if (SP0->clusterList().second) pix = false;
1204 const Trk::Surface* sur0 = (*r0)->sur();
1205 float X = (*r0)->x() ;
1206 float Y = (*r0)->y() ;
1207 float Z = (*r0)->z() ;
1208 int Nb = 0 ;
1209
1210 // Bottom links production
1211 //
1212 for (int i=0; i<NB; ++i) {
1213 for (r=rb[i]; r!=rbe[i]; ++r) {
1214 float Rb =(*r)->radius();
1215 float dR = R-Rb;
1216 if (dR > m_drmax) {
1217 rb[i]=r;
1218 continue;
1219 }
1220 if (dR < m_drmin) break;
1221 if ((*r)->sur()==sur0) continue;
1222 if ( !pix && !(*r)->spacepoint->clusterList().second) continue;
1223 float Tz = (Z-(*r)->z())/dR;
1224 if (Tz < m_dzdrmin || Tz > m_dzdrmax) continue;
1225
1226 // Comparison with vertices Z coordinates
1227 //
1228 float Zo = Z-R*Tz;
1229 if (!isZCompatible(data, Zo, Rb, Tz)) continue;
1230 data.SP[Nb] = (*r);
1231 if (++Nb==m_maxsizeSP) goto breakb;
1232 }
1233 }
1234 breakb:
1235 if (!Nb || Nb==m_maxsizeSP) continue;
1236 int Nt = Nb;
1237
1238 // Top links production
1239 //
1240 for (int i=0; i<NT; ++i) {
1241 for (r=rt[i]; r!=rte[i]; ++r) {
1242 float Rt =(*r)->radius();
1243 float dR = Rt-R;
1244 if (dR<m_drmin) {
1245 rt[i]=r;
1246 continue;
1247 }
1248 if (dR > m_drmax) break;
1249 if ((*r)->sur()==sur0) continue;
1250 float Tz = ((*r)->z()-Z)/dR;
1251 if (Tz < m_dzdrmin || Tz > m_dzdrmax) continue;
1252
1253 // Comparison with vertices Z coordinates
1254 //
1255 float Zo = Z-R*Tz;
1256 if (!isZCompatible(data, Zo, R, Tz)) continue;
1257 data.SP[Nt] = (*r);
1258 if (++Nt==m_maxsizeSP) goto breakt;
1259 }
1260 }
1261
1262 breakt:
1263 if (!(Nt-Nb)) continue;
1264
1265 float covr0 = (*r0)->covr();
1266 float covz0 = (*r0)->covz();
1267
1268 float ax = X/R;
1269 float ay = Y/R;
1270
1271 for (int i=0; i<Nt; ++i) {
1273
1274 float dx = sp->x()-X ;
1275 float dy = sp->y()-Y ;
1276 float dz = sp->z()-Z ;
1277 float x = dx*ax+dy*ay ;
1278 float y =-dx*ay+dy*ax ;
1279 float r2 = 1.f/(x*x+y*y);
1280 float dr = std::sqrt(r2) ;
1281 float tz = dz*dr ;
1282 if (i < Nb) tz = -tz;
1283
1284 data.Tz[i] = tz ;
1285 data.Zo[i] = Z-R*tz ;
1286 data.R [i] = dr ;
1287 data.U [i] = x*r2 ;
1288 data.V [i] = y*r2 ;
1289 data.Er[i] = (covz0+sp->covz()+tz*tz*(covr0+sp->covr()))*r2;
1290 }
1291
1292 float imc = m_diver ;
1293 float imcs = m_diverpps;
1294 float ipt2 = m_ipt2 ;
1295 float K = data.K ;
1296 float K2 = K*K ;
1297 float COF = m_COF ;
1298 float ipt2K = ipt2/K2 ;
1299 float ipt2C = ipt2*COF ;
1300 float COFK = COF*K2 ;
1301 covr0 *= 2. ;
1302 covz0 *= 2. ;
1303
1304 // Three space points comparison
1305 //
1306 for (int b=0; b<Nb; ++b) {
1307 const Trk::SpacePoint* SPb = data.SP[b]->spacepoint;
1308
1309 float Zob = data.Zo[b] ;
1310 float Tzb = data.Tz[b] ;
1311 float Rb2r = data.R [b]*covr0;
1312 float Rb2z = data.R [b]*covz0;
1313 float Erb = data.Er[b] ;
1314 float Vb = data.V [b] ;
1315 float Ub = data.U [b] ;
1316 float Tzb2 = (1.f+Tzb*Tzb) ;
1317 float CSA = Tzb2*COFK ;
1318 float ICSA = Tzb2*ipt2C ;
1319
1320 for (int t=Nb; t<Nt; ++t) {
1321 float Ts = .5f*(Tzb+data.Tz[t]) ;
1322 float dt = Tzb-data.Tz[t] ;
1323 float dT = dt*dt-Erb-data.Er[t]-data.R[t]*(Ts*Ts*Rb2r+Rb2z);
1324 if ( dT > ICSA) continue;
1325 float dU = data.U[t]-Ub;
1326 if (dU == 0.) continue;
1327 float A = (data.V[t]-Vb)/dU ;
1328 float S2 = 1.f+A*A ;
1329 float B = Vb-A*Ub ;
1330 float B2 = B*B ;
1331 if (B2 > ipt2K*S2 || dT*S2 > B2*CSA) continue;
1332 float Im = std::abs((A-B*R)*R) ;
1333
1334 if (pix) {
1335 if ( Im > imc ) continue;
1336 if (data.SP[t]->spacepoint->clusterList().second && Im > imcs) continue;
1337 } else if (Im > m_diversss) {
1338 continue;
1339 }
1340 newOneSeed(data, SPb, SP0, data.SP[t]->spacepoint, Zob, Im);
1341 }
1342 }
1343 nseed += data.mapOneSeeds.size();
1344 fillSeeds(data);
1345 if (nseed>=m_maxsize) {
1346 data.endlist=false;
1347 ++r0;
1348 data.rMin = r0;
1349 return;
1350 }
1351 }
1352}
1353
1355// New 3 space points seeds from one space points
1357
1359(EventData& data,
1360 const Trk::SpacePoint*& p1,const Trk::SpacePoint*& p2,
1361 const Trk::SpacePoint*& p3,const float& z,const float& q) const
1362{
1363 if (data.nOneSeeds < m_maxOneSize) {
1364
1365 data.OneSeeds[data.nOneSeeds].erase();
1366 data.OneSeeds[data.nOneSeeds].add(p1);
1367 data.OneSeeds[data.nOneSeeds].add(p2);
1368 data.OneSeeds[data.nOneSeeds].add(p3);
1369 data.OneSeeds[data.nOneSeeds].setZVertex(static_cast<double>(z));
1370 data.mapOneSeeds.insert(std::make_pair(q, &(data.OneSeeds[data.nOneSeeds])));
1371 ++data.nOneSeeds;
1372 } else {
1373 std::multimap<float,InDet::SiSpacePointsSeed*>::reverse_iterator
1374 l = data.mapOneSeeds.rbegin();
1375 if ((*l).first <= q) return;
1376
1377 InDet::SiSpacePointsSeed* s = (*l).second;
1378 s->erase();
1379 s->add(p1);
1380 s->add(p2);
1381 s->add(p3);
1382 s->setZVertex(static_cast<double>(z));
1383 std::multimap<float,InDet::SiSpacePointsSeed*>::iterator
1384 i = data.mapOneSeeds.insert(std::make_pair(q,s));
1385
1386 for (++i; i!=data.mapOneSeeds.end(); ++i) {
1387 if ((*i).second==s) {
1388 data.mapOneSeeds.erase(i);
1389 return;
1390 }
1391 }
1392 }
1393}
1394
1396{
1397 if (not data.initialized) initializeEventData(data);
1398
1399 if (data.i_seed==data.i_seede) {
1400 findNext(data);
1401 //cppcheck-suppress identicalInnerCondition
1402 if (data.i_seed==data.i_seede) return nullptr;
1403 }
1404 return &(*data.i_seed++);
1405}
1406
1408(EventData& data, float& Zv, float& R, float& T) const
1409{
1410 if (Zv < m_zmin || Zv > m_zmax) return false;
1411 if (!data.izvertex) return true;
1412
1413 float dZmin = std::numeric_limits<float>::max();
1414 for (const float& v: data.l_vertex) {
1415 float dZ = std::abs(v-Zv);
1416 if (dZ<dZmin) dZmin=dZ;
1417 }
1418 return dZmin < (m_dzver+m_dzdrver*R)*sqrt(1.+T*T);
1419}
1420
1422{
1423 float dZm = std::numeric_limits<float>::max();
1424 for (const float& v: data.l_vertex) {
1425 float dZ = std::abs(v-Z);
1426 if (dZ<dZm) dZm = dZ;
1427 }
1428 return dZm;
1429}
1430
1432// New space point for seeds
1434
1436(EventData& data, const Trk::SpacePoint*const& sp)
1437{
1438 InDet::SiSpacePointForSeed* sps = nullptr;
1439
1440 float r[3];
1442
1443 if (data.i_spforseed!=data.l_spforseed.end()) {
1444 sps = &(*data.i_spforseed++);
1445 sps->set(sp,r);
1446 } else {
1447 data.l_spforseed.emplace_back(sp, r);
1448 sps = &(data.l_spforseed.back());
1449 data.i_spforseed = data.l_spforseed.end();
1450 }
1451
1452 return sps;
1453}
1454
1456// New 2 space points seeds
1458
1460(EventData& data,
1461 const Trk::SpacePoint*& p1, const Trk::SpacePoint*& p2,
1462 const float& z)
1463{
1464 if (data.i_seede!=data.l_seeds.end()) {
1465 InDet::SiSpacePointsSeed* s = &(*data.i_seede++);
1466 s->erase();
1467 s->add(p1);
1468 s->add(p2);
1469 s->setZVertex(static_cast<double>(z));
1470 } else {
1471 data.l_seeds.emplace_back(p1, p2, z);
1472 data.i_seede = data.l_seeds.end();
1473 }
1474}
1475
1477// New 3 space points seeds
1479
1481(EventData& data,
1482 const Trk::SpacePoint*& p1, const Trk::SpacePoint*& p2,
1483 const Trk::SpacePoint*& p3, const float& z)
1484{
1485 if (data.i_seede!=data.l_seeds.end()) {
1486 InDet::SiSpacePointsSeed* s = &(*data.i_seede++);
1487 s->erase();
1488 s->add(p1);
1489 s->add(p2);
1490 s->add(p3);
1491 s->setZVertex(static_cast<double>(z));
1492 } else {
1493 data.l_seeds.emplace_back(p1, p2, p3, z);
1494 data.i_seede = data.l_seeds.end();
1495 }
1496}
1497
1499// Fill seeds
1501
1503{
1504 std::multimap<float, InDet::SiSpacePointsSeed*>::iterator
1505 l = data.mapOneSeeds.begin(),
1506 le = data.mapOneSeeds.end ();
1507 for (; l!=le; ++l) {
1508 if (data.i_seede!=data.l_seeds.end()) {
1509 InDet::SiSpacePointsSeed* s = &(*data.i_seede++);
1510 *s = *(*l).second;
1511 } else {
1512 data.l_seeds.emplace_back(*(*l).second);
1513 data.i_seede = data.l_seeds.end();
1514 }
1515 }
1516}
1517
1519 data.initialize(EventData::ToolType::HeavyIon,
1522 0, // maxsize not used
1523 m_r_size,
1524 0, // sizeRF not used
1525 SizeRFZ,
1526 SizeRFZV,
1527 false); // checkEta not used
1528}
1529
1532
const boost::regex re(r_e)
#define M_PI
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static Double_t sp
static Double_t a
static Double_t sc
#define F(x, y, z)
Definition MD5.cxx:112
struct TBPatternUnitContext S2
#define y
#define x
#define z
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
Describes the API of the Region of Ineterest geometry.
This is a "hash" representation of an Identifier.
void set(const Trk::SpacePoint *, std::span< float const, 3 >)
virtual void writeNtuple(const SiSpacePointsSeed *seed, const Trk::Track *track, int seedType, long eventNumber) const override
virtual MsgStream & dump(EventData &data, MsgStream &out) const override
virtual void newRegion(const EventContext &ctx, EventData &data, const std::vector< IdentifierHash > &vPixel, const std::vector< IdentifierHash > &vSCT) const override
void newOneSeed(EventData &data, const Trk::SpacePoint *&, const Trk::SpacePoint *&, const Trk::SpacePoint *&, const float &, const float &) const
static MsgStream & dumpEvent(EventData &data, MsgStream &out)
bool newVertices(EventData &data, const std::list< Trk::Vertex > &) const
bool isZCompatible(EventData &data, float &, float &, float &) const
static void convertToBeamFrameWork(EventData &data, const Trk::SpacePoint *const &, float *)
void buildBeamFrameWork(const EventContext &ctx, EventData &data) const
virtual void newEvent(const EventContext &ctx, EventData &data, int iteration) const override
SG::ReadHandleKey< SpacePointOverlapCollection > m_spacepointsOverlap
virtual const SiSpacePointsSeed * next(const EventContext &ctx, EventData &data) const override
virtual void find2Sp(EventData &data, const std::list< Trk::Vertex > &lv) const override
with two space points with or without vertex constraint
static void newSeed(EventData &data, const Trk::SpacePoint *&, const Trk::SpacePoint *&, const float &)
static float dZVertexMin(EventData &data, float &)
MsgStream & dumpConditions(EventData &data, MsgStream &out) const
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
SG::ReadHandleKey< SpacePointContainer > m_spacepointsSCT
virtual void findVSp(const EventContext &ctx, EventData &data, const std::list< Trk::Vertex > &lv) const override
SG::ReadHandleKey< SpacePointContainer > m_spacepointsPixel
void production3SpNoVertex(EventData &data, std::vector< InDet::SiSpacePointForSeed * >::iterator *, std::vector< InDet::SiSpacePointForSeed * >::iterator *, std::vector< InDet::SiSpacePointForSeed * >::iterator *, std::vector< InDet::SiSpacePointForSeed * >::iterator *, int, int, int &) const
static SiSpacePointForSeed * newSpacePoint(EventData &data, const Trk::SpacePoint *const &)
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
virtual void find3Sp(const EventContext &ctx, EventData &data, const std::list< Trk::Vertex > &lv) const override
with three space points with or without vertex constraint
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
bool solenoidOn() const
status of the magnets
void getFieldZR(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field valaue on the z-r plane at given position works only inside the solenoid.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
Abstract Base Class for tracking surfaces.
This class is a simplest representation of a vertex candidate.
int ir
counter of the current depth
Definition fastadd.cxx:49
int r
Definition globals.cxx:22
int cost(std::vector< std::string > &files, node &n, const std::string &directory="", bool deleteref=false, bool relocate=false)
Definition hcg.cxx:922
Eigen::Matrix< double, 3, 1 > Vector3D
-event-from-file
hold the test vectors and ease the comparison
MsgStream & msg
Definition testRead.cxx:32