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  c.setConsumes(pixelQualityToken_);
129  c.setConsumes(pixelCablingToken_);
130  }
131 
132  std::tie(stripQualityFlags_, stripQualityDebugFlags_) = stripFlags(p);
133  if (stripQualityFlags_ != 0) {
134  c.setConsumes(stripQualityToken_, 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  c.setConsumes(pixelCPEToken_, edm::ESInputTag("", p.getParameter<std::string>("PixelCPE")));
150  c.setConsumes(stripCPEToken_, edm::ESInputTag("", p.getParameter<std::string>("StripCPE")));
151  c.setConsumes(hitMatcherToken_, edm::ESInputTag("", p.getParameter<std::string>("HitMatcher")));
152  c.setConsumes(trackerTopologyToken_);
153  c.setConsumes(trackerGeomToken_);
154  c.setConsumes(geometricSearchTrackerToken_);
155 
156  //FIXME:: just temporary solution for phase2!
157  auto phase2 = p.getParameter<std::string>("Phase2StripCPE");
158  if (not phase2.empty()) {
159  usePhase2_ = true;
160  c.setConsumes(phase2TrackerCPEToken_, edm::ESInputTag("", phase2));
161  }
162 }
163 
165 
166 std::unique_ptr<MeasurementTracker> MeasurementTrackerESProducer::produce(const CkfComponentsRecord &iRecord) {
167  // ========= SiPixelQuality related tasks =============
168  const SiPixelQuality *ptr_pixelQuality = nullptr;
169  const SiPixelFedCabling *ptr_pixelCabling = nullptr;
170 
171  if (pixelQualityFlags_ != 0) {
172  ptr_pixelQuality = &iRecord.get(pixelQualityToken_);
173  ptr_pixelCabling = &iRecord.get(pixelCablingToken_);
174  }
175 
176  // ========= SiStripQuality related tasks =============
177  const SiStripQuality *ptr_stripQuality = nullptr;
178  if (stripQualityFlags_ != 0) {
179  ptr_stripQuality = &iRecord.get(stripQualityToken_);
180  }
181 
182  const ClusterParameterEstimator<Phase2TrackerCluster1D> *ptr_phase2TrackerCPE = nullptr;
183  if (usePhase2_) {
184  ptr_phase2TrackerCPE = &iRecord.get(phase2TrackerCPEToken_);
185  }
186  return std::make_unique<MeasurementTrackerImpl>(badStripCuts_,
187  &iRecord.get(pixelCPEToken_),
188  &iRecord.get(stripCPEToken_),
189  &iRecord.get(hitMatcherToken_),
190  &iRecord.get(trackerTopologyToken_),
191  &iRecord.get(trackerGeomToken_),
192  &iRecord.get(geometricSearchTrackerToken_),
193  ptr_stripQuality,
194  stripQualityFlags_,
195  stripQualityDebugFlags_,
196  ptr_pixelQuality,
197  ptr_pixelCabling,
198  pixelQualityFlags_,
199  pixelQualityDebugFlags_,
200  ptr_phase2TrackerCPE);
201 }
202 
205 
206  desc.add<std::string>("ComponentName", "");
207 
208  desc.add<std::string>("PixelCPE", "PixelCPEGeneric");
209  desc.add<std::string>("StripCPE", "StripCPEfromTrackAngle");
210  desc.add<std::string>("HitMatcher", "StandardMatcher");
211 
212  desc.add<std::string>("Phase2StripCPE", "")->setComment("empty string used to turn off Phase 2");
213 
214  desc.add<std::string>("SiStripQualityLabel", "");
215  desc.add<bool>("UseStripModuleQualityDB", true);
216  desc.addUntracked<bool>("DebugStripModuleQualityDB", false)->setComment("Dump out info on module status");
217  desc.add<bool>("UseStripAPVFiberQualityDB", true)->setComment("Read APV and Fiber status from SiStripQuality");
218  desc.addUntracked<bool>("DebugStripAPVFiberQualityDB", false)->setComment("Dump out info on module status");
219  desc.add<bool>("MaskBadAPVFibers", true)
220  ->setComment(
221  "if set to true, clusters with barycenter on bad APV and Fibers are ignored. (UseStripAPVFiberQualityDB must "
222  "also be true for this to work)");
223 
224  desc.add<bool>("UseStripStripQualityDB", true)->setComment("read Strip status from SiStripQuality");
225  desc.addUntracked<bool>("DebugStripStripQualityDB", false)->setComment("dump out info on module status");
226 
227  {
228  //used by MeasurementTrackerImpl
229  edm::ParameterSetDescription badStripCutsDesc;
230  badStripCutsDesc.add<uint32_t>("maxBad", 4);
231  badStripCutsDesc.add<uint32_t>("maxConsecutiveBad", 2);
232 
234  mtiDesc.add<edm::ParameterSetDescription>("TIB", badStripCutsDesc);
235  mtiDesc.add<edm::ParameterSetDescription>("TOB", badStripCutsDesc);
236  mtiDesc.add<edm::ParameterSetDescription>("TID", badStripCutsDesc);
237  mtiDesc.add<edm::ParameterSetDescription>("TEC", badStripCutsDesc);
238 
239  desc.addOptional<edm::ParameterSetDescription>("badStripCuts", mtiDesc);
240  }
241 
242  desc.add<bool>("UsePixelModuleQualityDB", true)->setComment("Use DB info at the module level (that is, detid level)");
243  desc.addUntracked<bool>("DebugPixelModuleQualityDB", false)->setComment("dump out info on module status");
244  desc.add<bool>("UsePixelROCQualityDB", true)->setComment("Use DB info at the ROC level");
245  desc.addUntracked<bool>("DebugPixelROCQualityDB", false)->setComment("dump out info om module status ");
246 
247  descriptions.add("_MeasurementTrackerESProducer_default", desc);
248 }
249 
StMeasurementConditionSet::BadStripCuts
Definition: TkMeasurementDetSet.h:48
MeasurementTrackerESProducer::~MeasurementTrackerESProducer
~MeasurementTrackerESProducer() override
Definition: MeasurementTrackerESProducer.cc:164
edm::ESInputTag
Definition: ESInputTag.h:87
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
MeasurementTracker::BadAPVFibers
Definition: MeasurementTracker.h:25
GSMeasurementTrackerESProducer_cfi.MeasurementTrackerESProducer
MeasurementTrackerESProducer
Definition: GSMeasurementTrackerESProducer_cfi.py:3
TrackerGeometry.h
MeasurementTrackerESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: MeasurementTrackerESProducer.cc:203
ESHandle.h
MeasurementTrackerESProducer::stripCPEToken_
edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > stripCPEToken_
Definition: MeasurementTrackerESProducer.cc:51
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
TkStripCPERecord
Definition: TkStripCPERecord.h:13
MeasurementTracker::BadModules
Definition: MeasurementTracker.h:24
PixelClusterParameterEstimator.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ESProducer.h
TrackerRecoGeometryRecord.h
SiPixelFedCablingMap.h
MeasurementTracker::BadROCs
Definition: MeasurementTracker.h:28
MeasurementTrackerESProducer::pixelQualityDebugFlags_
int pixelQualityDebugFlags_
Definition: MeasurementTrackerESProducer.cc:61
SiStripNoises.h
CkfComponentsRecord.h
SiPixelFedCabling
Definition: SiPixelFedCabling.h:10
MeasurementTrackerESProducer::stripQualityFlags_
int stripQualityFlags_
Definition: MeasurementTrackerESProducer.cc:63
edm::ParameterSetDescription::addOptional
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:105
GeometricSearchTracker.h
MeasurementTrackerESProducer::pixelCablingToken_
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > pixelCablingToken_
Definition: MeasurementTrackerESProducer.cc:47
MeasurementTrackerESProducer::phase2TrackerCPEToken_
edm::ESGetToken< ClusterParameterEstimator< Phase2TrackerCluster1D >, TkStripCPERecord > phase2TrackerCPEToken_
Definition: MeasurementTrackerESProducer.cc:56
MeasurementTracker::BadStrips
Definition: MeasurementTracker.h:26
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CkfComponentsRecord
Definition: CkfComponentsRecord.h:22
MeasurementTrackerESProducer::geometricSearchTrackerToken_
edm::ESGetToken< GeometricSearchTracker, TrackerRecoGeometryRecord > geometricSearchTrackerToken_
Definition: MeasurementTrackerESProducer.cc:55
SiPixelQualityRcd.h
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Phase2StripCPE.h
MeasurementTrackerESProducer::pixelQualityFlags_
int pixelQualityFlags_
Definition: MeasurementTrackerESProducer.cc:60
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:112
MeasurementTrackerESProducer
Definition: MeasurementTrackerESProducer.cc:37
dso_hidden
#define dso_hidden
Definition: Visibility.h:12
ClusterParameterEstimator< Phase2TrackerCluster1D >
MeasurementTrackerESProducer::trackerTopologyToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
Definition: MeasurementTrackerESProducer.cc:53
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MeasurementTrackerImpl.h
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
TrackerDigiGeometryRecord.h
MeasurementTrackerESProducer::trackerGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
Definition: MeasurementTrackerESProducer.cc:54
edm::ParameterSet
Definition: ParameterSet.h:36
SiPixelQuality
Definition: SiPixelQuality.h:27
SiPixelFedCablingMapRcd.h
MeasurementTrackerESProducer::stripQualityToken_
edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_
Definition: MeasurementTrackerESProducer.cc:48
TrackerCPERecord.h
MeasurementTrackerESProducer::badStripCuts_
MeasurementTrackerImpl::BadStripCutsDet badStripCuts_
Definition: MeasurementTrackerESProducer.cc:58
MeasurementTrackerESProducer::produce
std::unique_ptr< MeasurementTracker > produce(const CkfComponentsRecord &)
Definition: MeasurementTrackerESProducer.cc:166
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
MeasurementTrackerESProducer::hitMatcherToken_
edm::ESGetToken< SiStripRecHitMatcher, TkStripCPERecord > hitMatcherToken_
Definition: MeasurementTrackerESProducer.cc:52
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd >
SiStripRecHitMatcher.h
ModuleFactory.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
MeasurementTrackerESProducer::pixelCPEToken_
edm::ESGetToken< PixelClusterParameterEstimator, TkPixelCPERecord > pixelCPEToken_
Definition: MeasurementTrackerESProducer.cc:50
SiStripQuality.h
SiStripQualityRcd.h
EventSetup.h
StripClusterParameterEstimator.h
MeasurementTrackerESProducer::stripQualityDebugFlags_
int stripQualityDebugFlags_
Definition: MeasurementTrackerESProducer.cc:64
MeasurementTrackerImpl::BadStripCutsDet
Definition: MeasurementTrackerImpl.h:48
SiPixelQuality.h
edm::ESProducer
Definition: ESProducer.h:101
SiStripNoisesRcd.h
SiStripDetCablingRcd.h
MeasurementTrackerESProducer::pixelQualityToken_
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > pixelQualityToken_
Definition: MeasurementTrackerESProducer.cc:46
ParameterSet.h
MeasurementTrackerESProducer::MeasurementTrackerESProducer
MeasurementTrackerESProducer(const edm::ParameterSet &p)
Definition: MeasurementTrackerESProducer.cc:121
MeasurementTrackerImpl::BadStrips
Definition: MeasurementTrackerImpl.h:43
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MeasurementTracker.h
SiStripQuality
Definition: SiStripQuality.h:32
MeasurementTracker::MaskBad128StripBlocks
Definition: MeasurementTracker.h:27