|
ATLAS Offline Software
|
Go to the documentation of this file.
13 #include "GaudiKernel/SystemOfUnits.h"
49 v.setCovariancePosition (
cov);
56 std::cout <<
a.x() <<
" " <<
a.y() <<
" " <<
a.z();
60 void assertVec3D (
const char*
which,
62 const std::vector<double>&
v,
65 if (
v.size() - offs < 3) std::abort();
70 std::cerr <<
"VertexSeedFinderTestAlg::assertVec3D mismatch " <<
which
77 <<
v[offs+2] <<
"]\n";
83 void dumpVector (
const std::vector<float>&
v)
87 std::cerr <<
f <<
", ";
91 void failVector (
const char*
which,
92 const std::vector<float>&
a,
93 const std::vector<float>&
b)
95 std::cerr <<
"VertexSeedFinderTestAlg::assertVector mismatch " <<
which
101 void assertVector (
const char*
which,
102 const std::vector<float>&
a,
103 const std::vector<float>&
b)
105 if (
a.size() !=
b.size()) {
108 for (
size_t i=0;
i <
a.size();
i++) {
129 return StatusCode::SUCCESS;
139 const EventContext& ctx = Gaudi::Hive::currentContext();
158 auto p1a = std::make_unique<Trk::Perigee>(pos1a, mom1a, 1, pos0, cov5());
159 auto p1b = std::make_unique<Trk::Perigee>(pos1b, mom1b, -1, pos0, cov5());
160 auto p1c = std::make_unique<Trk::Perigee>(pos1c, mom1c, -1, pos0, cov5());
162 std::vector<const Trk::TrackParameters*> v1a { p1a.get(), p1b.get(), p1c.get() };
163 std::vector<const Trk::TrackParameters*> v1b { p1c.get(), p1a.get(), p1b.get() };
170 std::unique_ptr<Trk::IMode3dInfo>
info;
175 std::vector<float>
phi;
176 std::vector<float>
r;
177 std::vector<float>
z;
178 std::vector<float>
w;
180 assert (
sz ==
phi.size());
181 assert (
sz ==
r.size());
182 assert (
sz ==
z.size());
183 assert (
sz ==
w.size());
191 std::vector<const Trk::TrackParameters*>
p;
192 size_t sz =
info->perigeesAtSeed (
p, v1a);
193 assert (
sz ==
p.size());
194 std::vector<int> ndx;
197 assert (
it != v1a.end());
198 ndx.push_back (
it - v1a.begin());
206 info->getCorrelationDistance (cXY, cZ);
220 p =
m_finder->findSeed (vx, vy, v1b, &vert1);
224 std::vector<std::unique_ptr<Trk::Perigee> > perigees;
225 std::vector<const Trk::TrackParameters*>
pvec;
235 double x = xdist(
rng);
236 double y = ydist(
rng);
246 double pt = ptdist(
rng);
247 double phi = phidist(
rng);
248 double eta = etadist(
rng);
250 double charge = etadist(
rng) > 0 ? 1 : -1;
251 perigees.emplace_back (std::make_unique<Trk::Perigee> (
pos,
mom,
charge, pos0,
253 pvec.push_back (perigees.back().get());
267 std::vector<Amg::Vector3D> seeds =
m_finder->findMultiSeeds (
pvec);
269 std::cerr <<
"VertexSeedFinderTestAlg size mismatch 3b "
270 << seeds.size() <<
" / " <<
m_expected3.size()/3 <<
"\n";
274 for (
const auto& seed : seeds) {
281 return StatusCode::SUCCESS;
291 auto *evt1 =
new HepMC::GenEvent();
292 auto *evt2 =
new HepMC::GenEvent();
293 auto *evt3 =
new HepMC::GenEvent();
305 for (
unsigned int i = 0;
i < 1000;
i++) {
306 double pt = ptdist(
rng);
307 double phi = phidist(
rng);
308 double eta = etadist(
rng);
309 double e =
pt*sinh(eta);
310 double charge = etadist(
rng) > 0 ? 1 : -1;
314 double vrand = etadist(
rng);
318 else if (vrand < 3) {
326 auto evtcoll = std::make_unique<McEventCollection>();
330 evtcoll->push_back (evt1);
331 evtcoll->push_back (evt2);
332 evtcoll->push_back (evt3);
336 return StatusCode::SUCCESS;
Gaudi::Property< std::vector< int > > m_expected1Indices
@ z
global position (cartesian)
Gaudi::Property< unsigned int > m_npart3
Vertex_v1 Vertex
Define the latest version of the vertex class.
std::string find(const std::string &s)
return a remapped string
SG::WriteHandleKey< McEventCollection > m_mcEventCollectionKey
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Gaudi::Property< std::vector< float > > m_expected1Weights
Gaudi::Property< std::vector< float > > m_expected1RModes
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
bool empty() const
Test if the key is blank.
Gaudi::Property< std::vector< double > > m_expected2
void fillBarcodesAttribute(GenEvent *)
#define AmgSymMatrix(dim)
Gaudi::Property< std::vector< float > > m_expected1PhiModes
Gaudi::Property< std::vector< double > > m_expected3
Gaudi::Property< std::vector< double > > m_expected1CorrDist
ToolHandle< Trk::IVertexSeedFinder > m_finder
virtual StatusCode execute() override
Execute the algorithm.
Very simple random numbers for regression testing.
Handle class for recording to StoreGate.
void set_signal_process_vertex(GenEvent *e, T v)
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
::StatusCode StatusCode
StatusCode definition for legacy code.
bool isEqual(double x1, double x2, double thresh=1e-6)
StatusCode makeMcEventCollection(const EventContext &ctx) const
Make a test McEventCollection.
Gaudi::Property< std::vector< float > > m_expected1ZModes
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Gaudi::Property< std::vector< double > > m_priVert
Algorithm for doing unit tests of the seed finder tools. Basic test only, not terribly comprehensive.
Ensure that the ATLAS eigen extensions are properly loaded.
double charge(const T &p)
Eigen::Matrix< double, 3, 1 > Vector3D
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
Class describing a Vertex.
Generator compatible with the C++11 STL UniformRandomNumberGenerator.
Gaudi::Property< std::vector< double > > m_expected1
GenVertex * signal_process_vertex(const GenEvent *e)