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< DetIdCollection > > 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 19 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(), HLT_2022v12_cff::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<DetIdCollection>(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:303
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > pixelCablingMapToken_
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > theBadPixelFEDChannelsLabels
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsRejLabel
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 22 of file MeasurementTrackerEventProducer.h.

22 {}

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, HLT_2022v12_cff::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 DetIdCollections 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 405 of file MeasurementTrackerEventProducer.cc.

References edm::EDCollection< T >::begin(), edm::EDCollection< T >::end(), jetUpdater_cfi::sort, and theInactiveStripDetectorLabels.

Referenced by updateStrips().

406  {
407  if (!theInactiveStripDetectorLabels.empty()) {
410  if (event.getByToken(tk, detIds)) {
411  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
412  }
413  }
414  if (!rawInactiveDetIds.empty())
415  std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
416  }
417 }
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
const_iterator begin() const
Definition: EDCollection.h:117
const_iterator end() const
Definition: EDCollection.h:122
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 }
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
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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 364 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(), SummaryClient_cfi::labels, highPtTripletStepClusters_cfi::phase2OTClusters, Phase2OTMeasurementDetSet::setActiveThisEvent(), Phase2OTMeasurementDetSet::setEmpty(), Phase2OTMeasurementDetSet::size(), thePh2OTClusterLabel, and Phase2OTMeasurementDetSet::update().

Referenced by produce().

365  {
366  thePh2OTDets.setEmpty();
367 
368  // Phase2OT Clusters
369  if (isPhase2_) {
370  if (thePh2OTClusterLabel.isUninitialized()) { //clusters have not been produced
371  thePh2OTDets.setActiveThisEvent(false);
372  } else {
374  if (event.getByToken(thePh2OTClusterLabel, phase2OTClusters)) {
375  const edmNew::DetSetVector<Phase2TrackerCluster1D>* phase2OTCollection = phase2OTClusters.product();
376 
377  int i = 0, endDet = thePh2OTDets.size();
379  ed = phase2OTCollection->end();
380  it != ed;
381  ++it) {
383  unsigned int id = set.id();
384  while (id != thePh2OTDets.id(i)) {
385  ++i;
386  if (endDet == i)
387  throw "we have a problem!!!!";
388  }
389  // push cluster range in det
390  if (thePh2OTDets.isActive(i)) {
391  thePh2OTDets.update(i, set);
392  }
393  }
394  } else {
396  labelsForToken(thePh2OTClusterLabel, labels);
397  edm::LogWarning("MeasurementTrackerEventProducer")
398  << "input Phase2TrackerCluster1D collection " << labels.module << " is not valid";
399  }
400  }
401  }
402  return;
403 }
id_type id() const
Definition: DetSetNew.h:64
unsigned int id(int i) const
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
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, PixelTopology::colsperroc(), 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, triggerObjects_cff::id, edmNew::DetSet< T >::id(), edm::HandleBase::id(), PxMeasurementDetSet::id(), TrackerGeometry::idToDet(), PxMeasurementDetSet::isActive(), edm::EDGetTokenT< T >::isUninitialized(), SummaryClient_cfi::labels, DTRecHitClients_cfi::local, Topology::localPosition(), LogDebug, SiStripPI::max, SiStripPI::min, castor_dqm_sourceclient_file_cfg::path, pixelCablingMapToken_, DQMOffline_LumiMonitoring_cff::pixelClusters, sipixelobjects::PixelROC::rawId(), PixelMapPlotter::roc, sipixelobjects::GlobalPixel::row, PixelTopology::rowsperroc(), selfUpdateSkipClusters_, PxMeasurementDetSet::setActiveThisEvent(), PxMeasurementDetSet::setEmpty(), PxMeasurementDetSet::size(), jetUpdater_cfi::sort, PixelGeomDetUnit::specificTopology(), switchOffPixelsIfEmpty_, theBadPixelFEDChannelsLabels, theInactivePixelDetectorLabels, thePixelClusterLabel, thePixelClusterMask, sipixelobjects::PixelROC::toGlobal(), 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 (!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  for (path.roc = 1; path.roc <= (ch.roc_last - ch.roc_first) + 1; path.roc++) {
193  const sipixelobjects::PixelROC* roc = cablingMap.findItem(path);
194  if (roc == nullptr)
195  continue;
196  assert(roc->rawId() == disabledChannels.detId());
197  if (roc->idInDetUnit() == ch.roc_first)
198  roc_first = roc;
199  if (roc->idInDetUnit() == ch.roc_last)
200  roc_last = roc;
201  }
202  if (roc_first == nullptr || roc_last == nullptr) {
203  edm::LogError("PixelFEDChannelCollection")
204  << "Do not find either roc_first or roc_last in the cabling map.";
205  continue;
206  }
207  const PixelGeomDetUnit* theGeomDet =
208  dynamic_cast<const PixelGeomDetUnit*>(trackerGeom.idToDet(roc_first->rawId()));
209  PixelTopology const* topology = &(theGeomDet->specificTopology());
211  topology->rowsperroc() / 2, topology->colsperroc() / 2}; //corresponding to center of ROC row, col
213  LocalPoint lp1 = topology->localPosition(MeasurementPoint(global.row, global.col));
214  global = roc_last->toGlobal(sipixelobjects::LocalPixel(local));
215  LocalPoint lp2 = topology->localPosition(MeasurementPoint(global.row, global.col));
216  LocalPoint ll(std::min(lp1.x(), lp2.x()), std::min(lp1.y(), lp2.y()), std::min(lp1.z(), lp2.z()));
217  LocalPoint ur(std::max(lp1.x(), lp2.x()), std::max(lp1.y(), lp2.y()), std::max(lp1.z(), lp2.z()));
218  positions.push_back(std::make_pair(ll, ur));
219  } // loop on channels
220  if (!positions.empty()) {
221  i = thePxDets.find(disabledChannels.detId(), i);
222  assert(i != thePxDets.size() && thePxDets.id(i) == disabledChannels.detId());
223  thePxDets.addBadFEDChannelPositions(i, positions);
224  }
225  } // loop on DetId-s
226  } // loop on labels
227  } // if collection labels are populated
228 
229  // Pixel Clusters
230  if (thePixelClusterLabel.isUninitialized()) { //clusters have not been produced
232  thePxDets.setActiveThisEvent(false);
233  }
234  } else {
236  if (event.getByToken(thePixelClusterLabel, pixelClusters)) {
237  const edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
238 
239  if (switchOffPixelsIfEmpty_ && pixelCollection->empty()) {
240  thePxDets.setActiveThisEvent(false);
241  } else {
242  //std::cout <<"updatePixels "<<pixelCollection->dataSize()<<std::endl;
243  pixelClustersToSkip.resize(pixelCollection->dataSize());
244  std::fill(pixelClustersToSkip.begin(), pixelClustersToSkip.end(), false);
245 
248  //and get the collection of pixel ref to skip
249  event.getByToken(thePixelClusterMask, pixelClusterMask);
250  LogDebug("MeasurementTracker") << "getting pxl refs to skip";
251  if (pixelClusterMask.failedToGet())
252  edm::LogError("MeasurementTracker") << "not getting the pixel clusters to skip";
253  if (pixelClusterMask->refProd().id() != pixelClusters.id()) {
254  edm::LogError("ProductIdMismatch")
255  << "The pixel masking does not point to the proper collection of clusters: "
256  << pixelClusterMask->refProd().id() << "!=" << pixelClusters.id();
257  }
258  pixelClusterMask->copyMaskTo(pixelClustersToSkip);
259  }
260 
261  // FIXME: should check if lower_bound is better
262  int i = 0, endDet = thePxDets.size();
263  for (edmNew::DetSetVector<SiPixelCluster>::const_iterator it = pixelCollection->begin(),
264  ed = pixelCollection->end();
265  it != ed;
266  ++it) {
268  unsigned int id = set.id();
269  while (id != thePxDets.id(i)) {
270  ++i;
271  if (endDet == i)
272  throw "we have a problem!!!!";
273  }
274  // push cluster range in det
275  if (thePxDets.isActive(i)) {
276  thePxDets.update(i, set);
277  }
278  }
279  }
280  } else {
282  labelsForToken(thePixelClusterLabel, labels);
283  edm::LogWarning("MeasurementTrackerEventProducer")
284  << "input pixel clusters collection " << labels.module << " is not valid";
285  }
286  }
287 }
std::vector< std::pair< LocalPoint, LocalPoint > > BadFEDChannelPositions
size_type dataSize() const
id_type id() const
Definition: DetSetNew.h:64
ProductID id() const
Definition: HandleBase.cc:29
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
T z() const
Definition: PV3DBase.h:61
virtual int rowsperroc() const =0
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
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
virtual int colsperroc() const =0
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:55
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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:117
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:122
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 38 of file MeasurementTrackerEventProducer.h.

Referenced by produce().

38 {};

◆ updateStrips()

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

Definition at line 289 of file MeasurementTrackerEventProducer.cc.

References cms::cuda::assert(), ALCARECOSiPixelCalSingleMuonDQM_cff::clusterCollection, edm::HandleBase::failedToGet(), StMeasurementDetSet::find(), getInactiveStrips(), StMeasurementDetSet::handle(), mps_fire::i, triggerObjects_cff::id, edm::HandleBase::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().

291  {
292  typedef edmNew::DetSet<SiStripCluster> StripDetSet;
293 
294  std::vector<uint32_t> rawInactiveDetIds;
295  getInactiveStrips(event, rawInactiveDetIds);
296 
297  // Strip Clusters
298  //first clear all of them
299  theStDets.setEmpty();
300 
302  return; //clusters have not been produced
303 
304  const int endDet = theStDets.size();
305 
306  // mark as inactive if in rawInactiveDetIds
307  int i = 0;
308  unsigned int idp = 0;
309  for (auto id : rawInactiveDetIds) {
310  if (id == idp)
311  continue; // skip multiple id
312  idp = id;
313  i = theStDets.find(id, i);
314  assert(i != endDet && id == theStDets.id(i));
315  theStDets.setActiveThisEvent(i, false);
316  }
317 
318  //========= actually load cluster =============
319  {
321  if (event.getByToken(theStripClusterLabel, clusterHandle)) {
323 
326  //and get the collection of pixel ref to skip
327  LogDebug("MeasurementTracker") << "getting strp refs to skip";
328  event.getByToken(theStripClusterMask, stripClusterMask);
329  if (stripClusterMask.failedToGet())
330  edm::LogError("MeasurementTracker") << "not getting the strip clusters to skip";
331  if (stripClusterMask->refProd().id() != clusterHandle.id()) {
332  edm::LogError("ProductIdMismatch")
333  << "The strip masking does not point to the proper collection of clusters: "
334  << stripClusterMask->refProd().id() << "!=" << clusterHandle.id();
335  }
336  stripClusterMask->copyMaskTo(stripClustersToSkip);
337  }
338 
339  theStDets.handle() = clusterHandle;
340  int i = 0;
341  // cluster and det and in order (both) and unique so let's use set intersection
342  for (auto j = 0U; j < (*clusterCollection).size(); ++j) {
343  unsigned int id = (*clusterCollection).id(j);
344  while (id != theStDets.id(i)) { // eventually change to lower_bound
345  ++i;
346  if (endDet == i)
347  throw "we have a problem in strips!!!!";
348  }
349 
350  // push cluster range in det
351  if (theStDets.isActive(i))
352  theStDets.update(i, j);
353  }
354  } else {
356  labelsForToken(theStripClusterLabel, labels);
357  edm::LogWarning("MeasurementTrackerEventProducer")
358  << "input strip cluster collection " << labels.module << " is not valid";
359  }
360  }
361 }
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:99
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 42 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 57 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<DetIdCollection> > MeasurementTrackerEventProducer::theInactiveStripDetectorLabels
protected

◆ thePh2OTClusterLabel

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

◆ thePh2OTVectorHitsLabel

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

Definition at line 46 of file MeasurementTrackerEventProducer.h.

Referenced by MeasurementTrackerEventProducer(), and produce().

◆ thePh2OTVectorHitsRejLabel

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

Definition at line 47 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 59 of file MeasurementTrackerEventProducer.h.

Referenced by MeasurementTrackerEventProducer(), and produce().