CMS 3D CMS Logo

MeasurementTrackerESProducer.cc
Go to the documentation of this file.
2 
8 
17 
21 
24 
29 
33 
34 #include <string>
35 #include <memory>
36 
38 public:
40  ~MeasurementTrackerESProducer() override;
41  std::unique_ptr<MeasurementTracker> produce(const CkfComponentsRecord &);
42 
43  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
44 
45 private:
49 
57 
59 
62 
65 
66  bool usePhase2_ = false;
67 };
68 
69 using namespace edm;
70 
71 namespace {
72  std::pair<int, int> stripFlags(const edm::ParameterSet &pset) {
73  int stripQualityFlags = 0;
74  int stripQualityDebugFlags = 0;
75 
76  if (pset.getParameter<bool>("UseStripModuleQualityDB")) {
77  stripQualityFlags += MeasurementTracker::BadModules;
78  if (pset.getUntrackedParameter<bool>("DebugStripModuleQualityDB", false)) {
79  stripQualityDebugFlags += MeasurementTracker::BadModules;
80  }
81  }
82  if (pset.getParameter<bool>("UseStripAPVFiberQualityDB")) {
83  stripQualityFlags += MeasurementTracker::BadAPVFibers;
84  if (pset.getUntrackedParameter<bool>("DebugStripAPVFiberQualityDB", false)) {
85  stripQualityDebugFlags += MeasurementTracker::BadAPVFibers;
86  }
87  if (pset.getParameter<bool>("MaskBadAPVFibers")) {
88  stripQualityFlags += MeasurementTracker::MaskBad128StripBlocks;
89  }
90  }
91  if (pset.getParameter<bool>("UseStripStripQualityDB")) {
92  stripQualityFlags += MeasurementTracker::BadStrips;
93  if (pset.getUntrackedParameter<bool>("DebugStripStripQualityDB", false)) {
94  stripQualityDebugFlags += MeasurementTracker::BadStrips;
95  }
96  }
97  return std::make_pair(stripQualityFlags, stripQualityDebugFlags);
98  }
99 
100  std::pair<int, int> pixelFlags(const edm::ParameterSet &pset) {
101  int pixelQualityFlags = 0;
102  int pixelQualityDebugFlags = 0;
103 
104  if (pset.getParameter<bool>("UsePixelModuleQualityDB")) {
105  pixelQualityFlags += MeasurementTracker::BadModules;
106  if (pset.getUntrackedParameter<bool>("DebugPixelModuleQualityDB", false)) {
107  pixelQualityDebugFlags += MeasurementTracker::BadModules;
108  }
109  }
110  if (pset.getParameter<bool>("UsePixelROCQualityDB")) {
111  pixelQualityFlags += MeasurementTracker::BadROCs;
112  if (pset.getUntrackedParameter<bool>("DebugPixelROCQualityDB", false)) {
113  pixelQualityDebugFlags += MeasurementTracker::BadROCs;
114  }
115  }
116 
117  return std::make_pair(pixelQualityFlags, pixelQualityDebugFlags);
118  }
119 } // namespace
120 
122  std::string myname = p.getParameter<std::string>("ComponentName");
123 
124  auto c = setWhatProduced(this, myname);
125 
126  std::tie(pixelQualityFlags_, pixelQualityDebugFlags_) = pixelFlags(p);
127  if (pixelQualityFlags_ != 0) {
128  pixelQualityToken_ = c.consumes();
129  pixelCablingToken_ = c.consumes();
130  }
131 
132  std::tie(stripQualityFlags_, stripQualityDebugFlags_) = stripFlags(p);
133  if (stripQualityFlags_ != 0) {
134  stripQualityToken_ = c.consumes(edm::ESInputTag("", p.getParameter<std::string>("SiStripQualityLabel")));
135  if (stripQualityFlags_ & MeasurementTrackerImpl::BadStrips) {
136  auto makeBadStripCuts = [](edm::ParameterSet const &pset) {
137  return StMeasurementConditionSet::BadStripCuts(pset.getParameter<uint32_t>("maxBad"),
138  pset.getParameter<uint32_t>("maxConsecutiveBad"));
139  };
140 
141  auto cutPset = p.getParameter<edm::ParameterSet>("badStripCuts");
142  badStripCuts_.tib = makeBadStripCuts(cutPset.getParameter<edm::ParameterSet>("TIB"));
143  badStripCuts_.tob = makeBadStripCuts(cutPset.getParameter<edm::ParameterSet>("TOB"));
144  badStripCuts_.tid = makeBadStripCuts(cutPset.getParameter<edm::ParameterSet>("TID"));
145  badStripCuts_.tec = makeBadStripCuts(cutPset.getParameter<edm::ParameterSet>("TEC"));
146  }
147  }
148 
149  pixelCPEToken_ = c.consumes(edm::ESInputTag("", p.getParameter<std::string>("PixelCPE")));
150  hitMatcherToken_ = c.consumes(edm::ESInputTag("", p.getParameter<std::string>("HitMatcher")));
151  trackerTopologyToken_ = c.consumes();
152  trackerGeomToken_ = c.consumes();
153  geometricSearchTrackerToken_ = c.consumes();
154 
155  //FIXME:: just temporary solution for phase2!
156  auto phase2 = p.getParameter<std::string>("Phase2StripCPE");
157  if (not phase2.empty()) {
158  usePhase2_ = true;
159  phase2TrackerCPEToken_ = c.consumes(edm::ESInputTag("", phase2));
160  } else {
161  stripCPEToken_ = c.consumes(edm::ESInputTag("", p.getParameter<std::string>("StripCPE")));
162  }
163 }
164 
166 
167 std::unique_ptr<MeasurementTracker> MeasurementTrackerESProducer::produce(const CkfComponentsRecord &iRecord) {
168  // ========= SiPixelQuality related tasks =============
169  const SiPixelQuality *ptr_pixelQuality = nullptr;
170  const SiPixelFedCabling *ptr_pixelCabling = nullptr;
171 
172  if (pixelQualityFlags_ != 0) {
173  ptr_pixelQuality = &iRecord.get(pixelQualityToken_);
174  ptr_pixelCabling = &iRecord.get(pixelCablingToken_);
175  }
176 
177  // ========= SiStripQuality related tasks =============
178  const SiStripQuality *ptr_stripQuality = nullptr;
179  if (stripQualityFlags_ != 0) {
180  ptr_stripQuality = &iRecord.get(stripQualityToken_);
181  }
182 
183  const ClusterParameterEstimator<Phase2TrackerCluster1D> *ptr_phase2TrackerCPE = nullptr;
184  const StripClusterParameterEstimator *ptr_SiStripTrackerCPE = nullptr;
185  if (usePhase2_) {
186  ptr_phase2TrackerCPE = &iRecord.get(phase2TrackerCPEToken_);
187  } else {
188  ptr_SiStripTrackerCPE = &iRecord.get(stripCPEToken_);
189  }
190  return std::make_unique<MeasurementTrackerImpl>(badStripCuts_,
191  &iRecord.get(pixelCPEToken_),
192  ptr_SiStripTrackerCPE,
193  &iRecord.get(hitMatcherToken_),
194  &iRecord.get(trackerTopologyToken_),
195  &iRecord.get(trackerGeomToken_),
196  &iRecord.get(geometricSearchTrackerToken_),
197  ptr_stripQuality,
198  stripQualityFlags_,
199  stripQualityDebugFlags_,
200  ptr_pixelQuality,
201  ptr_pixelCabling,
202  pixelQualityFlags_,
203  pixelQualityDebugFlags_,
204  ptr_phase2TrackerCPE);
205 }
206 
209 
210  desc.add<std::string>("ComponentName", "");
211 
212  desc.add<std::string>("PixelCPE", "PixelCPEGeneric");
213  desc.add<std::string>("StripCPE", "StripCPEfromTrackAngle");
214  desc.add<std::string>("HitMatcher", "StandardMatcher");
215 
216  desc.add<std::string>("Phase2StripCPE", "")->setComment("empty string used to turn off Phase 2");
217 
218  desc.add<std::string>("SiStripQualityLabel", "");
219  desc.add<bool>("UseStripModuleQualityDB", true);
220  desc.addUntracked<bool>("DebugStripModuleQualityDB", false)->setComment("Dump out info on module status");
221  desc.add<bool>("UseStripAPVFiberQualityDB", true)->setComment("Read APV and Fiber status from SiStripQuality");
222  desc.addUntracked<bool>("DebugStripAPVFiberQualityDB", false)->setComment("Dump out info on module status");
223  desc.add<bool>("MaskBadAPVFibers", true)
224  ->setComment(
225  "if set to true, clusters with barycenter on bad APV and Fibers are ignored. (UseStripAPVFiberQualityDB must "
226  "also be true for this to work)");
227 
228  desc.add<bool>("UseStripStripQualityDB", true)->setComment("read Strip status from SiStripQuality");
229  desc.addUntracked<bool>("DebugStripStripQualityDB", false)->setComment("dump out info on module status");
230 
231  {
232  //used by MeasurementTrackerImpl
233  edm::ParameterSetDescription badStripCutsDesc;
234  badStripCutsDesc.add<uint32_t>("maxBad", 4);
235  badStripCutsDesc.add<uint32_t>("maxConsecutiveBad", 2);
236 
238  mtiDesc.add<edm::ParameterSetDescription>("TIB", badStripCutsDesc);
239  mtiDesc.add<edm::ParameterSetDescription>("TOB", badStripCutsDesc);
240  mtiDesc.add<edm::ParameterSetDescription>("TID", badStripCutsDesc);
241  mtiDesc.add<edm::ParameterSetDescription>("TEC", badStripCutsDesc);
242 
243  desc.addOptional<edm::ParameterSetDescription>("badStripCuts", mtiDesc);
244  }
245 
246  desc.add<bool>("UsePixelModuleQualityDB", true)->setComment("Use DB info at the module level (that is, detid level)");
247  desc.addUntracked<bool>("DebugPixelModuleQualityDB", false)->setComment("dump out info on module status");
248  desc.add<bool>("UsePixelROCQualityDB", true)->setComment("Use DB info at the ROC level");
249  desc.addUntracked<bool>("DebugPixelROCQualityDB", false)->setComment("dump out info om module status ");
250 
251  descriptions.add("_MeasurementTrackerESProducer_default", desc);
252 }
253 
edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > stripCPEToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > pixelCablingToken_
edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > geometricSearchTrackerToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_
edm::ESGetToken< SiStripRecHitMatcher, TkStripCPERecord > hitMatcherToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:61
std::unique_ptr< MeasurementTracker > produce(const CkfComponentsRecord &)
#define dso_hidden
Definition: Visibility.h:12
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
MeasurementTrackerImpl::BadStripCutsDet badStripCuts_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
edm::ESGetToken< ClusterParameterEstimator< Phase2TrackerCluster1D >, TkPhase2OTCPERecord > phase2TrackerCPEToken_
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > pixelQualityToken_
edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > pixelCPEToken_
MeasurementTrackerESProducer(const edm::ParameterSet &p)