CMS 3D CMS Logo

SiStripHitEfficiencyWorker.cc
Go to the documentation of this file.
1 // Package: CalibTracker/SiStripHitEfficiency
3 // Class: SiStripHitEfficiencyWorker
4 // Original Author: Pieter David
5 //
6 // Adapted from HitEff (Keith Ulmer -- University of Colorado, keith.ulmer@colorado.edu
7 // SiStripHitEffFromCalibTree (Christopher Edelmaier)
9 
61 
63 public:
64  explicit SiStripHitEfficiencyWorker(const edm::ParameterSet& conf);
65  ~SiStripHitEfficiencyWorker() override = default;
66  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
67 
68 private:
69  void beginJob(); // TODO remove
70  void endJob(); // TODO remove
71  void bookHistograms(DQMStore::IBooker& booker, const edm::Run& run, const edm::EventSetup& setup) override;
72  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
73  void fillForTraj(const TrajectoryAtInvalidHit& tm,
74  const TrackerTopology* tTopo,
75  const TrackerGeometry* tkgeom,
76  const StripClusterParameterEstimator& stripCPE,
77  const SiStripQuality& stripQuality,
78  const DetIdCollection& fedErrorIds,
79  const edm::Handle<edm::DetSetVector<SiStripRawDigi>>& commonModeDigis,
80  const edmNew::DetSetVector<SiStripCluster>& theClusters,
81  int bunchCrossing,
82  float instLumi,
83  float PU,
84  bool highPurity);
85 
86  // ----------member data ---------------------------
88 
89  // event data tokens
99 
100  // event setup tokens
110 
111  // configurable parameters
113  unsigned int layers_;
114  bool DEBUG_;
115  bool addLumi_;
118  unsigned int trackMultiplicityCut_;
123  float resXSig_;
127  int bunchX_;
130  unsigned int nTEClayers_;
131 
132  // output file
133  std::set<uint32_t> badModules_;
134 
135  // counters
137 
138  struct EffME1 {
139  EffME1() : hTotal(nullptr), hFound(nullptr) {}
141 
142  void fill(double x, bool found, float weight = 1.) {
143  hTotal->Fill(x, weight);
144  if (found) {
145  hFound->Fill(x, weight);
146  }
147  }
148 
150  };
151  struct EffTkMap {
152  EffTkMap() : hTotal(nullptr), hFound(nullptr) {}
153  EffTkMap(std::unique_ptr<TkHistoMap>&& total, std::unique_ptr<TkHistoMap>&& found)
154  : hTotal(std::move(total)), hFound(std::move(found)) {}
155 
156  void fill(uint32_t id, bool found, float weight = 1.) {
157  hTotal->fill(id, weight);
158  if (found) {
159  hFound->fill(id, weight);
160  }
161  }
162 
163  std::unique_ptr<TkHistoMap> hTotal, hFound;
164  };
165 
171  std::vector<MonitorElement*> h_resolution;
172  std::vector<EffME1> h_layer_vsLumi;
173  std::vector<EffME1> h_layer_vsBx;
174  std::vector<EffME1> h_layer_vsPU;
175  std::vector<EffME1> h_layer_vsCM;
176  std::vector<MonitorElement*> h_hotcold;
177 
179 };
180 
181 //
182 // constructors and destructor
183 //
184 
186  : scalerToken_(consumes<LumiScalersCollection>(conf.getParameter<edm::InputTag>("lumiScalers"))),
187  metaDataToken_(consumes<OnlineLuminosityRecord>(conf.getParameter<edm::InputTag>("metadata"))),
188  commonModeToken_(mayConsume<edm::DetSetVector<SiStripRawDigi>>(conf.getParameter<edm::InputTag>("commonMode"))),
189  combinatorialTracks_token_(
190  consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("combinatorialTracks"))),
191  trajectories_token_(consumes<std::vector<Trajectory>>(conf.getParameter<edm::InputTag>("trajectories"))),
192  trajTrackAsso_token_(consumes<TrajTrackAssociationCollection>(conf.getParameter<edm::InputTag>("trajectories"))),
193  clusters_token_(
194  consumes<edmNew::DetSetVector<SiStripCluster>>(conf.getParameter<edm::InputTag>("siStripClusters"))),
195  digis_token_(consumes<DetIdCollection>(conf.getParameter<edm::InputTag>("siStripDigis"))),
196  trackerEvent_token_(consumes<MeasurementTrackerEvent>(conf.getParameter<edm::InputTag>("trackerEvent"))),
197  tTopoToken_(esConsumes()),
198  tkGeomToken_(esConsumes()),
199  stripCPEToken_(esConsumes(edm::ESInputTag{"", "StripCPEfromTrackAngle"})),
200  stripQualityToken_(esConsumes()),
201  magFieldToken_(esConsumes()),
202  measTrackerToken_(esConsumes()),
203  chi2EstimatorToken_(esConsumes(edm::ESInputTag{"", "Chi2"})),
204  propagatorToken_(esConsumes(edm::ESInputTag{"", "PropagatorWithMaterial"})),
205  tkDetMapToken_(esConsumes<edm::Transition::BeginRun>()),
206  dqmDir_(conf.getParameter<std::string>("dqmDir")),
207  layers_(conf.getParameter<int>("Layer")),
208  DEBUG_(conf.getUntrackedParameter<bool>("Debug", false)),
209  addLumi_(conf.getUntrackedParameter<bool>("addLumi", false)),
210  addCommonMode_(conf.getUntrackedParameter<bool>("addCommonMode", false)),
211  cutOnTracks_(conf.getParameter<bool>("cutOnTracks")),
212  trackMultiplicityCut_(conf.getParameter<unsigned int>("trackMultiplicity")),
213  useFirstMeas_(conf.getParameter<bool>("useFirstMeas")),
214  useLastMeas_(conf.getParameter<bool>("useLastMeas")),
215  useAllHitsFromTracksWithMissingHits_(conf.getParameter<bool>("useAllHitsFromTracksWithMissingHits")),
216  clusterMatchingMethod_(conf.getParameter<int>("ClusterMatchingMethod")),
217  resXSig_(conf.getParameter<double>("ResXSig")),
218  clusterTracjDist_(conf.getParameter<double>("ClusterTrajDist")),
219  stripsApvEdge_(conf.getParameter<double>("StripsApvEdge")),
220  useOnlyHighPurityTracks_(conf.getParameter<bool>("UseOnlyHighPurityTracks")),
221  bunchX_(conf.getUntrackedParameter<int>("BunchCrossing", 0)),
222  showRings_(conf.getUntrackedParameter<bool>("ShowRings", false)),
223  showTOB6TEC9_(conf.getUntrackedParameter<bool>("ShowTOB6TEC9", false)) {
224  nTEClayers_ = (showRings_ ? 7 : 9); // number of rings or wheels
225 
226  const std::string badModulesFile = conf.getUntrackedParameter<std::string>("BadModulesFile", "");
227  if (!badModulesFile.empty()) {
228  std::ifstream badModules_file(badModulesFile);
229  uint32_t badmodule_detid;
230  int mods, fiber1, fiber2, fiber3;
231  if (badModules_file.is_open()) {
233  while (getline(badModules_file, line)) {
234  if (badModules_file.eof())
235  continue;
236  std::stringstream ss(line);
237  ss >> badmodule_detid >> mods >> fiber1 >> fiber2 >> fiber3;
238  if (badmodule_detid != 0 && mods == 1 && (fiber1 == 1 || fiber2 == 1 || fiber3 == 1))
239  badModules_.insert(badmodule_detid);
240  }
241  badModules_file.close();
242  }
243  }
244  if (!badModules_.empty())
245  LogDebug("SiStripHitEfficiencyWorker") << "Remove additionnal bad modules from the analysis: ";
246  for (const auto badMod : badModules_) {
247  LogDebug("SiStripHitEfficiencyWorker") << " " << badMod;
248  }
249 }
250 
252  // TODO convert to counters, or simply remove?
253  events = 0;
254  EventTrackCKF = 0;
255 }
256 
258  const edm::Run& run,
259  const edm::EventSetup& setup) {
260  booker.setCurrentFolder(fmt::format("{}/EventInfo", dqmDir_));
261  h_bx = booker.book1D("bx", "bx", 3600, 0, 3600);
262  h_instLumi = booker.book1D("instLumi", "inst. lumi.", 250, 0, 25000);
263  h_PU = booker.book1D("PU", "PU", 200, 0, 200);
264  h_nTracks = booker.book1D("ntracks", "n.tracks;n. tracks;n.events", 500, -0.5, 499.5);
265  h_nTracksVsPU = booker.bookProfile("nTracksVsPU", "n. tracks vs PU; PU; n.tracks ", 200, 0, 200, 500, -0.5, 499.5);
266 
267  calibData_.EventStats = booker.book2I("EventStats", "Statistics", 3, -0.5, 2.5, 1, 0, 1);
268  calibData_.EventStats->setBinLabel(1, "events count", 1);
269  calibData_.EventStats->setBinLabel(2, "tracks count", 1);
270  calibData_.EventStats->setBinLabel(3, "measurements count", 1);
271 
272  booker.setCurrentFolder(dqmDir_);
273  h_goodLayer = EffME1(booker.book1D("goodlayer_total", "goodlayer_total", 35, 0., 35.),
274  booker.book1D("goodlayer_found", "goodlayer_found", 35, 0., 35.));
275  h_allLayer = EffME1(booker.book1D("alllayer_total", "alllayer_total", 35, 0., 35.),
276  booker.book1D("alllayer_found", "alllayer_found", 35, 0., 35.));
277 
278  h_layer = EffME1(
279  booker.book1D(
280  "layer_found", "layer_found", bounds::k_END_OF_LAYERS, 0., static_cast<float>(bounds::k_END_OF_LAYERS)),
281  booker.book1D(
282  "layer_total", "layer_total", bounds::k_END_OF_LAYERS, 0., static_cast<float>(bounds::k_END_OF_LAYERS)));
283 
284  for (int layer = 1; layer != bounds::k_END_OF_LAYERS; ++layer) {
285  const auto lyrName = ::layerName(layer, showRings_, nTEClayers_);
286 
287  // book resolutions
288  booker.setCurrentFolder(fmt::format("{}/Resolutions", dqmDir_));
289  auto ihres = booker.book1D(Form("resol_layer_%i", layer), lyrName, 125, -125., 125.);
290  ihres->setAxisTitle("trajX-clusX [strip unit]");
291  h_resolution.push_back(ihres);
292 
293  // book plots vs Lumi
294  booker.setCurrentFolder(fmt::format("{}/VsLumi", dqmDir_));
295  h_layer_vsLumi.push_back(EffME1(booker.book1D(Form("layertotal_vsLumi_layer_%i", layer), lyrName, 100, 0, 25000),
296  booker.book1D(Form("layerfound_vsLumi_layer_%i", layer), lyrName, 100, 0, 25000)));
297 
298  // book plots vs Lumi
299  booker.setCurrentFolder(fmt::format("{}/VsPu", dqmDir_));
300  h_layer_vsPU.push_back(EffME1(booker.book1D(Form("layertotal_vsPU_layer_%i", layer), lyrName, 45, 0, 90),
301  booker.book1D(Form("layerfound_vsPU_layer_%i", layer), lyrName, 45, 0, 90)));
302  if (addCommonMode_) {
303  // book plots for common mode
304  booker.setCurrentFolder(fmt::format("{}/CommonMode", dqmDir_));
305  h_layer_vsCM.push_back(EffME1(booker.book1D(Form("layertotal_vsCM_layer_%i", layer), lyrName, 20, 0, 400),
306  booker.book1D(Form("layerfound_vsCM_layer_%i", layer), lyrName, 20, 0, 400)));
307  }
308 
309  // book plots vs Lumi
310  booker.setCurrentFolder(fmt::format("{}/VsBx", dqmDir_));
311  h_layer_vsBx.push_back(EffME1(
312  booker.book1D(Form("totalVsBx_layer%i", layer), Form("layer %i (%s)", layer, lyrName.c_str()), 3565, 0, 3565),
313  booker.book1D(Form("foundVsBx_layer%i", layer), Form("layer %i (%s)", layer, lyrName.c_str()), 3565, 0, 3565)));
314 
315  // book hot and cold
316  booker.setCurrentFolder(fmt::format("{}/MissingHits", dqmDir_));
317  if (layer <= bounds::k_LayersAtTOBEnd) {
318  const bool isTIB = layer <= bounds::k_LayersAtTIBEnd;
319  const auto partition = (isTIB ? "TIB" : "TOB");
320  const auto yMax = (isTIB ? 100 : 120);
321 
322  const auto tit = Form("%s%i: Map of missing hits", partition, (isTIB ? layer : layer - bounds::k_LayersAtTIBEnd));
323 
324  auto ihhotcold = booker.book2D(tit, tit, 100, -1, 361, 100, -yMax, yMax);
325  ihhotcold->setAxisTitle("#phi [deg]", 1);
326  ihhotcold->setBinLabel(1, "360", 1);
327  ihhotcold->setBinLabel(50, "180", 1);
328  ihhotcold->setBinLabel(100, "0", 1);
329  ihhotcold->setAxisTitle("Global Z [cm]", 2);
330  ihhotcold->setOption("colz");
331  h_hotcold.push_back(ihhotcold);
332  } else {
333  const bool isTID = layer <= bounds::k_LayersAtTIDEnd;
334  const auto partitions =
335  (isTID ? std::vector<std::string>{"TID-", "TID+"} : std::vector<std::string>{"TEC-", "TEC+"});
336  const auto axMax = (isTID ? 100 : 120);
337  for (const auto& part : partitions) {
338  const auto tit = Form("%s%i: Map of missing hits",
339  part.c_str(),
340  (isTID ? layer - bounds::k_LayersAtTOBEnd : layer - bounds::k_LayersAtTIDEnd));
341 
342  auto ihhotcold = booker.book2D(tit, tit, 100, -axMax, axMax, 100, -axMax, axMax);
343  ihhotcold->setAxisTitle("Global Y", 1);
344  ihhotcold->setBinLabel(1, "+Y", 1);
345  ihhotcold->setBinLabel(50, "0", 1);
346  ihhotcold->setBinLabel(100, "-Y", 1);
347  ihhotcold->setAxisTitle("Global X", 2);
348  ihhotcold->setBinLabel(1, "-X", 2);
349  ihhotcold->setBinLabel(50, "0", 2);
350  ihhotcold->setBinLabel(100, "+X", 2);
351  ihhotcold->setOption("colz");
352  h_hotcold.push_back(ihhotcold);
353  }
354  }
355  }
356 
357  // come back to the main folder
358  booker.setCurrentFolder(dqmDir_);
359  const auto tkDetMapFolder = fmt::format("{}/TkDetMaps", dqmDir_);
360 
361  const TkDetMap* tkDetMap = &setup.getData(tkDetMapToken_);
362  h_module =
363  EffTkMap(std::make_unique<TkHistoMap>(tkDetMap, booker, tkDetMapFolder, "perModule_total", 0, false, true),
364  std::make_unique<TkHistoMap>(tkDetMap, booker, tkDetMapFolder, "perModule_found", 0, false, true));
365 
366  // fill the FED Errors
367  booker.setCurrentFolder(dqmDir_);
368  const auto FEDErrorMapFolder = fmt::format("{}/FEDErrorTkDetMaps", dqmDir_);
369  calibData_.FEDErrorOccupancy = TkHistoMap(tkDetMap, booker, FEDErrorMapFolder, "perModule_FEDErrors", 0, false, true);
370 }
371 
373  const auto tTopo = &es.getData(tTopoToken_);
374 
375  // bool DEBUG_ = false;
376 
377  LogDebug("SiStripHitEfficiencyWorker") << "beginning analyze from HitEff";
378 
379  // Step A: Get Inputs
380 
381  // Luminosity informations
384 
385  float instLumi = 0;
386  float PU = 0;
387  if (addLumi_) {
388  if (lumiScalers.isValid() && !lumiScalers->empty()) {
389  if (lumiScalers->begin() != lumiScalers->end()) {
390  instLumi = lumiScalers->begin()->instantLumi();
391  PU = lumiScalers->begin()->pileup();
392  }
393  } else if (metaData.isValid()) {
394  instLumi = metaData->instLumi();
395  PU = metaData->avgPileUp();
396  } else {
397  edm::LogWarning("SiStripHitEfficiencyWorker") << "could not find a source for the Luminosity and PU";
398  }
399  }
400 
401  h_bx->Fill(e.bunchCrossing());
403  h_PU->Fill(PU);
404 
406  if (addCommonMode_)
407  e.getByToken(commonModeToken_, commonModeDigis);
408 
410  e.getByToken(combinatorialTracks_token_, tracksCKF);
411 
412  edm::Handle<std::vector<Trajectory>> TrajectoryCollectionCKF;
413  e.getByToken(trajectories_token_, TrajectoryCollectionCKF);
414 
415  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
416  e.getByToken(trajTrackAsso_token_, trajTrackAssociationHandle);
417 
419  e.getByToken(clusters_token_, theClusters);
420 
421  edm::Handle<DetIdCollection> fedErrorIds;
422  e.getByToken(digis_token_, fedErrorIds);
423 
424  // fill the calibData with the FEDErrors
425  for (const auto& fedErr : *fedErrorIds) {
426  if (calibData_.fedErrorCounts.find(fedErr.rawId()) != calibData_.fedErrorCounts.end()) {
427  calibData_.fedErrorCounts[fedErr.rawId()] += 1;
428  } else {
429  calibData_.fedErrorCounts.insert(std::make_pair(fedErr.rawId(), 1));
430  }
431  }
432 
435 
436  const auto tkgeom = &es.getData(tkGeomToken_);
437  const auto& stripcpe = es.getData(stripCPEToken_);
438  const auto& stripQuality = es.getData(stripQualityToken_);
439  const auto& magField = es.getData(magFieldToken_);
440  const auto& measTracker = es.getData(measTrackerToken_);
441  const auto& chi2Estimator = es.getData(chi2EstimatorToken_);
442  const auto& prop = es.getData(propagatorToken_);
443 
444  ++events;
445 
446  // Tracking
447  LogDebug("SiStripHitEfficiencyWorker") << "number ckf tracks found = " << tracksCKF->size();
448 
449  h_nTracks->Fill(tracksCKF->size());
450  h_nTracksVsPU->Fill(PU, tracksCKF->size());
451 
452  // bin 0: one entry for each event
453  calibData_.EventStats->Fill(0., 0., 1);
454  // bin 1: one entry for each track
455  calibData_.EventStats->Fill(1., 0., tracksCKF->size());
456 
457  if (!tracksCKF->empty()) {
458  if (cutOnTracks_ && (tracksCKF->size() >= trackMultiplicityCut_))
459  return;
460  if (cutOnTracks_)
461  LogDebug("SiStripHitEfficiencyWorker")
462  << "starting checking good event with < " << trackMultiplicityCut_ << " tracks";
463 
464  ++EventTrackCKF;
465 
466  // actually should do a loop over all the tracks in the event here
467 
468  // Looping over traj-track associations to be able to get traj & track informations
469  for (const auto& trajTrack : *trajTrackAssociationHandle) {
470  // for each track, fill some variables such as number of hits and momentum
471 
472  const bool highPurity = trajTrack.val->quality(reco::TrackBase::TrackQuality::highPurity);
473  auto TMeas = trajTrack.key->measurements();
474 
475  const bool hasMissingHits = std::any_of(std::begin(TMeas), std::end(TMeas), [](const auto& tm) {
476  return tm.recHit()->getType() == TrackingRecHit::Type::missing;
477  });
478 
479  // Loop on each measurement and take into consideration
480  //--------------------------------------------------------
481  for (auto itm = TMeas.cbegin(); itm != TMeas.cend(); ++itm) {
482  const auto theInHit = (*itm).recHit();
483 
484  //bin 2: one entry for each measurement
485  calibData_.EventStats->Fill(2., 0., 1.);
486 
487  LogDebug("SiStripHitEfficiencyWorker") << "theInHit is valid = " << theInHit->isValid();
488 
489  unsigned int iidd = theInHit->geographicalId().rawId();
490 
491  unsigned int TKlayers = ::checkLayer(iidd, tTopo);
492 
493  // do not bother with pixel hits
494  if (DetId(iidd).subdetId() < SiStripSubdetector::TIB)
495  continue;
496 
497  LogDebug("SiStripHitEfficiencyWorker") << "TKlayer from trajectory: " << TKlayers << " from module = " << iidd
498  << " matched/stereo/rphi = " << ((iidd & 0x3) == 0) << "/"
499  << ((iidd & 0x3) == 1) << "/" << ((iidd & 0x3) == 2);
500 
501  // Test first and last points of the trajectory
502  // the list of measurements starts from outer layers !!! This could change -> should add a check
503  if ((!useFirstMeas_ && (itm == (TMeas.end() - 1))) || (!useLastMeas_ && (itm == (TMeas.begin()))) ||
504  // In case of missing hit in the track, check whether to use the other hits or not.
505  (!useAllHitsFromTracksWithMissingHits_ && hasMissingHits &&
506  theInHit->getType() != TrackingRecHit::Type::missing))
507  continue;
508  // If Trajectory measurement from TOB 6 or TEC 9, skip it because it's always valid they are filled later
509  if (TKlayers == bounds::k_LayersAtTOBEnd || TKlayers == bounds::k_LayersAtTECEnd) {
510  LogDebug("SiStripHitEfficiencyWorker") << "skipping original TM for TOB 6 or TEC 9";
511  continue;
512  }
513 
514  std::vector<TrajectoryAtInvalidHit> TMs;
515 
516  // Make AnalyticalPropagat // TODO where to save these?or to use in TAVH constructor
518 
519  // for double sided layers check both sensors--if no hit was found on either sensor surface,
520  // the trajectory measurements only have one invalid hit entry on the matched surface
521  // so get the TrajectoryAtInvalidHit for both surfaces and include them in the study
522  if (::isDoubleSided(iidd, tTopo) && ((iidd & 0x3) == 0)) {
523  // do hit eff check twice--once for each sensor
524  //add a TM for each surface
525  TMs.emplace_back(*itm, tTopo, tkgeom, propagator, 1);
526  TMs.emplace_back(*itm, tTopo, tkgeom, propagator, 2);
527  } else if (::isDoubleSided(iidd, tTopo) && (!::check2DPartner(iidd, TMeas))) {
528  // if only one hit was found the trajectory measurement is on that sensor surface, and the other surface from
529  // the matched layer should be added to the study as well
530  TMs.emplace_back(*itm, tTopo, tkgeom, propagator, 1);
531  TMs.emplace_back(*itm, tTopo, tkgeom, propagator, 2);
532  LogDebug("SiStripHitEfficiencyWorker") << " found a hit with a missing partner";
533  } else {
534  //only add one TM for the single surface and the other will be added in the next iteration
535  TMs.emplace_back(*itm, tTopo, tkgeom, propagator);
536  }
537 
539  //Now check for tracks at TOB6 and TEC9
540 
541  // to make sure we only propagate on the last TOB5 hit check the next entry isn't also in TOB5
542  // to avoid bias, make sure the TOB5 hit is valid (an invalid hit on TOB5 could only exist with a valid hit on TOB6)
543  const auto nextId = (itm + 1 != TMeas.end()) ? (itm + 1)->recHit()->geographicalId() : DetId{}; // null if last
544 
545  if (TKlayers == 9 && theInHit->isValid() && !((!nextId.null()) && (::checkLayer(nextId.rawId(), tTopo) == 9))) {
546  // if ( TKlayers==9 && itm==TMeas.rbegin()) {
547  // if ( TKlayers==9 && (itm==TMeas.back()) ) { // to check for only the last entry in the trajectory for propagation
548  const DetLayer* tob6 = measTracker.geometricSearchTracker()->tobLayers().back();
549  const LayerMeasurements theLayerMeasurements{measTracker, *measurementTrackerEvent};
550  const TrajectoryStateOnSurface tsosTOB5 = itm->updatedState();
551  const auto tmp = theLayerMeasurements.measurements(*tob6, tsosTOB5, prop, chi2Estimator);
552 
553  if (!tmp.empty()) {
554  LogDebug("SiStripHitEfficiencyWorker") << "size of TM from propagation = " << tmp.size();
555 
556  // take the last of the TMs, which is always an invalid hit
557  // if no detId is available, ie detId==0, then no compatible layer was crossed
558  // otherwise, use that TM for the efficiency measurement
559  const auto& tob6TM = tmp.back();
560  const auto& tob6Hit = tob6TM.recHit();
561  if (tob6Hit->geographicalId().rawId() != 0) {
562  LogDebug("SiStripHitEfficiencyWorker") << "tob6 hit actually being added to TM vector";
563  TMs.emplace_back(tob6TM, tTopo, tkgeom, propagator);
564  }
565  }
566  }
567 
568  // same for TEC8
569  if (TKlayers == 21 && theInHit->isValid() &&
570  !((!nextId.null()) && (::checkLayer(nextId.rawId(), tTopo) == 21))) {
571  const DetLayer* tec9pos = measTracker.geometricSearchTracker()->posTecLayers().back();
572  const DetLayer* tec9neg = measTracker.geometricSearchTracker()->negTecLayers().back();
573 
574  const LayerMeasurements theLayerMeasurements{measTracker, *measurementTrackerEvent};
575  const TrajectoryStateOnSurface tsosTEC9 = itm->updatedState();
576 
577  // check if track on positive or negative z
578  if (!(iidd == SiStripSubdetector::TEC))
579  LogDebug("SiStripHitEfficiencyWorker") << "there is a problem with TEC 9 extrapolation";
580 
581  //LogDebug("SiStripHitEfficiencyWorker") << " tec9 id = " << iidd << " and side = " << tTopo->tecSide(iidd) ;
582  std::vector<TrajectoryMeasurement> tmp;
583  if (tTopo->tecSide(iidd) == 1) {
584  tmp = theLayerMeasurements.measurements(*tec9neg, tsosTEC9, prop, chi2Estimator);
585  //LogDebug("SiStripHitEfficiencyWorker") << "on negative side" ;
586  }
587  if (tTopo->tecSide(iidd) == 2) {
588  tmp = theLayerMeasurements.measurements(*tec9pos, tsosTEC9, prop, chi2Estimator);
589  //LogDebug("SiStripHitEfficiencyWorker") << "on positive side" ;
590  }
591 
592  if (!tmp.empty()) {
593  // take the last of the TMs, which is always an invalid hit
594  // if no detId is available, ie detId==0, then no compatible layer was crossed
595  // otherwise, use that TM for the efficiency measurement
596  const auto& tec9TM = tmp.back();
597  const auto& tec9Hit = tec9TM.recHit();
598 
599  const unsigned int tec9id = tec9Hit->geographicalId().rawId();
600  LogDebug("SiStripHitEfficiencyWorker")
601  << "tec9id = " << tec9id << " is Double sided = " << ::isDoubleSided(tec9id, tTopo)
602  << " and 0x3 = " << (tec9id & 0x3);
603 
604  if (tec9Hit->geographicalId().rawId() != 0) {
605  LogDebug("SiStripHitEfficiencyWorker") << "tec9 hit actually being added to TM vector";
606  // in tec the hit can be single or doubled sided. whenever the invalid hit at the end of vector of TMs is
607  // double sided it is always on the matched surface, so we need to split it into the true sensor surfaces
608  if (::isDoubleSided(tec9id, tTopo)) {
609  TMs.emplace_back(tec9TM, tTopo, tkgeom, propagator, 1);
610  TMs.emplace_back(tec9TM, tTopo, tkgeom, propagator, 2);
611  } else
612  TMs.emplace_back(tec9TM, tTopo, tkgeom, propagator);
613  }
614  } //else LogDebug("SiStripHitEfficiencyWorker") << "tec9 tmp empty" ;
615  }
616 
617  for (const auto& tm : TMs) {
618  fillForTraj(tm,
619  tTopo,
620  tkgeom,
621  stripcpe,
622  stripQuality,
623  *fedErrorIds,
624  commonModeDigis,
625  *theClusters,
626  e.bunchCrossing(),
627  instLumi,
628  PU,
629  highPurity);
630  }
631  LogDebug("SiStripHitEfficiencyWorker") << "After looping over TrajAtValidHit list";
632  }
633  LogDebug("SiStripHitEfficiencyWorker") << "end TMeasurement loop";
634  }
635  LogDebug("SiStripHitEfficiencyWorker") << "end of trajectories loop";
636  }
637 }
638 
640  const TrackerTopology* tTopo,
641  const TrackerGeometry* tkgeom,
642  const StripClusterParameterEstimator& stripCPE,
643  const SiStripQuality& stripQuality,
644  const DetIdCollection& fedErrorIds,
645  const edm::Handle<edm::DetSetVector<SiStripRawDigi>>& commonModeDigis,
646  const edmNew::DetSetVector<SiStripCluster>& theClusters,
647  int bunchCrossing,
648  float instLumi,
649  float PU,
650  bool highPurity) {
651  // --> Get trajectory from combinatedStat& e
652  const auto iidd = tm.monodet_id();
653  LogDebug("SiStripHitEfficiencyWorker") << "setting iidd = " << iidd << " before checking efficiency and ";
654 
655  const auto xloc = tm.localX();
656  const auto yloc = tm.localY();
657 
658  const auto xErr = tm.localErrorX();
659  const auto yErr = tm.localErrorY();
660 
661  int TrajStrip = -1;
662 
663  // reget layer from iidd here, to account for TOB 6 and TEC 9 TKlayers being off
664  const auto TKlayers = ::checkLayer(iidd, tTopo);
665 
666  const bool withinAcceptance =
667  tm.withinAcceptance() && (!::isInBondingExclusionZone(iidd, TKlayers, yloc, yErr, tTopo));
668 
669  if ( // (TKlayers > 0) && // FIXME confirm this
670  ((layers_ == TKlayers) ||
671  (layers_ == bounds::k_LayersStart))) { // Look at the layer not used to reconstruct the track
672  LogDebug("SiStripHitEfficiencyWorker") << "Looking at layer under study";
673  unsigned int ModIsBad = 2;
674  unsigned int SiStripQualBad = 0;
675  float commonMode = -100;
676 
677  // RPhi RecHit Efficiency
678 
679  if (!theClusters.empty()) {
680  LogDebug("SiStripHitEfficiencyWorker") << "Checking clusters with size = " << theClusters.size();
681  std::vector<::ClusterInfo> VCluster_info; //fill with X residual, X residual pull, local X
682  const auto idsv = theClusters.find(iidd);
683  if (idsv != theClusters.end()) {
684  //if (DEBUG_) LogDebug("SiStripHitEfficiencyWorker") << "the ID from the dsv = " << dsv.id() ;
685  LogDebug("SiStripHitEfficiencyWorker")
686  << "found (ClusterId == iidd) with ClusterId = " << idsv->id() << " and iidd = " << iidd;
687  const auto stripdet = dynamic_cast<const StripGeomDetUnit*>(tkgeom->idToDetUnit(DetId(iidd)));
688  const StripTopology& Topo = stripdet->specificTopology();
689 
690  float hbedge = 0.0;
691  float htedge = 0.0;
692  float hapoth = 0.0;
693  float uylfac = 0.0;
694  float uxlden = 0.0;
695  if (TKlayers > bounds::k_LayersAtTOBEnd) {
696  const BoundPlane& plane = stripdet->surface();
697  const TrapezoidalPlaneBounds* trapezoidalBounds(
698  dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
699  std::array<const float, 4> const& parameterTrap = (*trapezoidalBounds).parameters(); // el bueno aqui
700  hbedge = parameterTrap[0];
701  htedge = parameterTrap[1];
702  hapoth = parameterTrap[3];
703  uylfac = (htedge - hbedge) / (htedge + hbedge) / hapoth;
704  uxlden = 1 + yloc * uylfac;
705  }
706 
707  // Need to know position of trajectory in strip number for selecting the right APV later
708  if (TrajStrip == -1) {
709  int nstrips = Topo.nstrips();
710  float pitch = stripdet->surface().bounds().width() / nstrips;
711  TrajStrip = xloc / pitch + nstrips / 2.0;
712  // Need additionnal corrections for endcap
713  if (TKlayers > bounds::k_LayersAtTOBEnd) {
714  const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
715  hapoth); // radialy extrapolated x loc position at middle
716  TrajStrip = TrajLocXMid / pitch + nstrips / 2.0;
717  }
718  //LogDebug("SiStripHitEfficiency")<<" Layer "<<TKlayers<<" TrajStrip: "<<nstrips<<" "<<pitch<<" "<<TrajStrip;;
719  }
720 
721  for (const auto& clus : *idsv) {
723  float res = (parameters.first.x() - xloc);
724  float sigma = ::checkConsistency(parameters, xloc, xErr);
725  // The consistency is probably more accurately measured with the Chi2MeasurementEstimator. To use it
726  // you need a TransientTrackingRecHit instead of the cluster
727  //theEstimator= new Chi2MeasurementEstimator(30);
728  //const Chi2MeasurementEstimator *theEstimator(100);
729  //theEstimator->estimate(tm.tsos(), TransientTrackingRecHit);
730 
731  if (TKlayers > bounds::k_LayersAtTOBEnd) {
732  res = parameters.first.x() - xloc / uxlden; // radialy extrapolated x loc position at middle
733  sigma = abs(res) / sqrt(parameters.second.xx() + xErr * xErr / uxlden / uxlden +
734  yErr * yErr * xloc * xloc * uylfac * uylfac / uxlden / uxlden / uxlden / uxlden);
735  }
736 
737  VCluster_info.emplace_back(res, sigma, parameters.first.x());
738 
739  LogDebug("SiStripHitEfficiencyWorker") << "Have ID match. residual = " << res << " res sigma = " << sigma;
740  //LogDebug("SiStripHitEfficiencyWorker")
741  // << "trajectory measurement compatability estimate = " << (*itm).estimate() ;
742  LogDebug("SiStripHitEfficiencyWorker")
743  << "hit position = " << parameters.first.x() << " hit error = " << sqrt(parameters.second.xx())
744  << " trajectory position = " << xloc << " traj error = " << xErr;
745  }
746  }
747  ::ClusterInfo finalCluster{1000.0, 1000.0, 0.0};
748  if (!VCluster_info.empty()) {
749  LogDebug("SiStripHitEfficiencyWorker") << "found clusters > 0";
750  if (VCluster_info.size() > 1) {
751  //get the smallest one
752  for (const auto& res : VCluster_info) {
753  if (std::abs(res.xResidualPull) < std::abs(finalCluster.xResidualPull)) {
754  finalCluster = res;
755  }
756  LogDebug("SiStripHitEfficiencyWorker")
757  << "iresidual = " << res.xResidual << " isigma = " << res.xResidualPull
758  << " and FinalRes = " << finalCluster.xResidual;
759  }
760  } else {
761  finalCluster = VCluster_info[0];
762  }
763  VCluster_info.clear();
764  }
765 
766  LogDebug("SiStripHitEfficiencyWorker") << "Final residual in X = " << finalCluster.xResidual << "+-"
767  << (finalCluster.xResidual / finalCluster.xResidualPull);
768  LogDebug("SiStripHitEfficiencyWorker")
769  << "Checking location of trajectory: abs(yloc) = " << abs(yloc) << " abs(xloc) = " << abs(xloc);
770 
771  //
772  // fill ntuple varibles
773 
774  //if ( stripQuality->IsModuleBad(iidd) )
775  if (stripQuality.getBadApvs(iidd) != 0) {
776  SiStripQualBad = 1;
777  LogDebug("SiStripHitEfficiencyWorker") << "strip is bad from SiStripQuality";
778  } else {
779  SiStripQualBad = 0;
780  LogDebug("SiStripHitEfficiencyWorker") << "strip is good from SiStripQuality";
781  }
782 
783  //check for FED-detected errors and include those in SiStripQualBad
784  for (unsigned int ii = 0; ii < fedErrorIds.size(); ii++) {
785  if (iidd == fedErrorIds[ii].rawId())
786  SiStripQualBad = 1;
787  }
788 
789  // CM of APV crossed by traj
790  if (addCommonMode_)
791  if (commonModeDigis.isValid() && TrajStrip >= 0 && TrajStrip <= 768) {
792  const auto digiframe = commonModeDigis->find(iidd);
793  if (digiframe != commonModeDigis->end())
794  if ((unsigned)TrajStrip / sistrip::STRIPS_PER_APV < digiframe->data.size())
795  commonMode = digiframe->data.at(TrajStrip / sistrip::STRIPS_PER_APV).adc();
796  }
797 
798  LogDebug("SiStripHitEfficiencyWorker") << "before check good";
799 
800  if (finalCluster.xResidualPull < 999.0) { //could make requirement on track/hit consistency, but for
801  //now take anything with a hit on the module
802  LogDebug("SiStripHitEfficiencyWorker")
803  << "hit being counted as good " << finalCluster.xResidual << " FinalRecHit " << iidd << " TKlayers "
804  << TKlayers << " xloc " << xloc << " yloc " << yloc << " module " << iidd
805  << " matched/stereo/rphi = " << ((iidd & 0x3) == 0) << "/" << ((iidd & 0x3) == 1) << "/"
806  << ((iidd & 0x3) == 2);
807  ModIsBad = 0;
808  } else {
809  LogDebug("SiStripHitEfficiencyWorker")
810  << "hit being counted as bad ######### Invalid RPhi FinalResX " << finalCluster.xResidual
811  << " FinalRecHit " << iidd << " TKlayers " << TKlayers << " xloc " << xloc << " yloc " << yloc
812  << " module " << iidd << " matched/stereo/rphi = " << ((iidd & 0x3) == 0) << "/" << ((iidd & 0x3) == 1)
813  << "/" << ((iidd & 0x3) == 2);
814  ModIsBad = 1;
815  LogDebug("SiStripHitEfficiencyWorker")
816  << " RPhi Error " << sqrt(xErr * xErr + yErr * yErr) << " ErrorX " << xErr << " yErr " << yErr;
817  }
818 
819  LogDebug("SiStripHitEfficiencyWorker")
820  << "To avoid them staying unused: ModIsBad=" << ModIsBad << ", SiStripQualBad=" << SiStripQualBad
821  << ", commonMode=" << commonMode << ", highPurity=" << highPurity
822  << ", withinAcceptance=" << withinAcceptance;
823 
824  unsigned int layer = TKlayers;
825  if (showRings_ && layer > bounds::k_LayersAtTOBEnd) { // use rings instead of wheels
826  if (layer <= bounds::k_LayersAtTIDEnd) { // TID
827  layer = bounds::k_LayersAtTOBEnd +
828  tTopo->tidRing(iidd); // ((iidd >> 9) & 0x3); // 3 disks and also 3 rings -> use the same container
829  } else { // TEC
830  layer = bounds::k_LayersAtTIDEnd + tTopo->tecRing(iidd); // ((iidd >> 5) & 0x7);
831  }
832  }
833  unsigned int layerWithSide = layer;
834  if (layer > bounds::k_LayersAtTOBEnd && layer <= bounds::k_LayersAtTIDEnd) {
835  const auto side = tTopo->tidSide(iidd); //(iidd >> 13) & 0x3; // TID
836  if (side == 2)
837  layerWithSide = layer + 3;
838  } else if (layer > bounds::k_LayersAtTIDEnd) {
839  const auto side = tTopo->tecSide(iidd); // (iidd >> 18) & 0x3; // TEC
840  if (side == 1) {
841  layerWithSide = layer + 3;
842  } else if (side == 2) {
843  layerWithSide = layer + 3 + (showRings_ ? 7 : 9);
844  }
845  }
846 
847  if ((bunchX_ > 0 && bunchX_ != bunchCrossing) || (!withinAcceptance) ||
849  (!showTOB6TEC9_ && (TKlayers == bounds::k_LayersAtTOBEnd || TKlayers == bounds::k_LayersAtTECEnd)) ||
850  (badModules_.end() != badModules_.find(iidd)))
851  return;
852 
853  const bool badquality = (SiStripQualBad == 1);
854 
855  //Now that we have a good event, we need to look at if we expected it or not, and the location
856  //if we didn't
857  //Fill the missing hit information first
858  bool badflag = false; // true for hits that are expected but not found
859  if (resXSig_ < 0) {
860  if (ModIsBad == 1)
861  badflag = true; // isBad set to false in the tree when resxsig<999.0
862  } else {
863  if (ModIsBad == 1 || finalCluster.xResidualPull > resXSig_)
864  badflag = true;
865  }
866 
867  // Conversion of positions in strip unit
868  int nstrips = -9;
869  float Pitch = -9.0;
870  const StripGeomDetUnit* stripdet = nullptr;
871  if (finalCluster.xResidualPull ==
872  1000.0) { // special treatment, no GeomDetUnit associated in some cases when no cluster found
873  Pitch = 0.0205; // maximum
874  nstrips = 768; // maximum
875  } else {
876  stripdet = dynamic_cast<const StripGeomDetUnit*>(tkgeom->idToDetUnit(iidd));
877  const StripTopology& Topo = stripdet->specificTopology();
878  nstrips = Topo.nstrips();
879  Pitch = stripdet->surface().bounds().width() / Topo.nstrips();
880  }
881  double stripTrajMid = xloc / Pitch + nstrips / 2.0;
882  double stripCluster = finalCluster.xLocal / Pitch + nstrips / 2.0;
883  // For trapezoidal modules: extrapolation of x trajectory position to the y middle of the module
884  // for correct comparison with cluster position
885  if (stripdet && layer > bounds::k_LayersAtTOBEnd) {
886  const auto& trapezoidalBounds = dynamic_cast<const TrapezoidalPlaneBounds&>(stripdet->surface().bounds());
887  std::array<const float, 4> const& parameters = trapezoidalBounds.parameters();
888  const float hbedge = parameters[0];
889  const float htedge = parameters[1];
890  const float hapoth = parameters[3];
891  const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
892  hapoth); // radialy extrapolated x loc position at middle
893  stripTrajMid = TrajLocXMid / Pitch + nstrips / 2.0;
894  }
895 
896  if ((!badquality) && (layer < h_resolution.size())) {
897  LogDebug("SiStripHitEfficiencyWorker")
898  << "layer " << layer << " vector index " << layer - 1 << " before filling h_resolution" << std::endl;
899  h_resolution[layer - 1]->Fill(finalCluster.xResidualPull != 1000.0 ? stripTrajMid - stripCluster : 1000);
900  }
901 
902  // New matching methods
903  if (clusterMatchingMethod_ >= 1) {
904  badflag = false;
905  if (finalCluster.xResidualPull == 1000.0) {
906  LogDebug("SiStripHitEfficiencyWorker") << "Marking bad for resxsig=1000";
907  badflag = true;
908  } else {
910  // check the distance between cluster and trajectory position
911  if (std::abs(stripCluster - stripTrajMid) > clusterTracjDist_) {
912  LogDebug("SiStripHitEfficiencyWorker") << "Marking bad for cluster-to-traj distance";
913  badflag = true;
914  }
915  }
917  // cluster and traj have to be in the same APV (don't take edges into accounts)
918  const int tapv = (int)stripTrajMid / sistrip::STRIPS_PER_APV;
919  const int capv = (int)stripCluster / sistrip::STRIPS_PER_APV;
920  float stripInAPV = stripTrajMid - tapv * sistrip::STRIPS_PER_APV;
921  if (stripInAPV < stripsApvEdge_ || stripInAPV > sistrip::STRIPS_PER_APV - stripsApvEdge_) {
922  LogDebug("SiStripHitEfficiencyWorker") << "Too close to the edge: " << stripInAPV;
923  return;
924  }
925  if (tapv != capv) {
926  LogDebug("SiStripHitEfficiencyWorker") << "Marking bad for tapv!=capv";
927  badflag = true;
928  }
929  }
930  }
931  }
932  if (!badquality) {
933  LogDebug("SiStripHitEfficiencyWorker")
934  << "Filling measurement for " << iidd << " in layer " << layer << " histograms with bx=" << bunchCrossing
935  << ", lumi=" << instLumi << ", PU=" << PU << "; bad flag=" << badflag;
936 
937  // hot/cold maps of hits that are expected but not found
938  if (badflag) {
939  if (layer > bounds::k_LayersStart && layer <= bounds::k_LayersAtTIBEnd) {
940  //We are in the TIB
941  float phi = ::calcPhi(tm.globalX(), tm.globalY());
942  h_hotcold[layer - 1]->Fill(360. - phi, tm.globalZ(), 1.);
943  } else if (layer > bounds::k_LayersAtTIBEnd && layer <= bounds::k_LayersAtTOBEnd) {
944  //We are in the TOB
945  float phi = ::calcPhi(tm.globalX(), tm.globalY());
946  h_hotcold[layer - 1]->Fill(360. - phi, tm.globalZ(), 1.);
947  } else if (layer > bounds::k_LayersAtTOBEnd && layer <= bounds::k_LayersAtTIDEnd) {
948  //We are in the TID
949  //There are 2 different maps here
950  int side = tTopo->tidSide(iidd);
951  if (side == 1)
952  h_hotcold[(layer - 1) + (layer - 11)]->Fill(-tm.globalY(), tm.globalX(), 1.);
953  else if (side == 2)
954  h_hotcold[(layer - 1) + (layer - 10)]->Fill(-tm.globalY(), tm.globalX(), 1.);
955  } else if (layer > bounds::k_LayersAtTIDEnd) {
956  //We are in the TEC
957  //There are 2 different maps here
958  int side = tTopo->tecSide(iidd);
959  if (side == 1)
960  h_hotcold[(layer + 2) + (layer - 14)]->Fill(-tm.globalY(), tm.globalX(), 1.);
961  else if (side == 2)
962  h_hotcold[(layer + 2) + (layer - 13)]->Fill(-tm.globalY(), tm.globalX(), 1.);
963  }
964  }
965 
966  LogDebug("SiStripHitEfficiencyWorker")
967  << "layer " << layer << " vector index " << layer - 1 << " before filling h_layer_vsSmthg" << std::endl;
968  h_layer_vsBx[layer - 1].fill(bunchCrossing, !badflag);
969  if (addLumi_) {
970  h_layer_vsLumi[layer - 1].fill(instLumi, !badflag);
971  h_layer_vsPU[layer - 1].fill(PU, !badflag);
972  }
973  if (addCommonMode_) {
974  h_layer_vsCM[layer - 1].fill(commonMode, !badflag);
975  }
976  h_goodLayer.fill(layerWithSide, !badflag);
977  }
978  // efficiency without bad modules excluded
979  h_allLayer.fill(layerWithSide, !badflag);
980 
981  // efficiency without bad modules excluded
982  if (TKlayers) {
983  h_module.fill(iidd, !badflag);
984  }
985 
986  /* Used in SiStripHitEffFromCalibTree:
987  * run -> "run" -> run // e.id().run()
988  * event -> "event" -> evt // e.id().event()
989  * ModIsBad -> "ModIsBad" -> isBad
990  * SiStripQualBad -> "SiStripQualBad"" -> quality
991  * Id -> "Id" -> id // iidd
992  * withinAcceptance -> "withinAcceptance" -> accept
993  * whatlayer -> "layer" -> layer_wheel // Tklayers
994  * highPurity -> "highPurity" -> highPurity
995  * TrajGlbX -> "TrajGlbX" -> x // tm.globalX()
996  * TrajGlbY -> "TrajGlbY" -> y // tm.globalY()
997  * TrajGlbZ -> "TrajGlbZ" -> z // tm.globalZ()
998  * ResXSig -> "ResXSig" -> resxsig // finalCluster.xResidualPull;
999  * TrajLocX -> "TrajLocX" -> TrajLocX // xloc
1000  * TrajLocY -> "TrajLocY" -> TrajLocY // yloc
1001  * ClusterLocX -> "ClusterLocX" -> ClusterLocX // finalCluster.xLocal
1002  * bunchx -> "bunchx" -> bx // e.bunchCrossing()
1003  * instLumi -> "instLumi" -> instLumi ## if addLumi_
1004  * PU -> "PU" -> PU ## if addLumi_
1005  * commonMode -> "commonMode" -> CM ## if addCommonMode_ / _useCM
1006  */
1007  LogDebug("SiStripHitEfficiencyWorker") << "after good location check";
1008  }
1009  LogDebug("SiStripHitEfficiencyWorker") << "after list of clusters";
1010  }
1011  LogDebug("SiStripHitEfficiencyWorker") << "After layers=TKLayers if with TKlayers=" << TKlayers
1012  << ", layers=" << layers_;
1013 }
1014 
1016  LogDebug("SiStripHitEfficiencyWorker") << " Events Analysed " << events;
1017  LogDebug("SiStripHitEfficiencyWorker") << " Number Of Tracked events " << EventTrackCKF;
1018 
1019  // fill the TkMap Data
1021 }
1022 
1025  desc.add<std::string>("dqmDir", "AlCaReco/SiStripHitEfficiency");
1026  desc.add<bool>("UseOnlyHighPurityTracks", true);
1027  desc.add<bool>("cutOnTracks", false);
1028  desc.add<bool>("useAllHitsFromTracksWithMissingHits", false);
1029  desc.add<bool>("useFirstMeas", false);
1030  desc.add<bool>("useLastMeas", false);
1031  desc.add<double>("ClusterTrajDist", 64.0);
1032  desc.add<double>("ResXSig", -1);
1033  desc.add<double>("StripsApvEdge", 10.0);
1034  desc.add<edm::InputTag>("combinatorialTracks", edm::InputTag{"generalTracks"});
1035  desc.add<edm::InputTag>("commonMode", edm::InputTag{"siStripDigis", "CommonMode"});
1036  desc.add<edm::InputTag>("lumiScalers", edm::InputTag{"scalersRawToDigi"});
1037  desc.add<edm::InputTag>("metadata", edm::InputTag{"onlineMetaDataDigis"});
1038  desc.add<edm::InputTag>("siStripClusters", edm::InputTag{"siStripClusters"});
1039  desc.add<edm::InputTag>("siStripDigis", edm::InputTag{"siStripDigis"});
1040  desc.add<edm::InputTag>("trackerEvent", edm::InputTag{"MeasurementTrackerEvent"});
1041  desc.add<edm::InputTag>("trajectories", edm::InputTag{"generalTracks"});
1042  desc.add<int>("ClusterMatchingMethod", 0);
1043  desc.add<int>("Layer", 0);
1044  desc.add<unsigned int>("trackMultiplicity", 100);
1045  desc.addUntracked<bool>("Debug", false);
1046  desc.addUntracked<bool>("ShowRings", false);
1047  desc.addUntracked<bool>("ShowTOB6TEC9", false);
1048  desc.addUntracked<bool>("addCommonMode", false);
1049  desc.addUntracked<bool>("addLumi", true);
1050  desc.addUntracked<int>("BunchCrossing", 0);
1051  desc.addUntracked<std::string>("BadModulesFile", "");
1052  descriptions.addWithDefaultLabel(desc);
1053 }
1054 
std::pair< LocalPoint, LocalError > LocalValues
const edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measTrackerToken_
virtual int nstrips() const =0
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void fill(double x, bool found, float weight=1.)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
constexpr char const * layerName[numberOfLayers]
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::vector< MonitorElement * > h_resolution
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
EffME1(MonitorElement *total, MonitorElement *found)
const edm::EDGetTokenT< std::vector< Trajectory > > trajectories_token_
std::vector< MonitorElement * > h_hotcold
virtual void localParameters(AClusters const &clusters, ALocalValues &retValues, const GeomDetUnit &gd, const LocalTrajectoryParameters &ltp) const
void bookHistograms(DQMStore::IBooker &booker, const edm::Run &run, const edm::EventSetup &setup) override
unsigned int tidSide(const DetId &id) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Class to contain the online luminosity from soft FED 1022.
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
unsigned int monodet_id() const
Definition: weight.py:1
const edm::EDGetTokenT< DetIdCollection > digis_token_
float instLumi() const
Return the luminosity for the current nibble.
std::unordered_map< uint32_t, int > fedErrorCounts
unsigned int tecRing(const DetId &id) const
ring id
Definition: Electron.h:6
missing
Definition: combine.py:5
const edm::EDGetTokenT< MeasurementTrackerEvent > trackerEvent_token_
constexpr std::array< uint8_t, layerIndexSize > layer
const_iterator end(bool update=false) const
~SiStripHitEfficiencyWorker() override=default
void Fill(long long x)
const edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_
TkHistoMap FEDErrorOccupancy
void fillForTraj(const TrajectoryAtInvalidHit &tm, const TrackerTopology *tTopo, const TrackerGeometry *tkgeom, const StripClusterParameterEstimator &stripCPE, const SiStripQuality &stripQuality, const DetIdCollection &fedErrorIds, const edm::Handle< edm::DetSetVector< SiStripRawDigi >> &commonModeDigis, const edmNew::DetSetVector< SiStripCluster > &theClusters, int bunchCrossing, float instLumi, float PU, bool highPurity)
const edm::ESGetToken< StripClusterParameterEstimator, TkStripCPERecord > stripCPEToken_
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
const edm::EDGetTokenT< OnlineLuminosityRecord > metaDataToken_
const edm::ESGetToken< Chi2MeasurementEstimatorBase, TrackingComponentsRecord > chi2EstimatorToken_
unsigned int tecSide(const DetId &id) const
EffTkMap(std::unique_ptr< TkHistoMap > &&total, std::unique_ptr< TkHistoMap > &&found)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
T sqrt(T t)
Definition: SSEVec.h:19
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkGeomToken_
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool getData(T &iHolder) const
Definition: EventSetup.h:122
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
dqm::reco::MonitorElement * EventStats
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
ii
Definition: cuy.py:589
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
SiStripHitEfficiencyWorker(const edm::ParameterSet &conf)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: DetId.h:17
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
size_type size() const
const edm::EDGetTokenT< TrajTrackAssociationCollection > trajTrackAsso_token_
Constants and enumerated types for FED/FEC systems.
part
Definition: HCALResponse.h:20
virtual const std::array< const float, 4 > parameters() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > clusters_token_
bool isValid() const
Definition: HandleBase.h:70
fixed size matrix
HLT enums.
const_iterator find(id_type i, bool update=false) const
size_type size() const
Definition: EDCollection.h:82
static const uint16_t STRIPS_PER_APV
const edm::EDGetTokenT< reco::TrackCollection > combinatorialTracks_token_
const edm::ESGetToken< SiStripQuality, SiStripQualityRcd > stripQualityToken_
const edm::EDGetTokenT< LumiScalersCollection > scalerToken_
unsigned int tidRing(const DetId &id) const
std::vector< LumiScalers > LumiScalersCollection
Definition: LumiScalers.h:144
void fill(uint32_t id, bool found, float weight=1.)
const edm::EDGetTokenT< edm::DetSetVector< SiStripRawDigi > > commonModeToken_
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
tmp
align.sh
Definition: createJobs.py:716
virtual float width() const =0
MonitorElement * book2I(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:296
float avgPileUp() const
Return the average pileup for th current nibble.
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
#define LogDebug(id)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
short getBadApvs(uint32_t detid) const
const Bounds & bounds() const
Definition: Surface.h:87