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 
63 
65 public:
66  explicit SiStripHitEfficiencyWorker(const edm::ParameterSet& conf);
67  ~SiStripHitEfficiencyWorker() override = default;
68  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
69 
70 private:
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 DetIdVector& 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
100 
101  // event setup tokens
111 
112  // configurable parameters
114  unsigned int layers_;
115  bool DEBUG_;
116  bool addLumi_;
119  unsigned int trackMultiplicityCut_;
125  float resXSig_;
129  int bunchX_;
132  unsigned int nTEClayers_;
133 
134  // output file
135  std::set<uint32_t> badModules_;
136 
137  // for the missing hits recovery
138  std::vector<unsigned int> hitRecoveryCounters;
139  std::vector<unsigned int> hitTotalCounters;
141  std::vector<int> missHitPerLayer;
142 
143  struct EffME1 {
144  EffME1() : hTotal(nullptr), hFound(nullptr) {}
146 
147  void fill(double x, bool found, float weight = 1.) {
148  hTotal->Fill(x, weight);
149  if (found) {
150  hFound->Fill(x, weight);
151  }
152  }
153 
155  };
156  struct EffTkMap {
157  EffTkMap() : hTotal(nullptr), hFound(nullptr) {}
158  EffTkMap(std::unique_ptr<TkHistoMap>&& total, std::unique_ptr<TkHistoMap>&& found)
159  : hTotal(std::move(total)), hFound(std::move(found)) {}
160 
161  void fill(uint32_t id, bool found, float weight = 1.) {
162  hTotal->fill(id, weight);
163  if (found) {
164  hFound->fill(id, weight);
165  }
166  }
167 
168  bool check(uint32_t id) {
169  if (hTotal->getValue(id) < hFound->getValue(id)) {
170  return false;
171  } else {
172  return true;
173  }
174  }
175 
176  std::unique_ptr<TkHistoMap> hTotal, hFound;
177  };
178 
184  std::vector<MonitorElement*> h_resolution;
185  std::vector<EffME1> h_layer_vsLumi;
186  std::vector<EffME1> h_layer_vsBx;
187  std::vector<EffME1> h_layer_vsPU;
188  std::vector<EffME1> h_layer_vsCM;
189  std::vector<MonitorElement*> h_hotcold;
190 
192 };
193 
194 //
195 // constructors and destructor
196 //
197 
199  : scalerToken_(consumes<LumiScalersCollection>(conf.getParameter<edm::InputTag>("lumiScalers"))),
200  metaDataToken_(consumes<OnlineLuminosityRecord>(conf.getParameter<edm::InputTag>("metadata"))),
201  commonModeToken_(mayConsume<edm::DetSetVector<SiStripRawDigi>>(conf.getParameter<edm::InputTag>("commonMode"))),
202  combinatorialTracks_token_(
203  consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("combinatorialTracks"))),
204  trajectories_token_(consumes<std::vector<Trajectory>>(conf.getParameter<edm::InputTag>("trajectories"))),
205  trajTrackAsso_token_(consumes<TrajTrackAssociationCollection>(conf.getParameter<edm::InputTag>("trajectories"))),
206  clusters_token_(
207  consumes<edmNew::DetSetVector<SiStripCluster>>(conf.getParameter<edm::InputTag>("siStripClusters"))),
208  digisCol_token_(consumes(conf.getParameter<edm::InputTag>("siStripDigis"))),
209  digisVec_token_(consumes(conf.getParameter<edm::InputTag>("siStripDigis"))),
210  trackerEvent_token_(consumes<MeasurementTrackerEvent>(conf.getParameter<edm::InputTag>("trackerEvent"))),
211  tTopoToken_(esConsumes()),
212  tkGeomToken_(esConsumes()),
213  stripCPEToken_(esConsumes(edm::ESInputTag{"", "StripCPEfromTrackAngle"})),
214  stripQualityToken_(esConsumes()),
215  magFieldToken_(esConsumes()),
216  measTrackerToken_(esConsumes()),
217  chi2EstimatorToken_(esConsumes(edm::ESInputTag{"", "Chi2"})),
218  propagatorToken_(esConsumes(edm::ESInputTag{"", "PropagatorWithMaterial"})),
219  tkDetMapToken_(esConsumes<edm::Transition::BeginRun>()),
220  dqmDir_(conf.getParameter<std::string>("dqmDir")),
221  layers_(conf.getParameter<int>("Layer")),
222  DEBUG_(conf.getUntrackedParameter<bool>("Debug", false)),
223  addLumi_(conf.getUntrackedParameter<bool>("addLumi", false)),
224  addCommonMode_(conf.getUntrackedParameter<bool>("addCommonMode", false)),
225  cutOnTracks_(conf.getParameter<bool>("cutOnTracks")),
226  trackMultiplicityCut_(conf.getParameter<unsigned int>("trackMultiplicity")),
227  useFirstMeas_(conf.getParameter<bool>("useFirstMeas")),
228  useLastMeas_(conf.getParameter<bool>("useLastMeas")),
229  useAllHitsFromTracksWithMissingHits_(conf.getParameter<bool>("useAllHitsFromTracksWithMissingHits")),
230  doMissingHitsRecovery_(conf.getParameter<bool>("doMissingHitsRecovery")),
231  clusterMatchingMethod_(conf.getParameter<int>("ClusterMatchingMethod")),
232  resXSig_(conf.getParameter<double>("ResXSig")),
233  clusterTracjDist_(conf.getParameter<double>("ClusterTrajDist")),
234  stripsApvEdge_(conf.getParameter<double>("StripsApvEdge")),
235  useOnlyHighPurityTracks_(conf.getParameter<bool>("UseOnlyHighPurityTracks")),
236  bunchX_(conf.getUntrackedParameter<int>("BunchCrossing", 0)),
237  showRings_(conf.getUntrackedParameter<bool>("ShowRings", false)),
238  showTOB6TEC9_(conf.getUntrackedParameter<bool>("ShowTOB6TEC9", false)) {
239  hitRecoveryCounters.resize(k_END_OF_LAYERS, 0);
240  hitTotalCounters.resize(k_END_OF_LAYERS, 0);
241  missHitPerLayer.resize(k_END_OF_LAYERS, 0);
242  totalNbHits = 0;
243 
244  nTEClayers_ = (showRings_ ? 7 : 9); // number of rings or wheels
245 
246  const std::string badModulesFile = conf.getUntrackedParameter<std::string>("BadModulesFile", "");
247  if (!badModulesFile.empty()) {
248  std::ifstream badModules_file(badModulesFile);
249  uint32_t badmodule_detid;
250  int mods, fiber1, fiber2, fiber3;
251  if (badModules_file.is_open()) {
253  while (getline(badModules_file, line)) {
254  if (badModules_file.eof())
255  continue;
256  std::stringstream ss(line);
257  ss >> badmodule_detid >> mods >> fiber1 >> fiber2 >> fiber3;
258  if (badmodule_detid != 0 && mods == 1 && (fiber1 == 1 || fiber2 == 1 || fiber3 == 1))
259  badModules_.insert(badmodule_detid);
260  }
261  badModules_file.close();
262  }
263  }
264  if (!badModules_.empty())
265  LogDebug("SiStripHitEfficiencyWorker") << "Remove additionnal bad modules from the analysis: ";
266  for (const auto badMod : badModules_) {
267  LogDebug("SiStripHitEfficiencyWorker") << " " << badMod;
268  }
269 }
270 
272  const edm::Run& run,
273  const edm::EventSetup& setup) {
274  booker.setCurrentFolder(fmt::format("{}/EventInfo", dqmDir_));
275  h_bx = booker.book1D("bx", "bx", 3600, 0, 3600);
276  h_instLumi = booker.book1D("instLumi", "inst. lumi.", 250, 0, 25000);
277  h_PU = booker.book1D("PU", "PU", 200, 0, 200);
278  h_nTracks = booker.book1D("ntracks", "n.tracks;n. tracks;n.events", 500, -0.5, 499.5);
279  h_nTracksVsPU = booker.bookProfile("nTracksVsPU", "n. tracks vs PU; PU; n.tracks ", 200, 0, 200, 500, -0.5, 499.5);
280 
281  calibData_.EventStats = booker.book2I("EventStats", "Statistics", 3, -0.5, 2.5, 1, 0, 1);
282  calibData_.EventStats->setBinLabel(1, "events count", 1);
283  calibData_.EventStats->setBinLabel(2, "tracks count", 1);
284  calibData_.EventStats->setBinLabel(3, "measurements count", 1);
285 
286  booker.setCurrentFolder(dqmDir_);
287  h_goodLayer = EffME1(booker.book1D("goodlayer_total", "goodlayer_total", 35, 0., 35.),
288  booker.book1D("goodlayer_found", "goodlayer_found", 35, 0., 35.));
289  h_allLayer = EffME1(booker.book1D("alllayer_total", "alllayer_total", 35, 0., 35.),
290  booker.book1D("alllayer_found", "alllayer_found", 35, 0., 35.));
291 
292  h_layer = EffME1(
293  booker.book1D(
294  "layer_found", "layer_found", bounds::k_END_OF_LAYERS, 0., static_cast<float>(bounds::k_END_OF_LAYERS)),
295  booker.book1D(
296  "layer_total", "layer_total", bounds::k_END_OF_LAYERS, 0., static_cast<float>(bounds::k_END_OF_LAYERS)));
297 
298  for (int layer = 1; layer != bounds::k_END_OF_LAYERS; ++layer) {
299  const auto lyrName = ::layerName(layer, showRings_, nTEClayers_);
300 
301  // book resolutions
302  booker.setCurrentFolder(fmt::format("{}/Resolutions", dqmDir_));
303  auto ihres = booker.book1D(Form("resol_layer_%i", layer), lyrName, 125, -125., 125.);
304  ihres->setAxisTitle("trajX-clusX [strip unit]");
305  h_resolution.push_back(ihres);
306 
307  // book plots vs Lumi
308  booker.setCurrentFolder(fmt::format("{}/VsLumi", dqmDir_));
309  h_layer_vsLumi.push_back(EffME1(booker.book1D(Form("layertotal_vsLumi_layer_%i", layer), lyrName, 100, 0, 25000),
310  booker.book1D(Form("layerfound_vsLumi_layer_%i", layer), lyrName, 100, 0, 25000)));
311 
312  // book plots vs Lumi
313  booker.setCurrentFolder(fmt::format("{}/VsPu", dqmDir_));
314  h_layer_vsPU.push_back(EffME1(booker.book1D(Form("layertotal_vsPU_layer_%i", layer), lyrName, 45, 0, 90),
315  booker.book1D(Form("layerfound_vsPU_layer_%i", layer), lyrName, 45, 0, 90)));
316  if (addCommonMode_) {
317  // book plots for common mode
318  booker.setCurrentFolder(fmt::format("{}/CommonMode", dqmDir_));
319  h_layer_vsCM.push_back(EffME1(booker.book1D(Form("layertotal_vsCM_layer_%i", layer), lyrName, 20, 0, 400),
320  booker.book1D(Form("layerfound_vsCM_layer_%i", layer), lyrName, 20, 0, 400)));
321  }
322 
323  // book plots vs Lumi
324  booker.setCurrentFolder(fmt::format("{}/VsBx", dqmDir_));
325  h_layer_vsBx.push_back(EffME1(
326  booker.book1D(Form("totalVsBx_layer%i", layer), Form("layer %i (%s)", layer, lyrName.c_str()), 3565, 0, 3565),
327  booker.book1D(Form("foundVsBx_layer%i", layer), Form("layer %i (%s)", layer, lyrName.c_str()), 3565, 0, 3565)));
328 
329  // book hot and cold
330  booker.setCurrentFolder(fmt::format("{}/MissingHits", dqmDir_));
331  if (layer <= bounds::k_LayersAtTOBEnd) {
332  const bool isTIB = layer <= bounds::k_LayersAtTIBEnd;
333  const auto partition = (isTIB ? "TIB" : "TOB");
334  const auto yMax = (isTIB ? 100 : 120);
335 
336  const auto& tit =
337  Form("%s%i: Map of missing hits", partition, (isTIB ? layer : layer - bounds::k_LayersAtTIBEnd));
338 
339  // histogram name must not contain ":" otherwise it fails upload to the GUI
340  // see https://github.com/cms-DQM/dqmgui_prod/blob/af0a388e8f57c60e51111585d298aeeea943367f/src/cpp/DQM/DQMStore.cc#L56
341  std::string name{tit};
342  ::replaceInString(name, ":", "");
343 
344  auto ihhotcold = booker.book2D(name, tit, 100, -1, 361, 100, -yMax, yMax);
345  ihhotcold->setAxisTitle("#phi [deg]", 1);
346  ihhotcold->setBinLabel(1, "360", 1);
347  ihhotcold->setBinLabel(50, "180", 1);
348  ihhotcold->setBinLabel(100, "0", 1);
349  ihhotcold->setAxisTitle("Global Z [cm]", 2);
350  ihhotcold->setOption("colz");
351  h_hotcold.push_back(ihhotcold);
352  } else {
353  const bool isTID = layer <= bounds::k_LayersAtTIDEnd;
354  const auto partitions =
355  (isTID ? std::vector<std::string>{"TIDplus", "TIDminus"} : std::vector<std::string>{"TECplus", "TECminus"});
356  const auto axMax = (isTID ? 100 : 120);
357  for (const auto& part : partitions) {
358  // create the title by replacing the minus/plus symbols
359  std::string forTitle{part};
360  ::replaceInString(forTitle, "minus", "-");
361  ::replaceInString(forTitle, "plus", "+");
362 
363  // histogram name must not contain ":" otherwise it fails upload to the GUI
364  // see https://github.com/cms-DQM/dqmgui_prod/blob/af0a388e8f57c60e51111585d298aeeea943367f/src/cpp/DQM/DQMStore.cc#L56
365  const auto& name = Form("%s %i Map of Missing Hits",
366  part.c_str(),
367  (isTID ? layer - bounds::k_LayersAtTOBEnd : layer - bounds::k_LayersAtTIDEnd));
368  const auto& tit = Form("%s%i: Map of Missing Hits",
369  forTitle.c_str(),
370  (isTID ? layer - bounds::k_LayersAtTOBEnd : layer - bounds::k_LayersAtTIDEnd));
371 
372  auto ihhotcold = booker.book2D(name, tit, 100, -axMax, axMax, 100, -axMax, axMax);
373  ihhotcold->setAxisTitle("Global Y", 1);
374  ihhotcold->setBinLabel(1, "+Y", 1);
375  ihhotcold->setBinLabel(50, "0", 1);
376  ihhotcold->setBinLabel(100, "-Y", 1);
377  ihhotcold->setAxisTitle("Global X", 2);
378  ihhotcold->setBinLabel(1, "-X", 2);
379  ihhotcold->setBinLabel(50, "0", 2);
380  ihhotcold->setBinLabel(100, "+X", 2);
381  ihhotcold->setOption("colz");
382  h_hotcold.push_back(ihhotcold);
383  }
384  }
385  }
386 
387  // come back to the main folder
388  booker.setCurrentFolder(dqmDir_);
389  const auto tkDetMapFolder = fmt::format("{}/TkDetMaps", dqmDir_);
390 
391  const TkDetMap* tkDetMap = &setup.getData(tkDetMapToken_);
392  h_module =
393  EffTkMap(std::make_unique<TkHistoMap>(tkDetMap, booker, tkDetMapFolder, "perModule_total", 0, false, true),
394  std::make_unique<TkHistoMap>(tkDetMap, booker, tkDetMapFolder, "perModule_found", 0, false, true));
395 
396  // fill the FED Errors
397  booker.setCurrentFolder(dqmDir_);
398  const auto FEDErrorMapFolder = fmt::format("{}/FEDErrorTkDetMaps", dqmDir_);
400  std::make_unique<TkHistoMap>(tkDetMap, booker, FEDErrorMapFolder, "perModule_FEDErrors", 0, false, true);
401 }
402 
404  const auto tTopo = &es.getData(tTopoToken_);
405 
406  // bool DEBUG_ = false;
407 
408  LogDebug("SiStripHitEfficiencyWorker") << "beginning analyze from HitEff";
409 
410  // Step A: Get Inputs
411 
412  // Luminosity informations
415 
416  float instLumi = 0;
417  float PU = 0;
418  if (addLumi_) {
419  if (lumiScalers.isValid() && !lumiScalers->empty()) {
420  if (lumiScalers->begin() != lumiScalers->end()) {
421  instLumi = lumiScalers->begin()->instantLumi();
422  PU = lumiScalers->begin()->pileup();
423  }
424  } else if (metaData.isValid()) {
425  instLumi = metaData->instLumi();
426  PU = metaData->avgPileUp();
427  } else {
428  edm::LogWarning("SiStripHitEfficiencyWorker") << "could not find a source for the Luminosity and PU";
429  }
430  }
431 
432  h_bx->Fill(e.bunchCrossing());
434  h_PU->Fill(PU);
435 
437  if (addCommonMode_)
438  e.getByToken(commonModeToken_, commonModeDigis);
439 
441  e.getByToken(combinatorialTracks_token_, tracksCKF);
442 
443  edm::Handle<std::vector<Trajectory>> TrajectoryCollectionCKF;
444  e.getByToken(trajectories_token_, TrajectoryCollectionCKF);
445 
446  edm::Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
447  e.getByToken(trajTrackAsso_token_, trajTrackAssociationHandle);
448 
450  e.getByToken(clusters_token_, theClusters);
451 
452  // get the list of module IDs with FED-detected errors
453  // - In Aug-2023, the data format was changed from DetIdCollection to DetIdVector.
454  // - To provide some level of backward-compatibility,
455  // the plugin checks for both types giving preference to the new format.
456  // - If only the old format is available, the collection is
457  // converted to the new format, then used downstream.
458  auto const& fedErrorIdsCol_h = e.getHandle(digisCol_token_);
459  auto const& fedErrorIdsVec_h = e.getHandle(digisVec_token_);
460  if (not fedErrorIdsCol_h.isValid() and not fedErrorIdsVec_h.isValid()) {
461  throw cms::Exception("InvalidProductSiStripDetIdsWithFEDErrors")
462  << "no valid product for SiStrip DetIds with FED errors (see parameter \"siStripDigis\"), "
463  "neither for new format (DetIdVector) nor old format (DetIdCollection)";
464  }
465  auto const& fedErrorIds = fedErrorIdsVec_h.isValid() ? *fedErrorIdsVec_h : fedErrorIdsCol_h->as_vector();
466 
467  // fill the calibData with the FEDErrors
468  for (const auto& fedErr : fedErrorIds) {
469  // fill the TkHistoMap occupancy map
470  calibData_.FEDErrorOccupancy->fill(fedErr.rawId(), 1.);
471 
472  // fill the unordered map
473  if (calibData_.fedErrorCounts.find(fedErr.rawId()) != calibData_.fedErrorCounts.end()) {
474  calibData_.fedErrorCounts[fedErr.rawId()] += 1;
475  } else {
476  calibData_.fedErrorCounts.insert(std::make_pair(fedErr.rawId(), 1));
477  }
478  }
479 
482 
483  const auto tkgeom = &es.getData(tkGeomToken_);
484  const auto& stripcpe = es.getData(stripCPEToken_);
485  const auto& stripQuality = es.getData(stripQualityToken_);
486  const auto& magField = es.getData(magFieldToken_);
487  const auto& measTracker = es.getData(measTrackerToken_);
488  const auto& chi2Estimator = es.getData(chi2EstimatorToken_);
489  const auto& prop = es.getData(propagatorToken_);
490 
491  // Tracking
492  LogDebug("SiStripHitEfficiencyWorker") << "number ckf tracks found = " << tracksCKF->size();
493 
494  h_nTracks->Fill(tracksCKF->size());
495  h_nTracksVsPU->Fill(PU, tracksCKF->size());
496 
497  // bin 0: one entry for each event
498  calibData_.EventStats->Fill(0., 0., 1);
499  // bin 1: one entry for each track
500  calibData_.EventStats->Fill(1., 0., tracksCKF->size());
501 
502  if (!tracksCKF->empty()) {
503  if (cutOnTracks_ && (tracksCKF->size() >= trackMultiplicityCut_))
504  return;
505  if (cutOnTracks_)
506  LogDebug("SiStripHitEfficiencyWorker")
507  << "starting checking good event with < " << trackMultiplicityCut_ << " tracks";
508 
509  // actually should do a loop over all the tracks in the event here
510 
511  // Looping over traj-track associations to be able to get traj & track informations
512  for (const auto& trajTrack : *trajTrackAssociationHandle) {
513  // for each track, fill some variables such as number of hits and momentum
514 
515  const bool highPurity = trajTrack.val->quality(reco::TrackBase::TrackQuality::highPurity);
516  auto TMeas = trajTrack.key->measurements();
517  totalNbHits += int(TMeas.size());
518 
519  /*
520  const bool hasMissingHits = std::any_of(std::begin(TMeas), std::end(TMeas), [](const auto& tm) {
521  return tm.recHit()->getType() == TrackingRecHit::Type::missing;
522  });
523  */
524 
525  // Check whether the trajectory has some missing hits
526  bool hasMissingHits{false};
527  int previous_layer{999};
528  std::vector<unsigned int> missedLayers;
529 
530  for (const auto& itm : TMeas) {
531  auto theHit = itm.recHit();
532  unsigned int iidd = theHit->geographicalId().rawId();
533  int layer = ::checkLayer(iidd, tTopo);
534  int missedLayer = layer + 1;
535  int previousMissedLayer = (layer + 2);
536  int diffPreviousLayer = (layer - previous_layer);
538  //Layers from TIB + TOB
539  if (diffPreviousLayer == -2 && missedLayer > k_LayersStart && missedLayer < k_LayersAtTOBEnd) {
540  missHitPerLayer[missedLayer] += 1;
541  hasMissingHits = true;
542  }
543  //Layers from TID
544  else if (diffPreviousLayer == -2 && (missedLayer > k_LayersAtTOBEnd + 1 && missedLayer <= k_LayersAtTIDEnd)) {
545  missHitPerLayer[missedLayer] += 1;
546  hasMissingHits = true;
547  }
548  //Layers from TEC
549  else if (diffPreviousLayer == -2 && missedLayer > k_LayersAtTIDEnd && missedLayer <= k_LayersAtTECEnd) {
550  missHitPerLayer[missedLayer] += 1;
551  hasMissingHits = true;
552  }
553 
554  //##### TID Layer 11 in transition TID -> TIB : layer is in TIB, previous layer = 12
555  if ((layer > k_LayersStart && layer <= k_LayersAtTIBEnd) && (previous_layer == 12)) {
556  missHitPerLayer[11] += 1;
557  hasMissingHits = true;
558  }
559 
560  //##### TEC Layer 14 in transition TEC -> TOB : layer is in TOB, previous layer = 15
561  if ((layer > k_LayersAtTIBEnd && layer <= k_LayersAtTOBEnd) && (previous_layer == 15)) {
562  missHitPerLayer[14] += 1;
563  hasMissingHits = true;
564  }
565 
566  //####### Consecutive missing hits case #######
567 
568  //##### Layers from TIB + TOB
569  if (diffPreviousLayer == -3 && missedLayer > k_LayersStart && missedLayer < k_LayersAtTOBEnd &&
570  previousMissedLayer > k_LayersStart && previousMissedLayer < k_LayersAtTOBEnd) {
571  missHitPerLayer[missedLayer] += 1;
572  missHitPerLayer[previousMissedLayer] += 1;
573  hasMissingHits = true;
574  }
575 
576  //##### Layers from TEC
577  else if (diffPreviousLayer == -3 && missedLayer > k_LayersAtTIDEnd && missedLayer <= k_LayersAtTECEnd &&
578  previousMissedLayer > k_LayersAtTIDEnd && previousMissedLayer <= k_LayersAtTECEnd) {
579  missHitPerLayer[missedLayer] += 1;
580  missHitPerLayer[previousMissedLayer] += 1;
581  hasMissingHits = true;
582  }
583  }
584  if (theHit->getType() == TrackingRecHit::Type::missing)
585  hasMissingHits = true;
586 
587  if (hasMissingHits)
588  missedLayers.push_back(layer);
589  previous_layer = layer;
590  }
591 
592  // Loop on each measurement and take into consideration
593  //--------------------------------------------------------
594  unsigned int prev_TKlayers = 0;
595  for (auto itm = TMeas.cbegin(); itm != TMeas.cend(); ++itm) {
596  const auto theInHit = (*itm).recHit();
597 
598  //bin 2: one entry for each measurement
599  calibData_.EventStats->Fill(2., 0., 1.);
600 
601  LogDebug("SiStripHitEfficiencyWorker") << "theInHit is valid = " << theInHit->isValid();
602 
603  unsigned int iidd = theInHit->geographicalId().rawId();
604 
605  unsigned int TKlayers = ::checkLayer(iidd, tTopo);
606 
607  bool foundConsMissingHits{false};
608 
609  // do not bother with pixel hits
610  if (DetId(iidd).subdetId() < SiStripSubdetector::TIB)
611  continue;
612 
613  LogDebug("SiStripHitEfficiencyWorker") << "TKlayer from trajectory: " << TKlayers << " from module = " << iidd
614  << " matched/stereo/rphi = " << ((iidd & 0x3) == 0) << "/"
615  << ((iidd & 0x3) == 1) << "/" << ((iidd & 0x3) == 2);
616 
617  // Test first and last points of the trajectory
618  // the list of measurements starts from outer layers !!! This could change -> should add a check
619  bool isFirstMeas = (itm == (TMeas.end() - 1));
620  bool isLastMeas = (itm == (TMeas.begin()));
621 
622  if (!useFirstMeas_ && isFirstMeas)
623  continue;
624  if (!useLastMeas_ && isLastMeas)
625  continue;
626 
627  // In case of missing hit in the track, check whether to use the other hits or not.
628  if (hasMissingHits && theInHit->getType() != TrackingRecHit::Type::missing &&
630  continue;
631 
632  // If Trajectory measurement from TOB 6 or TEC 9, skip it because it's always valid they are filled later
633  if (TKlayers == bounds::k_LayersAtTOBEnd || TKlayers == bounds::k_LayersAtTECEnd) {
634  LogDebug("SiStripHitEfficiencyWorker") << "skipping original TM for TOB 6 or TEC 9";
635  continue;
636  }
637 
638  std::vector<TrajectoryAtInvalidHit> TMs;
639 
640  // Make AnalyticalPropagat // TODO where to save these?or to use in TAVH constructor
642 
643  // for double sided layers check both sensors--if no hit was found on either sensor surface,
644  // the trajectory measurements only have one invalid hit entry on the matched surface
645  // so get the TrajectoryAtInvalidHit for both surfaces and include them in the study
646  if (::isDoubleSided(iidd, tTopo) && ((iidd & 0x3) == 0)) {
647  // do hit eff check twice--once for each sensor
648  //add a TM for each surface
649  TMs.emplace_back(*itm, tTopo, tkgeom, propagator, 1);
650  TMs.emplace_back(*itm, tTopo, tkgeom, propagator, 2);
651  } else if (::isDoubleSided(iidd, tTopo) && (!::check2DPartner(iidd, TMeas))) {
652  // if only one hit was found the trajectory measurement is on that sensor surface, and the other surface from
653  // the matched layer should be added to the study as well
654  TMs.emplace_back(*itm, tTopo, tkgeom, propagator, 1);
655  TMs.emplace_back(*itm, tTopo, tkgeom, propagator, 2);
656  LogDebug("SiStripHitEfficiencyWorker") << " found a hit with a missing partner";
657  } else {
658  //only add one TM for the single surface and the other will be added in the next iteration
659  TMs.emplace_back(*itm, tTopo, tkgeom, propagator);
660  }
661 
662  bool missingHitAdded{false};
663  std::vector<TrajectoryMeasurement> tmpTmeas, prev_tmpTmeas;
664  unsigned int misLayer = TKlayers + 1;
665  unsigned int previousMisLayer = TKlayers + 2;
666  //Use bool doMissingHitsRecovery to add possible missing hits based on actual/previous hit
668  if (int(TKlayers) - int(prev_TKlayers) == -2) {
669  const DetLayer* detlayer = itm->layer();
670  const LayerMeasurements layerMeasurements{measTracker, *measurementTrackerEvent};
671  const TrajectoryStateOnSurface tsos = itm->updatedState();
672  std::vector<DetLayer::DetWithState> compatDets = detlayer->compatibleDets(tsos, prop, chi2Estimator);
673 
674  if (misLayer > k_LayersAtTIDEnd && misLayer < k_LayersAtTECEnd) { //TEC
675  std::vector<ForwardDetLayer const*> negTECLayers = measTracker.geometricSearchTracker()->negTecLayers();
676  std::vector<ForwardDetLayer const*> posTECLayers = measTracker.geometricSearchTracker()->posTecLayers();
677  const DetLayer* tecLayerneg = negTECLayers[misLayer - k_LayersAtTIDEnd - 1];
678  const DetLayer* tecLayerpos = posTECLayers[misLayer - k_LayersAtTIDEnd - 1];
679  if (tTopo->tecSide(iidd) == 1) {
680  tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, prop, chi2Estimator);
681  } else if (tTopo->tecSide(iidd) == 2) {
682  tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, prop, chi2Estimator);
683  }
684  }
685 
686  else if (misLayer == (k_LayersAtTIDEnd - 1) ||
687  misLayer == k_LayersAtTIDEnd) { // This is for TID layers 12 and 13
688  std::vector<ForwardDetLayer const*> negTIDLayers = measTracker.geometricSearchTracker()->negTidLayers();
689  std::vector<ForwardDetLayer const*> posTIDLayers = measTracker.geometricSearchTracker()->posTidLayers();
690  const DetLayer* tidLayerneg = negTIDLayers[misLayer - k_LayersAtTOBEnd - 1];
691  const DetLayer* tidLayerpos = posTIDLayers[misLayer - k_LayersAtTOBEnd - 1];
692 
693  if (tTopo->tidSide(iidd) == 1) {
694  tmpTmeas = layerMeasurements.measurements(*tidLayerneg, tsos, prop, chi2Estimator);
695  } else if (tTopo->tidSide(iidd) == 2) {
696  tmpTmeas = layerMeasurements.measurements(*tidLayerpos, tsos, prop, chi2Estimator);
697  }
698  }
699 
700  if (misLayer > k_LayersStart && misLayer < k_LayersAtTOBEnd) { // Barrel
701 
702  std::vector<BarrelDetLayer const*> barrelTIBLayers = measTracker.geometricSearchTracker()->tibLayers();
703  std::vector<BarrelDetLayer const*> barrelTOBLayers = measTracker.geometricSearchTracker()->tobLayers();
704 
705  if (misLayer > k_LayersStart && misLayer <= k_LayersAtTIBEnd) {
706  const DetLayer* tibLayer = barrelTIBLayers[misLayer - k_LayersStart - 1];
707  tmpTmeas = layerMeasurements.measurements(*tibLayer, tsos, prop, chi2Estimator);
708  } else if (misLayer > k_LayersAtTIBEnd && misLayer < k_LayersAtTOBEnd) {
709  const DetLayer* tobLayer = barrelTOBLayers[misLayer - k_LayersAtTIBEnd - 1];
710  tmpTmeas = layerMeasurements.measurements(*tobLayer, tsos, prop, chi2Estimator);
711  }
712  }
713  }
714  if ((int(TKlayers) > k_LayersStart && int(TKlayers) <= k_LayersAtTIBEnd) && int(prev_TKlayers) == 12) {
715  const DetLayer* detlayer = itm->layer();
716  const LayerMeasurements layerMeasurements{measTracker, *measurementTrackerEvent};
717  const TrajectoryStateOnSurface tsos = itm->updatedState();
718  std::vector<DetLayer::DetWithState> compatDets = detlayer->compatibleDets(tsos, prop, chi2Estimator);
719  std::vector<ForwardDetLayer const*> negTIDLayers = measTracker.geometricSearchTracker()->negTidLayers();
720  std::vector<ForwardDetLayer const*> posTIDLayers = measTracker.geometricSearchTracker()->posTidLayers();
721 
722  const DetLayer* tidLayerneg = negTIDLayers[k_LayersStart];
723  const DetLayer* tidLayerpos = posTIDLayers[k_LayersStart];
724  if (tTopo->tidSide(iidd) == 1) {
725  tmpTmeas = layerMeasurements.measurements(*tidLayerneg, tsos, prop, chi2Estimator);
726  } else if (tTopo->tidSide(iidd) == 2) {
727  tmpTmeas = layerMeasurements.measurements(*tidLayerpos, tsos, prop, chi2Estimator);
728  }
729  }
730 
731  if ((int(TKlayers) > k_LayersAtTIBEnd && int(TKlayers) <= k_LayersAtTOBEnd) && int(prev_TKlayers) == 15) {
732  const DetLayer* detlayer = itm->layer();
733  const LayerMeasurements layerMeasurements{measTracker, *measurementTrackerEvent};
734  const TrajectoryStateOnSurface tsos = itm->updatedState();
735  std::vector<DetLayer::DetWithState> compatDets = detlayer->compatibleDets(tsos, prop, chi2Estimator);
736 
737  std::vector<ForwardDetLayer const*> negTECLayers = measTracker.geometricSearchTracker()->negTecLayers();
738  std::vector<ForwardDetLayer const*> posTECLayers = measTracker.geometricSearchTracker()->posTecLayers();
739 
740  const DetLayer* tecLayerneg = negTECLayers[k_LayersStart];
741  const DetLayer* tecLayerpos = posTECLayers[k_LayersStart];
742  if (tTopo->tecSide(iidd) == 1) {
743  tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, prop, chi2Estimator);
744  } else if (tTopo->tecSide(iidd) == 2) {
745  tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, prop, chi2Estimator);
746  }
747  }
748 
749  //Test for two consecutive missing hits
750  if (int(TKlayers) - int(prev_TKlayers) == -3) {
751  foundConsMissingHits = true;
752  const DetLayer* detlayer = itm->layer();
753  const LayerMeasurements layerMeasurements{measTracker, *measurementTrackerEvent};
754  const TrajectoryStateOnSurface tsos = itm->updatedState();
755  std::vector<DetLayer::DetWithState> compatDets = detlayer->compatibleDets(tsos, prop, chi2Estimator);
756 
757  if (misLayer > k_LayersStart && misLayer <= k_LayersAtTOBEnd && previousMisLayer > k_LayersStart &&
758  previousMisLayer <= k_LayersAtTOBEnd) { //Barrel case
759  std::vector<BarrelDetLayer const*> barrelTIBLayers = measTracker.geometricSearchTracker()->tibLayers();
760  std::vector<BarrelDetLayer const*> barrelTOBLayers = measTracker.geometricSearchTracker()->tobLayers();
761  if (misLayer > k_LayersStart && misLayer < k_LayersAtTIBEnd) {
762  const DetLayer* tibLayer = barrelTIBLayers[misLayer - k_LayersStart - 1];
763  const DetLayer* prevTibLayer = barrelTIBLayers[previousMisLayer - k_LayersStart - 1];
764 
765  tmpTmeas = layerMeasurements.measurements(*tibLayer, tsos, prop, chi2Estimator);
766  prev_tmpTmeas = layerMeasurements.measurements(*prevTibLayer, tsos, prop, chi2Estimator);
767  } else if (misLayer > k_LayersAtTIBEnd && misLayer < k_LayersAtTOBEnd) {
768  const DetLayer* tobLayer = barrelTOBLayers[misLayer - k_LayersAtTIBEnd - 1];
769  const DetLayer* prevTobLayer = barrelTOBLayers[previousMisLayer - k_LayersAtTIBEnd - 1];
770  tmpTmeas = layerMeasurements.measurements(*tobLayer, tsos, prop, chi2Estimator);
771  prev_tmpTmeas = layerMeasurements.measurements(*prevTobLayer, tsos, prop, chi2Estimator);
772  }
773  } else if (misLayer > k_LayersAtTIDEnd && misLayer < k_LayersAtTECEnd &&
774  previousMisLayer > k_LayersAtTIDEnd && previousMisLayer < k_LayersAtTECEnd) { //TEC
775  std::vector<ForwardDetLayer const*> negTECLayers = measTracker.geometricSearchTracker()->negTecLayers();
776  std::vector<ForwardDetLayer const*> posTECLayers = measTracker.geometricSearchTracker()->posTecLayers();
777 
778  const DetLayer* tecLayerneg = negTECLayers[misLayer - k_LayersAtTIDEnd - 1];
779  const DetLayer* prevTecLayerneg = negTECLayers[previousMisLayer - k_LayersAtTIDEnd - 1];
780 
781  const DetLayer* tecLayerpos = posTECLayers[misLayer - k_LayersAtTIDEnd - 1];
782  const DetLayer* prevTecLayerpos = posTECLayers[previousMisLayer - k_LayersAtTIDEnd - 1];
783 
784  if (tTopo->tecSide(iidd) == 1) {
785  tmpTmeas = layerMeasurements.measurements(*tecLayerneg, tsos, prop, chi2Estimator);
786  prev_tmpTmeas = layerMeasurements.measurements(*prevTecLayerneg, tsos, prop, chi2Estimator);
787  } else if (tTopo->tecSide(iidd) == 2) {
788  tmpTmeas = layerMeasurements.measurements(*tecLayerpos, tsos, prop, chi2Estimator);
789  prev_tmpTmeas = layerMeasurements.measurements(*prevTecLayerpos, tsos, prop, chi2Estimator);
790  }
791  }
792  }
793  if (!tmpTmeas.empty() && !foundConsMissingHits) {
794  TrajectoryMeasurement TM_tmp(tmpTmeas.back());
795  unsigned int iidd_tmp = TM_tmp.recHit()->geographicalId().rawId();
796  if (iidd_tmp != 0) {
797  LogDebug("SiStripHitEfficiency:HitEff") << " hit actually being added to TM vector";
798  if ((!useAllHitsFromTracksWithMissingHits_ || (!useFirstMeas_ && isFirstMeas)))
799  TMs.clear();
800  if (::isDoubleSided(iidd_tmp, tTopo)) {
801  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp, tTopo, tkgeom, propagator, 1));
802  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp, tTopo, tkgeom, propagator, 2));
803  } else
804  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp, tTopo, tkgeom, propagator));
805  missingHitAdded = true;
806  hitRecoveryCounters[misLayer] += 1;
807  }
808  }
809 
810  if (!tmpTmeas.empty() && !prev_tmpTmeas.empty() &&
811  foundConsMissingHits) { //Found two consecutive missing hits
812  TrajectoryMeasurement TM_tmp1(tmpTmeas.back());
813  TrajectoryMeasurement TM_tmp2(prev_tmpTmeas.back());
814  //Inner and outer hits module IDs
815  unsigned int modIdInner = TM_tmp1.recHit()->geographicalId().rawId();
816  unsigned int modIdOuter = TM_tmp2.recHit()->geographicalId().rawId();
817  bool innerModInactive = false, outerModInactive = false;
818  for (const auto& tm : tmpTmeas) { //Check if inner module is inactive
819  unsigned int tmModId = tm.recHit()->geographicalId().rawId();
820  if (tmModId == modIdInner && tm.recHit()->getType() == 2) {
821  innerModInactive = true;
822  break;
823  }
824  }
825  for (const auto& tm : prev_tmpTmeas) { //Check if outer module is inactive
826  unsigned int tmModId = tm.recHit()->geographicalId().rawId();
827  if (tmModId == modIdOuter && tm.recHit()->getType() == 2) {
828  outerModInactive = true;
829  break; //Found the inactive module
830  }
831  }
832 
833  if (outerModInactive) { //If outer missing hit is in inactive module, recover the inner one
834  if (modIdInner != 0) {
835  LogDebug("SiStripHitEfficiency:HitEff") << " hit actually being added to TM vector";
836  if ((!useAllHitsFromTracksWithMissingHits_ || (!useFirstMeas_ && isFirstMeas)))
837  TMs.clear();
838  if (::isDoubleSided(modIdInner, tTopo)) {
839  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp1, tTopo, tkgeom, propagator, 1));
840  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp1, tTopo, tkgeom, propagator, 2));
841  } else
842  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp1, tTopo, tkgeom, propagator));
843  missingHitAdded = true;
844  hitRecoveryCounters[misLayer] += 1;
845  }
846  }
847  if (innerModInactive) { //If inner missing hit is in inactive module, recover the outer one
848  if (modIdOuter != 0) {
849  LogDebug("SiStripHitEfficiency:HitEff") << " hit actually being added to TM vector";
850  if ((!useAllHitsFromTracksWithMissingHits_ || (!useFirstMeas_ && isFirstMeas)))
851  TMs.clear();
852  if (::isDoubleSided(modIdOuter, tTopo)) {
853  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp2, tTopo, tkgeom, propagator, 1));
854  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp2, tTopo, tkgeom, propagator, 2));
855  } else
856  TMs.push_back(TrajectoryAtInvalidHit(TM_tmp2, tTopo, tkgeom, propagator));
857  missingHitAdded = true;
858  hitRecoveryCounters[previousMisLayer] += 1;
859  }
860  }
861  }
862  }
863 
864  prev_TKlayers = TKlayers;
865  if (!useFirstMeas_ && isFirstMeas && !missingHitAdded)
866  continue;
867  if (!useLastMeas_ && isLastMeas)
868  continue;
869  bool hitsWithBias = false;
870  for (auto ilayer : missedLayers) {
871  if (ilayer < TKlayers)
872  hitsWithBias = true;
873  }
874  if (hasMissingHits && theInHit->getType() != TrackingRecHit::Type::missing && !missingHitAdded &&
875  hitsWithBias && !useAllHitsFromTracksWithMissingHits_) {
876  continue;
877  }
878 
880  //Now check for tracks at TOB6 and TEC9
881 
882  // to make sure we only propagate on the last TOB5 hit check the next entry isn't also in TOB5
883  // to avoid bias, make sure the TOB5 hit is valid (an invalid hit on TOB5 could only exist with a valid hit on TOB6)
884  const auto nextId = (itm + 1 != TMeas.end()) ? (itm + 1)->recHit()->geographicalId() : DetId{}; // null if last
885 
886  if (TKlayers == 9 && theInHit->isValid() && !((!nextId.null()) && (::checkLayer(nextId.rawId(), tTopo) == 9))) {
887  // if ( TKlayers==9 && itm==TMeas.rbegin()) {
888  // if ( TKlayers==9 && (itm==TMeas.back()) ) { // to check for only the last entry in the trajectory for propagation
889  const DetLayer* tob6 = measTracker.geometricSearchTracker()->tobLayers().back();
890  const LayerMeasurements theLayerMeasurements{measTracker, *measurementTrackerEvent};
891  const TrajectoryStateOnSurface tsosTOB5 = itm->updatedState();
892  const auto tmp = theLayerMeasurements.measurements(*tob6, tsosTOB5, prop, chi2Estimator);
893 
894  if (!tmp.empty()) {
895  LogDebug("SiStripHitEfficiencyWorker") << "size of TM from propagation = " << tmp.size();
896 
897  // take the last of the TMs, which is always an invalid hit
898  // if no detId is available, ie detId==0, then no compatible layer was crossed
899  // otherwise, use that TM for the efficiency measurement
900  const auto& tob6TM = tmp.back();
901  const auto& tob6Hit = tob6TM.recHit();
902  if (tob6Hit->geographicalId().rawId() != 0) {
903  LogDebug("SiStripHitEfficiencyWorker") << "tob6 hit actually being added to TM vector";
904  TMs.emplace_back(tob6TM, tTopo, tkgeom, propagator);
905  }
906  }
907  }
908 
909  // same for TEC8
910  if (TKlayers == 21 && theInHit->isValid() &&
911  !((!nextId.null()) && (::checkLayer(nextId.rawId(), tTopo) == 21))) {
912  const DetLayer* tec9pos = measTracker.geometricSearchTracker()->posTecLayers().back();
913  const DetLayer* tec9neg = measTracker.geometricSearchTracker()->negTecLayers().back();
914 
915  const LayerMeasurements theLayerMeasurements{measTracker, *measurementTrackerEvent};
916  const TrajectoryStateOnSurface tsosTEC9 = itm->updatedState();
917 
918  // check if track on positive or negative z
919  if (!(iidd == SiStripSubdetector::TEC))
920  LogDebug("SiStripHitEfficiencyWorker") << "there is a problem with TEC 9 extrapolation";
921 
922  //LogDebug("SiStripHitEfficiencyWorker") << " tec9 id = " << iidd << " and side = " << tTopo->tecSide(iidd) ;
923  std::vector<TrajectoryMeasurement> tmp;
924  if (tTopo->tecSide(iidd) == 1) {
925  tmp = theLayerMeasurements.measurements(*tec9neg, tsosTEC9, prop, chi2Estimator);
926  //LogDebug("SiStripHitEfficiencyWorker") << "on negative side" ;
927  }
928  if (tTopo->tecSide(iidd) == 2) {
929  tmp = theLayerMeasurements.measurements(*tec9pos, tsosTEC9, prop, chi2Estimator);
930  //LogDebug("SiStripHitEfficiencyWorker") << "on positive side" ;
931  }
932 
933  if (!tmp.empty()) {
934  // take the last of the TMs, which is always an invalid hit
935  // if no detId is available, ie detId==0, then no compatible layer was crossed
936  // otherwise, use that TM for the efficiency measurement
937  const auto& tec9TM = tmp.back();
938  const auto& tec9Hit = tec9TM.recHit();
939 
940  const unsigned int tec9id = tec9Hit->geographicalId().rawId();
941  LogDebug("SiStripHitEfficiencyWorker")
942  << "tec9id = " << tec9id << " is Double sided = " << ::isDoubleSided(tec9id, tTopo)
943  << " and 0x3 = " << (tec9id & 0x3);
944 
945  if (tec9Hit->geographicalId().rawId() != 0) {
946  LogDebug("SiStripHitEfficiencyWorker") << "tec9 hit actually being added to TM vector";
947  // in tec the hit can be single or doubled sided. whenever the invalid hit at the end of vector of TMs is
948  // double sided it is always on the matched surface, so we need to split it into the true sensor surfaces
949  if (::isDoubleSided(tec9id, tTopo)) {
950  TMs.emplace_back(tec9TM, tTopo, tkgeom, propagator, 1);
951  TMs.emplace_back(tec9TM, tTopo, tkgeom, propagator, 2);
952  } else
953  TMs.emplace_back(tec9TM, tTopo, tkgeom, propagator);
954  }
955  } //else LogDebug("SiStripHitEfficiencyWorker") << "tec9 tmp empty" ;
956  }
957 
958  for (const auto& tm : TMs) {
959  fillForTraj(tm,
960  tTopo,
961  tkgeom,
962  stripcpe,
963  stripQuality,
964  fedErrorIds,
965  commonModeDigis,
966  *theClusters,
967  e.bunchCrossing(),
968  instLumi,
969  PU,
970  highPurity);
971  }
972  LogDebug("SiStripHitEfficiencyWorker") << "After looping over TrajAtValidHit list";
973  }
974  LogDebug("SiStripHitEfficiencyWorker") << "end TMeasurement loop";
975  }
976  LogDebug("SiStripHitEfficiencyWorker") << "end of trajectories loop";
977  }
978 }
979 
981  const TrackerTopology* tTopo,
982  const TrackerGeometry* tkgeom,
983  const StripClusterParameterEstimator& stripCPE,
984  const SiStripQuality& stripQuality,
985  const DetIdVector& fedErrorIds,
986  const edm::Handle<edm::DetSetVector<SiStripRawDigi>>& commonModeDigis,
987  const edmNew::DetSetVector<SiStripCluster>& theClusters,
988  int bunchCrossing,
989  float instLumi,
990  float PU,
991  bool highPurity) {
992  // --> Get trajectory from combinatedStat& e
993  const auto iidd = tm.monodet_id();
994  LogDebug("SiStripHitEfficiencyWorker") << "setting iidd = " << iidd << " before checking efficiency and ";
995 
996  const auto xloc = tm.localX();
997  const auto yloc = tm.localY();
998 
999  const auto xErr = tm.localErrorX();
1000  const auto yErr = tm.localErrorY();
1001 
1002  int TrajStrip = -1;
1003 
1004  // reget layer from iidd here, to account for TOB 6 and TEC 9 TKlayers being off
1005  const auto TKlayers = ::checkLayer(iidd, tTopo);
1006 
1007  const bool withinAcceptance =
1008  tm.withinAcceptance() && (!::isInBondingExclusionZone(iidd, TKlayers, yloc, yErr, tTopo));
1009 
1010  if ( // (TKlayers > 0) && // FIXME confirm this
1011  ((layers_ == TKlayers) ||
1012  (layers_ == bounds::k_LayersStart))) { // Look at the layer not used to reconstruct the track
1013  LogDebug("SiStripHitEfficiencyWorker") << "Looking at layer under study";
1014  unsigned int ModIsBad = 2;
1015  unsigned int SiStripQualBad = 0;
1016  float commonMode = -100;
1017 
1018  // RPhi RecHit Efficiency
1019 
1020  if (!theClusters.empty()) {
1021  LogDebug("SiStripHitEfficiencyWorker") << "Checking clusters with size = " << theClusters.size();
1022  std::vector<::ClusterInfo> VCluster_info; //fill with X residual, X residual pull, local X
1023  const auto idsv = theClusters.find(iidd);
1024  if (idsv != theClusters.end()) {
1025  //if (DEBUG_) LogDebug("SiStripHitEfficiencyWorker") << "the ID from the dsv = " << dsv.id() ;
1026  LogDebug("SiStripHitEfficiencyWorker")
1027  << "found (ClusterId == iidd) with ClusterId = " << idsv->id() << " and iidd = " << iidd;
1028  const auto stripdet = dynamic_cast<const StripGeomDetUnit*>(tkgeom->idToDetUnit(DetId(iidd)));
1029  const StripTopology& Topo = stripdet->specificTopology();
1030 
1031  float hbedge = 0.0;
1032  float htedge = 0.0;
1033  float hapoth = 0.0;
1034  float uylfac = 0.0;
1035  float uxlden = 0.0;
1036  if (TKlayers > bounds::k_LayersAtTOBEnd) {
1037  const BoundPlane& plane = stripdet->surface();
1038  const TrapezoidalPlaneBounds* trapezoidalBounds(
1039  dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
1040  std::array<const float, 4> const& parameterTrap = (*trapezoidalBounds).parameters(); // el bueno aqui
1041  hbedge = parameterTrap[0];
1042  htedge = parameterTrap[1];
1043  hapoth = parameterTrap[3];
1044  uylfac = (htedge - hbedge) / (htedge + hbedge) / hapoth;
1045  uxlden = 1 + yloc * uylfac;
1046  }
1047 
1048  // Need to know position of trajectory in strip number for selecting the right APV later
1049  if (TrajStrip == -1) {
1050  int nstrips = Topo.nstrips();
1051  float pitch = stripdet->surface().bounds().width() / nstrips;
1052  TrajStrip = xloc / pitch + nstrips / 2.0;
1053  // Need additionnal corrections for endcap
1054  if (TKlayers > bounds::k_LayersAtTOBEnd) {
1055  const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
1056  hapoth); // radialy extrapolated x loc position at middle
1057  TrajStrip = TrajLocXMid / pitch + nstrips / 2.0;
1058  }
1059  //LogDebug("SiStripHitEfficiency")<<" Layer "<<TKlayers<<" TrajStrip: "<<nstrips<<" "<<pitch<<" "<<TrajStrip;;
1060  }
1061 
1062  for (const auto& clus : *idsv) {
1064  float res = (parameters.first.x() - xloc);
1065  float sigma = ::checkConsistency(parameters, xloc, xErr);
1066  // The consistency is probably more accurately measured with the Chi2MeasurementEstimator. To use it
1067  // you need a TransientTrackingRecHit instead of the cluster
1068  //theEstimator= new Chi2MeasurementEstimator(30);
1069  //const Chi2MeasurementEstimator *theEstimator(100);
1070  //theEstimator->estimate(tm.tsos(), TransientTrackingRecHit);
1071 
1072  if (TKlayers > bounds::k_LayersAtTOBEnd) {
1073  res = parameters.first.x() - xloc / uxlden; // radialy extrapolated x loc position at middle
1074  sigma = abs(res) / sqrt(parameters.second.xx() + xErr * xErr / uxlden / uxlden +
1075  yErr * yErr * xloc * xloc * uylfac * uylfac / uxlden / uxlden / uxlden / uxlden);
1076  }
1077 
1078  VCluster_info.emplace_back(res, sigma, parameters.first.x());
1079 
1080  LogDebug("SiStripHitEfficiencyWorker") << "Have ID match. residual = " << res << " res sigma = " << sigma;
1081  //LogDebug("SiStripHitEfficiencyWorker")
1082  // << "trajectory measurement compatability estimate = " << (*itm).estimate() ;
1083  LogDebug("SiStripHitEfficiencyWorker")
1084  << "hit position = " << parameters.first.x() << " hit error = " << sqrt(parameters.second.xx())
1085  << " trajectory position = " << xloc << " traj error = " << xErr;
1086  }
1087  }
1088  ::ClusterInfo finalCluster{1000.0, 1000.0, 0.0};
1089  if (!VCluster_info.empty()) {
1090  LogDebug("SiStripHitEfficiencyWorker") << "found clusters > 0";
1091  if (VCluster_info.size() > 1) {
1092  //get the smallest one
1093  for (const auto& res : VCluster_info) {
1094  if (std::abs(res.xResidualPull) < std::abs(finalCluster.xResidualPull)) {
1095  finalCluster = res;
1096  }
1097  LogDebug("SiStripHitEfficiencyWorker")
1098  << "iresidual = " << res.xResidual << " isigma = " << res.xResidualPull
1099  << " and FinalRes = " << finalCluster.xResidual;
1100  }
1101  } else {
1102  finalCluster = VCluster_info[0];
1103  }
1104  VCluster_info.clear();
1105  }
1106 
1107  LogDebug("SiStripHitEfficiencyWorker") << "Final residual in X = " << finalCluster.xResidual << "+-"
1108  << (finalCluster.xResidual / finalCluster.xResidualPull);
1109  LogDebug("SiStripHitEfficiencyWorker")
1110  << "Checking location of trajectory: abs(yloc) = " << abs(yloc) << " abs(xloc) = " << abs(xloc);
1111 
1112  //
1113  // fill ntuple varibles
1114 
1115  //if ( stripQuality->IsModuleBad(iidd) )
1116  if (stripQuality.getBadApvs(iidd) != 0) {
1117  SiStripQualBad = 1;
1118  LogDebug("SiStripHitEfficiencyWorker") << "strip is bad from SiStripQuality";
1119  } else {
1120  SiStripQualBad = 0;
1121  LogDebug("SiStripHitEfficiencyWorker") << "strip is good from SiStripQuality";
1122  }
1123 
1124  //check for FED-detected errors and include those in SiStripQualBad
1125  for (unsigned int ii = 0; ii < fedErrorIds.size(); ii++) {
1126  if (iidd == fedErrorIds[ii].rawId())
1127  SiStripQualBad = 1;
1128  }
1129 
1130  // CM of APV crossed by traj
1131  if (addCommonMode_)
1132  if (commonModeDigis.isValid() && TrajStrip >= 0 && TrajStrip <= 768) {
1133  const auto digiframe = commonModeDigis->find(iidd);
1134  if (digiframe != commonModeDigis->end())
1135  if ((unsigned)TrajStrip / sistrip::STRIPS_PER_APV < digiframe->data.size())
1136  commonMode = digiframe->data.at(TrajStrip / sistrip::STRIPS_PER_APV).adc();
1137  }
1138 
1139  LogDebug("SiStripHitEfficiencyWorker") << "before check good";
1140 
1141  if (finalCluster.xResidualPull < 999.0) { //could make requirement on track/hit consistency, but for
1142  //now take anything with a hit on the module
1143  LogDebug("SiStripHitEfficiencyWorker")
1144  << "hit being counted as good " << finalCluster.xResidual << " FinalRecHit " << iidd << " TKlayers "
1145  << TKlayers << " xloc " << xloc << " yloc " << yloc << " module " << iidd
1146  << " matched/stereo/rphi = " << ((iidd & 0x3) == 0) << "/" << ((iidd & 0x3) == 1) << "/"
1147  << ((iidd & 0x3) == 2);
1148  ModIsBad = 0;
1149  } else {
1150  LogDebug("SiStripHitEfficiencyWorker")
1151  << "hit being counted as bad ######### Invalid RPhi FinalResX " << finalCluster.xResidual
1152  << " FinalRecHit " << iidd << " TKlayers " << TKlayers << " xloc " << xloc << " yloc " << yloc
1153  << " module " << iidd << " matched/stereo/rphi = " << ((iidd & 0x3) == 0) << "/" << ((iidd & 0x3) == 1)
1154  << "/" << ((iidd & 0x3) == 2);
1155  ModIsBad = 1;
1156  LogDebug("SiStripHitEfficiencyWorker")
1157  << " RPhi Error " << sqrt(xErr * xErr + yErr * yErr) << " ErrorX " << xErr << " yErr " << yErr;
1158  }
1159 
1160  LogDebug("SiStripHitEfficiencyWorker")
1161  << "To avoid them staying unused: ModIsBad=" << ModIsBad << ", SiStripQualBad=" << SiStripQualBad
1162  << ", commonMode=" << commonMode << ", highPurity=" << highPurity
1163  << ", withinAcceptance=" << withinAcceptance;
1164 
1165  unsigned int layer = TKlayers;
1166  if (showRings_ && layer > bounds::k_LayersAtTOBEnd) { // use rings instead of wheels
1167  if (layer <= bounds::k_LayersAtTIDEnd) { // TID
1168  layer = bounds::k_LayersAtTOBEnd +
1169  tTopo->tidRing(iidd); // ((iidd >> 9) & 0x3); // 3 disks and also 3 rings -> use the same container
1170  } else { // TEC
1171  layer = bounds::k_LayersAtTIDEnd + tTopo->tecRing(iidd); // ((iidd >> 5) & 0x7);
1172  }
1173  }
1174  unsigned int layerWithSide = layer;
1175  if (layer > bounds::k_LayersAtTOBEnd && layer <= bounds::k_LayersAtTIDEnd) {
1176  const auto side = tTopo->tidSide(iidd); //(iidd >> 13) & 0x3; // TID
1177  if (side == 2)
1178  layerWithSide = layer + 3;
1179  } else if (layer > bounds::k_LayersAtTIDEnd) {
1180  const auto side = tTopo->tecSide(iidd); // (iidd >> 18) & 0x3; // TEC
1181  if (side == 1) {
1182  layerWithSide = layer + 3;
1183  } else if (side == 2) {
1184  layerWithSide = layer + 3 + (showRings_ ? 7 : 9);
1185  }
1186  }
1187 
1188  if ((bunchX_ > 0 && bunchX_ != bunchCrossing) || (!withinAcceptance) ||
1190  (!showTOB6TEC9_ && (TKlayers == bounds::k_LayersAtTOBEnd || TKlayers == bounds::k_LayersAtTECEnd)) ||
1191  (badModules_.end() != badModules_.find(iidd)))
1192  return;
1193 
1194  const bool badquality = (SiStripQualBad == 1);
1195 
1196  //Now that we have a good event, we need to look at if we expected it or not, and the location
1197  //if we didn't
1198  //Fill the missing hit information first
1199  bool badflag = false; // true for hits that are expected but not found
1200  if (resXSig_ < 0) {
1201  if (ModIsBad == 1)
1202  badflag = true; // isBad set to false in the tree when resxsig<999.0
1203  } else {
1204  if (ModIsBad == 1 || finalCluster.xResidualPull > resXSig_)
1205  badflag = true;
1206  }
1207 
1208  // Conversion of positions in strip unit
1209  int nstrips = -9;
1210  float Pitch = -9.0;
1211  const StripGeomDetUnit* stripdet = nullptr;
1212  if (finalCluster.xResidualPull ==
1213  1000.0) { // special treatment, no GeomDetUnit associated in some cases when no cluster found
1214  Pitch = 0.0205; // maximum
1215  nstrips = 768; // maximum
1216  } else {
1217  stripdet = dynamic_cast<const StripGeomDetUnit*>(tkgeom->idToDetUnit(iidd));
1218  const StripTopology& Topo = stripdet->specificTopology();
1219  nstrips = Topo.nstrips();
1220  Pitch = stripdet->surface().bounds().width() / Topo.nstrips();
1221  }
1222  double stripTrajMid = xloc / Pitch + nstrips / 2.0;
1223  double stripCluster = finalCluster.xLocal / Pitch + nstrips / 2.0;
1224  // For trapezoidal modules: extrapolation of x trajectory position to the y middle of the module
1225  // for correct comparison with cluster position
1226  if (stripdet && layer > bounds::k_LayersAtTOBEnd) {
1227  const auto& trapezoidalBounds = dynamic_cast<const TrapezoidalPlaneBounds&>(stripdet->surface().bounds());
1228  std::array<const float, 4> const& parameters = trapezoidalBounds.parameters();
1229  const float hbedge = parameters[0];
1230  const float htedge = parameters[1];
1231  const float hapoth = parameters[3];
1232  const float TrajLocXMid = xloc / (1 + (htedge - hbedge) * yloc / (htedge + hbedge) /
1233  hapoth); // radialy extrapolated x loc position at middle
1234  stripTrajMid = TrajLocXMid / Pitch + nstrips / 2.0;
1235  }
1236 
1237  if ((!badquality) && (layer < h_resolution.size())) {
1238  LogDebug("SiStripHitEfficiencyWorker")
1239  << "layer " << layer << " vector index " << layer - 1 << " before filling h_resolution" << std::endl;
1240  h_resolution[layer - 1]->Fill(finalCluster.xResidualPull != 1000.0 ? stripTrajMid - stripCluster : 1000);
1241  }
1242 
1243  // New matching methods
1244  if (clusterMatchingMethod_ >= 1) {
1245  badflag = false;
1246  if (finalCluster.xResidualPull == 1000.0) {
1247  LogDebug("SiStripHitEfficiencyWorker") << "Marking bad for resxsig=1000";
1248  badflag = true;
1249  } else {
1251  // check the distance between cluster and trajectory position
1252  if (std::abs(stripCluster - stripTrajMid) > clusterTracjDist_) {
1253  LogDebug("SiStripHitEfficiencyWorker") << "Marking bad for cluster-to-traj distance";
1254  badflag = true;
1255  }
1256  }
1258  // cluster and traj have to be in the same APV (don't take edges into accounts)
1259  const int tapv = (int)stripTrajMid / sistrip::STRIPS_PER_APV;
1260  const int capv = (int)stripCluster / sistrip::STRIPS_PER_APV;
1261  float stripInAPV = stripTrajMid - tapv * sistrip::STRIPS_PER_APV;
1262  if (stripInAPV < stripsApvEdge_ || stripInAPV > sistrip::STRIPS_PER_APV - stripsApvEdge_) {
1263  LogDebug("SiStripHitEfficiencyWorker") << "Too close to the edge: " << stripInAPV;
1264  return;
1265  }
1266  if (tapv != capv) {
1267  LogDebug("SiStripHitEfficiencyWorker") << "Marking bad for tapv!=capv";
1268  badflag = true;
1269  }
1270  }
1271  }
1272  }
1273  if (!badquality) {
1274  LogDebug("SiStripHitEfficiencyWorker")
1275  << "Filling measurement for " << iidd << " in layer " << layer << " histograms with bx=" << bunchCrossing
1276  << ", lumi=" << instLumi << ", PU=" << PU << "; bad flag=" << badflag;
1277 
1278  // hot/cold maps of hits that are expected but not found
1279  if (badflag) {
1280  if (layer > bounds::k_LayersStart && layer <= bounds::k_LayersAtTIBEnd) {
1281  //We are in the TIB
1282  float phi = ::calcPhi(tm.globalX(), tm.globalY());
1283  h_hotcold[layer - 1]->Fill(360. - phi, tm.globalZ(), 1.);
1284  } else if (layer > bounds::k_LayersAtTIBEnd && layer <= bounds::k_LayersAtTOBEnd) {
1285  //We are in the TOB
1286  float phi = ::calcPhi(tm.globalX(), tm.globalY());
1287  h_hotcold[layer - 1]->Fill(360. - phi, tm.globalZ(), 1.);
1288  } else if (layer > bounds::k_LayersAtTOBEnd && layer <= bounds::k_LayersAtTIDEnd) {
1289  //We are in the TID
1290  //There are 2 different maps here
1291  int side = tTopo->tidSide(iidd);
1292  if (side == 1)
1293  h_hotcold[(layer - 1) + (layer - 11)]->Fill(-tm.globalY(), tm.globalX(), 1.);
1294  else if (side == 2)
1295  h_hotcold[(layer - 1) + (layer - 10)]->Fill(-tm.globalY(), tm.globalX(), 1.);
1296  } else if (layer > bounds::k_LayersAtTIDEnd) {
1297  //We are in the TEC
1298  //There are 2 different maps here
1299  int side = tTopo->tecSide(iidd);
1300  if (side == 1)
1301  h_hotcold[(layer + 2) + (layer - 14)]->Fill(-tm.globalY(), tm.globalX(), 1.);
1302  else if (side == 2)
1303  h_hotcold[(layer + 2) + (layer - 13)]->Fill(-tm.globalY(), tm.globalX(), 1.);
1304  }
1305  }
1306 
1307  LogDebug("SiStripHitEfficiencyWorker")
1308  << "layer " << layer << " vector index " << layer - 1 << " before filling h_layer_vsSmthg" << std::endl;
1309  h_layer_vsBx[layer - 1].fill(bunchCrossing, !badflag);
1310  if (addLumi_) {
1311  h_layer_vsLumi[layer - 1].fill(instLumi, !badflag);
1312  h_layer_vsPU[layer - 1].fill(PU, !badflag);
1313  }
1314  if (addCommonMode_) {
1315  h_layer_vsCM[layer - 1].fill(commonMode, !badflag);
1316  }
1317  h_goodLayer.fill(layerWithSide, !badflag);
1318  }
1319  // efficiency without bad modules excluded
1320  h_allLayer.fill(layerWithSide, !badflag);
1321 
1322  // efficiency without bad modules excluded
1323  if (TKlayers) {
1324  h_module.fill(iidd, !badflag);
1325  assert(h_module.check(iidd));
1326  }
1327 
1328  /* Used in SiStripHitEffFromCalibTree:
1329  * run -> "run" -> run // e.id().run()
1330  * event -> "event" -> evt // e.id().event()
1331  * ModIsBad -> "ModIsBad" -> isBad
1332  * SiStripQualBad -> "SiStripQualBad"" -> quality
1333  * Id -> "Id" -> id // iidd
1334  * withinAcceptance -> "withinAcceptance" -> accept
1335  * whatlayer -> "layer" -> layer_wheel // Tklayers
1336  * highPurity -> "highPurity" -> highPurity
1337  * TrajGlbX -> "TrajGlbX" -> x // tm.globalX()
1338  * TrajGlbY -> "TrajGlbY" -> y // tm.globalY()
1339  * TrajGlbZ -> "TrajGlbZ" -> z // tm.globalZ()
1340  * ResXSig -> "ResXSig" -> resxsig // finalCluster.xResidualPull;
1341  * TrajLocX -> "TrajLocX" -> TrajLocX // xloc
1342  * TrajLocY -> "TrajLocY" -> TrajLocY // yloc
1343  * ClusterLocX -> "ClusterLocX" -> ClusterLocX // finalCluster.xLocal
1344  * bunchx -> "bunchx" -> bx // e.bunchCrossing()
1345  * instLumi -> "instLumi" -> instLumi ## if addLumi_
1346  * PU -> "PU" -> PU ## if addLumi_
1347  * commonMode -> "commonMode" -> CM ## if addCommonMode_ / _useCM
1348  */
1349  LogDebug("SiStripHitEfficiencyWorker") << "after good location check";
1350  }
1351  LogDebug("SiStripHitEfficiencyWorker") << "after list of clusters";
1352  }
1353  LogDebug("SiStripHitEfficiencyWorker") << "After layers=TKLayers if with TKlayers=" << TKlayers
1354  << ", layers=" << layers_;
1355 }
1356 
1359  desc.add<std::string>("dqmDir", "AlCaReco/SiStripHitEfficiency");
1360  desc.add<bool>("UseOnlyHighPurityTracks", true);
1361  desc.add<bool>("cutOnTracks", false);
1362  desc.add<bool>("doMissingHitsRecovery", false);
1363  desc.add<bool>("useAllHitsFromTracksWithMissingHits", false);
1364  desc.add<bool>("useFirstMeas", false);
1365  desc.add<bool>("useLastMeas", false);
1366  desc.add<double>("ClusterTrajDist", 64.0);
1367  desc.add<double>("ResXSig", -1);
1368  desc.add<double>("StripsApvEdge", 10.0);
1369  desc.add<edm::InputTag>("combinatorialTracks", edm::InputTag{"generalTracks"});
1370  desc.add<edm::InputTag>("commonMode", edm::InputTag{"siStripDigis", "CommonMode"});
1371  desc.add<edm::InputTag>("lumiScalers", edm::InputTag{"scalersRawToDigi"});
1372  desc.add<edm::InputTag>("metadata", edm::InputTag{"onlineMetaDataDigis"});
1373  desc.add<edm::InputTag>("siStripClusters", edm::InputTag{"siStripClusters"});
1374  desc.add<edm::InputTag>("siStripDigis", edm::InputTag{"siStripDigis"});
1375  desc.add<edm::InputTag>("trackerEvent", edm::InputTag{"MeasurementTrackerEvent"});
1376  desc.add<edm::InputTag>("trajectories", edm::InputTag{"generalTracks"});
1377  desc.add<int>("ClusterMatchingMethod", 0);
1378  desc.add<int>("Layer", 0);
1379  desc.add<unsigned int>("trackMultiplicity", 100);
1380  desc.addUntracked<bool>("Debug", false);
1381  desc.addUntracked<bool>("ShowRings", false);
1382  desc.addUntracked<bool>("ShowTOB6TEC9", false);
1383  desc.addUntracked<bool>("addCommonMode", false);
1384  desc.addUntracked<bool>("addLumi", true);
1385  desc.addUntracked<int>("BunchCrossing", 0);
1386  desc.addUntracked<std::string>("BadModulesFile", "");
1387  descriptions.addWithDefaultLabel(desc);
1388 }
1389 
std::pair< LocalPoint, LocalError > LocalValues
const edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measTrackerToken_
const edm::EDGetTokenT< DetIdVector > digisVec_token_
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
virtual std::vector< DetWithState > compatibleDets(const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
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:36
EffME1(MonitorElement *total, MonitorElement *found)
void fillForTraj(const TrajectoryAtInvalidHit &tm, const TrackerTopology *tTopo, const TrackerGeometry *tkgeom, const StripClusterParameterEstimator &stripCPE, const SiStripQuality &stripQuality, const DetIdVector &fedErrorIds, const edm::Handle< edm::DetSetVector< SiStripRawDigi >> &commonModeDigis, const edmNew::DetSetVector< SiStripCluster > &theClusters, int bunchCrossing, float instLumi, float PU, bool highPurity)
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
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
float instLumi() const
Return the luminosity for the current nibble.
std::unordered_map< uint32_t, int > fedErrorCounts
assert(be >=bs)
unsigned int tecRing(const DetId &id) const
ring id
Definition: Electron.h:6
missing
Definition: combine.py:5
std::unique_ptr< TkHistoMap > FEDErrorOccupancy
const edm::EDGetTokenT< MeasurementTrackerEvent > trackerEvent_token_
const_iterator end(bool update=false) const
~SiStripHitEfficiencyWorker() override=default
void Fill(long long x)
const edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_
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:408
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
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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
std::vector< DetId > DetIdVector
Definition: DetIdVector.h:7
std::vector< unsigned int > hitTotalCounters
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:221
const edm::EDGetTokenT< DetIdCollection > digisCol_token_
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
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_
std::vector< unsigned int > hitRecoveryCounters
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:305
float avgPileUp() const
Return the average pileup for th current nibble.
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45
ConstRecHitPointer const & recHit() const
#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