CMS 3D CMS Logo

graph_util.h File Reference

#include "DetectorDescription/Core/interface/adjgraph.h"
#include "DetectorDescription/Core/interface/graphwalker.h"
#include <iostream>
#include <string>

Go to the source code of this file.

Functions

template<class N, class E>
void graph_combine (const graph< N, E > &g1, const graph< N, E > &g2, const N &n1, const N &n2, const N &root, graph< N, E > &result)
template<class N, class E>
void graph_tree_output (const graph< N, E > &g, const N &root, std::ostream &os)
template<class N, class E>
void output (const graph< N, E > &g, const N &root)


Function Documentation

template<class N, class E>
void graph_combine ( const graph< N, E > &  g1,
const graph< N, E > &  g2,
const N &  n1,
const N &  n2,
const N &  root,
graph< N, E > &  result 
) [inline]

Definition at line 26 of file graph_util.h.

References graph< N, E >::addEdge(), graphwalker< N, E >::current(), first, N, graphwalker< N, E >::next(), graph< N, E >::nodeData(), dbtoconf::parent, graph< N, E >::replace(), and graphwalker< N, E >::stack().

00029 {
00030   result = g1;
00031   result.replace(n1,n2);
00032   //output(result,n2);
00033   graphwalker<N,E> walker(g2,n2);
00034   while (walker.next()) {
00035     const N & parent = g2.nodeData((++walker.stack().rbegin())->first->first);
00036     /*
00037     N parent = g2.nodeData((++walker.stack().rbegin())->first->first);
00038     N child  = walker.current().first;
00039     E edge   = walker.current().second;
00040     */
00041     //std::cout << parent << ' ' << walker.current().first << ' ' << walker.current().second<< std::endl;
00042     result.addEdge(parent, walker.current().first, walker.current().second);
00043     //result.addEdge(parent,child,edge);
00044     //result.dump_graph();
00045     //output(result,n2);
00046   }
00047   result.replace(n2,root);                      
00048   //output(result,root);
00049 }               

template<class N, class E>
void graph_tree_output ( const graph< N, E > &  g,
const N &  root,
std::ostream &  os 
) [inline]

Definition at line 53 of file graph_util.h.

References graphwalker< N, E >::current(), lat::endl(), graphwalker< N, E >::firstChild(), graphwalker< N, E >::nextSibling(), graphwalker< N, E >::parent(), s, graphwalker< N, E >::stack(), and w.

00054 {
00055    graphwalker<N,E> w(g,root);
00056    bool go=true;
00057    unsigned int depth=0;
00058    while (go) {
00059      std::string s(2*depth,' ');
00060      os << ' ' << s << w.current().first << '(' << w.current().second << ')' << std::endl;
00061      if (go=w.firstChild()) {
00062        ++depth;
00063      }
00064      else if(w.stack().size() >1 && w.nextSibling()) {
00065         go=true;
00066      }
00067      else {
00068        go=false;
00069        while(w.parent()) {
00070          --depth;
00071           if (w.stack().size()>1 && w.nextSibling()) {
00072              go=true;
00073              break;
00074           }
00075        }
00076      }
00077      
00078    }  
00079 }

template<class N, class E>
void output ( const graph< N, E > &  g,
const N &  root 
) [inline]

Definition at line 14 of file graph_util.h.

References GenMuonPlsPt100GeV_cfg::cout, graphwalker< N, E >::current(), lat::endl(), graphwalker< N, E >::next(), and w.

Referenced by HcalTriggerPrimitiveAlgo::analyze(), L1CaloInputScalesGenerator::analyze(), SiStripFEDRawDataCheck::analyze(), HcalTriggerPrimitiveAlgo::analyzeHF(), reco::PFTauDecayMode::associatedChargedPFCandidates(), reco::PFTauDecayMode::associatedNeutralPFCandidates(), reco::PFTauDecayMode::chargedPionCandidates(), DCCTBBlockPrototype::checkDataField(), RoadSearchCloudMakerAlgorithm::Clean(), MuonSeedSimpleCleaner::clean(), TrackClusterRemover::cleanup(), CSCCLCTData::comparatorDigis(), DirectMuonNavigation::compatibleEndcapLayers(), DirectMuonNavigation::compatibleLayers(), DirectTrackerNavigation::compatibleLayers(), GeneratorTau::computeDecayMode(), GeneratorTau::convertMCVectorToLorentzVectors(), SiStripRawToDigiUnpacker::createDigis(), edm::MCatNLOSource::createStringFile(), edm::MCatNLOProducer::createStringFile(), reco::PFTauDecayMode::decayProductCandidates(), SiStripClusterCollection::detIDs(), PixelDigiCollection::detIDs(), LASBeamProfileFitCollection::detIDs(), DigiCollectionFP420::detIDs(), ClusterCollectionFP420::detIDs(), PFTauDiscriminants::OutlierNCharged::doComputation(), IgProf::dump(), RingMaker::dumpDetIds(), RingMaker::dumpDetIdsIntoFile(), MuonPatternRecoDumper::dumpFTS(), MuonPatternRecoDumper::dumpLayer(), MuonPatternRecoDumper::dumpMuonId(), MuonPatternRecoDumper::dumpTSOS(), EcalRawToDigiDev::EcalRawToDigiDev(), AlCaElectronsTest::endJob(), SiPixelSCurveCalibrationAnalysis::estimateSCurveParameters(), VisCuTkBuilder::fill(), HLTmmkFilter::filter(), cms::MTCCHLTrigger::filter(), HcalDataFrameFilter::filter(), CastorDataFrameFilter::filter(), PFTauDiscriminants::PFTauDiscriminantManager::filterByCharge(), reco::PFTauDecayMode::filteredObjectCandidates(), reco::PFTauDecayMode::filteredPFCandidates(), GeneratorTau::findLeadTrack(), DetIdAssociator::getCrossedDetIdsOrdered(), GeneratorTau::getGenChargedPions(), GeneratorTau::getGenGammas(), GeneratorTau::getGenNeutralPions(), GeneratorTau::getGenNu(), IgOIVBrowser::getIV(), GeneratorTau::getOpeningAngle(), NuclearInteractionFinder::getPersistentSeeds(), GeneratorTau::getStableDecayProducts(), StormStorageMaker::getTURL(), StormLcgGtStorageMaker::getTURL(), GeneratorTau::getVisibleFourVector(), edm::Schedule::limitOutput(), L1RCTLookupTables::lookup(), main(), mtrTransfer(), LASAlignmentParameterCollection::names(), reco::PFTauDecayMode::neutralPionCandidates(), MuonAlignmentInputSurveyDB::newAlignableMuon(), TauTagTools::filterChargedAndNeutralsByPt::operator()(), pixeltemp::DivisiveClusterizer1D< T >::operator()(), DivisiveClusterizer1D< T >::operator()(), BlockSolver::operator()(), MuonAlignmentInputXML::parseDouble(), edm::service::IguanaService::postBeginJob(), edm::service::IguanaService::postEndJob(), RoadSearchDetIdHelper::Print(), L1MuGMTMatrix< T >::print(), Ig3DBaseBrowser::printVector(), EcalFenixStripFormatEE::process(), EcalFenixStripFormatEB::process(), EcalFenixLinearizer::process(), EcalFenixAmplitudeFilter::process(), SiStripDigitizer::produce(), cms::SiPixelDigitizer::produce(), cms::DigitizerFP420::produce(), DTDigitizer::produce(), SimpleCosmicBONSeeder::produce(), CtfSpecialSeedGenerator::produce(), CRackSeedGenerator::produce(), CosmicSeedGenerator::produce(), cms::CosmicTrackFinder::produce(), RoadSearchTrackCandidateMaker::produce(), RoadSearchSeedFinder::produce(), cms::TrackListMerger::produce(), cms::RoadSearchTrackListCleaner::produce(), cms::RoadSearchHelixMaker::produce(), RoadSearchCloudMaker::produce(), cms::RoadSearchCloudCleaner::produce(), NuclearSeedsEDProducer::produce(), reco::modules::TrackerTrackHitFilter::produce(), reco::modules::CosmicTrackSplitter::produce(), TauMVADiscriminator::produce(), GsfSeedCleaner::produce(), ConvBremSeedProducer::produce(), RPCSeedGenerator::produce(), MuonSeedProducer::produce(), MuonSeedMerger::produce(), MuonSeedGenerator::produce(), CosmicMuonSeedGenerator::produce(), MuonLinksProducer::produce(), L2MuonSeedGenerator::produce(), cms::METProducer::produce(), cms::SiStripZeroSuppression::produce(), cms::SiStripClusterizer::produce(), cms::SiPixelRecHitConverter::produce(), cms::SiPixelClusterProducer::produce(), cms::BasePilupSubtractionJetProducer::produce(), cms::BaseJetProducer::produce(), EgammaHLTRegionalPixelSeedGeneratorProducers::produce(), SiStripElectronAssociator::produce(), CaloRecHitCandidateProducer::produce(), pat::PATTriggerMatchEmbedder< PATObjectType, RecoObjectType >::produce(), pat::PATCleaner< PATObjType >::produce(), BSCTrigger::produce(), cms::Type1MET::produce(), cms::TauMET::produce(), cms::MuonMET::produce(), TBRUInputSource::produce(), TrajectorySeedProducer::produce(), TrackCandidateProducer::produce(), SiStripFineDelayHit::produce(), TrackInfoProducer::produce(), LaserSeedGenerator::produce(), LaserClusterizer::produce(), cms::CkfTrackCandidateMakerBase::produceBase(), SiStripFineDelayHit::produceNoTracking(), edm::service::IguanaService::registry(), edm::service::IguanaService::report(), TSinglePedEntry::RMSSq(), SiStripZeroSuppressionAlgorithm::run(), CSCStripElectronicsSim::runComparator(), sample_factor(), IgMatEdMainWidget::saveMaterialMap(), AlignmentProducer::simpleMisalignment_(), TrackCollectionFP420::stationIDs(), RecoCollectionFP420::stationIDs(), SubsystemNeutronWriter::SubsystemNeutronWriter(), KalmanAlignmentAlgorithm::terminate(), CSCCathodeLCTProcessor::testPatterns(), SiPixelOfflineCalibAnalysisBase::translateDetIdToString(), L1MuGMTLUT::u2vec(), evf::write_data(), write_maps(), and L1RCTLutWriter::writeRcLutFile().

00015 {
00016   graphwalker<N,E> w(g,root);
00017   bool go=true;
00018   while(go) {
00019     std::cout << w.current().first << ' ';
00020     go=w.next();
00021   }
00022   std::cout << std::endl;
00023 }


Generated on Tue Jun 9 17:52:36 2009 for CMSSW by  doxygen 1.5.4