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::map< std::string, int > nameToId
 
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::minAbsZ, SeedingLayerSetsBuilder::LayerSpec::minRing, SeedingLayerSetsBuilder::LayerSpec::name, mergeVDriftHistosByStation::name, plotscripts::nameToId(), SeedingLayerSetsBuilder::LayerSpec::pixelHitProducer, SeedingLayerSetsBuilder::LayerSpec::rphiRecHits, SeedingLayerSetsBuilder::LayerSpec::skipClusters, SeedingLayerSetsBuilder::LayerSpec::stereoRecHits, AlCaHLTBitMon_QueryRunRegistry::string, 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  int layerSetId = 0;
68  for (IT it = layerNamesInSets.begin(); it != layerNamesInSets.end(); it++) {
69  vector<LayerSpec> layersInSet;
70  for (IS is = it->begin(); is != it->end(); is++) {
71  LayerSpec layer;
72 
73  layer.name = *is;
74  //std::cout << "layer name in config: " << *is << std::endl;
75  edm::ParameterSet cfgLayer = layerConfig(layer.name, cfg);
76 
77  layer.usePixelHitProducer = true;
78  layer.useMatchedRecHits = true;
79  layer.useRPhiRecHits = true;
80  layer.useStereoRecHits = true;
81  if (cfgLayer.exists("HitProducer")) {
82  layer.pixelHitProducer = cfgLayer.getParameter<string>("HitProducer");
83  }else{
84  layer.usePixelHitProducer = false;
85  }
86  if (cfgLayer.exists("matchedRecHits")) {
87  layer.matchedRecHits = cfgLayer.getParameter<edm::InputTag>("matchedRecHits");
88  }else{
89  layer.useMatchedRecHits = false;
90  }
91  if (cfgLayer.exists("rphiRecHits")) {
92  layer.rphiRecHits = cfgLayer.getParameter<edm::InputTag>("rphiRecHits");
93  }else{
94  layer.useRPhiRecHits = false;
95  }
96  if (cfgLayer.exists("stereoRecHits")) {
97  layer.stereoRecHits= cfgLayer.getParameter<edm::InputTag>("stereoRecHits");
98  }else{
99  layer.useStereoRecHits = false;
100  }
101  if (cfgLayer.exists("skipClusters")){
102  LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" ready for skipping (1)";
103  layer.clustersToSkip = cfgLayer.getParameter<edm::InputTag>("skipClusters");
104  layer.skipClusters=true;
105  }else{
106  layer.skipClusters=false;
107  }
108  if (layer.skipClusters){
109  if (cfgLayer.exists("useProjection")){
110  LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" will project partially masked matched rechit";
111  layer.useProjection=cfgLayer.getParameter<bool>("useProjection");
112  }
113  else{
114  layer.useProjection=false;
115  }
116  }
117  layer.hitBuilder = cfgLayer.getParameter<string>("TTRHBuilder");
118 
119  layer.useErrorsFromParam = cfgLayer.exists("useErrorsFromParam") ? cfgLayer.getParameter<bool>("useErrorsFromParam") : false;
120  if(layer.useErrorsFromParam) {
121  layer.hitErrorRPhi = cfgLayer.getParameter<double>("hitErrorRPhi");
122  layer.hitErrorRZ = cfgLayer.getParameter<double>("hitErrorRZ");
123  }
124 
125  layer.useRingSelector = cfgLayer.exists("useRingSlector") ? cfgLayer.getParameter<bool>("useRingSlector") : false;
126  if (layer.useRingSelector) {
127  layer.minRing = cfgLayer.getParameter<int>("minRing");
128  layer.maxRing = cfgLayer.getParameter<int>("maxRing");
129  }
130 
131  layer.useSimpleRphiHitsCleaner = cfgLayer.exists("useSimpleRphiHitsCleaner") ? cfgLayer.getParameter<bool>("useSimpleRphiHitsCleaner") : true;
132 
133  layer.minAbsZ = cfgLayer.exists("MinAbsZ") ? cfgLayer.getParameter<double>("MinAbsZ") : 0.;
134 
135  layersInSet.push_back(layer);
136  mapConfig[layer.name]=layer;
137  if (nameToId.find(layer.name)==nameToId.end()) {
138  std::string name = layer.name;
139  nameToId.insert( std::pair<std::string,int>(name,layerSetId) );
140  layerSetId++;
141  }
142  }
143  theLayersInSets.push_back(layersInSet);
144  }
145 
146  // debug printout
147  // The following should not be set to cout
148 // for (map<string,LayerSpec>::const_iterator im = mapConfig.begin(); im != mapConfig.end(); im++) {
149 // std::cout << (*im).second.print() << std::endl;
150 // }
151 }
#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::map< std::string, int > nameToId
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 153 of file SeedingLayerSetsBuilder.cc.

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

154 {
156 
157  for (string::size_type iEnd=nameLayer.size(); iEnd > 0; --iEnd) {
158  string name = nameLayer.substr(0,iEnd);
159  if (cfg.exists(name)) return cfg.getParameter<edm::ParameterSet>(name);
160  }
161  cout <<"configuration for layer: "<<nameLayer<<" not found, job will probably crash!"<<endl;
162  return result;
163 }
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 165 of file SeedingLayerSetsBuilder.cc.

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

166 {
167  std::vector<std::vector<std::string> > result;
168  for (std::vector<std::string>::const_iterator is=namesPSet.begin(); is < namesPSet.end(); ++is) {
169  vector<std::string> layersInSet;
170  string line = *is;
171  string::size_type pos=0;
172  while (pos != string::npos ) {
173  pos=line.find("+");
174  string layer = line.substr(0,pos);
175  layersInSet.push_back(layer);
176  line=line.substr(pos+1,string::npos);
177  }
178  result.push_back(layersInSet);
179  }
180  return result;
181 }
uint16_t size_type
tuple result
Definition: query.py:137
SeedingLayerSets SeedingLayerSetsBuilder::layers ( const edm::EventSetup es) const

Definition at line 183 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::minAbsZ, SeedingLayerSetsBuilder::LayerSpec::minRing, SeedingLayerSetsBuilder::LayerSpec::name, mergeVDriftHistosByStation::name, plotscripts::nameToId(), ctfseeding::SeedingLayer::NegEndcap, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, SeedingLayerSetsBuilder::LayerSpec::pixelHitProducer, ctfseeding::SeedingLayer::PosEndcap, edm::ESHandle< class >::product(), query::result, SeedingLayerSetsBuilder::LayerSpec::rphiRecHits, ctfseeding::HitExtractorSTRP::setMinAbsZ(), ctfseeding::HitExtractorSTRP::setNoProjection(), SeedingLayerSetsBuilder::LayerSpec::skipClusters, SeedingLayerSetsBuilder::LayerSpec::stereoRecHits, AlCaHLTBitMon_QueryRunRegistry::string, 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().

184 {
185  typedef std::vector<SeedingLayer> Set;
187 
189  es.get<TrackerRecoGeometryRecord>().get( tracker );
190 
191  std::vector<BarrelDetLayer*> bpx = tracker->barrelLayers();
192  std::vector<BarrelDetLayer*> tib = tracker->tibLayers();
193  std::vector<BarrelDetLayer*> tob = tracker->tobLayers();
194 
195  std::vector<ForwardDetLayer*> fpx_pos = tracker->posForwardLayers();
196  std::vector<ForwardDetLayer*> tid_pos = tracker->posTidLayers();
197  std::vector<ForwardDetLayer*> tec_pos = tracker->posTecLayers();
198 
199  std::vector<ForwardDetLayer*> fpx_neg = tracker->negForwardLayers();
200  std::vector<ForwardDetLayer*> tid_neg = tracker->negTidLayers();
201  std::vector<ForwardDetLayer*> tec_neg = tracker->negTecLayers();
202 
203  typedef std::vector<std::vector<LayerSpec> >::const_iterator IT;
204  typedef std::vector<LayerSpec>::const_iterator IS;
205 
206  for (IT it = theLayersInSets.begin(); it != theLayersInSets.end(); it++) {
207  Set set;
208  bool setOK = true;
209  for (IS is = it->begin(), isEnd = it->end(); is < isEnd; ++is) {
210  const LayerSpec & layer = (*is);
211  std::string name = layer.name;
212  const DetLayer * detLayer =0;
214  int idLayer = 0;
215  bool nameOK = true;
216  HitExtractor * extractor = 0;
217 
218  //
219  // BPIX
220  //
221  if (name.find("BPix") != string::npos) {
222  idLayer = atoi(name.substr(name.find("BPix")+4,1).c_str());
224  detLayer=bpx[idLayer-1];
225  }
226  //
227  // FPIX
228  //
229  else if (name.find("FPix") != string::npos) {
230  idLayer = atoi(name.substr(name.find("FPix")+4,1).c_str());
231  if ( name.find("pos") != string::npos ) {
232  side = SeedingLayer::PosEndcap;
233  detLayer = fpx_pos[idLayer-1];
234  } else {
235  side = SeedingLayer::NegEndcap;
236  detLayer = fpx_neg[idLayer-1];
237  }
238  }
239  //
240  // TIB
241  //
242  else if (name.find("TIB") != string::npos) {
243  idLayer = atoi(name.substr(name.find("TIB")+3,1).c_str());
245  detLayer=tib[idLayer-1];
246  }
247  //
248  // TID
249  //
250  else if (name.find("TID") != string::npos) {
251  idLayer = atoi(name.substr(name.find("TID")+3,1).c_str());
252  if ( name.find("pos") != string::npos ) {
253  side = SeedingLayer::PosEndcap;
254  detLayer = tid_pos[idLayer-1];
255  } else {
256  side = SeedingLayer::NegEndcap;
257  detLayer = tid_neg[idLayer-1];
258  }
259  }
260  //
261  // TOB
262  //
263  else if (name.find("TOB") != string::npos) {
264  idLayer = atoi(name.substr(name.find("TOB")+3,1).c_str());
266  detLayer=tob[idLayer-1];
267  }
268  //
269  // TEC
270  //
271  else if (name.find("TEC") != string::npos) {
272  idLayer = atoi(name.substr(name.find("TEC")+3,1).c_str());
273  if ( name.find("pos") != string::npos ) {
274  side = SeedingLayer::PosEndcap;
275  detLayer = tec_pos[idLayer-1];
276  } else {
277  side = SeedingLayer::NegEndcap;
278  detLayer = tec_neg[idLayer-1];
279  }
280  }
281  else {
282  nameOK = false;
283  setOK = false;
284  }
285 
286  if(nameOK) {
287  if ( detLayer->subDetector() == GeomDetEnumerators::PixelBarrel ||
289  extractor = new HitExtractorPIX(side,idLayer,layer.pixelHitProducer);
290  } else {
291  HitExtractorSTRP extSTRP(detLayer,side,idLayer);
292  if (layer.useMatchedRecHits) extSTRP.useMatchedHits(layer.matchedRecHits);
293  if (layer.useRPhiRecHits) extSTRP.useRPhiHits(layer.rphiRecHits);
294  if (layer.useStereoRecHits) extSTRP.useStereoHits(layer.stereoRecHits);
295  if (layer.useRingSelector) extSTRP.useRingSelector(layer.minRing,layer.maxRing);
296  extSTRP.useSimpleRphiHitsCleaner(layer.useSimpleRphiHitsCleaner);
297  if (layer.minAbsZ>0.) extSTRP.setMinAbsZ(layer.minAbsZ);
298  if (layer.skipClusters && !layer.useProjection)
299  extSTRP.setNoProjection();
300  extractor = extSTRP.clone();
301  }
302  if (layer.skipClusters) {
303  LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" ready for skipping (2)";
304  extractor->useSkipClusters(layer.clustersToSkip);
305  }
306  else{
307  LogDebug("SeedingLayerSetsBuilder")<<layer.name<<" not skipping ";
308  }
309 
311  es.get<TransientRecHitRecord>().get(layer.hitBuilder, builder);
312 
313  auto it = nameToId.find(name);
314  if (it==nameToId.end()) {
315  edm::LogError("SeedingLayerSetsBuilder")<<"nameToId map mismatch! Could not find: "<<name;
316  return result;
317  }
318  int layerSetId = it->second;
319  if (layer.useErrorsFromParam) {
320  set.push_back( SeedingLayer( name, layerSetId, detLayer, builder.product(),
321  extractor, true, layer.hitErrorRPhi,layer.hitErrorRZ));
322  } else {
323  set.push_back( SeedingLayer( name, layerSetId, detLayer, builder.product(), extractor));
324  }
325  }
326 
327  }
328  if(setOK) result.push_back(set);
329  }
330  return result;
331 }
#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
std::map< std::string, int > nameToId
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

Member Data Documentation

std::map<std::string,int> SeedingLayerSetsBuilder::nameToId
private

Definition at line 27 of file SeedingLayerSetsBuilder.h.

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

Definition at line 43 of file SeedingLayerSetsBuilder.h.