CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
MeasurementTrackerEventProducer Class Referencefinal

#include <MeasurementTrackerEventProducer.h>

Inheritance diagram for MeasurementTrackerEventProducer:
edm::stream::EDProducer<>

Public Member Functions

 MeasurementTrackerEventProducer (const edm::ParameterSet &iConfig)
 
 ~MeasurementTrackerEventProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Protected Member Functions

void getInactiveStrips (const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
 
void updatePhase2OT (const edm::Event &, Phase2OTMeasurementDetSet &thePh2OTDets) const
 
void updatePixels (const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip, const TrackerGeometry &trackerGeom, const edm::EventSetup &iSetup) const
 
void updateStacks (const edm::Event &, Phase2OTMeasurementDetSet &theStDets) const
 
void updateStrips (const edm::Event &, StMeasurementDetSet &theStDets, std::vector< bool > &stripClustersToSkip) const
 

Protected Attributes

bool isPhase2_
 
edm::ESGetToken< MeasurementTracker, CkfComponentsRecordmeasurementTrackerToken_
 
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcdpixelCablingMapToken_
 
bool selfUpdateSkipClusters_
 
bool switchOffPixelsIfEmpty_
 
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > theBadPixelFEDChannelsLabels
 
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels
 
std::vector< edm::EDGetTokenT< DetIdVector > > theInactiveStripDetectorLabels
 
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
 
edm::EDGetTokenT< VectorHitCollectionthePh2OTVectorHitsLabel
 
edm::EDGetTokenT< VectorHitCollectionthePh2OTVectorHitsRejLabel
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
 
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
 
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
 
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask
 
bool useVectorHits_
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 20 of file MeasurementTrackerEventProducer.h.

Constructor & Destructor Documentation

◆ MeasurementTrackerEventProducer()

MeasurementTrackerEventProducer::MeasurementTrackerEventProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 14 of file MeasurementTrackerEventProducer.cc.

References deDxTools::esConsumes(), edm::ParameterSet::getParameter(), ProducerED_cfi::InputTag, isPhase2_, LogDebug, pixelCablingMapToken_, selfUpdateSkipClusters_, optionsL1T::skip, AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, theBadPixelFEDChannelsLabels, theInactivePixelDetectorLabels, theInactiveStripDetectorLabels, thePh2OTClusterLabel, thePh2OTVectorHitsLabel, thePh2OTVectorHitsRejLabel, thePixelClusterLabel, thePixelClusterMask, theStripClusterLabel, theStripClusterMask, and useVectorHits_.

16  esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("measurementTracker")))),
17  switchOffPixelsIfEmpty_(iConfig.getParameter<bool>("switchOffPixelsIfEmpty")) {
18  std::vector<edm::InputTag> inactivePixelDetectorTags(
19  iConfig.getParameter<std::vector<edm::InputTag>>("inactivePixelDetectorLabels"));
20  for (auto& t : inactivePixelDetectorTags)
21  theInactivePixelDetectorLabels.push_back(consumes<DetIdCollection>(t));
22 
23  std::vector<edm::InputTag> badPixelFEDChannelCollectionTags =
24  iConfig.getParameter<std::vector<edm::InputTag>>("badPixelFEDChannelCollectionLabels");
25  if (!badPixelFEDChannelCollectionTags.empty()) {
26  for (auto& t : badPixelFEDChannelCollectionTags)
27  theBadPixelFEDChannelsLabels.push_back(consumes<PixelFEDChannelCollection>(t));
28  pixelCablingMapToken_ = esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("pixelCablingMapLabel")));
29  }
30 
31  std::vector<edm::InputTag> inactiveStripDetectorTags(
32  iConfig.getParameter<std::vector<edm::InputTag>>("inactiveStripDetectorLabels"));
33  for (auto& t : inactiveStripDetectorTags)
34  theInactiveStripDetectorLabels.push_back(consumes<DetIdVector>(t));
35 
36  //the measurement tracking is set to skip clusters, the other option is set from outside
37  edm::InputTag skip = iConfig.getParameter<edm::InputTag>("skipClusters");
39  LogDebug("MeasurementTracker") << "skipping clusters: " << selfUpdateSkipClusters_;
40  isPhase2_ = false;
41  useVectorHits_ = false;
42 
43  if (!iConfig.getParameter<std::string>("stripClusterProducer").empty()) {
44  theStripClusterLabel = consumes<edmNew::DetSetVector<SiStripCluster>>(
45  edm::InputTag(iConfig.getParameter<std::string>("stripClusterProducer")));
47  theStripClusterMask = consumes<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster>>>(
48  iConfig.getParameter<edm::InputTag>("skipClusters"));
49  }
50  if (!iConfig.getParameter<std::string>("pixelClusterProducer").empty()) {
51  thePixelClusterLabel = consumes<edmNew::DetSetVector<SiPixelCluster>>(
52  edm::InputTag(iConfig.getParameter<std::string>("pixelClusterProducer")));
54  thePixelClusterMask = consumes<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster>>>(
55  iConfig.getParameter<edm::InputTag>("skipClusters"));
56  }
57  if (!iConfig.getParameter<std::string>("Phase2TrackerCluster1DProducer").empty()) {
58  thePh2OTClusterLabel = consumes<edmNew::DetSetVector<Phase2TrackerCluster1D>>(
59  edm::InputTag(iConfig.getParameter<std::string>("Phase2TrackerCluster1DProducer")));
60  isPhase2_ = true;
61  }
62  if (!(iConfig.getParameter<edm::InputTag>("vectorHits") == edm::InputTag("") ||
63  iConfig.getParameter<edm::InputTag>("vectorHitsRej") == edm::InputTag(""))) {
64  thePh2OTVectorHitsLabel = consumes<VectorHitCollection>(iConfig.getParameter<edm::InputTag>("vectorHits"));
65  thePh2OTVectorHitsRejLabel = consumes<VectorHitCollection>(iConfig.getParameter<edm::InputTag>("vectorHitsRej"));
66  isPhase2_ = true;
67  useVectorHits_ = true;
68  }
69 
70  produces<MeasurementTrackerEvent>();
71 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > pixelCablingMapToken_
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > theBadPixelFEDChannelsLabels
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsRejLabel
std::vector< edm::EDGetTokenT< DetIdVector > > theInactiveStripDetectorLabels
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTrackerToken_
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsLabel
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels
#define LogDebug(id)

◆ ~MeasurementTrackerEventProducer()

MeasurementTrackerEventProducer::~MeasurementTrackerEventProducer ( )
inlineoverride

Definition at line 23 of file MeasurementTrackerEventProducer.h.

23 {}

Member Function Documentation

◆ fillDescriptions()

void MeasurementTrackerEventProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 73 of file MeasurementTrackerEventProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

73  {
75 
76  desc.add<std::string>("measurementTracker", "");
77  desc.add<edm::InputTag>("skipClusters", edm::InputTag());
78  desc.add<std::string>("pixelClusterProducer", "siPixelClusters");
79  desc.add<std::string>("stripClusterProducer", "siStripClusters");
80  desc.add<std::string>("Phase2TrackerCluster1DProducer", "");
81  desc.add<edm::InputTag>("vectorHits", edm::InputTag(""));
82  desc.add<edm::InputTag>("vectorHitsRej", edm::InputTag(""));
83 
84  desc.add<std::vector<edm::InputTag>>("inactivePixelDetectorLabels",
85  std::vector<edm::InputTag>{{edm::InputTag("siPixelDigis")}})
86  ->setComment("One or more DetIdCollections of modules to mask on the fly for a given event");
87  desc.add<std::vector<edm::InputTag>>("badPixelFEDChannelCollectionLabels", std::vector<edm::InputTag>())
88  ->setComment("One or more PixelFEDChannelCollections of modules+ROCs to mask on the fly for a given event");
89  desc.add<std::string>("pixelCablingMapLabel", "");
90 
91  desc.add<std::vector<edm::InputTag>>("inactiveStripDetectorLabels",
92  std::vector<edm::InputTag>{{edm::InputTag("siStripDigis")}})
93  ->setComment("One or more DetIdVectors of modules to mask on the fly for a given event");
94 
95  desc.add<bool>("switchOffPixelsIfEmpty", true)->setComment("let's keep it like this, for cosmics");
96 
97  descriptions.add("measurementTrackerEventDefault", desc);
98 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ getInactiveStrips()

void MeasurementTrackerEventProducer::getInactiveStrips ( const edm::Event event,
std::vector< uint32_t > &  rawInactiveDetIds 
) const
protected

Definition at line 406 of file MeasurementTrackerEventProducer.cc.

References jetUpdater_cfi::sort, and theInactiveStripDetectorLabels.

Referenced by updateStrips().

407  {
408  if (!theInactiveStripDetectorLabels.empty()) {
411  if (event.getByToken(tk, detIds)) {
412  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
413  }
414  }
415  if (!rawInactiveDetIds.empty())
416  std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
417  }
418 }
std::vector< edm::EDGetTokenT< DetIdVector > > theInactiveStripDetectorLabels
Definition: event.py:1

◆ produce()

void MeasurementTrackerEventProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 100 of file MeasurementTrackerEventProducer.cc.

References edm::EventSetup::getData(), iEvent, HLTSiStripMonitoring_cff::measurementTracker, measurementTrackerToken_, thePh2OTVectorHitsLabel, thePh2OTVectorHitsRejLabel, updatePhase2OT(), updatePixels(), updateStacks(), updateStrips(), and useVectorHits_.

100  {
102 
103  // create new data structures from templates
104  auto stripData = std::make_unique<StMeasurementDetSet>(measurementTracker.stripDetConditions());
105  auto pixelData = std::make_unique<PxMeasurementDetSet>(measurementTracker.pixelDetConditions());
106  auto phase2OTData = std::make_unique<Phase2OTMeasurementDetSet>(measurementTracker.phase2DetConditions());
107 
108  std::vector<bool> stripClustersToSkip;
109  std::vector<bool> pixelClustersToSkip;
110  std::vector<bool> phase2ClustersToSkip;
111  // fill them
112  updateStrips(iEvent, *stripData, stripClustersToSkip);
114  *pixelData,
115  pixelClustersToSkip,
116  dynamic_cast<const TrackerGeometry&>(*(measurementTracker.geomTracker())),
117  iSetup);
118  updatePhase2OT(iEvent, *phase2OTData);
119  updateStacks(iEvent, *phase2OTData);
120 
121  // put into MTE
122  // put into event
123  //
124 
125  const VectorHitCollection* phase2OTVectorHits = useVectorHits_ ? &iEvent.get(thePh2OTVectorHitsLabel) : nullptr;
126  const VectorHitCollection* phase2OTVectorHitsRej = useVectorHits_ ? &iEvent.get(thePh2OTVectorHitsRejLabel) : nullptr;
127  iEvent.put(std::make_unique<MeasurementTrackerEvent>(measurementTracker,
128  stripData.release(),
129  pixelData.release(),
130  phase2OTData.release(),
131  phase2OTVectorHits,
132  phase2OTVectorHitsRej,
133  stripClustersToSkip,
134  pixelClustersToSkip,
135  phase2ClustersToSkip));
136 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void updatePixels(const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip, const TrackerGeometry &trackerGeom, const edm::EventSetup &iSetup) const
void updateStrips(const edm::Event &, StMeasurementDetSet &theStDets, std::vector< bool > &stripClustersToSkip) const
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsRejLabel
void updatePhase2OT(const edm::Event &, Phase2OTMeasurementDetSet &thePh2OTDets) const
void updateStacks(const edm::Event &, Phase2OTMeasurementDetSet &theStDets) const
edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTrackerToken_
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsLabel

◆ updatePhase2OT()

void MeasurementTrackerEventProducer::updatePhase2OT ( const edm::Event event,
Phase2OTMeasurementDetSet thePh2OTDets 
) const
protected

Definition at line 365 of file MeasurementTrackerEventProducer.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::end(), Phase2OTMeasurementDetSet::handle(), mps_fire::i, edmNew::DetSet< T >::id(), Phase2OTMeasurementDetSet::id(), Phase2OTMeasurementDetSet::isActive(), isPhase2_, edm::EDGetTokenT< T >::isUninitialized(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, SummaryClient_cfi::labels, hltElePixelHitTripletsClusterRemoverL1Seeded_cfi::phase2OTClusters, Phase2OTMeasurementDetSet::setActiveThisEvent(), Phase2OTMeasurementDetSet::setEmpty(), Phase2OTMeasurementDetSet::size(), thePh2OTClusterLabel, and Phase2OTMeasurementDetSet::update().

Referenced by produce().

366  {
367  thePh2OTDets.setEmpty();
368 
369  // Phase2OT Clusters
370  if (isPhase2_) {
371  if (thePh2OTClusterLabel.isUninitialized()) { //clusters have not been produced
372  thePh2OTDets.setActiveThisEvent(false);
373  } else {
375  if (event.getByToken(thePh2OTClusterLabel, phase2OTClusters)) {
376  const edmNew::DetSetVector<Phase2TrackerCluster1D>* phase2OTCollection = phase2OTClusters.product();
377 
378  int i = 0, endDet = thePh2OTDets.size();
380  ed = phase2OTCollection->end();
381  it != ed;
382  ++it) {
384  unsigned int id = set.id();
385  while (id != thePh2OTDets.id(i)) {
386  ++i;
387  if (endDet == i)
388  throw "we have a problem!!!!";
389  }
390  // push cluster range in det
391  if (thePh2OTDets.isActive(i)) {
392  thePh2OTDets.update(i, set);
393  }
394  }
395  } else {
397  labelsForToken(thePh2OTClusterLabel, labels);
398  edm::LogWarning("MeasurementTrackerEventProducer")
399  << "input Phase2TrackerCluster1D collection " << labels.module << " is not valid";
400  }
401  }
402  }
403  return;
404 }
id_type id() const
Definition: DetSetNew.h:61
unsigned int id(int i) const
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:98
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
const edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D > > & handle() const
const_iterator end(bool update=false) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin(bool update=false) const
void setActiveThisEvent(bool active)
Log< level::Warning, false > LogWarning
void update(int i, const Phase2DetSet &detSet)
Definition: event.py:1

◆ updatePixels()

void MeasurementTrackerEventProducer::updatePixels ( const edm::Event event,
PxMeasurementDetSet thePxDets,
std::vector< bool > &  pixelClustersToSkip,
const TrackerGeometry trackerGeom,
const edm::EventSetup iSetup 
) const
protected

Definition at line 138 of file MeasurementTrackerEventProducer.cc.

References PxMeasurementDetSet::addBadFEDChannelPositions(), cms::cuda::assert(), edm::EDCollection< T >::begin(), edmNew::DetSetVector< T >::begin(), sipixelobjects::GlobalPixel::col, edmNew::DetSetVector< T >::dataSize(), edmNew::DetSetVector< T >::empty(), edm::EDCollection< T >::end(), edmNew::DetSetVector< T >::end(), edm::HandleBase::failedToGet(), ntuplemaker::fill, PxMeasurementDetSet::find(), edm::EventSetup::getData(), PxMeasurementDetSet::handle(), mps_fire::i, edmNew::DetSet< T >::id(), edm::HandleBase::id(), l1ctLayer2EG_cff::id, PxMeasurementDetSet::id(), TrackerGeometry::idToDet(), PxMeasurementDetSet::isActive(), edm::EDGetTokenT< T >::isUninitialized(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, SummaryClient_cfi::labels, DTRecHitClients_cfi::local, LogDebug, SiStripPI::max, SiStripPI::min, castor_dqm_sourceclient_file_cfg::path, pixelCablingMapToken_, DQMOffline_LumiMonitoring_cff::pixelClusters, sipixelobjects::PixelROC::rawId(), PixelMapPlotter::roc, sipixelobjects::GlobalPixel::row, selfUpdateSkipClusters_, PxMeasurementDetSet::setActiveThisEvent(), PxMeasurementDetSet::setEmpty(), PxMeasurementDetSet::size(), jetUpdater_cfi::sort, PixelGeomDetUnit::specificTopology(), switchOffPixelsIfEmpty_, theBadPixelFEDChannelsLabels, theInactivePixelDetectorLabels, thePixelClusterLabel, thePixelClusterMask, sipixelobjects::PixelROC::toGlobal(), HLT_2024v14_cff::topology, PxMeasurementDetSet::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

142  {
143  // start by clearinng everything
144  thePxDets.setEmpty();
145 
146  std::vector<uint32_t> rawInactiveDetIds;
147  if (!theInactivePixelDetectorLabels.empty()) {
150  if (event.getByToken(tk, detIds)) {
151  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
152  } else {
153  static std::atomic<bool> iFailedAlready{false};
154  bool expected = false;
155  if (iFailedAlready.compare_exchange_strong(expected, true, std::memory_order_acq_rel)) {
156  edm::LogError("MissingProduct")
157  << "I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
158  }
159  }
160  }
161  if (!rawInactiveDetIds.empty())
162  std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
163  // mark as inactive if in rawInactiveDetIds
164  int i = 0, endDet = thePxDets.size();
165  unsigned int idp = 0;
166  for (auto id : rawInactiveDetIds) {
167  if (id == idp)
168  continue; // skip multiple id
169  idp = id;
170  i = thePxDets.find(id, i);
171  assert(i != endDet && id == thePxDets.id(i));
172  thePxDets.setActiveThisEvent(i, false);
173  }
174  }
175 
176  if (!theBadPixelFEDChannelsLabels.empty()) {
177  auto const& cablingMap = iSetup.getData(pixelCablingMapToken_);
178 
179  edm::Handle<PixelFEDChannelCollection> pixelFEDChannelCollectionHandle;
181  if (not event.getByToken(tk, pixelFEDChannelCollectionHandle))
182  continue;
183  int i = 0;
184  for (const auto& disabledChannels : *pixelFEDChannelCollectionHandle) {
186  for (const auto& ch : disabledChannels) {
187  const sipixelobjects::PixelROC *roc_first = nullptr, *roc_last = nullptr;
188  sipixelobjects::CablingPathToDetUnit path = {ch.fed, ch.link, 0};
189  // PixelFEDChannelCollection addresses the ROCs by their 'idInDetUnit' (from 0 to 15), ROCs also know their on 'idInDetUnit',
190  // however the cabling map uses a numbering [1,numberOfROCs], see sipixelobjects::PixelFEDLink::roc(unsigned int id), not necessarily sorted in the same direction.
191  // PixelFEDChannelCollection MUST be filled such that ch.roc_first (ch.roc_last) correspond to the lowest (highest) 'idInDetUnit' in the channel
192  assert(ch.roc_last >= ch.roc_first);
193  for (path.roc = 1; path.roc <= (ch.roc_last - ch.roc_first) + 1; ++path.roc) {
194  const sipixelobjects::PixelROC* roc = cablingMap.findItem(path);
195  if (roc == nullptr)
196  continue;
197  assert(roc->rawId() == disabledChannels.detId());
198  if (roc->idInDetUnit() == ch.roc_first)
199  roc_first = roc;
200  if (roc->idInDetUnit() == ch.roc_last)
201  roc_last = roc;
202  }
203  if (roc_first == nullptr || roc_last == nullptr) {
204  edm::LogError("PixelFEDChannelCollection")
205  << "Do not find either roc_first or roc_last in the cabling map.";
206  continue;
207  }
208  const PixelGeomDetUnit* theGeomDet =
209  dynamic_cast<const PixelGeomDetUnit*>(trackerGeom.idToDet(roc_first->rawId()));
210  PixelTopology const* topology = &(theGeomDet->specificTopology());
212  topology->rowsperroc() / 2, topology->colsperroc() / 2}; //corresponding to center of ROC row, col
214  LocalPoint lp1 = topology->localPosition(MeasurementPoint(global.row, global.col));
215  global = roc_last->toGlobal(sipixelobjects::LocalPixel(local));
216  LocalPoint lp2 = topology->localPosition(MeasurementPoint(global.row, global.col));
217  LocalPoint ll(std::min(lp1.x(), lp2.x()), std::min(lp1.y(), lp2.y()), std::min(lp1.z(), lp2.z()));
218  LocalPoint ur(std::max(lp1.x(), lp2.x()), std::max(lp1.y(), lp2.y()), std::max(lp1.z(), lp2.z()));
219  positions.push_back(std::make_pair(ll, ur));
220  } // loop on channels
221  if (not positions.empty()) {
222  i = thePxDets.find(disabledChannels.detId(), i);
223  assert(i != thePxDets.size() && thePxDets.id(i) == disabledChannels.detId());
224  thePxDets.addBadFEDChannelPositions(i, positions);
225  }
226  } // loop on DetId-s
227  } // loop on labels
228  } // if collection labels are populated
229 
230  // Pixel Clusters
231  if (thePixelClusterLabel.isUninitialized()) { //clusters have not been produced
233  thePxDets.setActiveThisEvent(false);
234  }
235  } else {
237  if (event.getByToken(thePixelClusterLabel, pixelClusters)) {
238  const edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
239 
240  if (switchOffPixelsIfEmpty_ && pixelCollection->empty()) {
241  thePxDets.setActiveThisEvent(false);
242  } else {
243  //std::cout <<"updatePixels "<<pixelCollection->dataSize()<<std::endl;
244  pixelClustersToSkip.resize(pixelCollection->dataSize());
245  std::fill(pixelClustersToSkip.begin(), pixelClustersToSkip.end(), false);
246 
249  //and get the collection of pixel ref to skip
250  event.getByToken(thePixelClusterMask, pixelClusterMask);
251  LogDebug("MeasurementTracker") << "getting pxl refs to skip";
252  if (pixelClusterMask.failedToGet())
253  edm::LogError("MeasurementTracker") << "not getting the pixel clusters to skip";
254  if (pixelClusterMask->refProd().id() != pixelClusters.id()) {
255  edm::LogError("ProductIdMismatch")
256  << "The pixel masking does not point to the proper collection of clusters: "
257  << pixelClusterMask->refProd().id() << "!=" << pixelClusters.id();
258  }
259  pixelClusterMask->copyMaskTo(pixelClustersToSkip);
260  }
261 
262  // FIXME: should check if lower_bound is better
263  int i = 0, endDet = thePxDets.size();
265  ed = pixelCollection->end();
266  it != ed;
267  ++it) {
269  unsigned int id = set.id();
270  while (id != thePxDets.id(i)) {
271  ++i;
272  if (endDet == i)
273  throw "we have a problem!!!!";
274  }
275  // push cluster range in det
276  if (thePxDets.isActive(i)) {
277  thePxDets.update(i, set);
278  }
279  }
280  }
281  } else {
283  labelsForToken(thePixelClusterLabel, labels);
284  edm::LogWarning("MeasurementTrackerEventProducer")
285  << "input pixel clusters collection " << labels.module << " is not valid";
286  }
287  }
288 }
std::vector< std::pair< LocalPoint, LocalPoint > > BadFEDChannelPositions
size_type dataSize() const
id_type id() const
Definition: DetSetNew.h:61
ProductID id() const
Definition: HandleBase.cc:29
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
T z() const
Definition: PV3DBase.h:61
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:98
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > pixelCablingMapToken_
Log< level::Error, false > LogError
assert(be >=bs)
bool isActive(int i) const
identify pixel inside single ROC
Definition: LocalPixel.h:7
const_iterator end(bool update=false) const
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > theBadPixelFEDChannelsLabels
bool failedToGet() const
Definition: HandleBase.h:72
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
unsigned int id(int i) const
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:55
void update(int i, const PixelDetSet &detSet)
void addBadFEDChannelPositions(int i, BadFEDChannelPositions &positions)
const TrackerGeomDet * idToDet(DetId) const override
const_iterator begin() const
Definition: EDCollection.h:118
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin(bool update=false) const
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
row and collumn in ROC representation
Definition: LocalPixel.h:13
void setActiveThisEvent(bool active)
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Log< level::Warning, false > LogWarning
const edm::Handle< edmNew::DetSetVector< SiPixelCluster > > & handle() const
int find(unsigned int jd, int i=0) const
const_iterator end() const
Definition: EDCollection.h:123
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
Definition: PixelROC.h:34
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels
Definition: event.py:1
#define LogDebug(id)

◆ updateStacks()

void MeasurementTrackerEventProducer::updateStacks ( const edm::Event ,
Phase2OTMeasurementDetSet theStDets 
) const
inlineprotected

Definition at line 39 of file MeasurementTrackerEventProducer.h.

Referenced by produce().

39 {};

◆ updateStrips()

void MeasurementTrackerEventProducer::updateStrips ( const edm::Event event,
StMeasurementDetSet theStDets,
std::vector< bool > &  stripClustersToSkip 
) const
protected

Definition at line 290 of file MeasurementTrackerEventProducer.cc.

References cms::cuda::assert(), ALCARECOSiPixelCalSingleMuonDQM_cff::clusterCollection, edm::HandleBase::failedToGet(), StMeasurementDetSet::find(), getInactiveStrips(), StMeasurementDetSet::handle(), mps_fire::i, edm::HandleBase::id(), l1ctLayer2EG_cff::id, StMeasurementDetSet::id(), StMeasurementDetSet::isActive(), edm::EDGetTokenT< T >::isUninitialized(), dqmiolumiharvest::j, SummaryClient_cfi::labels, LogDebug, edm::Handle< T >::product(), selfUpdateSkipClusters_, StMeasurementDetSet::setActiveThisEvent(), StMeasurementDetSet::setEmpty(), StMeasurementDetSet::size(), theStripClusterLabel, theStripClusterMask, mitigatedMETSequence_cff::U, and StMeasurementDetSet::update().

Referenced by produce().

292  {
293  typedef edmNew::DetSet<SiStripCluster> StripDetSet;
294 
295  std::vector<uint32_t> rawInactiveDetIds;
296  getInactiveStrips(event, rawInactiveDetIds);
297 
298  // Strip Clusters
299  //first clear all of them
300  theStDets.setEmpty();
301 
303  return; //clusters have not been produced
304 
305  const int endDet = theStDets.size();
306 
307  // mark as inactive if in rawInactiveDetIds
308  int i = 0;
309  unsigned int idp = 0;
310  for (auto id : rawInactiveDetIds) {
311  if (id == idp)
312  continue; // skip multiple id
313  idp = id;
314  i = theStDets.find(id, i);
315  assert(i != endDet && id == theStDets.id(i));
316  theStDets.setActiveThisEvent(i, false);
317  }
318 
319  //========= actually load cluster =============
320  {
322  if (event.getByToken(theStripClusterLabel, clusterHandle)) {
324 
327  //and get the collection of pixel ref to skip
328  LogDebug("MeasurementTracker") << "getting strp refs to skip";
329  event.getByToken(theStripClusterMask, stripClusterMask);
330  if (stripClusterMask.failedToGet())
331  edm::LogError("MeasurementTracker") << "not getting the strip clusters to skip";
332  if (stripClusterMask->refProd().id() != clusterHandle.id()) {
333  edm::LogError("ProductIdMismatch")
334  << "The strip masking does not point to the proper collection of clusters: "
335  << stripClusterMask->refProd().id() << "!=" << clusterHandle.id();
336  }
337  stripClusterMask->copyMaskTo(stripClustersToSkip);
338  }
339 
340  theStDets.handle() = clusterHandle;
341  int i = 0;
342  // cluster and det and in order (both) and unique so let's use set intersection
343  for (auto j = 0U; j < (*clusterCollection).size(); ++j) {
344  unsigned int id = (*clusterCollection).id(j);
345  while (id != theStDets.id(i)) { // eventually change to lower_bound
346  ++i;
347  if (endDet == i)
348  throw "we have a problem in strips!!!!";
349  }
350 
351  // push cluster range in det
352  if (theStDets.isActive(i))
353  theStDets.update(i, j);
354  }
355  } else {
357  labelsForToken(theStripClusterLabel, labels);
358  edm::LogWarning("MeasurementTrackerEventProducer")
359  << "input strip cluster collection " << labels.module << " is not valid";
360  }
361  }
362 }
ProductID id() const
Definition: HandleBase.cc:29
unsigned int id(int i) const
T const * product() const
Definition: Handle.h:70
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:98
void update(int i, const StripDetset &detSet)
Log< level::Error, false > LogError
assert(be >=bs)
bool failedToGet() const
Definition: HandleBase.h:72
void setActiveThisEvent(int i, bool active)
Turn on/off the module for reconstruction for one events. This per-event flag is cleared by any call ...
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
int find(unsigned int jd, int i=0) const
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
edm::Handle< edmNew::DetSetVector< SiStripCluster > > & handle()
Log< level::Warning, false > LogWarning
bool isActive(int i) const
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask
Definition: event.py:1
#define LogDebug(id)

Member Data Documentation

◆ isPhase2_

bool MeasurementTrackerEventProducer::isPhase2_
protected

◆ measurementTrackerToken_

edm::ESGetToken<MeasurementTracker, CkfComponentsRecord> MeasurementTrackerEventProducer::measurementTrackerToken_
protected

Definition at line 43 of file MeasurementTrackerEventProducer.h.

Referenced by produce().

◆ pixelCablingMapToken_

edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> MeasurementTrackerEventProducer::pixelCablingMapToken_
protected

◆ selfUpdateSkipClusters_

bool MeasurementTrackerEventProducer::selfUpdateSkipClusters_
protected

◆ switchOffPixelsIfEmpty_

bool MeasurementTrackerEventProducer::switchOffPixelsIfEmpty_
protected

Definition at line 58 of file MeasurementTrackerEventProducer.h.

Referenced by updatePixels().

◆ theBadPixelFEDChannelsLabels

std::vector<edm::EDGetTokenT<PixelFEDChannelCollection> > MeasurementTrackerEventProducer::theBadPixelFEDChannelsLabels
protected

◆ theInactivePixelDetectorLabels

std::vector<edm::EDGetTokenT<DetIdCollection> > MeasurementTrackerEventProducer::theInactivePixelDetectorLabels
protected

◆ theInactiveStripDetectorLabels

std::vector<edm::EDGetTokenT<DetIdVector> > MeasurementTrackerEventProducer::theInactiveStripDetectorLabels
protected

◆ thePh2OTClusterLabel

edm::EDGetTokenT<edmNew::DetSetVector<Phase2TrackerCluster1D> > MeasurementTrackerEventProducer::thePh2OTClusterLabel
protected

◆ thePh2OTVectorHitsLabel

edm::EDGetTokenT<VectorHitCollection> MeasurementTrackerEventProducer::thePh2OTVectorHitsLabel
protected

Definition at line 47 of file MeasurementTrackerEventProducer.h.

Referenced by MeasurementTrackerEventProducer(), and produce().

◆ thePh2OTVectorHitsRejLabel

edm::EDGetTokenT<VectorHitCollection> MeasurementTrackerEventProducer::thePh2OTVectorHitsRejLabel
protected

Definition at line 48 of file MeasurementTrackerEventProducer.h.

Referenced by MeasurementTrackerEventProducer(), and produce().

◆ thePixelClusterLabel

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > MeasurementTrackerEventProducer::thePixelClusterLabel
protected

◆ thePixelClusterMask

edm::EDGetTokenT<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > > MeasurementTrackerEventProducer::thePixelClusterMask
protected

◆ theStripClusterLabel

edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > MeasurementTrackerEventProducer::theStripClusterLabel
protected

◆ theStripClusterMask

edm::EDGetTokenT<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > > MeasurementTrackerEventProducer::theStripClusterMask
protected

◆ useVectorHits_

bool MeasurementTrackerEventProducer::useVectorHits_
protected

Definition at line 60 of file MeasurementTrackerEventProducer.h.

Referenced by MeasurementTrackerEventProducer(), and produce().