From 7ec7fddec13bd3206e059a43fa202f6fbcab448c Mon Sep 17 00:00:00 2001 From: Mingrui Zhao <mingrui.zhao@mail.labz0.org> Date: Thu, 17 Sep 2020 22:46:41 +0800 Subject: [PATCH] Correct data type: trackerHit* -> ConstTrackerHit --- .../src/ForwardTrackingAlg.cpp | 2 +- .../src/SiliconTrackingAlg.cpp | 204 +++++------ .../SiliconTracking/src/SiliconTrackingAlg.h | 10 +- .../src/SpacePointBuilderAlg.cpp | 22 +- .../src/SpacePointBuilderAlg.h | 2 +- .../SiliconTracking/src/TrackSubsetAlg.cpp | 18 +- .../KalDet/cmake/MacroCheckPackageLibs.cmake | 164 --------- .../cmake/MacroCheckPackageVersion.cmake | 108 ------ Utilities/KalDet/cmake/MacroRootDict.cmake | 145 -------- Utilities/KalDet/cmake/MyFindROOT.cmake | 316 ------------------ .../KalTest/cmake/MacroCheckPackageLibs.cmake | 164 --------- .../cmake/MacroCheckPackageVersion.cmake | 108 ------ Utilities/KalTest/cmake/MacroRootDict.cmake | 145 -------- Utilities/KalTest/cmake/MyFindROOT.cmake | 316 ------------------ 14 files changed, 129 insertions(+), 1595 deletions(-) delete mode 100644 Utilities/KalDet/cmake/MacroCheckPackageLibs.cmake delete mode 100644 Utilities/KalDet/cmake/MacroCheckPackageVersion.cmake delete mode 100644 Utilities/KalDet/cmake/MacroRootDict.cmake delete mode 100644 Utilities/KalDet/cmake/MyFindROOT.cmake delete mode 100644 Utilities/KalTest/cmake/MacroCheckPackageLibs.cmake delete mode 100644 Utilities/KalTest/cmake/MacroCheckPackageVersion.cmake delete mode 100644 Utilities/KalTest/cmake/MacroRootDict.cmake delete mode 100644 Utilities/KalTest/cmake/MyFindROOT.cmake diff --git a/Reconstruction/SiliconTracking/src/ForwardTrackingAlg.cpp b/Reconstruction/SiliconTracking/src/ForwardTrackingAlg.cpp index 3f9c425f..9badc084 100644 --- a/Reconstruction/SiliconTracking/src/ForwardTrackingAlg.cpp +++ b/Reconstruction/SiliconTracking/src/ForwardTrackingAlg.cpp @@ -264,7 +264,7 @@ StatusCode ForwardTrackingAlg::execute(){ for(auto trackerHit : *hitFTDCollections[iCol]){ edm4hep::ConstTrackerHit hit = trackerHit; debug() << "hit " << trackerHit.id() << " " << KiTrackMarlin::getCellID0Info( trackerHit.getCellID() ) - << " " << KiTrackMarlin::getPositionInfo( &hit )<< endmsg; + << " " << KiTrackMarlin::getPositionInfo( hit )<< endmsg; //Make an FTDHit01 from the TrackerHit FTDHit01* ftdHit = new FTDHit01 ( trackerHit , _sectorSystemFTD ); diff --git a/Reconstruction/SiliconTracking/src/SiliconTrackingAlg.cpp b/Reconstruction/SiliconTracking/src/SiliconTrackingAlg.cpp index 54b2720e..2e7ae95c 100644 --- a/Reconstruction/SiliconTracking/src/SiliconTrackingAlg.cpp +++ b/Reconstruction/SiliconTracking/src/SiliconTrackingAlg.cpp @@ -436,7 +436,7 @@ int SiliconTrackingAlg::InitialiseFTD() { //for (int ielem=0; ielem<nelem; ++ielem) { for(auto hit : *hitFTDPixelCol){ - //dm4hep::TrackerHit* hit = hitFTDPixelCol->at(ielem); + //dm4hep::ConstTrackerHit hit = hitFTDPixelCol->at(ielem); TrackerHitExtended * hitExt = new TrackerHitExtended( hit ); //gear::Vector3D U(1.0,hit->getU()[1],hit->getU()[0],gear::Vector3D::spherical); //gear::Vector3D V(1.0,hit->getV()[1],hit->getV()[0],gear::Vector3D::spherical); @@ -477,8 +477,8 @@ int SiliconTrackingAlg::InitialiseFTD() { double Phi = atan2(pos[1],pos[0]); if (Phi < 0.) Phi = Phi + TWOPI; // get the layer number - unsigned int layer = static_cast<unsigned int>(getLayerID(&hit)); - unsigned int petalIndex = static_cast<unsigned int>(getModuleID(&hit)); + unsigned int layer = static_cast<unsigned int>(getLayerID(hit)); + unsigned int petalIndex = static_cast<unsigned int>(getModuleID(hit)); if ( _petalBasedFTDWithOverlaps == true ) { @@ -499,7 +499,7 @@ int SiliconTrackingAlg::InitialiseFTD() { int iPhi = int(Phi/_dPhiFTD); - int side = getSideID(&hit); + int side = getSideID(hit); int iSemiSphere = 0; if (side > 0) @@ -547,7 +547,7 @@ int SiliconTrackingAlg::InitialiseFTD() { //for (int ielem=0; ielem<nelem; ++ielem) { for(auto hit : *hitFTDSpacePointCol){ - //edm4hep::TrackerHit* hit = hitFTDSpacePointCol->at(ielem); + //edm4hep::ConstTrackerHit hit = hitFTDSpacePointCol->at(ielem); TrackerHitExtended * hitExt = new TrackerHitExtended(hit); @@ -574,8 +574,8 @@ int SiliconTrackingAlg::InitialiseFTD() { if (Phi < 0.) Phi = Phi + TWOPI; // get the layer number - unsigned int layer = static_cast<unsigned int>(getLayerID(&hit)); - unsigned int petalIndex = static_cast<unsigned int>(getModuleID(&hit)); + unsigned int layer = static_cast<unsigned int>(getLayerID(hit)); + unsigned int petalIndex = static_cast<unsigned int>(getModuleID(hit)); if ( _petalBasedFTDWithOverlaps == true ) { @@ -597,7 +597,7 @@ int SiliconTrackingAlg::InitialiseFTD() { int iPhi = int(Phi/_dPhiFTD); - int side = getSideID(&hit); + int side = getSideID(hit); int iSemiSphere = 0; if (side > 0) @@ -703,7 +703,7 @@ int SiliconTrackingAlg::InitialiseVTX() { if (Phi < 0.) Phi = Phi + TWOPI; // get the layer number - int layer = getLayerID(&hit); + int layer = getLayerID(hit); if (layer < 0 || layer >= _nLayers) { error() << "SiliconTrackingAlg => fatal error in VTX : layer is outside allowed range : " << layer << endmsg; @@ -749,7 +749,7 @@ int SiliconTrackingAlg::InitialiseVTX() { debug() << "Number of SIT hits = " << nelem << endmsg; _nTotalSITHits = nelem; - //TrackerHit* trkhit = 0; + //ConstTrackerHit trkhit = 0; //TrackerHitPlane* trkhit_P = 0; //TrackerHitZCylinder* trkhit_C = 0; @@ -770,9 +770,9 @@ int SiliconTrackingAlg::InitialiseVTX() { // iv) TrackerHitZCylinder // v) Must be standard TrackerHit - //const edm4hep::TrackerHit* trkhit = hitSITCol->at(ielem); + //const edm4hep::ConstTrackerHit trkhit = hitSITCol->at(ielem); - int layer = getLayerID(&trkhit); + int layer = getLayerID(trkhit); // VXD and SIT are treated as one system so SIT layers start from _nLayersVTX layer = layer + _nLayersVTX; @@ -1145,21 +1145,21 @@ TrackExtended * SiliconTrackingAlg::TestTriplet(TrackerHitExtended * outerHit, float epar[15]; // first hit - xh[0] = outerHit->getTrackerHit()->getPosition()[0]; - yh[0] = outerHit->getTrackerHit()->getPosition()[1]; - zh[0] = float(outerHit->getTrackerHit()->getPosition()[2]); + xh[0] = outerHit->getTrackerHit().getPosition()[0]; + yh[0] = outerHit->getTrackerHit().getPosition()[1]; + zh[0] = float(outerHit->getTrackerHit().getPosition()[2]); wrh[0] = double(1.0/(outerHit->getResolutionRPhi()*outerHit->getResolutionRPhi())); wzh[0] = 1.0/(outerHit->getResolutionZ()*outerHit->getResolutionZ()); // second hit - xh[1] = middleHit->getTrackerHit()->getPosition()[0]; - yh[1] = middleHit->getTrackerHit()->getPosition()[1]; - zh[1] = float(middleHit->getTrackerHit()->getPosition()[2]); + xh[1] = middleHit->getTrackerHit().getPosition()[0]; + yh[1] = middleHit->getTrackerHit().getPosition()[1]; + zh[1] = float(middleHit->getTrackerHit().getPosition()[2]); wrh[1] = double(1.0/(middleHit->getResolutionRPhi()*middleHit->getResolutionRPhi())); wzh[1] = 1.0/(middleHit->getResolutionZ()*middleHit->getResolutionZ()); // third hit - xh[2] = innerHit->getTrackerHit()->getPosition()[0]; - yh[2] = innerHit->getTrackerHit()->getPosition()[1]; - zh[2] = float(innerHit->getTrackerHit()->getPosition()[2]); + xh[2] = innerHit->getTrackerHit().getPosition()[0]; + yh[2] = innerHit->getTrackerHit().getPosition()[1]; + zh[2] = float(innerHit->getTrackerHit().getPosition()[2]); wrh[2] = double(1.0/(innerHit->getResolutionRPhi()*innerHit->getResolutionRPhi())); wzh[2] = 1.0/(innerHit->getResolutionZ()*innerHit->getResolutionZ()); // calculate r and phi for all hits @@ -1195,7 +1195,7 @@ TrackExtended * SiliconTrackingAlg::TestTriplet(TrackerHitExtended * outerHit, // check the truth information for the triplet // define these outside of the ifdef so that we don't need to keep repeating it. - //std::vector<TrackerHit*> hit_list; + //std::vector<ConstTrackerHit> hit_list; //std::vector<MCParticle*> mcps_imo; //std::vector<MCParticle*> mcp_s; int triplet_code = 0; @@ -1225,7 +1225,7 @@ TrackExtended * SiliconTrackingAlg::TestTriplet(TrackerHitExtended * outerHit, for (unsigned ihit = 0; ihit < hit_list.size(); ++ihit) { - EVENT::TrackerHit* trkhit = hit_list[ihit]; + EVENT::ConstTrackerHit trkhit = hit_list[ihit]; std::vector<MCParticle*> mcps; MarlinTrk::getMCParticlesForTrackerHit(trkhit, mcps); @@ -1287,7 +1287,7 @@ TrackExtended * SiliconTrackingAlg::TestTriplet(TrackerHitExtended * outerHit, MarlinCED::drawHelix( _bField , mcp->getCharge(), mcp->getVertex()[0], mcp->getVertex()[1], mcp->getVertex()[2], mcp->getMomentum()[0], mcp->getMomentum()[1], mcp->getMomentum()[2], layer , size , 0x7af774 , 0.0, _helix_max_r , - helix_max_z, mcp->id() ) ; + helix_max_z, mcp.id() ) ; } @@ -1304,14 +1304,14 @@ TrackExtended * SiliconTrackingAlg::TestTriplet(TrackerHitExtended * outerHit, color = 0xFFFFFF; - for( std::vector<TrackerHit* >::const_iterator it = hit_list.begin(); it != hit_list.end() ; it++ ) { + for( std::vector<ConstTrackerHit >::const_iterator it = hit_list.begin(); it != hit_list.end() ; it++ ) { - TrackerHit* trkhit = *it; + ConstTrackerHit trkhit = *it; - ced_hit_ID(trkhit->getPosition()[0], - trkhit->getPosition()[1], - trkhit->getPosition()[2], - marker, layer, size , color, trkhit->id() ) ; + ced_hit_ID(trkhit.getPosition()[0], + trkhit.getPosition()[1], + trkhit.getPosition()[2], + marker, layer, size , color, trkhit.id() ) ; } // hits @@ -1476,7 +1476,7 @@ int SiliconTrackingAlg::BuildTrack(TrackerHitExtended * outerHit, float distance[3]; for (int i=0; i<3; ++i) { - pos[i] = float(currentHit->getTrackerHit()->getPosition()[i]); + pos[i] = float(currentHit->getTrackerHit().getPosition()[i]); } // get the distance of closest approach and distance s traversed to the POCA @@ -1512,10 +1512,10 @@ int SiliconTrackingAlg::BuildTrack(TrackerHitExtended * outerHit, float epar[15]; for (int ih=0;ih<nHits;++ih) { - edm4hep::TrackerHit * trkHit = hvec[ih]->getTrackerHit(); - xh[ih] = trkHit->getPosition()[0]; - yh[ih] = trkHit->getPosition()[1]; - zh[ih] = float(trkHit->getPosition()[2]); + edm4hep::ConstTrackerHit trkHit = hvec[ih]->getTrackerHit(); + xh[ih] = trkHit.getPosition()[0]; + yh[ih] = trkHit.getPosition()[1]; + zh[ih] = float(trkHit.getPosition()[2]); wrh[ih] = double(1.0/(hvec[ih]->getResolutionRPhi()*hvec[ih]->getResolutionRPhi())); wzh[ih] = 1.0/(hvec[ih]->getResolutionZ()*hvec[ih]->getResolutionZ()); rh[ih] = float(sqrt(xh[ih]*xh[ih]+yh[ih]*yh[ih])); @@ -1523,10 +1523,10 @@ int SiliconTrackingAlg::BuildTrack(TrackerHitExtended * outerHit, if (ph[ih] < 0.) ph[ih] = TWOPI + ph[ih]; } - edm4hep::TrackerHit * assignedTrkHit = assignedhit->getTrackerHit(); - xh[nHits] = assignedTrkHit->getPosition()[0]; - yh[nHits] = assignedTrkHit->getPosition()[1]; - zh[nHits] = float(assignedTrkHit->getPosition()[2]); + edm4hep::ConstTrackerHit assignedTrkHit = assignedhit->getTrackerHit(); + xh[nHits] = assignedTrkHit.getPosition()[0]; + yh[nHits] = assignedTrkHit.getPosition()[1]; + zh[nHits] = float(assignedTrkHit.getPosition()[2]); rh[nHits] = float(sqrt(xh[nHits]*xh[nHits]+yh[nHits]*yh[nHits])); ph[nHits] = float(atan2(yh[nHits],xh[nHits])); if (ph[nHits] < 0.) @@ -1666,24 +1666,24 @@ void SiliconTrackingAlg::CreateTrack(TrackExtended * trackAR ) { float epar[15]; float refPoint[3] = {0.,0.,0.}; for (int ih=0;ih<nHits;++ih) { - edm4hep::TrackerHit * trkHit = hitVec[ih]->getTrackerHit(); + edm4hep::ConstTrackerHit trkHit = hitVec[ih]->getTrackerHit(); float rR = hitVec[ih]->getResolutionRPhi(); float rZ = hitVec[ih]->getResolutionZ(); if (int(hitVec[ih]->getTrackExtendedVec().size()) != 0) debug() << "WARNING : HIT POINTS TO TRACK " << endmsg; - xh[ih] = trkHit->getPosition()[0]; - yh[ih] = trkHit->getPosition()[1]; - zh[ih] = float(trkHit->getPosition()[2]); + xh[ih] = trkHit.getPosition()[0]; + yh[ih] = trkHit.getPosition()[1]; + zh[ih] = float(trkHit.getPosition()[2]); wrh[ih] = double(1.0/(rR*rR)); wzh[ih] = 1.0/(rZ*rZ); rh[ih] = float(sqrt(xh[ih]*xh[ih]+yh[ih]*yh[ih])); ph[ih] = float(atan2(yh[ih],xh[ih])); } for (int ih=0;ih<nHitsOld;++ih) { - edm4hep::TrackerHit * trkHit = hitVecOld[ih]->getTrackerHit(); - xh[ih+nHits] = trkHit->getPosition()[0]; - yh[ih+nHits] = trkHit->getPosition()[1]; - zh[ih+nHits] = float(trkHit->getPosition()[2]); + edm4hep::ConstTrackerHit trkHit = hitVecOld[ih]->getTrackerHit(); + xh[ih+nHits] = trkHit.getPosition()[0]; + yh[ih+nHits] = trkHit.getPosition()[1]; + zh[ih+nHits] = float(trkHit.getPosition()[2]); float rR = hitVecOld[ih]->getResolutionRPhi(); float rZ = hitVecOld[ih]->getResolutionZ(); wrh[ih+nHits] = double(1.0/(rR*rR)); @@ -1875,11 +1875,11 @@ void SiliconTrackingAlg::AttachRemainingVTXHitsFast() { TrackerHitExtended * hitExt = hitVec[iH]; TrackExtendedVec& trackVec = hitExt->getTrackExtendedVec(); if (trackVec.size()==0) { - edm4hep::TrackerHit * hit = hitExt->getTrackerHit(); + edm4hep::ConstTrackerHit hit = hitExt->getTrackerHit(); double pos[3]; double radius = 0; for (int i=0; i<3; ++i) { - pos[i] = hit->getPosition()[i]; + pos[i] = hit.getPosition()[i]; radius += pos[i]*pos[i]; } radius = sqrt(radius); @@ -1939,14 +1939,14 @@ void SiliconTrackingAlg::AttachRemainingVTXHitsFast() { for (int IHIT=0;IHIT<NHITS;++IHIT) { // Here we are trying to find if a hits are too close i.e. closer than _minDistToDelta - edm4hep::TrackerHit* trkhit1 = hit->getTrackerHit(); - edm4hep::TrackerHit* trkhit2 = hitVector[IHIT]->getTrackerHit(); + edm4hep::ConstTrackerHit trkhit1 = hit->getTrackerHit(); + edm4hep::ConstTrackerHit trkhit2 = hitVector[IHIT]->getTrackerHit(); - if ( trkhit1->getCellID() == trkhit2->getCellID() ){ // i.e. they are in the same sensor + if ( trkhit1.getCellID() == trkhit2.getCellID() ){ // i.e. they are in the same sensor float distance = 0.; for (int iC=0;iC<3;++iC) { - float posFirst = float(hit->getTrackerHit()->getPosition()[iC]); - float posSecond = float(hitVector[IHIT]->getTrackerHit()->getPosition()[iC]); + float posFirst = float(hit->getTrackerHit().getPosition()[iC]); + float posSecond = float(hitVector[IHIT]->getTrackerHit().getPosition()[iC]); float deltaPos = posFirst - posSecond; distance += deltaPos*deltaPos; } @@ -1970,7 +1970,7 @@ void SiliconTrackingAlg::AttachRemainingVTXHitsFast() { if (layer > _minimalLayerToAttach) { float pos[3]; for (int i=0; i<3; ++i) - pos[i] = hit->getTrackerHit()->getPosition()[i]; + pos[i] = hit->getTrackerHit().getPosition()[i]; float distance[3]; float time = helix.getDistanceToPoint(pos,distance); if (time < 1.0e+10) { @@ -2017,7 +2017,7 @@ void SiliconTrackingAlg::AttachRemainingVTXHitsSlow() { if(isize>maxTrackSize)maxTrackSize = isize; } if (maxTrackSize<=3) { - debug() << " Add non attached hit to list: id = " << hit->getTrackerHit()->id() << endmsg; + debug() << " Add non attached hit to list: id = " << hit->getTrackerHit().id() << endmsg; nonAttachedHits.push_back( hit ); } @@ -2032,12 +2032,12 @@ void SiliconTrackingAlg::AttachRemainingVTXHitsSlow() { int nTrk = int(_trackImplVec.size()); for (int iHit=0; iHit<nNotAttached; ++iHit) { TrackerHitExtended * hit = nonAttachedHits[iHit]; - debug() << " Try hit: id = " << hit->getTrackerHit()->id() << endmsg; + debug() << " Try hit: id = " << hit->getTrackerHit().id() << endmsg; int layer = getLayerID( hit->getTrackerHit() ); if (layer > _minimalLayerToAttach) { float pos[3]; for (int i=0; i<3; ++i) - pos[i] = hit->getTrackerHit()->getPosition()[i]; + pos[i] = hit->getTrackerHit().getPosition()[i]; float minDist = 1e+10; TrackExtended * trackToAttach = NULL; for (int iTrk=0; iTrk<nTrk; ++iTrk) { @@ -2049,22 +2049,22 @@ void SiliconTrackingAlg::AttachRemainingVTXHitsSlow() { for (int IHIT=0;IHIT<NHITS;++IHIT) { // Here we are trying to find if a hits are too close i.e. closer than _minDistToDelta - edm4hep::TrackerHit* trkhit1 = hit->getTrackerHit(); - edm4hep::TrackerHit* trkhit2 = hitVector[IHIT]->getTrackerHit(); + edm4hep::ConstTrackerHit trkhit1 = hit->getTrackerHit(); + edm4hep::ConstTrackerHit trkhit2 = hitVector[IHIT]->getTrackerHit(); - if ( trkhit1->getCellID() == trkhit2->getCellID() ){ // i.e. they are in the same sensor + if ( trkhit1.getCellID() == trkhit2.getCellID() ){ // i.e. they are in the same sensor float distance = 0.; for (int iC=0;iC<3;++iC) { - float posFirst = float(hit->getTrackerHit()->getPosition()[iC]); - float posSecond = float(hitVector[IHIT]->getTrackerHit()->getPosition()[iC]); + float posFirst = float(hit->getTrackerHit().getPosition()[iC]); + float posSecond = float(hitVector[IHIT]->getTrackerHit().getPosition()[iC]); float deltaPos = posFirst - posSecond; distance += deltaPos*deltaPos; } distance = sqrt(distance); if (distance<_minDistToDelta) { consider = false; - debug() << " hit: id = " << hit->getTrackerHit()->id() << " condsidered delta together with hit " << trkhit2->id() << endmsg; + debug() << " hit: id = " << hit->getTrackerHit().id() << " condsidered delta together with hit " << trkhit2.id() << endmsg; break; } } @@ -2090,10 +2090,10 @@ void SiliconTrackingAlg::AttachRemainingVTXHitsSlow() { } if (minDist < _minDistCutAttach && trackToAttach != NULL) { int iopt = 2; - debug() << " Hit: id = " << hit->getTrackerHit()->id() << " : try attachement"<< endmsg; + debug() << " Hit: id = " << hit->getTrackerHit().id() << " : try attachement"<< endmsg; AttachHitToTrack(trackToAttach,hit,iopt); } else { - debug() << " Hit: id = " << hit->getTrackerHit()->id() << " rejected due to distance cut of " <<_minDistCutAttach<< " min distance = " << minDist << endmsg; + debug() << " Hit: id = " << hit->getTrackerHit().id() << " rejected due to distance cut of " <<_minDistCutAttach<< " min distance = " << minDist << endmsg; } } } @@ -2126,7 +2126,7 @@ void SiliconTrackingAlg::AttachRemainingFTDHitsSlow() { TrackerHitExtended * hit = nonAttachedHits[iHit]; float pos[3]; for (int i=0; i<3; ++i) - pos[i] = hit->getTrackerHit()->getPosition()[i]; + pos[i] = hit->getTrackerHit().getPosition()[i]; float minDist = 1e+10; TrackExtended * trackToAttach = NULL; for (int iTrk=0; iTrk<nTrk; ++iTrk) { @@ -2139,7 +2139,7 @@ void SiliconTrackingAlg::AttachRemainingFTDHitsSlow() { // SJA:FIXME: check to see if allowing no hits in the same sensor vs no hits in the same layer works // if (hit->getTrackerHit()->getType() == hitVector[IHIT]->getTrackerHit()->getType()) { - if (hit->getTrackerHit()->getCellID() == hitVector[IHIT]->getTrackerHit()->getCellID()) { + if (hit->getTrackerHit().getCellID() == hitVector[IHIT]->getTrackerHit().getCellID()) { consider = false; break; @@ -2223,7 +2223,7 @@ void SiliconTrackingAlg::AttachRemainingFTDHitsFast() { // SJA:FIXME: check to see if allowing no hits in the same sensor vs no hits in the same layer works for (int IHIT=0;IHIT<NHITS;++IHIT) { // if (hit->getTrackerHit()->getType() == hitVector[IHIT]->getTrackerHit()->getType()) { - if (hit->getTrackerHit()->getCellID() == hitVector[IHIT]->getTrackerHit()->getCellID()) { + if (hit->getTrackerHit().getCellID() == hitVector[IHIT]->getTrackerHit().getCellID()) { consider = false; break; } @@ -2233,7 +2233,7 @@ void SiliconTrackingAlg::AttachRemainingFTDHitsFast() { if (consider) { float pos[3]; for (int i=0;i<3;++i) { - pos[i] = hit->getTrackerHit()->getPosition()[i]; + pos[i] = hit->getTrackerHit().getPosition()[i]; } float distance[3]; float time = helix.getDistanceToPoint(pos,distance); @@ -2334,9 +2334,9 @@ void SiliconTrackingAlg::TrackingInFTD() { TrackerHitExtended * hitInner = hitVecInner[iInner]; HelixClass helix; // std::cout << endmsg; - // std::cout << "Outer Hit Type " << hitOuter->getTrackerHit()->getType() << " z = " << hitOuter->getTrackerHit()->getPosition()[2] - // << "\nMiddle Hit Type "<< hitMiddle->getTrackerHit()->getType() << " z = " << hitMiddle->getTrackerHit()->getPosition()[2] - // << "\nInner Hit Type "<< hitInner->getTrackerHit()->getType() << " z = " << hitInner->getTrackerHit()->getPosition()[2] << endmsg; + // std::cout << "Outer Hit Type " << hitOuter->getTrackerHit()->getType() << " z = " << hitOuter->getTrackerHit().getPosition()[2] + // << "\nMiddle Hit Type "<< hitMiddle->getTrackerHit()->getType() << " z = " << hitMiddle->getTrackerHit().getPosition()[2] + // << "\nInner Hit Type "<< hitInner->getTrackerHit()->getType() << " z = " << hitInner->getTrackerHit().getPosition()[2] << endmsg; debug() << " " << std::setw(3) << ipOuter << " " << std::setw(3) << ipMiddle << " " << std::setw(3) << ipInner << " " @@ -2401,10 +2401,10 @@ int SiliconTrackingAlg::BuildTrackFTD(TrackExtended * trackAR, int * nLR, int iS int nH = int(hitVec.size()); for (int iH=0; iH<nH; ++iH) { TrackerHitExtended * hit = hitVec[iH]; - edm4hep::TrackerHit * trkHit = hit->getTrackerHit(); + edm4hep::ConstTrackerHit trkHit = hit->getTrackerHit(); float pos[3]; for (int i=0;i<3;++i) - pos[i] = float(trkHit->getPosition()[i]); + pos[i] = float(trkHit.getPosition()[i]); float distance[3]; float time = helix.getDistanceToPoint(pos,distance); if (time < 1.0e+10) { @@ -2444,10 +2444,10 @@ int SiliconTrackingAlg::AttachHitToTrack(TrackExtended * trackAR, TrackerHitExte float epar[15]; for (int i=0; i<nHits; ++i) { - edm4hep::TrackerHit * trkHit = hitVec[i]->getTrackerHit(); - xh[i] = double(trkHit->getPosition()[0]); - yh[i] = double(trkHit->getPosition()[1]); - zh[i] = float(trkHit->getPosition()[2]); + edm4hep::ConstTrackerHit trkHit = hitVec[i]->getTrackerHit(); + xh[i] = double(trkHit.getPosition()[0]); + yh[i] = double(trkHit.getPosition()[1]); + zh[i] = float(trkHit.getPosition()[2]); ph[i] = float(atan2(yh[i],xh[i])); rh[i] = float(sqrt(xh[i]*xh[i]+yh[i]*yh[i])); float rR = hitVec[i]->getResolutionRPhi(); @@ -2456,10 +2456,10 @@ int SiliconTrackingAlg::AttachHitToTrack(TrackExtended * trackAR, TrackerHitExte wzh[i] = 1.0/(rZ*rZ); } - edm4hep::TrackerHit * trkHit = hit->getTrackerHit(); - xh[nHits] = double(trkHit->getPosition()[0]); - yh[nHits] = double(trkHit->getPosition()[1]); - zh[nHits] = float(trkHit->getPosition()[2]); + edm4hep::ConstTrackerHit trkHit = hit->getTrackerHit(); + xh[nHits] = double(trkHit.getPosition()[0]); + yh[nHits] = double(trkHit.getPosition()[1]); + zh[nHits] = float(trkHit.getPosition()[2]); ph[nHits] = float(atan2(yh[nHits],xh[nHits])); rh[nHits] = float(sqrt(xh[nHits]*xh[nHits]+yh[nHits]*yh[nHits])); @@ -2586,7 +2586,7 @@ void SiliconTrackingAlg::FinalRefit(edm4hep::TrackCollection* trk_col) { lh[ihit] = 1; // only hits which have lh=1 will be used for the fit // get the pointer to the lcio trackerhit for this hit - edm4hep::TrackerHit * trkHit = hitVec[ihit]->getTrackerHit(); + edm4hep::ConstTrackerHit trkHit = hitVec[ihit]->getTrackerHit(); int det = getDetectorID(trkHit); @@ -2600,7 +2600,7 @@ void SiliconTrackingAlg::FinalRefit(edm4hep::TrackCollection* trk_col) { for (int lhit=0;lhit<ihit;++lhit) { // get the pointer to the lcio trackerhit for the previously checked hit - edm4hep::TrackerHit * trkHitS = hitVec[lhit]->getTrackerHit(); + edm4hep::ConstTrackerHit trkHitS = hitVec[lhit]->getTrackerHit(); // int layerS = getLayerID(trkHitS); @@ -2612,14 +2612,14 @@ void SiliconTrackingAlg::FinalRefit(edm4hep::TrackCollection* trk_col) { // check if the hits have the same layer and petal number // hitVec[ihit]-> // if ((layer == layerS) && (moduleIndex==moduleIndexS) && (lh[lhit] == 1)) { - if ( (trkHit->getCellID() == trkHitS->getCellID()) && (lh[lhit] == 1)) { + if ( (trkHit.getCellID() == trkHitS.getCellID()) && (lh[lhit] == 1)) { // get the position of the hits float xP[3]; float xPS[3]; for (int iC=0;iC<3;++iC) { - xP[iC] = float(trkHit->getPosition()[iC]); - xPS[iC] = float(trkHitS->getPosition()[iC]); + xP[iC] = float(trkHit.getPosition()[iC]); + xPS[iC] = float(trkHitS.getPosition()[iC]); } // get the intersection of the helix with the either the cylinder or plane containing the hit @@ -2662,17 +2662,17 @@ void SiliconTrackingAlg::FinalRefit(edm4hep::TrackCollection* trk_col) { delete helix; - std::vector<TrackerHit*> trkHits; - std::vector<TrackerHit*> trkHits_used_inFit; + std::vector<ConstTrackerHit> trkHits; + std::vector<ConstTrackerHit> trkHits_used_inFit; int nFit = 0; for (int i=0; i<nHits; ++i) { // check if the hit has been rejected as being on the same layer and further from the helix lh==0 if (lh[i] == 1) { - edm4hep::TrackerHit * trkHit = hitVec[i]->getTrackerHit(); + edm4hep::ConstTrackerHit trkHit = hitVec[i]->getTrackerHit(); debug() << "TrackerHit " << i << " address = " << trkHit << endmsg; nFit++; - if(trkHit) { + if(trkHit.isAvailable()) { trkHits.push_back(trkHit); } else{ @@ -2709,12 +2709,12 @@ void SiliconTrackingAlg::FinalRefit(edm4hep::TrackCollection* trk_col) { covMatrix[14] = ( _initialTrackError_tanL ); //sigma_tanl^2 - std::vector< std::pair<float, edm4hep::TrackerHit*> > r2_values; + std::vector< std::pair<float, edm4hep::ConstTrackerHit> > r2_values; r2_values.reserve(trkHits.size()); - for (std::vector<edm4hep::TrackerHit*>::iterator it=trkHits.begin(); it!=trkHits.end(); ++it) { - edm4hep::TrackerHit* h = *it; - float r2 = h->getPosition()[0]*h->getPosition()[0]+h->getPosition()[1]*h->getPosition()[1]; + for (std::vector<edm4hep::ConstTrackerHit>::iterator it=trkHits.begin(); it!=trkHits.end(); ++it) { + edm4hep::ConstTrackerHit h = *it; + float r2 = h.getPosition()[0]*h.getPosition()[0]+h.getPosition()[1]*h.getPosition()[1]; r2_values.push_back(std::make_pair(r2, *it)); } @@ -2723,7 +2723,7 @@ void SiliconTrackingAlg::FinalRefit(edm4hep::TrackCollection* trk_col) { trkHits.clear(); trkHits.reserve(r2_values.size()); - for (std::vector< std::pair<float, edm4hep::TrackerHit*> >::iterator it=r2_values.begin(); it!=r2_values.end(); ++it) { + for (std::vector< std::pair<float, edm4hep::ConstTrackerHit> >::iterator it=r2_values.begin(); it!=r2_values.end(); ++it) { trkHits.push_back(it->second); } //std::cout << "fucd------------------3 " << _trksystem << std::endl; @@ -2782,16 +2782,16 @@ void SiliconTrackingAlg::FinalRefit(edm4hep::TrackCollection* trk_col) { #endif */ - std::vector<std::pair<edm4hep::TrackerHit* , double> > hits_in_fit ; - std::vector<std::pair<edm4hep::TrackerHit* , double> > outliers ; - std::vector<edm4hep::TrackerHit*> all_hits; + std::vector<std::pair<edm4hep::ConstTrackerHit , double> > hits_in_fit ; + std::vector<std::pair<edm4hep::ConstTrackerHit , double> > outliers ; + std::vector<edm4hep::ConstTrackerHit> all_hits; all_hits.reserve(300); marlinTrk->getHitsInFit(hits_in_fit); for ( unsigned ihit = 0; ihit < hits_in_fit.size(); ++ihit) { debug() << "Hit address=" << hits_in_fit[ihit].first << endmsg; - edm4hep::TrackerHit* trk = hits_in_fit[ihit].first; + edm4hep::ConstTrackerHit trk = hits_in_fit[ihit].first; all_hits.push_back(trk);//hits_in_fit[ihit].first); } @@ -2813,7 +2813,7 @@ void SiliconTrackingAlg::FinalRefit(edm4hep::TrackCollection* trk_col) { int nhits_in_ftd = track.getSubDetectorHitNumbers(1); int nhits_in_sit = track.getSubDetectorHitNumbers(2); - //debug() << " Hit numbers for Track "<< track->id() << ": " + //debug() << " Hit numbers for Track "<< track.id() << ": " debug() << " Hit numbers for Track "<< iTrk <<": " << " vxd hits = " << nhits_in_vxd << " ftd hits = " << nhits_in_ftd diff --git a/Reconstruction/SiliconTracking/src/SiliconTrackingAlg.h b/Reconstruction/SiliconTracking/src/SiliconTrackingAlg.h index 67ffdb96..9f21225c 100644 --- a/Reconstruction/SiliconTracking/src/SiliconTrackingAlg.h +++ b/Reconstruction/SiliconTracking/src/SiliconTrackingAlg.h @@ -402,11 +402,11 @@ class SiliconTrackingAlg : public GaudiAlgorithm { // int _createMap; UTIL::BitField64* _encoder; - int getDetectorID(edm4hep::TrackerHit* hit) { _encoder->setValue(hit->getCellID()); return (*_encoder)[lcio::ILDCellID0::subdet]; } - int getSideID(edm4hep::TrackerHit* hit) { _encoder->setValue(hit->getCellID()); return (*_encoder)[lcio::ILDCellID0::side]; }; - int getLayerID(edm4hep::TrackerHit* hit) { _encoder->setValue(hit->getCellID()); return (*_encoder)[lcio::ILDCellID0::layer]; }; - int getModuleID(edm4hep::TrackerHit* hit) { _encoder->setValue(hit->getCellID()); return (*_encoder)[lcio::ILDCellID0::module]; }; - int getSensorID(edm4hep::TrackerHit* hit) { _encoder->setValue(hit->getCellID()); return (*_encoder)[lcio::ILDCellID0::sensor]; }; + int getDetectorID(edm4hep::ConstTrackerHit hit) { _encoder->setValue(hit.getCellID()); return (*_encoder)[lcio::ILDCellID0::subdet]; } + int getSideID(edm4hep::ConstTrackerHit hit) { _encoder->setValue(hit.getCellID()); return (*_encoder)[lcio::ILDCellID0::side]; }; + int getLayerID(edm4hep::ConstTrackerHit hit) { _encoder->setValue(hit.getCellID()); return (*_encoder)[lcio::ILDCellID0::layer]; }; + int getModuleID(edm4hep::ConstTrackerHit hit) { _encoder->setValue(hit.getCellID()); return (*_encoder)[lcio::ILDCellID0::module]; }; + int getSensorID(edm4hep::ConstTrackerHit hit) { _encoder->setValue(hit.getCellID()); return (*_encoder)[lcio::ILDCellID0::sensor]; }; StatusCode setupGearGeom() ; diff --git a/Reconstruction/SiliconTracking/src/SpacePointBuilderAlg.cpp b/Reconstruction/SiliconTracking/src/SpacePointBuilderAlg.cpp index bae1388b..e907b93a 100644 --- a/Reconstruction/SiliconTracking/src/SpacePointBuilderAlg.cpp +++ b/Reconstruction/SiliconTracking/src/SpacePointBuilderAlg.cpp @@ -191,7 +191,7 @@ StatusCode SpacePointBuilderAlg::execute(){ // add tolerence strip_length_mm = strip_length_mm * (1.0 + _striplength_tolerance); try{ - edm4hep::TrackerHit spacePoint = createSpacePoint( &hitFront, &hitBack, strip_length_mm); + edm4hep::TrackerHit spacePoint = createSpacePoint( hitFront, hitBack, strip_length_mm); //UTIL::CellIDEncoder<TrackerHitImpl> cellid_encoder( UTIL::ILDCellID0::encoder_string , spCol ); //cellid_encoder.setValue( cellID0 ); //give the new hit, the CellID0 of the front hit @@ -260,32 +260,32 @@ StatusCode SpacePointBuilderAlg::finalize(){ return GaudiAlgorithm::finalize(); } -edm4hep::TrackerHit SpacePointBuilderAlg::createSpacePoint( edm4hep::TrackerHit* a , edm4hep::TrackerHit* b, double stripLength ){ +edm4hep::TrackerHit SpacePointBuilderAlg::createSpacePoint( edm4hep::ConstTrackerHit a , edm4hep::ConstTrackerHit b, double stripLength ){ - const edm4hep::Vector3d& pa = a->getPosition(); + const edm4hep::Vector3d& pa = a.getPosition(); double xa = pa[0]; double ya = pa[1]; double za = pa[2]; CLHEP::Hep3Vector PA( xa,ya,za ); //double du_a = a->getdU(); - float du_a = a->getCovMatrix(2); + float du_a = a.getCovMatrix(2); - gear::MeasurementSurface const* msA = _GEAR->getMeasurementSurfaceStore().GetMeasurementSurface( a->getCellID() ); + gear::MeasurementSurface const* msA = _GEAR->getMeasurementSurfaceStore().GetMeasurementSurface( a.getCellID() ); gear::CartesianCoordinateSystem* ccsA = dynamic_cast< gear::CartesianCoordinateSystem* >( msA->getCoordinateSystem() ); CLHEP::Hep3Vector WA = ccsA->getLocalZAxis(); // the vector W of the local coordinate system the measurement surface has CLHEP::Hep3Vector VA = ccsA->getLocalYAxis(); // the vector V of the local coordinate system the measurement surface has CLHEP::Hep3Vector UA = ccsA->getLocalXAxis(); // the vector U of the local coordinate system the measurement surface has - const edm4hep::Vector3d& pb = b->getPosition(); + const edm4hep::Vector3d& pb = b.getPosition(); double xb = pb[0]; double yb = pb[1]; double zb = pb[2]; CLHEP::Hep3Vector PB( xb,yb,zb ); //double du_b = b->getdU(); - float du_b = b->getCovMatrix(2); + float du_b = b.getCovMatrix(2); - gear::MeasurementSurface const* msB = _GEAR->getMeasurementSurfaceStore().GetMeasurementSurface( b->getCellID() ); + gear::MeasurementSurface const* msB = _GEAR->getMeasurementSurfaceStore().GetMeasurementSurface( b.getCellID() ); gear::CartesianCoordinateSystem* ccsB = dynamic_cast< gear::CartesianCoordinateSystem* >( msB->getCoordinateSystem() ); CLHEP::Hep3Vector WB = ccsB->getLocalZAxis(); // the vector W of the local coordinate system the measurement surface has CLHEP::Hep3Vector VB = ccsB->getLocalYAxis(); // the vector V of the local coordinate system the measurement surface has @@ -464,7 +464,7 @@ TrackerHitImpl* SpacePointBuilderAlg::createSpacePointOld( TrackerHitPlane* a , streamlog_out( DEBUG2 ) << "\t OLD OLD OLD OLD\n"; - const double* p1 = a->getPosition(); + const double* p1 = a.getPosition(); double x1 = p1[0]; double y1 = p1[1]; double z1 = p1[2]; @@ -472,7 +472,7 @@ TrackerHitImpl* SpacePointBuilderAlg::createSpacePointOld( TrackerHitPlane* a , float ex1 = cos( v1[1] ) * sin( v1[0] ); float ey1 = sin( v1[1] ) * sin( v1[0] ); - const double* p2 = b->getPosition(); + const double* p2 = b.getPosition(); double x2 = p2[0]; double y2 = p2[1]; double z2 = p2[2]; @@ -499,7 +499,7 @@ TrackerHitImpl* SpacePointBuilderAlg::createSpacePointOld( TrackerHitPlane* a , // Check if the new hit is within the boundary CLHEP::Hep3Vector globalPoint(x,y,z); - // gear::MeasurementSurface* ms = gear::MeasurementSurfaceStore::Instance().GetMeasurementSurface( a->getCellID() ); + // gear::MeasurementSurface* ms = gear::MeasurementSurfaceStore::Instance().GetMeasurementSurface( a.getCellID() ); CLHEP::Hep3Vector localPoint = ms->getCoordinateSystem()->getLocalPoint(globalPoint); localPoint.setZ( 0. ); // we set w to 0 so it is in the plane ( we are only interested if u and v are in or out of range, to exclude w from the check it is set to 0) if( !ms->isLocalInBoundary( localPoint ) ){ diff --git a/Reconstruction/SiliconTracking/src/SpacePointBuilderAlg.h b/Reconstruction/SiliconTracking/src/SpacePointBuilderAlg.h index 0106b89b..6f731e62 100644 --- a/Reconstruction/SiliconTracking/src/SpacePointBuilderAlg.h +++ b/Reconstruction/SiliconTracking/src/SpacePointBuilderAlg.h @@ -144,7 +144,7 @@ class SpacePointBuilderAlg : public GaudiAlgorithm { /** @return a spacepoint (in the form of a TrackerHitImpl* ) created from two TrackerHitPlane* which stand for si-strips */ - edm4hep::TrackerHit createSpacePoint( edm4hep::TrackerHit* a , edm4hep::TrackerHit* b, double stripLength ); + edm4hep::TrackerHit createSpacePoint( edm4hep::ConstTrackerHit a , edm4hep::ConstTrackerHit b, double stripLength ); // TrackerHitImpl* createSpacePointOld( TrackerHitPlane* a , TrackerHitPlane* b ); diff --git a/Reconstruction/SiliconTracking/src/TrackSubsetAlg.cpp b/Reconstruction/SiliconTracking/src/TrackSubsetAlg.cpp index 541c5b16..2a241cf5 100644 --- a/Reconstruction/SiliconTracking/src/TrackSubsetAlg.cpp +++ b/Reconstruction/SiliconTracking/src/TrackSubsetAlg.cpp @@ -206,7 +206,7 @@ StatusCode TrackSubsetAlg::execute(){ edm4hep::Track* track = accepted[i]; std::vector<edm4hep::ConstTrackerHit> trackerHitsObj; - std::vector<edm4hep::TrackerHit*> trackerHits; + std::vector<edm4hep::ConstTrackerHit> trackerHits; std::copy(track->trackerHits_begin(), track->trackerHits_end(), std::back_inserter(trackerHitsObj)); for(unsigned i=0; i<trackerHitsObj.size(); i++){ @@ -225,12 +225,12 @@ StatusCode TrackSubsetAlg::execute(){ covMatrix[9] = ( _initialTrackError_z0 ); //sigma_z0^2 covMatrix[14] = ( _initialTrackError_tanL ); //sigma_tanl^2 - std::vector< std::pair<float, edm4hep::TrackerHit*> > r2_values; + std::vector< std::pair<float, edm4hep::ConstTrackerHit> > r2_values; r2_values.reserve(trackerHits.size()); - for (std::vector<edm4hep::TrackerHit*>::iterator it=trackerHits.begin(); it!=trackerHits.end(); ++it) { - edm4hep::TrackerHit* h = *it; - float r2 = h->getPosition()[0]*h->getPosition()[0]+h->getPosition()[1]*h->getPosition()[1]; + for (std::vector<edm4hep::ConstTrackerHit>::iterator it=trackerHits.begin(); it!=trackerHits.end(); ++it) { + edm4hep::ConstTrackerHit h = *it; + float r2 = h.getPosition()[0]*h.getPosition()[0]+h.getPosition()[1]*h.getPosition()[1]; r2_values.push_back(std::make_pair(r2, *it)); } @@ -239,7 +239,7 @@ StatusCode TrackSubsetAlg::execute(){ trackerHits.clear(); trackerHits.reserve(r2_values.size()); - for (std::vector< std::pair<float, edm4hep::TrackerHit*> >::iterator it=r2_values.begin(); it!=r2_values.end(); ++it) { + for (std::vector< std::pair<float, edm4hep::ConstTrackerHit> >::iterator it=r2_values.begin(); it!=r2_values.end(); ++it) { trackerHits.push_back(it->second); } @@ -264,9 +264,9 @@ StatusCode TrackSubsetAlg::execute(){ // Add hit numbers - std::vector<std::pair<edm4hep::TrackerHit* , double> > hits_in_fit ; - std::vector<std::pair<edm4hep::TrackerHit* , double> > outliers ; - std::vector<edm4hep::TrackerHit*> all_hits; + std::vector<std::pair<edm4hep::ConstTrackerHit , double> > hits_in_fit ; + std::vector<std::pair<edm4hep::ConstTrackerHit , double> > outliers ; + std::vector<edm4hep::ConstTrackerHit> all_hits; all_hits.reserve(300); marlinTrk->getHitsInFit(hits_in_fit); diff --git a/Utilities/KalDet/cmake/MacroCheckPackageLibs.cmake b/Utilities/KalDet/cmake/MacroCheckPackageLibs.cmake deleted file mode 100644 index c4451b3e..00000000 --- a/Utilities/KalDet/cmake/MacroCheckPackageLibs.cmake +++ /dev/null @@ -1,164 +0,0 @@ -############################################################################## -# macro for checkin package libraries in ${PKG_ROOT}/lib -# -# -# macro usage: -# CHECK_PACKAGE_LIBS( PACKAGE_NAME stdlib1 stdlib2 ... stdlibn ) -# only standard libraries should be passed as arguments to the macro -# component libraries are set by cmake in PKG_FIND_COMPONENTS (when -# calling FIND_PACKAGE with COMPONENTS argument) or through the -# variable PKG_USE_COMPONENTS -# -# -# required variables: -# PKG_ROOT : path to PKG root directory -# -# -# returns following variables: -# PKG_LIBRARY_DIRS : list of paths to be used with LINK_DIRECTORIES -# PGK_LIBRARIES : list of STANDARD libraries (NOT including COMPONENTS) -# PKG_COMPONENT_LIBRARIES : list of COMPONENT libraries -# PKG_${COMPONENT}_FOUND : set to TRUE or FALSE for each library -# PKG_${COMPONENT}_LIBRARY : path to each individual library -# -# -# PKG_LIBRARIES and PKG_LIBRARY_DIRS will be empty if any of the standard -# libraries is missing -# -# @author Jan Engels, Desy -############################################################################## - - -SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE ) - -MACRO( CHECK_PACKAGE_LIBS _pkgname ) - - SET( _std_lib_missing FALSE ) - SET( _ext_lib_missing FALSE ) - - SET( _std_libnames ${ARGN} ) - SET( _ext_libnames ${${_pkgname}_FIND_COMPONENTS} ${${_pkgname}_USE_COMPONENTS} ) - - IF( _ext_libnames ) - SEPARATE_ARGUMENTS( _ext_libnames ) - LIST( REMOVE_DUPLICATES _ext_libnames ) - ENDIF() - - IF( NOT ${_pkgname}_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ${_pkgname}_LIBRARIES: ${_std_libnames}" ) - IF( _ext_libnames ) - MESSAGE( STATUS "Check for ${_pkgname}_COMPONENT_LIBRARIES: ${_ext_libnames}" ) - ENDIF() - ENDIF() - - SET( ${_pkgname}_LIBRARY_DIRS ) - MARK_AS_ADVANCED( ${_pkgname}_LIBRARY_DIRS ) - - SET( ${_pkgname}_LIBRARIES ) - MARK_AS_ADVANCED( ${_pkgname}_LIBRARIES ) - - SET( ${_pkgname}_COMPONENT_LIBRARIES ) - MARK_AS_ADVANCED( ${_pkgname}_COMPONENT_LIBRARIES ) - - SET( ${_pkgname}_COMPONENT_VARIABLES ) - MARK_AS_ADVANCED( ${_pkgname}_COMPONENT_VARIABLES ) - - FOREACH( _libname ${_std_libnames} ${_ext_libnames} ) - - # flag to check if it is a standard or a component library - LIST( FIND _std_libnames "${_libname}" _aux ) - IF( ${_aux} LESS 0 ) - SET( _is_std_lib FALSE ) - ELSE() - SET( _is_std_lib TRUE ) - ENDIF() - - # libname in upper case - STRING( TOUPPER ${_libname} _ulibname ) - - SET( ${_pkgname}_${_ulibname}_LIBRARY ${_pkgname}_${_ulibname}_LIBRARY-NOTFOUND ) - MARK_AS_ADVANCED( ${_pkgname}_${_ulibname}_LIBRARY ) - - # WARNING: using PATH_SUFFIXES may cause problems when using variable CMAKE_FIND_ROOT_PATH - # this problem does not occur if expanding PATHS - # look in FindMySQL.cmake for more info - #FIND_LIBRARY( ${_pkgname}_${_ulibname}_LIBRARY NAMES ${_libname} PATHS - # ${${_pkgname}_ROOT} ${${_pkgname}_DIR} ${${_pkgname}_LIB_SEARCH_PATH} - # PATH_SUFFIXES lib64 lib - # NO_DEFAULT_PATH - #) - - FIND_LIBRARY( ${_pkgname}_${_ulibname}_LIBRARY NAMES ${_libname} PATHS - ${${_pkgname}_ROOT}/lib64 ${${_pkgname}_ROOT}/lib - ${${_pkgname}_DIR}/lib64 ${${_pkgname}_DIR}/lib - ${${_pkgname}_LIB_SEARCH_PATH} ${${_pkgname}_LIB_SEARCH_PATH}/lib64 ${${_pkgname}_LIB_SEARCH_PATH}/lib - NO_DEFAULT_PATH - ) - - IF( NOT ${_pkgname}_DIR ) - FIND_LIBRARY( ${_pkgname}_${_ulibname}_LIBRARY NAMES ${_libname} ) - ENDIF() - - IF( ${_pkgname}_FIND_REQUIRED ) - LIST( APPEND ${_pkgname}_COMPONENT_VARIABLES ${_pkgname}_${_ulibname}_LIBRARY ) - ENDIF() - - IF( ${_pkgname}_${_ulibname}_LIBRARY ) # if library found - - SET( ${_pkgname}_${_ulibname}_FOUND TRUE ) - - # split libraries in PKG_LIBRARIES and PKG_COMPONENT_LIBRARIES - IF( _is_std_lib ) - LIST( APPEND ${_pkgname}_LIBRARIES ${${_pkgname}_${_ulibname}_LIBRARY} ) - ELSE() - LIST( APPEND ${_pkgname}_COMPONENT_LIBRARIES ${${_pkgname}_${_ulibname}_LIBRARY} ) - ENDIF() - - GET_FILENAME_COMPONENT( _aux ${${_pkgname}_${_ulibname}_LIBRARY} PATH ) - LIST( APPEND ${_pkgname}_LIBRARY_DIRS ${_aux} ) - - IF( NOT ${_pkgname}_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ${_pkgname}_${_ulibname}_LIBRARY: ${${_pkgname}_${_ulibname}_LIBRARY} -- ok" ) - ENDIF() - - ELSE() # library not found - - SET( ${_pkgname}_${_ulibname}_FOUND FALSE ) - - IF( _is_std_lib ) - SET( _std_lib_missing TRUE ) - ELSE() - SET( _ext_lib_missing TRUE ) - ENDIF() - - IF( NOT ${_pkgname}_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ${_pkgname}_${_ulibname}_LIBRARY: ${_libname} -- failed" ) - ENDIF() - - ENDIF() - - ENDFOREACH() - - # clear PKG_LIBRARIES if standard library is missing - IF( _std_lib_missing ) - SET( ${_pkgname}_LIBRARIES ) - ENDIF() - - # clear PKG_COMPONENT_LIBRARIES if a component library is missing and - # FIND_PACKAGE called with REQUIRED argument - IF( _ext_lib_missing AND ${_pkgname}_FIND_REQUIRED ) - SET( ${_pkgname}_COMPONENT_LIBRARIES ) - ENDIF() - - # remove duplicate paths in PKG_LIBRARY_DIRS - IF( ${_pkgname}_LIBRARY_DIRS ) - LIST( REMOVE_DUPLICATES ${_pkgname}_LIBRARY_DIRS ) - ENDIF() - - # debug - #MESSAGE( STATUS "${_pkgname}_LIBRARIES: ${${_pkgname}_LIBRARIES}" ) - #MESSAGE( STATUS "${_pkgname}_COMPONENT_LIBRARIES: ${${_pkgname}_COMPONENT_LIBRARIES}" ) - #MESSAGE( STATUS "${_pkgname}_LIBRARY_DIRS: ${${_pkgname}_LIBRARY_DIRS}" ) - -ENDMACRO( CHECK_PACKAGE_LIBS _pkgname ) - diff --git a/Utilities/KalDet/cmake/MacroCheckPackageVersion.cmake b/Utilities/KalDet/cmake/MacroCheckPackageVersion.cmake deleted file mode 100644 index e3ec75d9..00000000 --- a/Utilities/KalDet/cmake/MacroCheckPackageVersion.cmake +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################## -# macro for checking a package version -# -# this macro should be called from your PKGVersion.cmake or from a -# FindPKG.cmake module with the following arguments: -# _pkgname : The package name -# _iversion : The installed version of the package -# -# -# the following conventions are used: -# -# if FIND_PACKAGE is called with EXACT argument than the version has to -# match EXACTLY, i.e.: -# 1.5 == 1.5 -# 1.5 == 1.5.0 -# 1.5 == 1.5.0.0 -# 1.5.2 == 1.5.2.0 -# 1.5.2.1 == 1.5.2.1 -# 1.5.2 != 1.5.2.1 -# 1.5 != 1.5.0.1 -# -# -# otherwise a MINIMUM_REQUIRED version is checked for, i.e. the same -# behavior as with the cmake variable CMAKE_MINIMUM_REQUIRED, e.g.: -# searching: 1.2 --> installed: 1.5.2.2 --> compatible -# searching: 1.5 --> installed: 1.5.2.2 --> compatible -# searching: 1.5.2.1 --> installed: 1.5.2.2 --> compatible -# searching: 1.5.2.3 --> installed: 1.5.2.2 --> unsuitable -# searching: 1.7 --> installed: 1.5.2.2 --> unsuitable -# -# -# following variables are returned (internally to cmake): -# PACKAGE_VERSION_EXACT : set to TRUE if exact version was found -# PACKAGE_VERSION_COMPATIBLE : set to TRUE if version is compatible -# PACKAGE_VERSION_UNSUITABLE : set to TRUE if version found is unsuitable -# -# -# @author Jan Engels, Desy IT -############################################################################## - -# these variables are evaluated internally by the cmake command FIND_PACKAGE to mark this -# package as suitable or not depending on the required version -SET( PACKAGE_VERSION_EXACT FALSE ) -SET( PACKAGE_VERSION_COMPATIBLE TRUE ) -SET( PACKAGE_VERSION_UNSUITABLE FALSE ) - - -# cmake internal variable PACKAGE_FIND_NAME is not defined on FindPKG.cmake -# modules, therefore it is passed as an argument to the macro -# _iversion is the installed version of the package -# _sversion is the version searched by the user with FIND_PACKAGE -#MACRO( CHECK_PACKAGE_VERSION _pkgname _iversion ) -MACRO( CHECK_PACKAGE_VERSION _pkgname ) # left with one argument only for backwards compatibility - - IF( NOT "${ARGV1}" STREQUAL "" ) - SET( _iversion ${ARGV1} ) - ELSE() - SET( _iversion ${${_pkgname}_VERSION_MAJOR}.${${_pkgname}_VERSION_MINOR}.${${_pkgname}_VERSION_PATCH}.${${_pkgname}_VERSION_TWEAK} ) - ENDIF() - - #SET( _sversion_major ${${_pkgname}_FIND_VERSION_MAJOR} ) - #SET( _sversion_minor ${${_pkgname}_FIND_VERSION_MINOR} ) - - SET( _sversion ${${_pkgname}_FIND_VERSION} ) - - IF( NOT ${_pkgname}_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ${_pkgname} (${_iversion})" ) - ENDIF() - - # only do work if FIND_PACKAGE called with a version argument - IF( _sversion ) - - #IF( NOT ${_pkgname}_FIND_QUIETLY ) - # MESSAGE( STATUS "Check for ${_pkgname}: looking for version ${_sversion}" ) - #ENDIF() - - IF( ${_iversion} VERSION_EQUAL ${_sversion} ) # if version matches EXACTLY - #IF( NOT ${_pkgname}_FIND_QUIETLY ) - # MESSAGE( STATUS "Check for ${_pkgname}: exact version found: ${_iversion}" ) - #ENDIF() - SET( PACKAGE_VERSION_EXACT TRUE ) - ELSE() # if version does not match EXACTLY, check if it is compatible/suitable - - # installed version must be greater or equal than version searched by the user, i.e. - # like with the CMAKE_MINIMUM_REQUIRED commando - # if user asks for version 1.2.5 then any version >= 1.2.5 is suitable/compatible - IF( NOT ${_sversion} VERSION_LESS ${_iversion} ) - SET( PACKAGE_VERSION_UNSUITABLE TRUE ) - ENDIF() - # ------------------------------------------------------------------------------------- - - IF( ${_pkgname}_FIND_VERSION_EXACT ) # if exact version was required search must fail!! - #IF( NOT ${_pkgname}_FIND_QUIETLY ) - # MESSAGE( "Check for ${_pkgname}: could not find exact version" ) - #ENDIF() - SET( PACKAGE_VERSION_UNSUITABLE TRUE ) - ENDIF() - - ENDIF() - - IF( PACKAGE_VERSION_UNSUITABLE ) - SET( PACKAGE_VERSION_COMPATIBLE FALSE ) - ENDIF() - - ENDIF( _sversion ) - -ENDMACRO( CHECK_PACKAGE_VERSION ) - diff --git a/Utilities/KalDet/cmake/MacroRootDict.cmake b/Utilities/KalDet/cmake/MacroRootDict.cmake deleted file mode 100644 index eb1059ed..00000000 --- a/Utilities/KalDet/cmake/MacroRootDict.cmake +++ /dev/null @@ -1,145 +0,0 @@ -IF(APPLE) - SET( LD_LIBRARY_PATH_VAR DYLD_LIBRARY_PATH ) -ELSE() - SET( LD_LIBRARY_PATH_VAR LD_LIBRARY_PATH ) -ENDIF() -SET( LD_LIBRARY_PATH_CONTENTS $ENV{${LD_LIBRARY_PATH_VAR}} ) -#MESSAGE( STATUS "LD_LIBRARY_PATH_CONTENTS: ${LD_LIBRARY_PATH_CONTENTS}" ) -#MESSAGE( STATUS "ROOT_CINT_EXECUTABLE: ${ROOT_CINT_EXECUTABLE}" ) - -SET( ROOT_CINT_WRAPPER ${LD_LIBRARY_PATH_VAR}=${ROOT_LIBRARY_DIR}:${LD_LIBRARY_PATH_CONTENTS} ${ROOT_CINT_EXECUTABLE} ) - -IF( NOT DEFINED ROOT_DICT_OUTPUT_DIR ) - SET( ROOT_DICT_OUTPUT_DIR "${PROJECT_BINARY_DIR}/rootdict" ) -ENDIF() - -# clean generated header files with 'make clean' -SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ROOT_DICT_OUTPUT_DIR}" ) - -IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ROOT_DICT_OUTPUT_DIR: ${PROJECT_BINARY_DIR}/rootdict" ) - MESSAGE( STATUS "Check for ROOT_DICT_CINT_DEFINITIONS: ${ROOT_DICT_CINT_DEFINITIONS}" ) -ENDIF() - - -# ============================================================================ -# helper macro to prepare input headers for GEN_ROOT_DICT_SOURCES -# sorts LinkDef.h to be the last header (required by rootcint) -# -# arguments: -# input_dir - directory to search for headers matching *.h -# -# returns: -# ROOT_DICT_INPUT_HEADERS - all header files found in input_dir with -# LinkDef.h as the last header (if found) -# -# ---------------------------------------------------------------------------- -MACRO( PREPARE_ROOT_DICT_HEADERS _input_dir ) - - FILE( GLOB ROOT_DICT_INPUT_HEADERS "${_input_dir}/*.h" ) - FILE( GLOB _linkdef_hdr "${_input_dir}/LinkDef.h" ) - - #LIST( FIND ROOT_DICT_INPUT_HEADERS ${_linkdef_hdr} _aux ) - #IF( ${_aux} EQUAL 0 OR ${_aux} GREATER 0 ) - # LIST( REMOVE_ITEM ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) - # LIST( APPEND ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) - #ENDIF() - - IF( _linkdef_hdr ) - LIST( REMOVE_ITEM ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) - LIST( APPEND ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}") - ENDIF() - - #MESSAGE( STATUS "ROOT_DICT_INPUT_HEADERS: ${ROOT_DICT_INPUT_HEADERS}" ) - -ENDMACRO( PREPARE_ROOT_DICT_HEADERS ) - - - -# ============================================================================ -# helper macro to generate Linkdef.h files for rootcint -# -# arguments: -# namespace - prefix used for creating header <namespace>_Linkdef.h -# ARGN - list of sources to be used for generating Linkdef.h -# -# returns: -# ROOT_DICT_INPUT_HEADERS - all header files + <namespace>_LinkDef.h in the -# correct order to be used by macro GEN_ROOT_DICT_SOURCES -# -# ---------------------------------------------------------------------------- -MACRO( GEN_ROOT_DICT_LINKDEF_HEADER _namespace ) - - SET( _input_headers ${ARGN} ) - SET( _linkdef_header "${ROOT_DICT_OUTPUT_DIR}/${_namespace}_Linkdef.h" ) - - FOREACH( _header ${_input_headers} ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}\\#pragma link C++ defined_in \\\"${_header}\\\"\\;\\\\n" ) - ENDFOREACH() - - ADD_CUSTOM_COMMAND( - OUTPUT ${_linkdef_header} - COMMAND mkdir -p ${ROOT_DICT_OUTPUT_DIR} - COMMAND printf "${${_namespace}_file_contents}" > ${_linkdef_header} - DEPENDS ${_input_headers} - COMMENT "generating: ${_linkdef_header}" - ) - - SET( ROOT_DICT_INPUT_HEADERS ${_input_headers} ${_linkdef_header} ) - -ENDMACRO() - - -# ============================================================================ -# macro for generating root dict sources with rootcint -# -# arguments: -# dict_src_filename - filename of the dictionary source (to be generated) -# -# requires following variables: -# ROOT_DICT_INPUT_HEADERS - list of headers needed to generate dict source -# * if LinkDef.h is in the list it must be at the end !! -# ROOT_DICT_INCLUDE_DIRS - list of include dirs to pass to rootcint -I.. -# ROOT_DICT_CINT_DEFINITIONS - extra definitions to pass to rootcint -# ROOT_DICT_OUTPUT_DIR - where dictionary source should be generated -# -# returns: -# ROOT_DICT_OUTPUT_SOURCES - list containing generated source and other -# previously generated sources - -# ---------------------------------------------------------------------------- -MACRO( GEN_ROOT_DICT_SOURCE _dict_src_filename ) - - # TODO check for ROOT_CINT_EXECUTABLE - - # need to prefix all include dirs with -I - set( _dict_includes ) - FOREACH( _inc ${ROOT_DICT_INCLUDE_DIRS} ) - SET( _dict_includes "${_dict_includes}\t-I${_inc}") #fg: the \t fixes a wired string expansion - #SET( _dict_includes ${_dict_includes} -I${_inc} ) - ENDFOREACH() - - STRING( REPLACE "/" "_" _dict_src_filename_nosc ${_dict_src_filename} ) - SET( _dict_src_file ${ROOT_DICT_OUTPUT_DIR}/${_dict_src_filename_nosc} ) - STRING( REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" _dict_hdr_file "${_dict_src_file}" ) - #message("fucd debug: ${_dict_src_file} ${ROOT_DICT_CINT_DEFINITIONS} ${_dict_includes} ${ROOT_DICT_INPUT_HEADERS}") - ADD_CUSTOM_COMMAND( - OUTPUT ${_dict_src_file} ${_dict_hdr_file} - COMMAND mkdir -p ${ROOT_DICT_OUTPUT_DIR} - COMMAND ${ROOT_CINT_WRAPPER} -f "${_dict_src_file}" -c ${ROOT_DICT_CINT_DEFINITIONS} ${_dict_includes} ${ROOT_DICT_INPUT_HEADERS} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - DEPENDS ${ROOT_DICT_INPUT_HEADERS} - COMMENT "generating: ${_dict_src_file} ${_dict_hdr_file}" - ) - LIST( APPEND ROOT_DICT_OUTPUT_SOURCES ${_dict_src_file} ) - -ENDMACRO() - -# for backwards compatibility -MACRO( GEN_ROOT_DICT_SOURCES _dict_src_filename ) - #MESSAGE( "USING DEPRECATED GEN_ROOT_DICT_SOURCES. PLEASE USE GEN_ROOT_DICT_SOURCE instead." ) - SET( ROOT_DICT_OUTPUT_SOURCES ) - GEN_ROOT_DICT_SOURCE( ${_dict_src_filename} ) -ENDMACRO() -# ============================================================================ - diff --git a/Utilities/KalDet/cmake/MyFindROOT.cmake b/Utilities/KalDet/cmake/MyFindROOT.cmake deleted file mode 100644 index 567ce159..00000000 --- a/Utilities/KalDet/cmake/MyFindROOT.cmake +++ /dev/null @@ -1,316 +0,0 @@ -############################################################################### -# cmake module for finding ROOT -# -# requires: -# MacroCheckPackageLibs.cmake for checking package libraries -# -# Following cmake variables are returned by this module: -# -# ROOT_FOUND : set to TRUE if ROOT found -# If FIND_PACKAGE is called with REQUIRED and COMPONENTS arguments -# ROOT_FOUND is only set to TRUE if ALL components are found. -# If REQUIRED is NOT set components may or may not be available -# -# ROOT_LIBRARIES : list of ROOT libraries (NOT including COMPONENTS) -# ROOT_INCLUDE_DIRS : list of paths to be used with INCLUDE_DIRECTORIES -# ROOT_LIBRARY_DIRS : list of paths to be used with LINK_DIRECTORIES -# ROOT_COMPONENT_LIBRARIES : list of ROOT component libraries -# ROOT_${COMPONENT}_FOUND : set to TRUE or FALSE for each library -# ROOT_${COMPONENT}_LIBRARY : path to individual libraries -# -# -# Please note that by convention components should be entered exactly as -# the library names, i.e. the component name equivalent to the library -# $ROOTSYS/lib/libMathMore.so should be called MathMore and NOT: -# mathmore or Mathmore or MATHMORE -# -# However to follow the usual cmake convention it is agreed that the -# ROOT_${COMPONENT}_FOUND and ROOT_${COMPONENT}_LIBRARY variables are ALL -# uppercase, i.e. the MathMore component returns: ROOT_MATHMORE_FOUND and -# ROOT_MATHMORE_LIBRARY NOT ROOT_MathMore_FOUND or ROOT_MathMore_LIBRARY -# -# -# The additional ROOT components should be defined as follows: -# FIND_PACKAGE( ROOT COMPONENTS MathMore Gdml Geom ...) -# -# If components are required use: -# FIND_PACKAGE( ROOT REQUIRED COMPONENTS MathMore Gdml Geom ...) -# -# If only root is required and components are NOT required use: -# FIND_PACKAGE( ROOT REQUIRED ) -# FIND_PACKAGE( ROOT COMPONENTS MathMore Gdml Geom ... QUIET ) -# then you need to check for ROOT_MATHMORE_FOUND, ROOT_GDML_FOUND, etc. -# -# The variable ROOT_USE_COMPONENTS can also be used before calling -# FIND_PACKAGE, i.e.: -# SET( ROOT_USE_COMPONENTS MathMore Gdml Geom ) -# FIND_PACKAGE( ROOT REQUIRED ) # all ROOT_USE_COMPONENTS must also be found -# FIND_PACKAGE( ROOT ) # check for ROOT_FOUND, ROOT_MATHMORE_FOUND, etc. -# -# @author Jan Engels, DESY -############################################################################### - -# ============================================== -# === ROOT_CONFIG_EXECUTABLE === -# ============================================== - -SET( ROOT_CONFIG_EXECUTABLE ROOT_CONFIG_EXECUTABLE-NOTFOUND ) -MARK_AS_ADVANCED( ROOT_CONFIG_EXECUTABLE ) -# FIND_PROGRAM: Once one of the calls succeeds the result variable will be set and stored in the cache so that no call will search again. -FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config PATHS ${ROOT_DIR}/bin NO_DEFAULT_PATH ) -FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config PATHS $ENV{ROOTSYS}/bin NO_DEFAULT_PATH) -FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config PATHS ENV PATH ) -FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config ) - -IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ROOT_CONFIG_EXECUTABLE: ${ROOT_CONFIG_EXECUTABLE}" ) -ENDIF() - -IF( ROOT_CONFIG_EXECUTABLE ) - - - # ============================================== - # === ROOT_VERSION === - # ============================================== - - INCLUDE( MacroCheckPackageVersion ) - - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --version - OUTPUT_VARIABLE _version - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( _exit_code EQUAL 0 ) - - # set required variables for MacroCheckPackageVersion - STRING(REGEX REPLACE "^([0-9]+).*" "\\1" ROOT_VERSION_MAJOR "${_version}") - STRING(REGEX REPLACE "^[0-9]+.([0-9]+).*" "\\1" ROOT_VERSION_MINOR "${_version}") - STRING(REGEX REPLACE "^[0-9]+.[0-9]+.([0-9]+).*" "\\1" ROOT_VERSION_PATCH "${_version}") - - SET( ROOT_VERSION "${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}.${ROOT_VERSION_PATCH}" ) - ENDIF() - - CHECK_PACKAGE_VERSION( ROOT ${ROOT_VERSION} ) - - - - # ============================================== - # === ROOT_PREFIX === - # ============================================== - - # get root prefix from root-config output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --prefix - OUTPUT_VARIABLE ROOT_PREFIX - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( NOT _exit_code EQUAL 0 ) - # clear variable if root-config exits with error - # it might contain garbage - SET( ROOT_PREFIX ) - ENDIF() - - # PKG_ROOT variables are a cmake standard - # since this package is also called ROOT the variable name - # becomes ROOT_ROOT ... - SET( ROOT_ROOT ${ROOT_PREFIX} ) - - - - # ============================================== - # === ROOT_BIN_DIR === - # ============================================== - - # get bindir from root-config output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --bindir - OUTPUT_VARIABLE ROOT_BIN_DIR - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( NOT _exit_code EQUAL 0 ) - # clear variable if root-config exits with error - # it might contain garbage - SET( ROOT_BIN_DIR ) - ENDIF() - - - - # ============================================== - # === ROOT_EXECUTABLE === - # ============================================== - - - SET( ROOT_EXECUTABLE ROOT_EXECUTABLE-NOTFOUND ) - MARK_AS_ADVANCED( ROOT_EXECUTABLE ) - FIND_PROGRAM( ROOT_EXECUTABLE root PATHS ${ROOT_BIN_DIR} NO_DEFAULT_PATH ) - - IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ROOT_EXECUTABLE: ${ROOT_EXECUTABLE}" ) - ENDIF() - - - - - # ============================================== - # === ROOT_CINT_EXECUTABLE === - # ============================================== - - - # find rootcint - SET( ROOT_CINT_EXECUTABLE ROOT_CINT_EXECUTABLE-NOTFOUND ) - MARK_AS_ADVANCED( ROOT_CINT_EXECUTABLE ) - FIND_PROGRAM( ROOT_CINT_EXECUTABLE rootcint PATHS ${ROOT_BIN_DIR} NO_DEFAULT_PATH ) - - IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ROOT_CINT_EXECUTABLE: ${ROOT_CINT_EXECUTABLE}" ) - ENDIF() - - - - # ============================================== - # === ROOT_INCLUDE_DIR === - # ============================================== - - # get include dir from root-config output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --incdir - OUTPUT_VARIABLE _inc_dir - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( NOT _exit_code EQUAL 0 ) - # clear variable if root-config exits with error - # it might contain garbage - SET( _inc_dir ) - ENDIF() - - - SET( ROOT_INCLUDE_DIRS ROOT_INCLUDE_DIRS-NOTFOUND ) - MARK_AS_ADVANCED( ROOT_INCLUDE_DIRS ) - - FIND_PATH( ROOT_INCLUDE_DIRS - NAMES TH1.h - PATHS ${ROOT_DIR}/include ${_inc_dir} - NO_DEFAULT_PATH - ) - - - - # ============================================== - # === ROOT_LIBRARIES === - # ============================================== - - # get library dir from root-config output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --libdir - OUTPUT_VARIABLE ROOT_LIBRARY_DIR - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( NOT _exit_code EQUAL 0 ) - # clear variable if root-config exits with error - # it might contain garbage - SET( ROOT_LIBRARY_DIR ) - ENDIF() - - - - # ========== standard root libraries ================= - - # standard root libraries (without components) - SET( _root_libnames ) - - # get standard root libraries from 'root-config --libs' output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --noauxlibs --libs - OUTPUT_VARIABLE _aux - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( _exit_code EQUAL 0 ) - - # create a list out of the output - SEPARATE_ARGUMENTS( _aux ) - - # remove first item -L compiler flag - LIST( REMOVE_AT _aux 0 ) - - FOREACH( _lib ${_aux} ) - - # extract libnames from -l compiler flags - STRING( REGEX REPLACE "^-.(.*)$" "\\1" _libname "${_lib}") - - # fix for some root-config versions which export -lz even if using --noauxlibs - IF( NOT _libname STREQUAL "z" ) - - # append all library names into a list - LIST( APPEND _root_libnames ${_libname} ) - - ENDIF() - - ENDFOREACH() - - ENDIF() - - - - # ========== additional root components ================= - - #LIST( APPEND ROOT_FIND_COMPONENTS Minuit2 ) # DEPRECATED !!! - - - # ---------- libraries -------------------------------------------------------- - INCLUDE( MacroCheckPackageLibs ) - - SET( ROOT_LIB_SEARCH_PATH ${ROOT_LIBRARY_DIR} ) - - # only standard libraries should be passed as arguments to CHECK_PACKAGE_LIBS - # additional components are set by cmake in variable PKG_FIND_COMPONENTS - # first argument should be the package name - CHECK_PACKAGE_LIBS( ROOT ${_root_libnames} ) - - - - - # ====== DL LIBRARY ================================================== - # workaround for cmake bug in 64 bit: - # see: http://public.kitware.com/mantis/view.php?id=10813 - IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - FIND_LIBRARY( DL_LIB NAMES ${CMAKE_DL_LIBS} dl PATHS /usr/lib64 /lib64 NO_DEFAULT_PATH ) - ENDIF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - - FIND_LIBRARY( DL_LIB NAMES ${CMAKE_DL_LIBS} dl ) - MARK_AS_ADVANCED( DL_LIB ) - - IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for libdl.so: ${DL_LIB}" ) - ENDIF() - -ENDIF( ROOT_CONFIG_EXECUTABLE ) - -# Threads library -#FIND_PACKAGE( Threads REQUIRED) - - -# ---------- final checking --------------------------------------------------- -INCLUDE( FindPackageHandleStandardArgs ) -# set ROOT_FOUND to TRUE if all listed variables are TRUE and not empty -# ROOT_COMPONENT_VARIABLES will be set if FIND_PACKAGE is called with REQUIRED argument -FIND_PACKAGE_HANDLE_STANDARD_ARGS( ROOT DEFAULT_MSG ROOT_INCLUDE_DIRS ROOT_LIBRARIES ${ROOT_COMPONENT_VARIABLES} PACKAGE_VERSION_COMPATIBLE DL_LIB ) - -IF( ROOT_FOUND ) - LIST( APPEND ROOT_LIBRARIES ${DL_LIB} ) - # FIXME DEPRECATED - SET( ROOT_DEFINITIONS "-DUSEROOT -DUSE_ROOT -DMARLIN_USE_ROOT" ) - MARK_AS_ADVANCED( ROOT_DEFINITIONS ) - - # file including MACROS for generating root dictionary sources - GET_FILENAME_COMPONENT( _aux ${CMAKE_CURRENT_LIST_FILE} PATH ) - SET( ROOT_DICT_MACROS_FILE ${_aux}/MacroRootDict.cmake ) - -ENDIF( ROOT_FOUND ) - -# ---------- cmake bug -------------------------------------------------------- -# ROOT_FIND_REQUIRED is not reset between FIND_PACKAGE calls, i.e. the following -# code fails when geartgeo component not available: (fixed in cmake 2.8) -# FIND_PACKAGE( ROOT REQUIRED ) -# FIND_PACKAGE( ROOT COMPONENTS geartgeo QUIET ) -SET( ROOT_FIND_REQUIRED ) - diff --git a/Utilities/KalTest/cmake/MacroCheckPackageLibs.cmake b/Utilities/KalTest/cmake/MacroCheckPackageLibs.cmake deleted file mode 100644 index c4451b3e..00000000 --- a/Utilities/KalTest/cmake/MacroCheckPackageLibs.cmake +++ /dev/null @@ -1,164 +0,0 @@ -############################################################################## -# macro for checkin package libraries in ${PKG_ROOT}/lib -# -# -# macro usage: -# CHECK_PACKAGE_LIBS( PACKAGE_NAME stdlib1 stdlib2 ... stdlibn ) -# only standard libraries should be passed as arguments to the macro -# component libraries are set by cmake in PKG_FIND_COMPONENTS (when -# calling FIND_PACKAGE with COMPONENTS argument) or through the -# variable PKG_USE_COMPONENTS -# -# -# required variables: -# PKG_ROOT : path to PKG root directory -# -# -# returns following variables: -# PKG_LIBRARY_DIRS : list of paths to be used with LINK_DIRECTORIES -# PGK_LIBRARIES : list of STANDARD libraries (NOT including COMPONENTS) -# PKG_COMPONENT_LIBRARIES : list of COMPONENT libraries -# PKG_${COMPONENT}_FOUND : set to TRUE or FALSE for each library -# PKG_${COMPONENT}_LIBRARY : path to each individual library -# -# -# PKG_LIBRARIES and PKG_LIBRARY_DIRS will be empty if any of the standard -# libraries is missing -# -# @author Jan Engels, Desy -############################################################################## - - -SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE ) - -MACRO( CHECK_PACKAGE_LIBS _pkgname ) - - SET( _std_lib_missing FALSE ) - SET( _ext_lib_missing FALSE ) - - SET( _std_libnames ${ARGN} ) - SET( _ext_libnames ${${_pkgname}_FIND_COMPONENTS} ${${_pkgname}_USE_COMPONENTS} ) - - IF( _ext_libnames ) - SEPARATE_ARGUMENTS( _ext_libnames ) - LIST( REMOVE_DUPLICATES _ext_libnames ) - ENDIF() - - IF( NOT ${_pkgname}_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ${_pkgname}_LIBRARIES: ${_std_libnames}" ) - IF( _ext_libnames ) - MESSAGE( STATUS "Check for ${_pkgname}_COMPONENT_LIBRARIES: ${_ext_libnames}" ) - ENDIF() - ENDIF() - - SET( ${_pkgname}_LIBRARY_DIRS ) - MARK_AS_ADVANCED( ${_pkgname}_LIBRARY_DIRS ) - - SET( ${_pkgname}_LIBRARIES ) - MARK_AS_ADVANCED( ${_pkgname}_LIBRARIES ) - - SET( ${_pkgname}_COMPONENT_LIBRARIES ) - MARK_AS_ADVANCED( ${_pkgname}_COMPONENT_LIBRARIES ) - - SET( ${_pkgname}_COMPONENT_VARIABLES ) - MARK_AS_ADVANCED( ${_pkgname}_COMPONENT_VARIABLES ) - - FOREACH( _libname ${_std_libnames} ${_ext_libnames} ) - - # flag to check if it is a standard or a component library - LIST( FIND _std_libnames "${_libname}" _aux ) - IF( ${_aux} LESS 0 ) - SET( _is_std_lib FALSE ) - ELSE() - SET( _is_std_lib TRUE ) - ENDIF() - - # libname in upper case - STRING( TOUPPER ${_libname} _ulibname ) - - SET( ${_pkgname}_${_ulibname}_LIBRARY ${_pkgname}_${_ulibname}_LIBRARY-NOTFOUND ) - MARK_AS_ADVANCED( ${_pkgname}_${_ulibname}_LIBRARY ) - - # WARNING: using PATH_SUFFIXES may cause problems when using variable CMAKE_FIND_ROOT_PATH - # this problem does not occur if expanding PATHS - # look in FindMySQL.cmake for more info - #FIND_LIBRARY( ${_pkgname}_${_ulibname}_LIBRARY NAMES ${_libname} PATHS - # ${${_pkgname}_ROOT} ${${_pkgname}_DIR} ${${_pkgname}_LIB_SEARCH_PATH} - # PATH_SUFFIXES lib64 lib - # NO_DEFAULT_PATH - #) - - FIND_LIBRARY( ${_pkgname}_${_ulibname}_LIBRARY NAMES ${_libname} PATHS - ${${_pkgname}_ROOT}/lib64 ${${_pkgname}_ROOT}/lib - ${${_pkgname}_DIR}/lib64 ${${_pkgname}_DIR}/lib - ${${_pkgname}_LIB_SEARCH_PATH} ${${_pkgname}_LIB_SEARCH_PATH}/lib64 ${${_pkgname}_LIB_SEARCH_PATH}/lib - NO_DEFAULT_PATH - ) - - IF( NOT ${_pkgname}_DIR ) - FIND_LIBRARY( ${_pkgname}_${_ulibname}_LIBRARY NAMES ${_libname} ) - ENDIF() - - IF( ${_pkgname}_FIND_REQUIRED ) - LIST( APPEND ${_pkgname}_COMPONENT_VARIABLES ${_pkgname}_${_ulibname}_LIBRARY ) - ENDIF() - - IF( ${_pkgname}_${_ulibname}_LIBRARY ) # if library found - - SET( ${_pkgname}_${_ulibname}_FOUND TRUE ) - - # split libraries in PKG_LIBRARIES and PKG_COMPONENT_LIBRARIES - IF( _is_std_lib ) - LIST( APPEND ${_pkgname}_LIBRARIES ${${_pkgname}_${_ulibname}_LIBRARY} ) - ELSE() - LIST( APPEND ${_pkgname}_COMPONENT_LIBRARIES ${${_pkgname}_${_ulibname}_LIBRARY} ) - ENDIF() - - GET_FILENAME_COMPONENT( _aux ${${_pkgname}_${_ulibname}_LIBRARY} PATH ) - LIST( APPEND ${_pkgname}_LIBRARY_DIRS ${_aux} ) - - IF( NOT ${_pkgname}_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ${_pkgname}_${_ulibname}_LIBRARY: ${${_pkgname}_${_ulibname}_LIBRARY} -- ok" ) - ENDIF() - - ELSE() # library not found - - SET( ${_pkgname}_${_ulibname}_FOUND FALSE ) - - IF( _is_std_lib ) - SET( _std_lib_missing TRUE ) - ELSE() - SET( _ext_lib_missing TRUE ) - ENDIF() - - IF( NOT ${_pkgname}_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ${_pkgname}_${_ulibname}_LIBRARY: ${_libname} -- failed" ) - ENDIF() - - ENDIF() - - ENDFOREACH() - - # clear PKG_LIBRARIES if standard library is missing - IF( _std_lib_missing ) - SET( ${_pkgname}_LIBRARIES ) - ENDIF() - - # clear PKG_COMPONENT_LIBRARIES if a component library is missing and - # FIND_PACKAGE called with REQUIRED argument - IF( _ext_lib_missing AND ${_pkgname}_FIND_REQUIRED ) - SET( ${_pkgname}_COMPONENT_LIBRARIES ) - ENDIF() - - # remove duplicate paths in PKG_LIBRARY_DIRS - IF( ${_pkgname}_LIBRARY_DIRS ) - LIST( REMOVE_DUPLICATES ${_pkgname}_LIBRARY_DIRS ) - ENDIF() - - # debug - #MESSAGE( STATUS "${_pkgname}_LIBRARIES: ${${_pkgname}_LIBRARIES}" ) - #MESSAGE( STATUS "${_pkgname}_COMPONENT_LIBRARIES: ${${_pkgname}_COMPONENT_LIBRARIES}" ) - #MESSAGE( STATUS "${_pkgname}_LIBRARY_DIRS: ${${_pkgname}_LIBRARY_DIRS}" ) - -ENDMACRO( CHECK_PACKAGE_LIBS _pkgname ) - diff --git a/Utilities/KalTest/cmake/MacroCheckPackageVersion.cmake b/Utilities/KalTest/cmake/MacroCheckPackageVersion.cmake deleted file mode 100644 index e3ec75d9..00000000 --- a/Utilities/KalTest/cmake/MacroCheckPackageVersion.cmake +++ /dev/null @@ -1,108 +0,0 @@ -############################################################################## -# macro for checking a package version -# -# this macro should be called from your PKGVersion.cmake or from a -# FindPKG.cmake module with the following arguments: -# _pkgname : The package name -# _iversion : The installed version of the package -# -# -# the following conventions are used: -# -# if FIND_PACKAGE is called with EXACT argument than the version has to -# match EXACTLY, i.e.: -# 1.5 == 1.5 -# 1.5 == 1.5.0 -# 1.5 == 1.5.0.0 -# 1.5.2 == 1.5.2.0 -# 1.5.2.1 == 1.5.2.1 -# 1.5.2 != 1.5.2.1 -# 1.5 != 1.5.0.1 -# -# -# otherwise a MINIMUM_REQUIRED version is checked for, i.e. the same -# behavior as with the cmake variable CMAKE_MINIMUM_REQUIRED, e.g.: -# searching: 1.2 --> installed: 1.5.2.2 --> compatible -# searching: 1.5 --> installed: 1.5.2.2 --> compatible -# searching: 1.5.2.1 --> installed: 1.5.2.2 --> compatible -# searching: 1.5.2.3 --> installed: 1.5.2.2 --> unsuitable -# searching: 1.7 --> installed: 1.5.2.2 --> unsuitable -# -# -# following variables are returned (internally to cmake): -# PACKAGE_VERSION_EXACT : set to TRUE if exact version was found -# PACKAGE_VERSION_COMPATIBLE : set to TRUE if version is compatible -# PACKAGE_VERSION_UNSUITABLE : set to TRUE if version found is unsuitable -# -# -# @author Jan Engels, Desy IT -############################################################################## - -# these variables are evaluated internally by the cmake command FIND_PACKAGE to mark this -# package as suitable or not depending on the required version -SET( PACKAGE_VERSION_EXACT FALSE ) -SET( PACKAGE_VERSION_COMPATIBLE TRUE ) -SET( PACKAGE_VERSION_UNSUITABLE FALSE ) - - -# cmake internal variable PACKAGE_FIND_NAME is not defined on FindPKG.cmake -# modules, therefore it is passed as an argument to the macro -# _iversion is the installed version of the package -# _sversion is the version searched by the user with FIND_PACKAGE -#MACRO( CHECK_PACKAGE_VERSION _pkgname _iversion ) -MACRO( CHECK_PACKAGE_VERSION _pkgname ) # left with one argument only for backwards compatibility - - IF( NOT "${ARGV1}" STREQUAL "" ) - SET( _iversion ${ARGV1} ) - ELSE() - SET( _iversion ${${_pkgname}_VERSION_MAJOR}.${${_pkgname}_VERSION_MINOR}.${${_pkgname}_VERSION_PATCH}.${${_pkgname}_VERSION_TWEAK} ) - ENDIF() - - #SET( _sversion_major ${${_pkgname}_FIND_VERSION_MAJOR} ) - #SET( _sversion_minor ${${_pkgname}_FIND_VERSION_MINOR} ) - - SET( _sversion ${${_pkgname}_FIND_VERSION} ) - - IF( NOT ${_pkgname}_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ${_pkgname} (${_iversion})" ) - ENDIF() - - # only do work if FIND_PACKAGE called with a version argument - IF( _sversion ) - - #IF( NOT ${_pkgname}_FIND_QUIETLY ) - # MESSAGE( STATUS "Check for ${_pkgname}: looking for version ${_sversion}" ) - #ENDIF() - - IF( ${_iversion} VERSION_EQUAL ${_sversion} ) # if version matches EXACTLY - #IF( NOT ${_pkgname}_FIND_QUIETLY ) - # MESSAGE( STATUS "Check for ${_pkgname}: exact version found: ${_iversion}" ) - #ENDIF() - SET( PACKAGE_VERSION_EXACT TRUE ) - ELSE() # if version does not match EXACTLY, check if it is compatible/suitable - - # installed version must be greater or equal than version searched by the user, i.e. - # like with the CMAKE_MINIMUM_REQUIRED commando - # if user asks for version 1.2.5 then any version >= 1.2.5 is suitable/compatible - IF( NOT ${_sversion} VERSION_LESS ${_iversion} ) - SET( PACKAGE_VERSION_UNSUITABLE TRUE ) - ENDIF() - # ------------------------------------------------------------------------------------- - - IF( ${_pkgname}_FIND_VERSION_EXACT ) # if exact version was required search must fail!! - #IF( NOT ${_pkgname}_FIND_QUIETLY ) - # MESSAGE( "Check for ${_pkgname}: could not find exact version" ) - #ENDIF() - SET( PACKAGE_VERSION_UNSUITABLE TRUE ) - ENDIF() - - ENDIF() - - IF( PACKAGE_VERSION_UNSUITABLE ) - SET( PACKAGE_VERSION_COMPATIBLE FALSE ) - ENDIF() - - ENDIF( _sversion ) - -ENDMACRO( CHECK_PACKAGE_VERSION ) - diff --git a/Utilities/KalTest/cmake/MacroRootDict.cmake b/Utilities/KalTest/cmake/MacroRootDict.cmake deleted file mode 100644 index ed7747fd..00000000 --- a/Utilities/KalTest/cmake/MacroRootDict.cmake +++ /dev/null @@ -1,145 +0,0 @@ -IF(APPLE) - SET( LD_LIBRARY_PATH_VAR DYLD_LIBRARY_PATH ) -ELSE() - SET( LD_LIBRARY_PATH_VAR LD_LIBRARY_PATH ) -ENDIF() -SET( LD_LIBRARY_PATH_CONTENTS $ENV{${LD_LIBRARY_PATH_VAR}} ) -#MESSAGE( STATUS "LD_LIBRARY_PATH_CONTENTS: ${LD_LIBRARY_PATH_CONTENTS}" ) -#MESSAGE( STATUS "ROOT_CINT_EXECUTABLE: ${ROOT_CINT_EXECUTABLE}" ) - -SET( ROOT_CINT_WRAPPER ${LD_LIBRARY_PATH_VAR}=${ROOT_LIBRARY_DIR}:${LD_LIBRARY_PATH_CONTENTS} ${ROOT_CINT_EXECUTABLE} ) - -IF( NOT DEFINED ROOT_DICT_OUTPUT_DIR ) - SET( ROOT_DICT_OUTPUT_DIR "${PROJECT_BINARY_DIR}/rootdict" ) -ENDIF() - -# clean generated header files with 'make clean' -SET_DIRECTORY_PROPERTIES( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${ROOT_DICT_OUTPUT_DIR}" ) - -IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ROOT_DICT_OUTPUT_DIR: ${PROJECT_BINARY_DIR}/rootdict" ) - MESSAGE( STATUS "Check for ROOT_DICT_CINT_DEFINITIONS: ${ROOT_DICT_CINT_DEFINITIONS}" ) -ENDIF() - - -# ============================================================================ -# helper macro to prepare input headers for GEN_ROOT_DICT_SOURCES -# sorts LinkDef.h to be the last header (required by rootcint) -# -# arguments: -# input_dir - directory to search for headers matching *.h -# -# returns: -# ROOT_DICT_INPUT_HEADERS - all header files found in input_dir with -# LinkDef.h as the last header (if found) -# -# ---------------------------------------------------------------------------- -MACRO( PREPARE_ROOT_DICT_HEADERS _input_dir ) - - FILE( GLOB ROOT_DICT_INPUT_HEADERS "${_input_dir}/*.h" ) - FILE( GLOB _linkdef_hdr "${_input_dir}/LinkDef.h" ) - - #LIST( FIND ROOT_DICT_INPUT_HEADERS ${_linkdef_hdr} _aux ) - #IF( ${_aux} EQUAL 0 OR ${_aux} GREATER 0 ) - # LIST( REMOVE_ITEM ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) - # LIST( APPEND ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) - #ENDIF() - - IF( _linkdef_hdr ) - LIST( REMOVE_ITEM ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}" ) - LIST( APPEND ROOT_DICT_INPUT_HEADERS "${_linkdef_hdr}") - ENDIF() - - #MESSAGE( STATUS "ROOT_DICT_INPUT_HEADERS: ${ROOT_DICT_INPUT_HEADERS}" ) - -ENDMACRO( PREPARE_ROOT_DICT_HEADERS ) - - - -# ============================================================================ -# helper macro to generate Linkdef.h files for rootcint -# -# arguments: -# namespace - prefix used for creating header <namespace>_Linkdef.h -# ARGN - list of sources to be used for generating Linkdef.h -# -# returns: -# ROOT_DICT_INPUT_HEADERS - all header files + <namespace>_LinkDef.h in the -# correct order to be used by macro GEN_ROOT_DICT_SOURCES -# -# ---------------------------------------------------------------------------- -MACRO( GEN_ROOT_DICT_LINKDEF_HEADER _namespace ) - - SET( _input_headers ${ARGN} ) - SET( _linkdef_header "${ROOT_DICT_OUTPUT_DIR}/${_namespace}_Linkdef.h" ) - - FOREACH( _header ${_input_headers} ) - SET( ${_namespace}_file_contents "${${_namespace}_file_contents}\\#pragma link C++ defined_in \\\"${_header}\\\"\\;\\\\n" ) - ENDFOREACH() - - ADD_CUSTOM_COMMAND( - OUTPUT ${_linkdef_header} - COMMAND mkdir -p ${ROOT_DICT_OUTPUT_DIR} - COMMAND printf "${${_namespace}_file_contents}" > ${_linkdef_header} - DEPENDS ${_input_headers} - COMMENT "generating: ${_linkdef_header}" - ) - - SET( ROOT_DICT_INPUT_HEADERS ${_input_headers} ${_linkdef_header} ) - -ENDMACRO() - - -# ============================================================================ -# macro for generating root dict sources with rootcint -# -# arguments: -# dict_src_filename - filename of the dictionary source (to be generated) -# -# requires following variables: -# ROOT_DICT_INPUT_HEADERS - list of headers needed to generate dict source -# * if LinkDef.h is in the list it must be at the end !! -# ROOT_DICT_INCLUDE_DIRS - list of include dirs to pass to rootcint -I.. -# ROOT_DICT_CINT_DEFINITIONS - extra definitions to pass to rootcint -# ROOT_DICT_OUTPUT_DIR - where dictionary source should be generated -# -# returns: -# ROOT_DICT_OUTPUT_SOURCES - list containing generated source and other -# previously generated sources - -# ---------------------------------------------------------------------------- -MACRO( GEN_ROOT_DICT_SOURCE _dict_src_filename ) - - # TODO check for ROOT_CINT_EXECUTABLE - - # need to prefix all include dirs with -I - set( _dict_includes ) - FOREACH( _inc ${ROOT_DICT_INCLUDE_DIRS} ) - SET( _dict_includes "${_dict_includes}\t-I${_inc}") #fg: the \t fixes a wired string expansion - #SET( _dict_includes ${_dict_includes} -I${_inc} ) - ENDFOREACH() - - STRING( REPLACE "/" "_" _dict_src_filename_nosc ${_dict_src_filename} ) - SET( _dict_src_file ${ROOT_DICT_OUTPUT_DIR}/${_dict_src_filename_nosc} ) - STRING( REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" _dict_hdr_file "${_dict_src_file}" ) - #message("${ROOT_DICT_INPUT_HEADERS}") - ADD_CUSTOM_COMMAND( - OUTPUT ${_dict_src_file} ${_dict_hdr_file} - COMMAND mkdir -p ${ROOT_DICT_OUTPUT_DIR} - COMMAND ${ROOT_CINT_WRAPPER} -f "${_dict_src_file}" -c ${ROOT_DICT_CINT_DEFINITIONS} ${_dict_includes} ${ROOT_DICT_INPUT_HEADERS} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - DEPENDS ${ROOT_DICT_INPUT_HEADERS} - COMMENT "generating: ${_dict_src_file} ${_dict_hdr_file}" - ) - LIST( APPEND ROOT_DICT_OUTPUT_SOURCES ${_dict_src_file} ) - -ENDMACRO() - -# for backwards compatibility -MACRO( GEN_ROOT_DICT_SOURCES _dict_src_filename ) - #MESSAGE( "USING DEPRECATED GEN_ROOT_DICT_SOURCES. PLEASE USE GEN_ROOT_DICT_SOURCE instead." ) - SET( ROOT_DICT_OUTPUT_SOURCES ) - GEN_ROOT_DICT_SOURCE( ${_dict_src_filename} ) -ENDMACRO() -# ============================================================================ - diff --git a/Utilities/KalTest/cmake/MyFindROOT.cmake b/Utilities/KalTest/cmake/MyFindROOT.cmake deleted file mode 100644 index 567ce159..00000000 --- a/Utilities/KalTest/cmake/MyFindROOT.cmake +++ /dev/null @@ -1,316 +0,0 @@ -############################################################################### -# cmake module for finding ROOT -# -# requires: -# MacroCheckPackageLibs.cmake for checking package libraries -# -# Following cmake variables are returned by this module: -# -# ROOT_FOUND : set to TRUE if ROOT found -# If FIND_PACKAGE is called with REQUIRED and COMPONENTS arguments -# ROOT_FOUND is only set to TRUE if ALL components are found. -# If REQUIRED is NOT set components may or may not be available -# -# ROOT_LIBRARIES : list of ROOT libraries (NOT including COMPONENTS) -# ROOT_INCLUDE_DIRS : list of paths to be used with INCLUDE_DIRECTORIES -# ROOT_LIBRARY_DIRS : list of paths to be used with LINK_DIRECTORIES -# ROOT_COMPONENT_LIBRARIES : list of ROOT component libraries -# ROOT_${COMPONENT}_FOUND : set to TRUE or FALSE for each library -# ROOT_${COMPONENT}_LIBRARY : path to individual libraries -# -# -# Please note that by convention components should be entered exactly as -# the library names, i.e. the component name equivalent to the library -# $ROOTSYS/lib/libMathMore.so should be called MathMore and NOT: -# mathmore or Mathmore or MATHMORE -# -# However to follow the usual cmake convention it is agreed that the -# ROOT_${COMPONENT}_FOUND and ROOT_${COMPONENT}_LIBRARY variables are ALL -# uppercase, i.e. the MathMore component returns: ROOT_MATHMORE_FOUND and -# ROOT_MATHMORE_LIBRARY NOT ROOT_MathMore_FOUND or ROOT_MathMore_LIBRARY -# -# -# The additional ROOT components should be defined as follows: -# FIND_PACKAGE( ROOT COMPONENTS MathMore Gdml Geom ...) -# -# If components are required use: -# FIND_PACKAGE( ROOT REQUIRED COMPONENTS MathMore Gdml Geom ...) -# -# If only root is required and components are NOT required use: -# FIND_PACKAGE( ROOT REQUIRED ) -# FIND_PACKAGE( ROOT COMPONENTS MathMore Gdml Geom ... QUIET ) -# then you need to check for ROOT_MATHMORE_FOUND, ROOT_GDML_FOUND, etc. -# -# The variable ROOT_USE_COMPONENTS can also be used before calling -# FIND_PACKAGE, i.e.: -# SET( ROOT_USE_COMPONENTS MathMore Gdml Geom ) -# FIND_PACKAGE( ROOT REQUIRED ) # all ROOT_USE_COMPONENTS must also be found -# FIND_PACKAGE( ROOT ) # check for ROOT_FOUND, ROOT_MATHMORE_FOUND, etc. -# -# @author Jan Engels, DESY -############################################################################### - -# ============================================== -# === ROOT_CONFIG_EXECUTABLE === -# ============================================== - -SET( ROOT_CONFIG_EXECUTABLE ROOT_CONFIG_EXECUTABLE-NOTFOUND ) -MARK_AS_ADVANCED( ROOT_CONFIG_EXECUTABLE ) -# FIND_PROGRAM: Once one of the calls succeeds the result variable will be set and stored in the cache so that no call will search again. -FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config PATHS ${ROOT_DIR}/bin NO_DEFAULT_PATH ) -FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config PATHS $ENV{ROOTSYS}/bin NO_DEFAULT_PATH) -FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config PATHS ENV PATH ) -FIND_PROGRAM( ROOT_CONFIG_EXECUTABLE root-config ) - -IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ROOT_CONFIG_EXECUTABLE: ${ROOT_CONFIG_EXECUTABLE}" ) -ENDIF() - -IF( ROOT_CONFIG_EXECUTABLE ) - - - # ============================================== - # === ROOT_VERSION === - # ============================================== - - INCLUDE( MacroCheckPackageVersion ) - - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --version - OUTPUT_VARIABLE _version - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( _exit_code EQUAL 0 ) - - # set required variables for MacroCheckPackageVersion - STRING(REGEX REPLACE "^([0-9]+).*" "\\1" ROOT_VERSION_MAJOR "${_version}") - STRING(REGEX REPLACE "^[0-9]+.([0-9]+).*" "\\1" ROOT_VERSION_MINOR "${_version}") - STRING(REGEX REPLACE "^[0-9]+.[0-9]+.([0-9]+).*" "\\1" ROOT_VERSION_PATCH "${_version}") - - SET( ROOT_VERSION "${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}.${ROOT_VERSION_PATCH}" ) - ENDIF() - - CHECK_PACKAGE_VERSION( ROOT ${ROOT_VERSION} ) - - - - # ============================================== - # === ROOT_PREFIX === - # ============================================== - - # get root prefix from root-config output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --prefix - OUTPUT_VARIABLE ROOT_PREFIX - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( NOT _exit_code EQUAL 0 ) - # clear variable if root-config exits with error - # it might contain garbage - SET( ROOT_PREFIX ) - ENDIF() - - # PKG_ROOT variables are a cmake standard - # since this package is also called ROOT the variable name - # becomes ROOT_ROOT ... - SET( ROOT_ROOT ${ROOT_PREFIX} ) - - - - # ============================================== - # === ROOT_BIN_DIR === - # ============================================== - - # get bindir from root-config output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --bindir - OUTPUT_VARIABLE ROOT_BIN_DIR - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( NOT _exit_code EQUAL 0 ) - # clear variable if root-config exits with error - # it might contain garbage - SET( ROOT_BIN_DIR ) - ENDIF() - - - - # ============================================== - # === ROOT_EXECUTABLE === - # ============================================== - - - SET( ROOT_EXECUTABLE ROOT_EXECUTABLE-NOTFOUND ) - MARK_AS_ADVANCED( ROOT_EXECUTABLE ) - FIND_PROGRAM( ROOT_EXECUTABLE root PATHS ${ROOT_BIN_DIR} NO_DEFAULT_PATH ) - - IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ROOT_EXECUTABLE: ${ROOT_EXECUTABLE}" ) - ENDIF() - - - - - # ============================================== - # === ROOT_CINT_EXECUTABLE === - # ============================================== - - - # find rootcint - SET( ROOT_CINT_EXECUTABLE ROOT_CINT_EXECUTABLE-NOTFOUND ) - MARK_AS_ADVANCED( ROOT_CINT_EXECUTABLE ) - FIND_PROGRAM( ROOT_CINT_EXECUTABLE rootcint PATHS ${ROOT_BIN_DIR} NO_DEFAULT_PATH ) - - IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for ROOT_CINT_EXECUTABLE: ${ROOT_CINT_EXECUTABLE}" ) - ENDIF() - - - - # ============================================== - # === ROOT_INCLUDE_DIR === - # ============================================== - - # get include dir from root-config output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --incdir - OUTPUT_VARIABLE _inc_dir - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( NOT _exit_code EQUAL 0 ) - # clear variable if root-config exits with error - # it might contain garbage - SET( _inc_dir ) - ENDIF() - - - SET( ROOT_INCLUDE_DIRS ROOT_INCLUDE_DIRS-NOTFOUND ) - MARK_AS_ADVANCED( ROOT_INCLUDE_DIRS ) - - FIND_PATH( ROOT_INCLUDE_DIRS - NAMES TH1.h - PATHS ${ROOT_DIR}/include ${_inc_dir} - NO_DEFAULT_PATH - ) - - - - # ============================================== - # === ROOT_LIBRARIES === - # ============================================== - - # get library dir from root-config output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --libdir - OUTPUT_VARIABLE ROOT_LIBRARY_DIR - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( NOT _exit_code EQUAL 0 ) - # clear variable if root-config exits with error - # it might contain garbage - SET( ROOT_LIBRARY_DIR ) - ENDIF() - - - - # ========== standard root libraries ================= - - # standard root libraries (without components) - SET( _root_libnames ) - - # get standard root libraries from 'root-config --libs' output - EXECUTE_PROCESS( COMMAND "${ROOT_CONFIG_EXECUTABLE}" --noauxlibs --libs - OUTPUT_VARIABLE _aux - RESULT_VARIABLE _exit_code - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - IF( _exit_code EQUAL 0 ) - - # create a list out of the output - SEPARATE_ARGUMENTS( _aux ) - - # remove first item -L compiler flag - LIST( REMOVE_AT _aux 0 ) - - FOREACH( _lib ${_aux} ) - - # extract libnames from -l compiler flags - STRING( REGEX REPLACE "^-.(.*)$" "\\1" _libname "${_lib}") - - # fix for some root-config versions which export -lz even if using --noauxlibs - IF( NOT _libname STREQUAL "z" ) - - # append all library names into a list - LIST( APPEND _root_libnames ${_libname} ) - - ENDIF() - - ENDFOREACH() - - ENDIF() - - - - # ========== additional root components ================= - - #LIST( APPEND ROOT_FIND_COMPONENTS Minuit2 ) # DEPRECATED !!! - - - # ---------- libraries -------------------------------------------------------- - INCLUDE( MacroCheckPackageLibs ) - - SET( ROOT_LIB_SEARCH_PATH ${ROOT_LIBRARY_DIR} ) - - # only standard libraries should be passed as arguments to CHECK_PACKAGE_LIBS - # additional components are set by cmake in variable PKG_FIND_COMPONENTS - # first argument should be the package name - CHECK_PACKAGE_LIBS( ROOT ${_root_libnames} ) - - - - - # ====== DL LIBRARY ================================================== - # workaround for cmake bug in 64 bit: - # see: http://public.kitware.com/mantis/view.php?id=10813 - IF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - FIND_LIBRARY( DL_LIB NAMES ${CMAKE_DL_LIBS} dl PATHS /usr/lib64 /lib64 NO_DEFAULT_PATH ) - ENDIF( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - - FIND_LIBRARY( DL_LIB NAMES ${CMAKE_DL_LIBS} dl ) - MARK_AS_ADVANCED( DL_LIB ) - - IF( NOT ROOT_FIND_QUIETLY ) - MESSAGE( STATUS "Check for libdl.so: ${DL_LIB}" ) - ENDIF() - -ENDIF( ROOT_CONFIG_EXECUTABLE ) - -# Threads library -#FIND_PACKAGE( Threads REQUIRED) - - -# ---------- final checking --------------------------------------------------- -INCLUDE( FindPackageHandleStandardArgs ) -# set ROOT_FOUND to TRUE if all listed variables are TRUE and not empty -# ROOT_COMPONENT_VARIABLES will be set if FIND_PACKAGE is called with REQUIRED argument -FIND_PACKAGE_HANDLE_STANDARD_ARGS( ROOT DEFAULT_MSG ROOT_INCLUDE_DIRS ROOT_LIBRARIES ${ROOT_COMPONENT_VARIABLES} PACKAGE_VERSION_COMPATIBLE DL_LIB ) - -IF( ROOT_FOUND ) - LIST( APPEND ROOT_LIBRARIES ${DL_LIB} ) - # FIXME DEPRECATED - SET( ROOT_DEFINITIONS "-DUSEROOT -DUSE_ROOT -DMARLIN_USE_ROOT" ) - MARK_AS_ADVANCED( ROOT_DEFINITIONS ) - - # file including MACROS for generating root dictionary sources - GET_FILENAME_COMPONENT( _aux ${CMAKE_CURRENT_LIST_FILE} PATH ) - SET( ROOT_DICT_MACROS_FILE ${_aux}/MacroRootDict.cmake ) - -ENDIF( ROOT_FOUND ) - -# ---------- cmake bug -------------------------------------------------------- -# ROOT_FIND_REQUIRED is not reset between FIND_PACKAGE calls, i.e. the following -# code fails when geartgeo component not available: (fixed in cmake 2.8) -# FIND_PACKAGE( ROOT REQUIRED ) -# FIND_PACKAGE( ROOT COMPONENTS geartgeo QUIET ) -SET( ROOT_FIND_REQUIRED ) - -- GitLab