Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove intrusive macros breaking libstdc++ #11953

Merged
merged 1 commit into from
Oct 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,18 @@ class SiStripLorentzAngle;
class PixelGeomDetUnit;
class StripGeomDetUnit;

// Function for testing ClusterShapeHitFilter
namespace test {
namespace ClusterShapeHitFilterTest {
int test();
}
}

class ClusterShapeHitFilter
{
// For tests
friend int test::ClusterShapeHitFilterTest::test();

public:

struct PixelData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@
// ClusterShapeHitFilter test
#define private public
#include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h"
#undef private

#include <iostream>
#include <cassert>
int main() {
const std::string use_PixelShapeFile("RecoPixelVertexing/PixelLowPtUtilities/data/pixelShape.par");

ClusterShapeHitFilter filter;
filter.PixelShapeFile = &use_PixelShapeFile;
filter.loadPixelLimits();
filter.loadStripLimits();

const float out = 10e12;
const float eps = 0.01;
std::cout << "dump strip limits" << std::endl;
for (int i=0; i!=StripKeys::N+1; i++) {
assert(!filter.stripLimits[i].isInside(out));
assert(!filter.stripLimits[i].isInside(-out));
std::cout << i << ": ";
float const * p = filter.stripLimits[i].data[0];
if (p[1]<1.e9) {
assert(filter.stripLimits[i].isInside(p[0]+eps));
assert(filter.stripLimits[i].isInside(p[3]-eps));
namespace test {
namespace ClusterShapeHitFilterTest {
int test() {
const std::string use_PixelShapeFile("RecoPixelVertexing/PixelLowPtUtilities/data/pixelShape.par");

ClusterShapeHitFilter filter;
filter.PixelShapeFile = &use_PixelShapeFile;
filter.loadPixelLimits();
filter.loadStripLimits();

const float out = 10e12;
const float eps = 0.01;
std::cout << "dump strip limits" << std::endl;
for (int i=0; i!=StripKeys::N+1; i++) {
assert(!filter.stripLimits[i].isInside(out));
assert(!filter.stripLimits[i].isInside(-out));
std::cout << i << ": ";
float const * p = filter.stripLimits[i].data[0];
if (p[1]<1.e9) {
assert(filter.stripLimits[i].isInside(p[0]+eps));
assert(filter.stripLimits[i].isInside(p[3]-eps));
}
for (int j=0;j!=4; ++j)
std::cout << p[j] << ", ";
std::cout << std::endl;
}

const std::pair<float,float> out1(out,out), out2(-out,-out);
std::cout << "\ndump pixel limits" << std::endl;
for (int i=0; i!=PixelKeys::N+1; i++) {
assert(!filter.pixelLimits[i].isInside(out1));
assert(!filter.pixelLimits[i].isInside(out2));
std::cout << i << ": ";
float const * p = filter.pixelLimits[i].data[0][0];
if (p[1]<1.e9) {
assert(filter.pixelLimits[i].isInside(std::pair<float,float>(p[0]+eps,p[3]-eps)));
assert(filter.pixelLimits[i].isInside(std::pair<float,float>(p[5]-eps,p[6]+eps)));
}
for (int j=0;j!=8; ++j)
std::cout << p[j] << ", ";
std::cout << std::endl;
}

return 0;
}
for (int j=0;j!=4; ++j)
std::cout << p[j] << ", ";
std::cout << std::endl;
}

const std::pair<float,float> out1(out,out), out2(-out,-out);
std::cout << "\ndump pixel limits" << std::endl;
for (int i=0; i!=PixelKeys::N+1; i++) {
assert(!filter.pixelLimits[i].isInside(out1));
assert(!filter.pixelLimits[i].isInside(out2));
std::cout << i << ": ";
float const * p = filter.pixelLimits[i].data[0][0];
if (p[1]<1.e9) {
assert(filter.pixelLimits[i].isInside(std::pair<float,float>(p[0]+eps,p[3]-eps)));
assert(filter.pixelLimits[i].isInside(std::pair<float,float>(p[5]-eps,p[6]+eps)));
}
for (int j=0;j!=8; ++j)
std::cout << p[j] << ", ";
std::cout << std::endl;
}
}

int main() {
return test::ClusterShapeHitFilterTest::test();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@
class TrackingRegion;
class OrderedHitPair;

// Function for testing ThirdHitPredictionFromInvParabola
namespace test {
namespace PixelTriplets_InvPrbl_prec {
int test();
}
namespace PixelTriplets_InvPrbl_t {
int test();
}
}


class ThirdHitPredictionFromInvParabola {
// For tests
friend int test::PixelTriplets_InvPrbl_prec::test();
friend int test::PixelTriplets_InvPrbl_t::test();

public:
using Scalar=double;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
#define private public
#include "RecoPixelVertexing/PixelTriplets/plugins/ThirdHitPredictionFromInvParabola.cc"
#undef private

#include<iostream>
#include<string>


int main(int n, const char **) {
if (n<2) return 0; // protect testing
std::string c("++Constr");
std::string r("++R");
std::string a;
double par[7];
double q[2];
while(std::cin) {
ThirdHitPredictionFromInvParabola pred;
std::cin >> a;
if (a==c) {
for ( auto & p : par ) std::cin >> p;
pred =ThirdHitPredictionFromInvParabola(par[0],par[1],par[2],par[3],par[4],par[5],par[6]);
std::cout << "ip min, max " << pred.theIpRangePlus.min() << " " << pred.theIpRangePlus.max()
<< " " << pred.theIpRangeMinus.min() << " " << pred.theIpRangeMinus.max() << std::endl;
}
else if (a==r) {
std::cin >> q[0] >> q[1];
{
auto rp = pred.rangeRPhi(q[0],1);
auto rn = pred.rangeRPhi(q[0],-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
}
{
auto rp = pred.rangeRPhi(q[1],1);
auto rn = pred.rangeRPhi(q[1],-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
namespace test {
namespace PixelTriplets_InvPrbl_prec {
int test() {
std::string c("++Constr");
std::string r("++R");
std::string a;
double par[7];
double q[2];
while(std::cin) {
ThirdHitPredictionFromInvParabola pred;
std::cin >> a;
if (a==c) {
for ( auto & p : par ) std::cin >> p;
pred =ThirdHitPredictionFromInvParabola(par[0],par[1],par[2],par[3],par[4],par[5],par[6]);
std::cout << "ip min, max " << pred.theIpRangePlus.min() << " " << pred.theIpRangePlus.max()
<< " " << pred.theIpRangeMinus.min() << " " << pred.theIpRangeMinus.max() << std::endl;
}
else if (a==r) {
std::cin >> q[0] >> q[1];
{
auto rp = pred.rangeRPhi(q[0],1);
auto rn = pred.rangeRPhi(q[0],-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
}
{
auto rp = pred.rangeRPhi(q[1],1);
auto rn = pred.rangeRPhi(q[1],-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
}
}
}
return 0;
}
}
return 0;
}

int main() {
return test::PixelTriplets_InvPrbl_prec::test();
}
89 changes: 47 additions & 42 deletions RecoPixelVertexing/PixelTriplets/test/PixelTriplets_InvPrbl_t.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#define private public
#include "RecoPixelVertexing/PixelTriplets/plugins/ThirdHitPredictionFromInvParabola.cc"
#undef private

#include <cmath>
#include "DataFormats/GeometryVector/interface/GlobalVector.h"
Expand Down Expand Up @@ -87,46 +85,53 @@ void newCode(const GlobalPoint & P1, const GlobalPoint & P2) {

}


int main() {

GlobalPoint P1(3., 4., 7.);
GlobalPoint P2(-2., 5., 7.);

oldCode(P1,P2);
newCode(P1,P2);

oldCode(P2,P1);
newCode(P2,P1);

{
ThirdHitPredictionFromInvParabola pred(P1,P2,0.2,0.05,0.1);
std::cout << "ip min, max " << pred.theIpRangePlus.min() << " " << pred.theIpRangePlus.max()
<< " " << pred.theIpRangeMinus.min() << " " << pred.theIpRangeMinus.max() << std::endl;
std::cout << "A,B +pos " << pred.coeffA(0.1) << " " << pred.coeffB(0.1) << std::endl;
std::cout << "A,B -pos " << pred.coeffA(-0.1) << " " << pred.coeffB(-0.1) << std::endl;

auto rp = pred.rangeRPhi(5.,1);
auto rn = pred.rangeRPhi(5.,-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
}

ThirdHitPredictionFromInvParabola pred(-1.092805, 4.187564, -2.361283, 7.892722, 0.111413, 0.019043, 0.032000);
std::cout << "ip min, max " << pred.theIpRangePlus.min() << " " << pred.theIpRangePlus.max()
<< " " << pred.theIpRangeMinus.min() << " " << pred.theIpRangeMinus.max() << std::endl;
{
auto rp = pred.rangeRPhi(11.4356,1);
auto rn = pred.rangeRPhi(11.4356,-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
}
{
auto rp = pred.rangeRPhi(13.2131,1);
auto rn = pred.rangeRPhi(13.2131,-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
namespace test {
namespace PixelTriplets_InvPrbl_t {
int test() {

GlobalPoint P1(3., 4., 7.);
GlobalPoint P2(-2., 5., 7.);

oldCode(P1,P2);
newCode(P1,P2);

oldCode(P2,P1);
newCode(P2,P1);

{
ThirdHitPredictionFromInvParabola pred(P1,P2,0.2,0.05,0.1);
std::cout << "ip min, max " << pred.theIpRangePlus.min() << " " << pred.theIpRangePlus.max()
<< " " << pred.theIpRangeMinus.min() << " " << pred.theIpRangeMinus.max() << std::endl;
std::cout << "A,B +pos " << pred.coeffA(0.1) << " " << pred.coeffB(0.1) << std::endl;
std::cout << "A,B -pos " << pred.coeffA(-0.1) << " " << pred.coeffB(-0.1) << std::endl;

auto rp = pred.rangeRPhi(5.,1);
auto rn = pred.rangeRPhi(5.,-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
}

ThirdHitPredictionFromInvParabola pred(-1.092805, 4.187564, -2.361283, 7.892722, 0.111413, 0.019043, 0.032000);
std::cout << "ip min, max " << pred.theIpRangePlus.min() << " " << pred.theIpRangePlus.max()
<< " " << pred.theIpRangeMinus.min() << " " << pred.theIpRangeMinus.max() << std::endl;
{
auto rp = pred.rangeRPhi(11.4356,1);
auto rn = pred.rangeRPhi(11.4356,-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
}
{
auto rp = pred.rangeRPhi(13.2131,1);
auto rn = pred.rangeRPhi(13.2131,-1);
std::cout << "range " << rp.min() << " " << rp.max()
<< " " << rn.min() << " " << rn.max() << std::endl;
}

return 0;
}
}
}

return 0;
int main() {
return test::PixelTriplets_InvPrbl_t::test();
}
8 changes: 8 additions & 0 deletions TrackingTools/PatternTools/interface/ClosestApproachInRPhi.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@
* the z-coordinates on the 2 tracks are the closest is chosen.
*/

// Function for testing ClosestApproachInRPhi
namespace test {
namespace ClosestApproachInRPhi_t {
int test();
}
}

class ClosestApproachInRPhi GCC11_FINAL : public ClosestApproachOnHelices {
friend int test::ClosestApproachInRPhi_t::test();

public:

Expand Down
Loading