CMS 3D CMS Logo

Classes | Public Member Functions | Private Member Functions | Private Attributes

SeedingLayerSetsBuilder Class Reference

#include <SeedingLayerSetsBuilder.h>

List of all members.

Classes

struct  LayerSpec

Public Member Functions

ctfseeding::SeedingLayerSets layers (const edm::EventSetup &es) const
 SeedingLayerSetsBuilder ()
 SeedingLayerSetsBuilder (const edm::ParameterSet &cfg)

Private Member Functions

edm::ParameterSet layerConfig (const std::string &nameLayer, const edm::ParameterSet &cfg) const
std::vector< std::vector
< std::string > > 
layerNamesInSets (const std::vector< std::string > &namesPSet)

Private Attributes

std::vector< std::vector
< LayerSpec > > 
theLayersInSets

Detailed Description

Definition at line 14 of file SeedingLayerSetsBuilder.h.


Constructor & Destructor Documentation

SeedingLayerSetsBuilder::SeedingLayerSetsBuilder ( ) [inline]

Definition at line 18 of file SeedingLayerSetsBuilder.h.

{}
SeedingLayerSetsBuilder::SeedingLayerSetsBuilder ( const edm::ParameterSet cfg)

Definition at line 48 of file SeedingLayerSetsBuilder.cc.

References SeedingLayerSetsBuilder::LayerSpec::clustersToSkip, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), SeedingLayerSetsBuilder::LayerSpec::hitBuilder, SeedingLayerSetsBuilder::LayerSpec::hitErrorRPhi, SeedingLayerSetsBuilder::LayerSpec::hitErrorRZ, LogDebug, SeedingLayerSetsBuilder::LayerSpec::matchedRecHits, SeedingLayerSetsBuilder::LayerSpec::maxRing, SeedingLayerSetsBuilder::LayerSpec::minRing, SeedingLayerSetsBuilder::LayerSpec::name, SeedingLayerSetsBuilder::LayerSpec::pixelHitProducer, SeedingLayerSetsBuilder::LayerSpec::rphiRecHits, SeedingLayerSetsBuilder::LayerSpec::skipClusters, SeedingLayerSetsBuilder::LayerSpec::stereoRecHits, SeedingLayerSetsBuilder::LayerSpec::useErrorsFromParam, SeedingLayerSetsBuilder::LayerSpec::useMatchedRecHits, SeedingLayerSetsBuilder::LayerSpec::usePixelHitProducer, SeedingLayerSetsBuilder::LayerSpec::useProjection, SeedingLayerSetsBuilder::LayerSpec::useRingSelector, SeedingLayerSetsBuilder::LayerSpec::useRPhiRecHits, SeedingLayerSetsBuilder::LayerSpec::useSimpleRphiHitsCleaner, and SeedingLayerSetsBuilder::LayerSpec::useStereoRecHits.

{
  std::vector<std::string> namesPset = cfg.getParameter<std::vector<std::string> >("layerList");
  std::vector<std::vector<std::string> > layerNamesInSets = this->layerNamesInSets(namesPset);

  // debug printout of layers
  typedef std::vector<std::string>::const_iterator IS;
  typedef std::vector<std::vector<std::string> >::const_iterator IT;
  std::ostringstream str;
  // The following should not be set to cout
//  for (IT it = layerNamesInSets.begin(); it != layerNamesInSets.end(); it++) {
//    str << "SET: ";
//    for (IS is = it->begin(); is != it->end(); is++)  str << *is <<" ";  
//    str << std::endl;
//  }
//  std::cout << str.str() << std::endl;

  map<string,LayerSpec> mapConfig; // for debug printout only!

  for (IT it = layerNamesInSets.begin(); it != layerNamesInSets.end(); it++) {
    vector<LayerSpec> layersInSet;
    for (IS is = it->begin(); is != it->end(); is++) {
      LayerSpec layer;

      layer.name = *is;
      //std::cout << "layer name in config: " << *is << std::endl;
      edm::ParameterSet cfgLayer = layerConfig(layer.name, cfg);

      layer.usePixelHitProducer = true;
      layer.useMatchedRecHits = true; 
      layer.useRPhiRecHits = true;
      layer.useStereoRecHits = true;
      if (cfgLayer.exists("HitProducer")) {
          layer.pixelHitProducer = cfgLayer.getParameter<string>("HitProducer"); 
      }else{
          layer.usePixelHitProducer = false;
      }
      if (cfgLayer.exists("matchedRecHits")) {
          layer.matchedRecHits = cfgLayer.getParameter<edm::InputTag>("matchedRecHits"); 
      }else{
          layer.useMatchedRecHits = false;
      }
      if (cfgLayer.exists("rphiRecHits")) {
          layer.rphiRecHits = cfgLayer.getParameter<edm::InputTag>("rphiRecHits"); 
      }else{
          layer.useRPhiRecHits = false;
      }
      if (cfgLayer.exists("stereoRecHits")) {
          layer.stereoRecHits= cfgLayer.getParameter<edm::InputTag>("stereoRecHits"); 
      }else{
          layer.useStereoRecHits = false;
      }
      if (cfgLayer.exists("skipClusters")){
        LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" ready for skipping (1)";
        layer.clustersToSkip = cfgLayer.getParameter<edm::InputTag>("skipClusters");
        layer.skipClusters=true;
      }else{
        layer.skipClusters=false;
      }
      if (layer.skipClusters){
        if (cfgLayer.exists("useProjection")){
          LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" will project partially masked matched rechit";
          layer.useProjection=cfgLayer.getParameter<bool>("useProjection");
        }
        else{
          layer.useProjection=false;
        }
      }
      layer.hitBuilder  = cfgLayer.getParameter<string>("TTRHBuilder");

      layer.useErrorsFromParam = cfgLayer.exists("useErrorsFromParam") ? cfgLayer.getParameter<bool>("useErrorsFromParam") : false; 
      if(layer.useErrorsFromParam) {
        layer.hitErrorRPhi = cfgLayer.getParameter<double>("hitErrorRPhi");
        layer.hitErrorRZ   = cfgLayer.getParameter<double>("hitErrorRZ");
      }

      layer.useRingSelector = cfgLayer.exists("useRingSlector") ? cfgLayer.getParameter<bool>("useRingSlector") : false;
      if (layer.useRingSelector) {
        layer.minRing = cfgLayer.getParameter<int>("minRing");
        layer.maxRing = cfgLayer.getParameter<int>("maxRing");
      }

      layer.useSimpleRphiHitsCleaner = cfgLayer.exists("useSimpleRphiHitsCleaner") ? cfgLayer.getParameter<bool>("useSimpleRphiHitsCleaner") : true; 

      layersInSet.push_back(layer);
      mapConfig[layer.name]=layer;
    }
    theLayersInSets.push_back(layersInSet);
  }

  // debug printout
  // The following should not be set to cout
//  for (map<string,LayerSpec>::const_iterator im = mapConfig.begin(); im != mapConfig.end(); im++) {
//    std::cout << (*im).second.print() << std::endl; 
//  }
}

Member Function Documentation

edm::ParameterSet SeedingLayerSetsBuilder::layerConfig ( const std::string &  nameLayer,
const edm::ParameterSet cfg 
) const [private]

Definition at line 145 of file SeedingLayerSetsBuilder.cc.

References gather_cfg::cout, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), mergeVDriftHistosByStation::name, and query::result.

{
  edm::ParameterSet result;
   
  for (string::size_type iEnd=nameLayer.size(); iEnd > 0; --iEnd) {
    string name = nameLayer.substr(0,iEnd);
    if (cfg.exists(name)) return cfg.getParameter<edm::ParameterSet>(name);
  } 
  cout <<"configuration for layer: "<<nameLayer<<" not found, job will probably crash!"<<endl;
  return result;
}
vector< vector< string > > SeedingLayerSetsBuilder::layerNamesInSets ( const std::vector< std::string > &  namesPSet) [private]

Definition at line 157 of file SeedingLayerSetsBuilder.cc.

References geometryCSVtoXML::line, pos, and query::result.

{
  std::vector<std::vector<std::string> > result; 
  for (std::vector<std::string>::const_iterator is=namesPSet.begin(); is < namesPSet.end(); ++is) {
    vector<std::string> layersInSet;
    string line = *is;
    string::size_type pos=0;
    while (pos != string::npos ) {
      pos=line.find("+");
      string layer = line.substr(0,pos);
      layersInSet.push_back(layer);
      line=line.substr(pos+1,string::npos); 
    }
    result.push_back(layersInSet);
  }
  return result;
}
SeedingLayerSets SeedingLayerSetsBuilder::layers ( const edm::EventSetup es) const

Definition at line 666 of file GroupedCkfTrajectoryBuilder.cc.

References cmsutils::bqueue< T >::back(), cmsutils::bqueue< T >::empty(), TrajectoryMeasurement::layer(), cmsutils::bqueue< T >::rbegin(), and cmsutils::bqueue< T >::rend().

Referenced by GenericPairGenerator::init(), GenericTripletGenerator::init(), and SimpleCosmicBONSeeder::triplets().

{
  result.clear();

  if ( measurements.empty() )  return ;

  result.push_back(measurements.back().layer());
  TempTrajectory::DataContainer::const_iterator ifirst = measurements.rbegin();
  --ifirst;      
  for ( TempTrajectory::DataContainer::const_iterator im=ifirst;
        im!=measurements.rend(); --im ) {
    if ( im->layer()!=result.back() )  result.push_back(im->layer());
  }

  for (vector<const DetLayer*>::const_iterator iter = result.begin(); iter != result.end(); iter++){
    if (!*iter) edm::LogWarning("CkfPattern")<< "Warning: null det layer!! ";
  }
}

Member Data Documentation

std::vector<std::vector<LayerSpec> > SeedingLayerSetsBuilder::theLayersInSets [private]

Definition at line 41 of file SeedingLayerSetsBuilder.h.