Belle II Software development
twoHitFilters.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <gtest/gtest.h>
10
11#include <tracking/spacePointCreation/SpacePoint.h>
12#include <tracking/trackFindingVXD/filterMap/twoHitVariables/Distance3DSquared.h>
13#include <tracking/trackFindingVXD/filterMap/twoHitVariables/Distance2DXYSquared.h>
14#include <tracking/trackFindingVXD/filterMap/twoHitVariables/Distance1DZ.h>
15#include <tracking/trackFindingVXD/filterMap/twoHitVariables/SlopeRZ.h>
16#include <tracking/trackFindingVXD/filterMap/twoHitVariables/CosDirectionXY.h>
17#include <tracking/trackFindingVXD/filterMap/twoHitVariables/Distance3DNormed.h>
18
19#include <tracking/trackFindingVXD/filterMap/filterFramework/Shortcuts.h>
20
21#include <vxd/geometry/SensorInfoBase.h>
22#include <iostream>
23#include <math.h>
24
25#include <functional>
26
27using namespace std;
28
29using namespace Belle2;
30
31namespace VXDTFtwoHitFilterTest {
32
34 class TwoHitFilterTest : public ::testing::Test {
35 protected:
36 };
37
38
40 VXD::SensorInfoBase createSensorInfo(VxdID aVxdID, double globalX = 0., double globalY = 0., double globalZ = -0.)
41 {
42 // (SensorType type, VxdID id, double width, double length, double thickness, int uCells, int vCells, double width2=-1, double splitLength=-1, int vCells2=0)
43 VXD::SensorInfoBase sensorInfoBase(VXD::SensorInfoBase::PXD, aVxdID, 2.3, 4.2, 0.3, 2, 4, -1);
44
45 TGeoRotation r1;
46 r1.SetAngles(45, 20, 30); // rotation defined by Euler angles
47 TGeoTranslation t1(globalX, globalY, globalZ);
48 TGeoCombiTrans c1(t1, r1);
49 TGeoHMatrix transform = c1;
50 sensorInfoBase.setTransformation(transform);
51 // also need the reco transform
52 sensorInfoBase.setTransformation(transform, true);
53
54 return sensorInfoBase;
55 }
56
57
59 SpacePoint provideSpacePointDummy(double X, double Y, double Z)
60 {
61 VxdID aVxdID = VxdID(1, 1, 1);
62 VXD::SensorInfoBase sensorInfoBase = createSensorInfo(aVxdID, X, Y, Z);
63
64 PXDCluster aCluster = PXDCluster(aVxdID, 0., 0., 0.1, 0.1, 0, 0, 1, 1, 1, 1, 1, 1);
65
66 return SpacePoint(&aCluster, &sensorInfoBase);
67 }
68
69
71 template < class T>
72 class counter {
73 public:
74 static unsigned int used;
75 static unsigned int accepted;
76 static unsigned int rejected;
77 static unsigned int wasInf;
78 static unsigned int wasNan;
79 counter() {};
80 ~counter() {};
81 static void resetCounter()
82 {
88 }
89 };
90
91
92
94 template<class T>
95 unsigned int counter<T>::used(0);
96 template<class T>
97 unsigned int counter<T>::accepted(0);
98 template<class T>
99 unsigned int counter<T>::rejected(0);
100 template<class T>
101 unsigned int counter<T>::wasInf(0);
102 template<class T>
103 unsigned int counter<T>::wasNan(0);
104
105
106
109 public:
111 template<class Var, typename ... otherTypes>
112 static void notify(const Var&,
113 otherTypes ...)
114 {
116 }
117
118 };
119
120
121
122
123
126 public:
127 template<class Var, class Range, typename ... otherTypes>
129 static void notify(const Var& filterType,
130 typename Var::variableType fResult,
131 const Range& range,
132 const typename Var::argumentType& outerHit,
133 const typename Var::argumentType& innerHit,
134 otherTypes ...)
135 {
136 B2ERROR(" Filter " << filterType.name() << " got result of " << fResult);
137 }
138
139 };
140
141
142
143
144
146 class InfoObserver : public VoidObserver {
147 public:
149 template<class Var, class Range, typename ... otherTypes>
150 static void notify(const Var& filterType,
151 typename Var::variableType fResult,
152 const Range&,
153 const typename Var::argumentType& outerHit,
154 const typename Var::argumentType& innerHit,
155 otherTypes ...)
156 {
157 B2WARNING(" Filter " << filterType.name() << " with outerhit/innerhit: " << outerHit.getPosition().PrintStringXYZ() << "/" <<
158 innerHit.getPosition().PrintStringXYZ() << " got result of " << fResult);
159 }
160
161 };
162
163
164
165
167 template<class FilterType> class VectorOfObservers : public VoidObserver {
168 public:
169
171 typedef std::function< void (const typename FilterType::argumentType&, const typename FilterType::argumentType&, const FilterType&, typename FilterType::variableType)>
173
175 using CStyleFunctionPointer = void(*)(const typename FilterType::argumentType&, const typename FilterType::argumentType&,
176 const FilterType&, typename FilterType::variableType) ;
177
179 template<typename ... otherTypes>
180 static void notify(const FilterType& filterType,
181 typename FilterType::variableType fResult,
182 const typename FilterType::argumentType& outerHit,
183 const typename FilterType::argumentType& innerHit,
184 otherTypes ...)
185 {
186 B2INFO(" Filter " << filterType.name() << " with Mag of outer-/innerHit " << outerHit.getPosition().Mag() << "/" <<
187 innerHit.getPosition().Mag() << " got result of " << fResult << " and Observer-Vector sm_collectedObservers got " <<
188 VectorOfObservers<FilterType>::sm_collectedObservers.size() << " observers collected");
189 B2INFO(" Filter " << filterType.name() << " with Mag of outer-/innerHit " << outerHit.getPosition().Mag() << "/" <<
190 innerHit.getPosition().Mag() << " got result of " << fResult << " and Observer-Vector sm_collectedObserversCSTYLE got " <<
191 VectorOfObservers<FilterType>::sm_collectedObserversCSTYLE.size() << " observers collected");
192
194 // for(auto& anObserver : CollectedObservers<FilterType>::collectedObservers) {
195 // anObserver(outerHit, innerHit, fResult);
196 // }
198 }
199
200
202 template <typename ObserverType>
203 static void addObserver(observerFunction newObserver)
204 {
205 VectorOfObservers<FilterType>::sm_collectedObservers.push_back(std::bind(&newObserver, std::placeholders::_1, std::placeholders::_2,
206 FilterType(), std::placeholders::_3));
207 }
208
209
211 static std::vector< observerFunction > sm_collectedObservers;
213 static std::vector< CStyleFunctionPointer > sm_collectedObserversCSTYLE;
214
216// static std::vector< std::_Bind<void (*(std::_Placeholder<1>, std::_Placeholder<2>, Belle2::Distance3DSquared, std::_Placeholder<3>))(Belle2::SpacePoint const&, Belle2::SpacePoint const&, Belle2::Distance3DSquared const&, float)> > sm_collectedObserversTry2;
217 };
218
220 template<typename FilterType> std::vector< typename VectorOfObservers<FilterType>::observerFunction >
223 template<typename FilterType> std::vector< typename VectorOfObservers<FilterType>::CStyleFunctionPointer >
226// template<typename FilterType> std::vector< typename VectorOfObservers<FilterType>::CStyleFunctionPointer > VectorOfObservers<FilterType>::sm_collectedObserversTry2 = {};
227
228
229
231 TEST_F(TwoHitFilterTest, TestObserverFlexibility)
232 {
233 // Very verbose declaration, see below for convenient shortcuts
235 1.));
236
237 // Filter< Distance3DSquared<SpacePoint>, Range<double, double>, VectorOfObservers<Distance3DSquared> > filter(unobservedFilter);
238 Filter< Distance3DSquared<SpacePoint>, Range<double, double>, InfoObserver > filter(unobservedFilter);
239 SpacePoint x1 = provideSpacePointDummy(0.0f, 0.0f, 0.0f);
240 SpacePoint x2 = provideSpacePointDummy(0.5f, 0.0f, 0.0f);
241 SpacePoint x3 = provideSpacePointDummy(2.0f, 0.0f, 0.0f);
242 auto myCounter = counter<Distance3DSquared<SpacePoint>>();
243 myCounter.resetCounter();
244
246// auto storeFuncVariantA = std::bind( ((VectorOfObservers<Distance3DSquared>::observerFunction) &CountingObserver::notify), std::placeholders::_1, std::placeholders::_2, Distance3DSquared(), std::placeholders::_3);
247 // VectorOfObservers<Distance3DSquared>::sm_collectedObservers.push_back(storeFuncVariantA);
248
250 auto storeFuncVariantB = std::bind(((VectorOfObservers<Distance3DSquared<SpacePoint>>::CStyleFunctionPointer)
251 &CountingObserver::notify), std::placeholders::_1, std::placeholders::_2, Distance3DSquared<SpacePoint>(),
252 std::placeholders::_3);
253
254 char* realname(nullptr);
255 int status(0);
256 realname = abi::__cxa_demangle(typeid(storeFuncVariantB).name(), 0, 0, &status);
257 std::string name(realname);
258 free(realname);
259 B2INFO("storeFuncVariantB is of type: " << name);
260
261// VectorOfObservers<Distance3DSquared>::sm_collectedObserversTry2.push_back(storeFuncVariantB);
262
263
265// VectorOfObservers<Distance3DSquared>::sm_collectedObserversCSTYLE.push_back(storeFuncVariantB);
266
268 // VectorOfObservers<Distance3DSquared>::addObserver(CountingObserver);
269 // VectorOfObservers<Distance3DSquared>::addObserver(WarningObserver);
270
271
272 filter.accept(x2, x1);
273 filter.accept(x3, x1);
274 EXPECT_EQ(0, myCounter.used);
275
276 }
277
278
279
281 TEST_F(TwoHitFilterTest, SpacePointCreation)
282 {
283 SpacePoint testSP = provideSpacePointDummy(1.2, 2.3, 4.2);
284 EXPECT_FLOAT_EQ(1.2, testSP.getPosition().X()) ;
285 EXPECT_FLOAT_EQ(2.3, testSP.getPosition().Y()) ;
286 EXPECT_FLOAT_EQ(4.2, testSP.getPosition().Z()) ;
287
288 }
289
290
292 TEST_F(TwoHitFilterTest, SelectionVariableName)
293 {
294 auto dist3D = Distance3DSquared<SpacePoint>();
295 EXPECT_EQ("Distance3DSquared", dist3D.name());
296 auto dist2DXY = Distance2DXYSquared<SpacePoint>();
297 EXPECT_EQ("Distance2DXYSquared", dist2DXY.name());
298 auto dist1DZ = Distance1DZ<SpacePoint>();
299 EXPECT_EQ("Distance1DZ", dist1DZ.name());
300 auto slopeRZ = SlopeRZ<SpacePoint>();
301 EXPECT_EQ("SlopeRZ", slopeRZ.name());
302
303 }
304
305
307 TEST_F(TwoHitFilterTest, BasicFilterTestDistance3DSquared)
308 {
309 // Very verbose declaration, see below for convenient shortcuts
311
312 SpacePoint x1 = provideSpacePointDummy(0., 0., 0.);
313 SpacePoint x2 = provideSpacePointDummy(.5, 0., 0.);
314 SpacePoint x3 = provideSpacePointDummy(2., 0., 0.);
315
316 EXPECT_TRUE(filter.accept(x1, x2));
317 EXPECT_FALSE(filter.accept(x1, x3));
318
319 }
320
321
323 TEST_F(TwoHitFilterTest, BasicFilterTestDistance2DXYSquared)
324 {
325 // Very verbose declaration, see below for convenient shortcuts
327
328 SpacePoint x1 = provideSpacePointDummy(0., 0., 0.);
329 SpacePoint x2 = provideSpacePointDummy(.5, 0., 0.);
330 SpacePoint x3 = provideSpacePointDummy(2., 0., 0.);
331 SpacePoint x4 = provideSpacePointDummy(0., 0., 2.);
332
333 EXPECT_TRUE(filter.accept(x1, x2));
334 EXPECT_FALSE(filter.accept(x1, x3));
335 EXPECT_TRUE(filter.accept(x2, x4));
336
337 }
338
339
341 TEST_F(TwoHitFilterTest, BasicFilterTestDistance1DZ)
342 {
343 // Very verbose declaration, see below for convenient shortcuts
345
346 SpacePoint x1 = provideSpacePointDummy(0., 0., 0.);
347 SpacePoint x2 = provideSpacePointDummy(0., 0., .5);
348 SpacePoint x3 = provideSpacePointDummy(.25, .25, 0.);
349 SpacePoint x4 = provideSpacePointDummy(0., 0., 1.);
350
351 EXPECT_TRUE(filter.accept(x2, x1));
352 EXPECT_FALSE(filter.accept(x1, x2)); // the input order is relevant
353 EXPECT_FALSE(filter.accept(x1, x3));
354 EXPECT_FALSE(filter.accept(x1, x4));
355
356 }
357
358
360 TEST_F(TwoHitFilterTest, TemplateFilterTestDistance1DZ)
361 {
362 // Very verbose declaration, see below for convenient shortcuts
364
365 SpacePoint x1 = provideSpacePointDummy(0., 0., 0.);
366 SpacePoint x2 = provideSpacePointDummy(0., 0., .5);
367 SpacePoint x3 = provideSpacePointDummy(.25, .25, 0.);
368 SpacePoint x4 = provideSpacePointDummy(0., 0., 1.);
369
370 EXPECT_TRUE(filter.accept(x2, x1));
371 EXPECT_FALSE(filter.accept(x1, x2)); // the input order is relevant
372 EXPECT_FALSE(filter.accept(x1, x3));
373 EXPECT_FALSE(filter.accept(x1, x4));
374
375 }
376
377
379 TEST_F(TwoHitFilterTest, BasicFilterTestSlopeRZ)
380 {
381 // Very verbose declaration, see below for convenient shortcuts
383
384 SpacePoint innerSP = provideSpacePointDummy(1, 2, 3);
385 SpacePoint outerSP1 = provideSpacePointDummy(1, 4, 4);
386 SpacePoint outerSP2 = provideSpacePointDummy(1, 4, 3.95);
387 SpacePoint outerSP3 = provideSpacePointDummy(1, 4, 4.05);
388 SpacePoint outerSP4 = provideSpacePointDummy(1, 3, 3.45);
389 SpacePoint outerSP5 = provideSpacePointDummy(1, 3, 3.55);
390 SpacePoint outerSP6 = provideSpacePointDummy(1, 4, 3);
391 SpacePoint outerSP7 = provideSpacePointDummy(1, 0, 4);
392
393 EXPECT_FALSE(filter.accept(outerSP3, innerSP));
394 EXPECT_FALSE(filter.accept(outerSP1, innerSP));
395 EXPECT_TRUE(filter.accept(outerSP2, innerSP));
396 EXPECT_FALSE(filter.accept(innerSP, outerSP2)); // reverse order not same result (because of z)
397 EXPECT_TRUE(filter.accept(outerSP4, innerSP));
398 EXPECT_FALSE(filter.accept(outerSP5, innerSP));
399 EXPECT_EQ(filter.accept(outerSP1, innerSP), filter.accept(outerSP7,
400 innerSP)); // (direction of r-vector not relevant, only its length)
401
402
403 auto sRZ = SlopeRZ<SpacePoint>();
404 EXPECT_FLOAT_EQ(0., sRZ.value(innerSP, innerSP));
405 EXPECT_FLOAT_EQ(atan(2.), sRZ.value(outerSP1, innerSP));
406 EXPECT_FLOAT_EQ(atan(2. / 0.95), sRZ.value(outerSP2, innerSP));
407 EXPECT_FLOAT_EQ(M_PI - sRZ.value(outerSP2, innerSP),
408 sRZ.value(innerSP, outerSP2)); // with latest bugfix reverse order will result in (Pi - SlopeRZ)
409 EXPECT_FLOAT_EQ(atan(2. / 1.05), sRZ.value(outerSP3, innerSP));
410 EXPECT_FLOAT_EQ(atan(1. / 0.45), sRZ.value(outerSP4, innerSP));
411 EXPECT_FLOAT_EQ(atan(1. / 0.55), sRZ.value(outerSP5, innerSP));
412 EXPECT_FLOAT_EQ(M_PI * 0.5, sRZ.value(outerSP6, innerSP)); // no problem with division by 0 in Z
413 EXPECT_FLOAT_EQ(atan(2. / 1.05), sRZ.value(outerSP3, innerSP));
414 EXPECT_FLOAT_EQ(sRZ.value(outerSP1, innerSP), sRZ.value(outerSP7,
415 innerSP)); // (direction of r-vector not relevant, only its length)
416
417 }
418
419
421 TEST_F(TwoHitFilterTest, BasicFilterTestDistance3DNormed)
422 {
423 // prepare spacePoints for new stuff
424 SpacePoint innerSP = provideSpacePointDummy(1, 2, 3);
425 SpacePoint outerSP1 = provideSpacePointDummy(2, 3, 4);
426 SpacePoint outerSP2 = provideSpacePointDummy(1, 2, 4);
427 SpacePoint outerSP3 = provideSpacePointDummy(2, 3, 3);
428
429 auto d3Dn = Distance3DNormed<SpacePoint>();
430 EXPECT_FLOAT_EQ(2. / 3., d3Dn.value(outerSP1, innerSP));
431 EXPECT_FLOAT_EQ(0., d3Dn.value(outerSP2, innerSP));
432 EXPECT_FLOAT_EQ(1., d3Dn.value(outerSP3, innerSP));
433 EXPECT_FLOAT_EQ(0., d3Dn.value(innerSP, innerSP));
434
435 }
436
437
439 TEST_F(TwoHitFilterTest, ObservedFilter)
440 {
441 // Very verbose declaration, see below for convenient shortcuts
443 1.));
444
445 Filter< Distance3DSquared<SpacePoint>, Range<double, double>, CountingObserver > filter(unobservedFilter);
446 SpacePoint x1 = provideSpacePointDummy(0.0f, 0.0f, 0.0f);
447 SpacePoint x2 = provideSpacePointDummy(0.5f, 0.0f, 0.0f);
448 SpacePoint x3 = provideSpacePointDummy(2.0f, 0.0f, 0.0f);
449 auto myCounter = counter<Distance3DSquared<SpacePoint>>();
450 myCounter.resetCounter();
451
452 EXPECT_TRUE(filter.accept(x1, x2));
453 EXPECT_FALSE(filter.accept(x1, x3));
454 EXPECT_EQ(2, myCounter.used);
455 }
456
457
459 TEST_F(TwoHitFilterTest, BypassableFilter)
460 {
461 bool bypassControl(false);
462 // Very verbose declaration, see below for convenient shortcuts
464 (0., 1.));
465 auto filter = nonBypassableFilter.bypass(bypassControl);
466 SpacePoint x1 = provideSpacePointDummy(0.0f, 0.0f, 0.0f);
467 SpacePoint x2 = provideSpacePointDummy(2.0f, 0.0f, 0.0f);
468 auto myCounter = counter<Distance3DSquared<SpacePoint>>();
469 myCounter.resetCounter();
470
471 EXPECT_FALSE(filter.accept(x1, x2));
472 EXPECT_EQ(1, myCounter.used);
473
474 // The clang static analyser doesn't understand that the `filter` has a pointer to
475 // `bypassControl` and thus doesn't know that the variable is in fact used after being changed to `true` here.
476 // According to https://clang-analyzer.llvm.org/faq.html#exclude_code, the only way to suppress these
477 // warnings as of May 2023 is the following
478#ifndef __clang_analyzer__
479 bypassControl = true;
480#endif
481 EXPECT_TRUE(filter.accept(x1, x2));
482 EXPECT_EQ(2, myCounter.used);
483
484 }
485
486
488 TEST_F(TwoHitFilterTest, Shortcuts)
489 {
490
491 SpacePoint x1 = provideSpacePointDummy(0.0f, 0.0f, 0.0f);
492 SpacePoint x2 = provideSpacePointDummy(0.5f, 0.0f, 0.0f);
493 SpacePoint x3 = provideSpacePointDummy(2.0f, 0.0f, 0.0f);
494
495 auto filterSup = (Distance3DSquared<SpacePoint>() < 1.) ;
496 EXPECT_TRUE(filterSup.accept(x1, x2));
497 EXPECT_FALSE(filterSup.accept(x1, x3));
498
499 auto filterSup2 = (1 > Distance3DSquared<SpacePoint>()) ;
500 EXPECT_TRUE(filterSup2.accept(x1, x2));
501 EXPECT_FALSE(filterSup2.accept(x1, x3));
502
503 auto filterInf = (Distance3DSquared<SpacePoint>() > 1.) ;
504 EXPECT_TRUE(filterInf.accept(x1, x3));
505 EXPECT_FALSE(filterInf.accept(x1, x2));
506
507 auto filterInf2 = (1 < Distance3DSquared<SpacePoint>()) ;
508 EXPECT_TRUE(filterInf2.accept(x1, x3));
509 EXPECT_FALSE(filterInf2.accept(x1, x2));
510
511 auto filterRange = (0.1 < Distance3DSquared<SpacePoint>() < 1);
512 EXPECT_FALSE(filterRange.accept(x1, x1));
513 EXPECT_TRUE(filterRange.accept(x1, x2));
514 EXPECT_FALSE(filterRange.accept(x1, x3));
515
516 }
517
518
520 TEST_F(TwoHitFilterTest, BooleanOperations)
521 {
522
523 SpacePoint x1 = provideSpacePointDummy(0.0f, 0.0f, 0.0f);
524 SpacePoint x2 = provideSpacePointDummy(1.0f, 0.0f, 0.0f);
525 SpacePoint x3 = provideSpacePointDummy(2.0f, 0.0f, 0.0f);
526
527 auto filter = !(Distance3DSquared<SpacePoint>() > 1.);
528 EXPECT_TRUE(filter.accept(x1, x2));
529 EXPECT_TRUE(filter.accept(x1, x1));
530 EXPECT_FALSE(filter.accept(x1, x3));
531
532 auto filter2 =
533 !(Distance3DSquared<SpacePoint>() > 1.) &&
534 !(Distance3DSquared<SpacePoint>() < 1);
535 // i.e. Distance3DSquared == 1
536 EXPECT_TRUE(filter2.accept(x1, x2));
537 EXPECT_FALSE(filter2.accept(x1, x1));
538 EXPECT_FALSE(filter2.accept(x1, x3));
539
540
541 auto filter3 =
542 (Distance3DSquared<SpacePoint>() > 1.) ||
543 (Distance3DSquared<SpacePoint>() < 1);
544 // i.e. Distance3DSquared != 1
545 EXPECT_FALSE(filter3.accept(x1, x2));
546 EXPECT_TRUE(filter3.accept(x1, x1));
547 EXPECT_TRUE(filter3.accept(x1, x3));
548
549 }
550
551
553 TEST_F(TwoHitFilterTest, ShortCircuitsEvaluation)
554 {
555 auto filter(
556 ((Distance2DXYSquared<SpacePoint>() < 1) &&
557 (Distance3DSquared<SpacePoint>() < 1)).observe(CountingObserver())
558 );
559
560 SpacePoint x1 = provideSpacePointDummy(0.0f, 0.0f, 0.0f);
561 SpacePoint x3 = provideSpacePointDummy(2.0f, 0.0f, 0.0f);
562
563 auto counter3D = counter<Distance3DSquared<SpacePoint>>();
564 auto counter2D = counter<Distance2DXYSquared<SpacePoint>>();
565 counter3D.used = 0;
566 counter2D.used = 0;
567
568 EXPECT_FALSE(filter.accept(x1, x3));
569 EXPECT_EQ(1, counter2D.used);
570 EXPECT_EQ(0, counter3D.used);
571
572 EXPECT_TRUE(filter.accept(x1, x1));
573 EXPECT_EQ(2, counter2D.used);
574 EXPECT_EQ(1, counter3D.used);
575
576 }
577
579 TEST_F(TwoHitFilterTest, TestCosDirectionXY)
580 {
581 SpacePoint x1 = provideSpacePointDummy(2.0f, 1.0f, 0.0f);
582 SpacePoint x2 = provideSpacePointDummy(1.0f, -2.0f, 0.0f);
583 SpacePoint x3 = provideSpacePointDummy(1.0f, 0.0f, 0.0f);
584 SpacePoint x4 = provideSpacePointDummy(0.5f, 0.86602540378443f, 0.0f);
585
586 EXPECT_FLOAT_EQ(0., CosDirectionXY<SpacePoint>::value(x1, x2));
587 EXPECT_NEAR(0.5, CosDirectionXY<SpacePoint>::value(x3, x4), 0.0000001);
588 }
589}
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:435
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:431
std::string PrintStringXYZ(unsigned precision=4) const
create a string containing vector in cartesian coordinates
Definition: B2Vector3.h:487
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:433
DataType Mag() const
The magnitude (rho in spherical coordinate system).
Definition: B2Vector3.h:159
This class is used to select pairs, triplets... of objects.
Definition: Filter.h:34
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:30
Represents a range of arithmetic types.
Definition: Range.h:29
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42
const B2Vector3D & getPosition() const
return the position vector in global coordinates
Definition: SpacePoint.h:138
Base class to provide Sensor Information for PXD and SVD.
The most CPU efficient Observer for the VXDTF filter tools (even if useless).
Definition: VoidObserver.h:30
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
this observer does simply count the number of times, the attached Filter was used
static void notify(const Var &, otherTypes ...)
notifier counting how often a SelectionVariable was used
this observer does simply print the name of the SelectionVariable and the result of its value-functio...
static void notify(const Var &filterType, typename Var::variableType fResult, const Range &range, const typename Var::argumentType &outerHit, const typename Var::argumentType &innerHit, otherTypes ...)
notifier: print the name of the SelectionVariable and the result of its value-function as an Error.
this observer does simply print the name of the SelectionVariable and the result of its value-functio...
static void notify(const Var &filterType, typename Var::variableType fResult, const Range &, const typename Var::argumentType &outerHit, const typename Var::argumentType &innerHit, otherTypes ...)
notifier: print the name of the SelectionVariable and the result of its value-function as a Warning.
Test class for these new and shiny two-hit-filters.
this observer does simply collect other observers which are to be executed during the call of the cor...
static std::vector< observerFunction > sm_collectedObservers
collects observers with std::function to be executed during notify (variant A)
static std::vector< CStyleFunctionPointer > sm_collectedObserversCSTYLE
collects observers with c-style function pointers to be executed during notify (variant B)
static void addObserver(observerFunction newObserver)
collects observers to be executed during notify (can not be used so far, but is long-term goal)
std::function< void(const typename FilterType::argumentType &, const typename FilterType::argumentType &, const FilterType &, typename FilterType::variableType)> observerFunction
a typedef to make the stuff more readable
static void notify(const FilterType &filterType, typename FilterType::variableType fResult, const typename FilterType::argumentType &outerHit, const typename FilterType::argumentType &innerHit, otherTypes ...)
iterate over all stored Observers and execute their notify-function
void(*)(const typename FilterType::argumentType &, const typename FilterType::argumentType &, const FilterType &, typename FilterType::variableType) CStyleFunctionPointer
a typedef to make the c-style pointer more readable (can not be done with classic typedef)
a tiny counter class for counting stuff
static unsigned int accepted
count number of times result was accepted
static void resetCounter()
destructor.
static unsigned int wasInf
count number of times result was inf
static unsigned int used
count number of times used
static unsigned int rejected
count number of times result was rejected
static unsigned int wasNan
count number of times result was nan
double atan(double a)
atan for double
Definition: beamHelpers.h:34
B2Vector3D outerHit(0, 0, 0)
testing out of range behavior
std::map< ExpRun, std::pair< double, double > > filter(const std::map< ExpRun, std::pair< double, double > > &runs, double cut, std::map< ExpRun, std::pair< double, double > > &runsRemoved)
filter events to remove runs shorter than cut, it stores removed runs in runsRemoved
Definition: Splitter.cc:38
Abstract base class for different kinds of events.
STL namespace.