CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
SeedingLayerSetsBuilder Class Reference

#include <SeedingLayerSetsBuilder.h>

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.

18 {}
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.

49 {
50  std::vector<std::string> namesPset = cfg.getParameter<std::vector<std::string> >("layerList");
51  std::vector<std::vector<std::string> > layerNamesInSets = this->layerNamesInSets(namesPset);
52 
53  // debug printout of layers
54  typedef std::vector<std::string>::const_iterator IS;
55  typedef std::vector<std::vector<std::string> >::const_iterator IT;
56  std::ostringstream str;
57  // The following should not be set to cout
58 // for (IT it = layerNamesInSets.begin(); it != layerNamesInSets.end(); it++) {
59 // str << "SET: ";
60 // for (IS is = it->begin(); is != it->end(); is++) str << *is <<" ";
61 // str << std::endl;
62 // }
63 // std::cout << str.str() << std::endl;
64 
65  map<string,LayerSpec> mapConfig; // for debug printout only!
66 
67  for (IT it = layerNamesInSets.begin(); it != layerNamesInSets.end(); it++) {
68  vector<LayerSpec> layersInSet;
69  for (IS is = it->begin(); is != it->end(); is++) {
70  LayerSpec layer;
71 
72  layer.name = *is;
73  //std::cout << "layer name in config: " << *is << std::endl;
74  edm::ParameterSet cfgLayer = layerConfig(layer.name, cfg);
75 
76  layer.usePixelHitProducer = true;
77  layer.useMatchedRecHits = true;
78  layer.useRPhiRecHits = true;
79  layer.useStereoRecHits = true;
80  if (cfgLayer.exists("HitProducer")) {
81  layer.pixelHitProducer = cfgLayer.getParameter<string>("HitProducer");
82  }else{
83  layer.usePixelHitProducer = false;
84  }
85  if (cfgLayer.exists("matchedRecHits")) {
86  layer.matchedRecHits = cfgLayer.getParameter<edm::InputTag>("matchedRecHits");
87  }else{
88  layer.useMatchedRecHits = false;
89  }
90  if (cfgLayer.exists("rphiRecHits")) {
91  layer.rphiRecHits = cfgLayer.getParameter<edm::InputTag>("rphiRecHits");
92  }else{
93  layer.useRPhiRecHits = false;
94  }
95  if (cfgLayer.exists("stereoRecHits")) {
96  layer.stereoRecHits= cfgLayer.getParameter<edm::InputTag>("stereoRecHits");
97  }else{
98  layer.useStereoRecHits = false;
99  }
100  if (cfgLayer.exists("skipClusters")){
101  LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" ready for skipping (1)";
102  layer.clustersToSkip = cfgLayer.getParameter<edm::InputTag>("skipClusters");
103  layer.skipClusters=true;
104  }else{
105  layer.skipClusters=false;
106  }
107  if (layer.skipClusters){
108  if (cfgLayer.exists("useProjection")){
109  LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" will project partially masked matched rechit";
110  layer.useProjection=cfgLayer.getParameter<bool>("useProjection");
111  }
112  else{
113  layer.useProjection=false;
114  }
115  }
116  layer.hitBuilder = cfgLayer.getParameter<string>("TTRHBuilder");
117 
118  layer.useErrorsFromParam = cfgLayer.exists("useErrorsFromParam") ? cfgLayer.getParameter<bool>("useErrorsFromParam") : false;
119  if(layer.useErrorsFromParam) {
120  layer.hitErrorRPhi = cfgLayer.getParameter<double>("hitErrorRPhi");
121  layer.hitErrorRZ = cfgLayer.getParameter<double>("hitErrorRZ");
122  }
123 
124  layer.useRingSelector = cfgLayer.exists("useRingSlector") ? cfgLayer.getParameter<bool>("useRingSlector") : false;
125  if (layer.useRingSelector) {
126  layer.minRing = cfgLayer.getParameter<int>("minRing");
127  layer.maxRing = cfgLayer.getParameter<int>("maxRing");
128  }
129 
130  layer.useSimpleRphiHitsCleaner = cfgLayer.exists("useSimpleRphiHitsCleaner") ? cfgLayer.getParameter<bool>("useSimpleRphiHitsCleaner") : true;
131 
132  layersInSet.push_back(layer);
133  mapConfig[layer.name]=layer;
134  }
135  theLayersInSets.push_back(layersInSet);
136  }
137 
138  // debug printout
139  // The following should not be set to cout
140 // for (map<string,LayerSpec>::const_iterator im = mapConfig.begin(); im != mapConfig.end(); im++) {
141 // std::cout << (*im).second.print() << std::endl;
142 // }
143 }
#define LogDebug(id)
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< LinkConnSpec >::const_iterator IT
std::vector< std::vector< LayerSpec > > theLayersInSets
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)

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.

146 {
148 
149  for (string::size_type iEnd=nameLayer.size(); iEnd > 0; --iEnd) {
150  string name = nameLayer.substr(0,iEnd);
151  if (cfg.exists(name)) return cfg.getParameter<edm::ParameterSet>(name);
152  }
153  cout <<"configuration for layer: "<<nameLayer<<" not found, job will probably crash!"<<endl;
154  return result;
155 }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
uint16_t size_type
tuple result
Definition: query.py:137
tuple cout
Definition: gather_cfg.py:121
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.

158 {
159  std::vector<std::vector<std::string> > result;
160  for (std::vector<std::string>::const_iterator is=namesPSet.begin(); is < namesPSet.end(); ++is) {
161  vector<std::string> layersInSet;
162  string line = *is;
164  while (pos != string::npos ) {
165  pos=line.find("+");
166  string layer = line.substr(0,pos);
167  layersInSet.push_back(layer);
168  line=line.substr(pos+1,string::npos);
169  }
170  result.push_back(layersInSet);
171  }
172  return result;
173 }
uint16_t size_type
tuple result
Definition: query.py:137
SeedingLayerSets SeedingLayerSetsBuilder::layers ( const edm::EventSetup es) const

Definition at line 175 of file SeedingLayerSetsBuilder.cc.

References ctfseeding::SeedingLayer::Barrel, ctfseeding::HitExtractorSTRP::clone(), SeedingLayerSetsBuilder::LayerSpec::clustersToSkip, edm::EventSetup::get(), SeedingLayerSetsBuilder::LayerSpec::hitBuilder, SeedingLayerSetsBuilder::LayerSpec::hitErrorRPhi, SeedingLayerSetsBuilder::LayerSpec::hitErrorRZ, LogDebug, SeedingLayerSetsBuilder::LayerSpec::matchedRecHits, SeedingLayerSetsBuilder::LayerSpec::maxRing, SeedingLayerSetsBuilder::LayerSpec::minRing, SeedingLayerSetsBuilder::LayerSpec::name, mergeVDriftHistosByStation::name, ctfseeding::SeedingLayer::NegEndcap, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, SeedingLayerSetsBuilder::LayerSpec::pixelHitProducer, ctfseeding::SeedingLayer::PosEndcap, edm::ESHandle< class >::product(), query::result, SeedingLayerSetsBuilder::LayerSpec::rphiRecHits, runtimedef::set(), ctfseeding::HitExtractorSTRP::setNoProjection(), SeedingLayerSetsBuilder::LayerSpec::skipClusters, SeedingLayerSetsBuilder::LayerSpec::stereoRecHits, DetLayer::subDetector(), patCandidatesForDimuonsSequences_cff::tracker, SeedingLayerSetsBuilder::LayerSpec::useErrorsFromParam, ctfseeding::HitExtractorSTRP::useMatchedHits(), SeedingLayerSetsBuilder::LayerSpec::useMatchedRecHits, SeedingLayerSetsBuilder::LayerSpec::useProjection, ctfseeding::HitExtractorSTRP::useRingSelector(), SeedingLayerSetsBuilder::LayerSpec::useRingSelector, ctfseeding::HitExtractorSTRP::useRPhiHits(), SeedingLayerSetsBuilder::LayerSpec::useRPhiRecHits, ctfseeding::HitExtractorSTRP::useSimpleRphiHitsCleaner(), SeedingLayerSetsBuilder::LayerSpec::useSimpleRphiHitsCleaner, ctfseeding::HitExtractor::useSkipClusters(), ctfseeding::HitExtractorSTRP::useStereoHits(), and SeedingLayerSetsBuilder::LayerSpec::useStereoRecHits.

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

176 {
177  typedef std::vector<SeedingLayer> Set;
179 
181  es.get<TrackerRecoGeometryRecord>().get( tracker );
182 
183  std::vector<BarrelDetLayer*> bpx = tracker->barrelLayers();
184  std::vector<BarrelDetLayer*> tib = tracker->tibLayers();
185  std::vector<BarrelDetLayer*> tob = tracker->tobLayers();
186 
187  std::vector<ForwardDetLayer*> fpx_pos = tracker->posForwardLayers();
188  std::vector<ForwardDetLayer*> tid_pos = tracker->posTidLayers();
189  std::vector<ForwardDetLayer*> tec_pos = tracker->posTecLayers();
190 
191  std::vector<ForwardDetLayer*> fpx_neg = tracker->negForwardLayers();
192  std::vector<ForwardDetLayer*> tid_neg = tracker->negTidLayers();
193  std::vector<ForwardDetLayer*> tec_neg = tracker->negTecLayers();
194 
195  typedef std::vector<std::vector<LayerSpec> >::const_iterator IT;
196  typedef std::vector<LayerSpec>::const_iterator IS;
197 
198  for (IT it = theLayersInSets.begin(); it != theLayersInSets.end(); it++) {
199  Set set;
200  bool setOK = true;
201  for (IS is = it->begin(), isEnd = it->end(); is < isEnd; ++is) {
202  const LayerSpec & layer = (*is);
203  std::string name = layer.name;
204  const DetLayer * detLayer =0;
206  int idLayer = 0;
207  bool nameOK = true;
208  HitExtractor * extractor = 0;
209 
210  //
211  // BPIX
212  //
213  if (name.substr(0,4) == "BPix") {
214  idLayer = atoi(name.substr(4,1).c_str());
216  detLayer=bpx[idLayer-1];
217  }
218  //
219  // FPIX
220  //
221  else if (name.substr(0,4) == "FPix") {
222  idLayer = atoi(name.substr(4,1).c_str());
223  if ( name.find("pos") != string::npos ) {
224  side = SeedingLayer::PosEndcap;
225  detLayer = fpx_pos[idLayer-1];
226  } else {
227  side = SeedingLayer::NegEndcap;
228  detLayer = fpx_neg[idLayer-1];
229  }
230  }
231  //
232  // TIB
233  //
234  else if (name.substr(0,3) == "TIB") {
235  idLayer = atoi(name.substr(3,1).c_str());
237  detLayer=tib[idLayer-1];
238  }
239  //
240  // TID
241  //
242  else if (name.substr(0,3) == "TID") {
243  idLayer = atoi(name.substr(3,1).c_str());
244  if ( name.find("pos") != string::npos ) {
245  side = SeedingLayer::PosEndcap;
246  detLayer = tid_pos[idLayer-1];
247  } else {
248  side = SeedingLayer::NegEndcap;
249  detLayer = tid_neg[idLayer-1];
250  }
251  }
252  //
253  // TOB
254  //
255  else if (name.substr(0,3) == "TOB") {
256  idLayer = atoi(name.substr(3,1).c_str());
258  detLayer=tob[idLayer-1];
259  }
260  //
261  // TEC
262  //
263  else if (name.substr(0,3) == "TEC") {
264  idLayer = atoi(name.substr(3,1).c_str());
265  if ( name.find("pos") != string::npos ) {
266  side = SeedingLayer::PosEndcap;
267  detLayer = tec_pos[idLayer-1];
268  } else {
269  side = SeedingLayer::NegEndcap;
270  detLayer = tec_neg[idLayer-1];
271  }
272  }
273  else {
274  nameOK = false;
275  setOK = false;
276  }
277 
278  if(nameOK) {
279  if ( detLayer->subDetector() == GeomDetEnumerators::PixelBarrel ||
281  extractor = new HitExtractorPIX(side,idLayer,layer.pixelHitProducer);
282  } else {
283  HitExtractorSTRP extSTRP(detLayer,side,idLayer);
284  if (layer.useMatchedRecHits) extSTRP.useMatchedHits(layer.matchedRecHits);
285  if (layer.useRPhiRecHits) extSTRP.useRPhiHits(layer.rphiRecHits);
286  if (layer.useStereoRecHits) extSTRP.useStereoHits(layer.stereoRecHits);
287  if (layer.useRingSelector) extSTRP.useRingSelector(layer.minRing,layer.maxRing);
288  extSTRP.useSimpleRphiHitsCleaner(layer.useSimpleRphiHitsCleaner);
289  if (layer.skipClusters && !layer.useProjection)
290  extSTRP.setNoProjection();
291  extractor = extSTRP.clone();
292  }
293  if (layer.skipClusters) {
294  LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" ready for skipping (2)";
295  extractor->useSkipClusters(layer.clustersToSkip);
296  }
297  else{
298  LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" not skipping ";
299  }
300 
302  es.get<TransientRecHitRecord>().get(layer.hitBuilder, builder);
303 
304  if (layer.useErrorsFromParam) {
305  set.push_back( SeedingLayer( name, detLayer, builder.product(),
306  extractor, true, layer.hitErrorRPhi,layer.hitErrorRZ));
307  } else {
308  set.push_back( SeedingLayer( name, detLayer, builder.product(), extractor));
309  }
310  }
311 
312  }
313  if(setOK) result.push_back(set);
314  }
315  return result;
316 }
#define LogDebug(id)
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
tuple result
Definition: query.py:137
std::vector< LinkConnSpec >::const_iterator IT
void useSkipClusters(const edm::InputTag &m)
Definition: HitExtractor.h:23
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::vector< std::vector< LayerSpec > > theLayersInSets
std::vector< std::vector< SeedingLayer > > SeedingLayerSets
void set(const std::string &name, int value)
set the flag, with a run-time name

Member Data Documentation

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

Definition at line 41 of file SeedingLayerSetsBuilder.h.