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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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
 
std::string measurementTrackerLabel_
 
std::string pixelCablingMapLabel_
 
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< 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
 

Private Member Functions

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

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 16 of file MeasurementTrackerEventProducer.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file MeasurementTrackerEventProducer.cc.

References edm::ParameterSet::getParameter(), isPhase2, LogDebug, pixelCablingMapLabel_, selfUpdateSkipClusters_, createPayload::skip, AlCaHLTBitMon_QueryRunRegistry::string, lumiQTWidget::t, theBadPixelFEDChannelsLabels, theInactivePixelDetectorLabels, theInactiveStripDetectorLabels, thePh2OTClusterLabel, thePixelClusterLabel, thePixelClusterMask, theStripClusterLabel, and theStripClusterMask.

17  :
18  measurementTrackerLabel_(iConfig.getParameter<std::string>("measurementTracker")),
19  switchOffPixelsIfEmpty_(iConfig.getParameter<bool>("switchOffPixelsIfEmpty"))
20 {
21  std::vector<edm::InputTag> inactivePixelDetectorTags(iConfig.getParameter<std::vector<edm::InputTag> >("inactivePixelDetectorLabels"));
22  for (auto &t : inactivePixelDetectorTags) theInactivePixelDetectorLabels.push_back(consumes<DetIdCollection>(t));
23 
24  std::vector<edm::InputTag> badPixelFEDChannelCollectionTags = iConfig.getParameter<std::vector<edm::InputTag> >("badPixelFEDChannelCollectionLabels");
25  if (!badPixelFEDChannelCollectionTags.empty()) {
26  for (auto &t : badPixelFEDChannelCollectionTags) theBadPixelFEDChannelsLabels.push_back(consumes<PixelFEDChannelCollection>(t));
27  pixelCablingMapLabel_ = iConfig.getParameter<std::string> ("pixelCablingMapLabel");
28  }
29 
30  std::vector<edm::InputTag> inactiveStripDetectorTags(iConfig.getParameter<std::vector<edm::InputTag> >("inactiveStripDetectorLabels"));
31  for (auto &t : inactiveStripDetectorTags) theInactiveStripDetectorLabels.push_back(consumes<DetIdCollection>(t));
32 
33  //the measurement tracking is set to skip clusters, the other option is set from outside
34  edm::InputTag skip=iConfig.getParameter<edm::InputTag>("skipClusters");
35  selfUpdateSkipClusters_ = !( skip==edm::InputTag("") );
36  LogDebug("MeasurementTracker")<<"skipping clusters: "<<selfUpdateSkipClusters_;
37  isPhase2 = false;
38 
39  if (iConfig.getParameter<std::string>("stripClusterProducer") != "") {
40  theStripClusterLabel = consumes<edmNew::DetSetVector<SiStripCluster> >(edm::InputTag(iConfig.getParameter<std::string>("stripClusterProducer")));
41  if (selfUpdateSkipClusters_) theStripClusterMask = consumes<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster>>>(iConfig.getParameter<edm::InputTag>("skipClusters"));
42  }
43  if (iConfig.getParameter<std::string>("pixelClusterProducer") != "") {
44  thePixelClusterLabel = consumes<edmNew::DetSetVector<SiPixelCluster> >(edm::InputTag(iConfig.getParameter<std::string>("pixelClusterProducer")));
45  if (selfUpdateSkipClusters_) thePixelClusterMask = consumes<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster>>>(iConfig.getParameter<edm::InputTag>("skipClusters"));
46  }
47  if (iConfig.getParameter<std::string>("Phase2TrackerCluster1DProducer") != "") {
48  thePh2OTClusterLabel = consumes<edmNew::DetSetVector<Phase2TrackerCluster1D> >(edm::InputTag(iConfig.getParameter<std::string>("Phase2TrackerCluster1DProducer")));
49  isPhase2 = true;
50  }
51 
52  produces<MeasurementTrackerEvent>();
53 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > theBadPixelFEDChannelsLabels
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels
MeasurementTrackerEventProducer::~MeasurementTrackerEventProducer ( )
inlineoverride

Definition at line 19 of file MeasurementTrackerEventProducer.h.

References fillDescriptions().

19 {}

Member Function Documentation

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

Definition at line 55 of file MeasurementTrackerEventProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

55  {
57 
58  desc.add<std::string>("measurementTracker", "");
59  desc.add<edm::InputTag>("skipClusters", edm::InputTag());
60  desc.add<std::string>("pixelClusterProducer", "siPixelClusters");
61  desc.add<std::string>("stripClusterProducer", "siStripClusters");
62  desc.add<std::string>("Phase2TrackerCluster1DProducer", "");
63 
64  desc.add<std::vector<edm::InputTag>>("inactivePixelDetectorLabels", std::vector<edm::InputTag>{{edm::InputTag("siPixelDigis")}})->setComment("One or more DetIdCollections of modules to mask on the fly for a given event");
65  desc.add<std::vector<edm::InputTag>>("badPixelFEDChannelCollectionLabels", std::vector<edm::InputTag>())->setComment("One or more PixelFEDChannelCollections of modules+ROCs to mask on the fly for a given event");
66  desc.add<std::string>("pixelCablingMapLabel", "");
67 
68  desc.add<std::vector<edm::InputTag>>("inactiveStripDetectorLabels", std::vector<edm::InputTag>{{edm::InputTag("siStripDigis")}})->setComment("One or more DetIdCollections of modules to mask on the fly for a given event");
69 
70  desc.add<bool>("switchOffPixelsIfEmpty", true)->setComment("let's keep it like this, for cosmics");
71 
72  descriptions.add("measurementTrackerEventDefault",desc);
73 }
void setComment(std::string const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void MeasurementTrackerEventProducer::getInactiveStrips ( const edm::Event event,
std::vector< uint32_t > &  rawInactiveDetIds 
) const
protected

Definition at line 354 of file MeasurementTrackerEventProducer.cc.

References edm::EDCollection< T >::begin(), DEFINE_FWK_MODULE, edm::EDCollection< T >::end(), edm::Event::getByToken(), and theInactiveStripDetectorLabels.

Referenced by updateStrips().

355 {
356  if (!theInactiveStripDetectorLabels.empty()) {
359  if (event.getByToken(tk, detIds)){
360  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
361  }
362  }
363  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
364  }
365 
366 }
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
const_iterator end() const
Definition: EDCollection.h:153
const_iterator begin() const
Definition: EDCollection.h:146
void MeasurementTrackerEventProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 77 of file MeasurementTrackerEventProducer.cc.

References MeasurementTracker::geomTracker(), edm::EventSetup::get(), measurementTrackerLabel_, eostools::move(), MeasurementTracker::phase2DetConditions(), MeasurementTracker::pixelDetConditions(), edm::Event::put(), MeasurementTracker::stripDetConditions(), updatePhase2OT(), updatePixels(), updateStacks(), and updateStrips().

78 {
79  edm::ESHandle<MeasurementTracker> measurementTracker;
80  iSetup.get<CkfComponentsRecord>().get(measurementTrackerLabel_, measurementTracker);
81 
82  // create new data structures from templates
83  auto stripData = std::make_unique<StMeasurementDetSet>(measurementTracker->stripDetConditions());
84  auto pixelData= std::make_unique<PxMeasurementDetSet>(measurementTracker->pixelDetConditions());
85  auto phase2OTData = std::make_unique<Phase2OTMeasurementDetSet>(measurementTracker->phase2DetConditions());
86  std::vector<bool> stripClustersToSkip;
87  std::vector<bool> pixelClustersToSkip;
88  std::vector<bool> phase2ClustersToSkip;
89  // fill them
90  updateStrips(iEvent, *stripData, stripClustersToSkip);
91  updatePixels(iEvent, *pixelData, pixelClustersToSkip, dynamic_cast<const TrackerGeometry&>(*(measurementTracker->geomTracker())), iSetup);
92  updatePhase2OT(iEvent, *phase2OTData);
93  updateStacks(iEvent, *phase2OTData);
94 
95  // put into MTE
96  // put into event
97  iEvent.put(std::move(
98  std::make_unique<MeasurementTrackerEvent>(*measurementTracker,
99  stripData.release(), pixelData.release(), phase2OTData.release(),
100  stripClustersToSkip, pixelClustersToSkip, phase2ClustersToSkip)
101  ));
102 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void updateStrips(const edm::Event &, StMeasurementDetSet &theStDets, std::vector< bool > &stripClustersToSkip) const
virtual const Phase2OTMeasurementConditionSet & phase2DetConditions() const =0
void updatePhase2OT(const edm::Event &, Phase2OTMeasurementDetSet &thePh2OTDets) const
const TrackingGeometry * geomTracker() const
void updateStacks(const edm::Event &, Phase2OTMeasurementDetSet &theStDets) const
virtual const StMeasurementConditionSet & stripDetConditions() const =0
Provide templates to be filled in.
void updatePixels(const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip, const TrackerGeometry &trackerGeom, const edm::EventSetup &iSetup) const
T get() const
Definition: EventSetup.h:63
virtual const PxMeasurementConditionSet & pixelDetConditions() const =0
def move(src, dest)
Definition: eostools.py:510
void MeasurementTrackerEventProducer::updatePhase2OT ( const edm::Event event,
Phase2OTMeasurementDetSet thePh2OTDets 
) const
protected

Definition at line 314 of file MeasurementTrackerEventProducer.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::end(), edm::Event::getByToken(), Phase2OTMeasurementDetSet::handle(), mps_fire::i, edmNew::DetSet< T >::id(), Phase2OTMeasurementDetSet::id(), Phase2OTMeasurementDetSet::isActive(), isPhase2, edm::EDGetTokenT< T >::isUninitialized(), tablePrinter::labels, edm::ProductLabels::module, seedClusterRemoverPhase2_cfi::phase2OTClusters, edm::Handle< T >::product(), Phase2OTMeasurementDetSet::setActiveThisEvent(), Phase2OTMeasurementDetSet::size(), thePh2OTClusterLabel, and Phase2OTMeasurementDetSet::update().

Referenced by produce().

314  {
315 
316 
317  // Phase2OT Clusters
318  if ( isPhase2 ) {
319 
320  if( thePh2OTClusterLabel.isUninitialized() ) { //clusters have not been produced
321  thePh2OTDets.setActiveThisEvent(false);
322  } else {
323 
325  if (event.getByToken(thePh2OTClusterLabel, phase2OTClusters)) {
326  const edmNew::DetSetVector<Phase2TrackerCluster1D>* phase2OTCollection = phase2OTClusters.product();
327 
328  int i = 0, endDet = thePh2OTDets.size();
329  for (edmNew::DetSetVector<Phase2TrackerCluster1D>::const_iterator it = phase2OTCollection->begin(), ed = phase2OTCollection->end(); it != ed; ++it) {
330 
332  unsigned int id = set.id();
333  while ( id != thePh2OTDets.id(i)) {
334  ++i;
335  if (endDet==i) throw "we have a problem!!!!";
336  }
337  // push cluster range in det
338  if ( thePh2OTDets.isActive(i) ) {
339  thePh2OTDets.update(i,set);
340  }
341  }
342  } else {
344  labelsForToken(thePh2OTClusterLabel, labels);
345  edm::LogWarning("MeasurementTrackerEventProducer") << "input Phase2TrackerCluster1D collection " << labels.module << " is not valid";
346  }
347  }
348 
349  }
350  return;
351 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
const edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D > > & handle() const
char const * module
Definition: ProductLabels.h:5
T const * product() const
Definition: Handle.h:81
id_type id() const
Definition: DetSetNew.h:81
bool isUninitialized() const
Definition: EDGetToken.h:73
void setActiveThisEvent(bool active)
unsigned int id(int i) const
void update(int i, const Phase2DetSet &detSet)
const_iterator begin(bool update=false) const
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 105 of file MeasurementTrackerEventProducer.cc.

References PxMeasurementDetSet::addBadFEDChannelPositions(), 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(), lumiContext::fill, PxMeasurementDetSet::find(), SiPixelFedCablingMap::findItem(), edm::EventSetup::get(), edm::Event::getByToken(), PxMeasurementDetSet::handle(), mps_fire::i, triggerObjects_cff::id, edmNew::DetSet< T >::id(), edm::HandleBase::id(), PxMeasurementDetSet::id(), sipixelobjects::PixelROC::idInDetUnit(), TrackerGeometry::idToDet(), PxMeasurementDetSet::isActive(), edm::EDGetTokenT< T >::isUninitialized(), tablePrinter::labels, DTRecHitClients_cfi::local, Topology::localPosition(), LogDebug, SiStripPI::max, min(), edm::ProductLabels::module, callgraph::path, pixelCablingMapLabel_, HiRegitMuonDetachedTripletStep_cff::pixelClusters, edm::Handle< T >::product(), sipixelobjects::PixelROC::rawId(), sipixelobjects::CablingPathToDetUnit::roc, sipixelobjects::GlobalPixel::row, PixelTopology::rowsperroc(), selfUpdateSkipClusters_, PxMeasurementDetSet::setActiveThisEvent(), PxMeasurementDetSet::setEmpty(), PxMeasurementDetSet::size(), PixelGeomDetUnit::specificTopology(), switchOffPixelsIfEmpty_, theBadPixelFEDChannelsLabels, theInactivePixelDetectorLabels, thePixelClusterLabel, thePixelClusterMask, sipixelobjects::PixelROC::toGlobal(), ecaldqm::topology(), PxMeasurementDetSet::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

107 {
108  // start by clearinng everything
109  thePxDets.setEmpty();
110 
111  std::vector<uint32_t> rawInactiveDetIds;
112  if (!theInactivePixelDetectorLabels.empty()) {
115  if (event.getByToken(tk, detIds)){
116  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
117  }else{
118  static std::atomic<bool> iFailedAlready{false};
119  bool expected = false;
120  if (iFailedAlready.compare_exchange_strong(expected,true,std::memory_order_acq_rel)){
121  edm::LogError("MissingProduct")<<"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
122  }
123  }
124  }
125  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
126  // mark as inactive if in rawInactiveDetIds
127  int i=0, endDet = thePxDets.size();
128  unsigned int idp=0;
129  for ( auto id : rawInactiveDetIds) {
130  if (id==idp) continue; // skip multiple id
131  idp=id;
132  i=thePxDets.find(id,i);
133  assert(i!=endDet && id == thePxDets.id(i));
134  thePxDets.setActiveThisEvent(i,false);
135  }
136  }
137 
138  if (!theBadPixelFEDChannelsLabels.empty()) {
140  iSetup.get<SiPixelFedCablingMapRcd>().get(pixelCablingMapLabel_, cablingMap);
141 
142  edm::Handle<PixelFEDChannelCollection> pixelFEDChannelCollectionHandle;
144  if (!event.getByToken(tk, pixelFEDChannelCollectionHandle)) continue;
145  int i=0;
146  for (const auto& disabledChannels: *pixelFEDChannelCollectionHandle) {
148  for(const auto& ch: disabledChannels) {
149  const sipixelobjects::PixelROC *roc_first=nullptr, *roc_last=nullptr;
150  sipixelobjects::CablingPathToDetUnit path = {ch.fed, ch.link, 0};
151  // PixelFEDChannelCollection addresses the ROCs by their 'idInDetUnit' (from 0 to 15), ROCs also know their on 'idInDetUnit',
152  // however the cabling map uses a numbering [1,numberOfROCs], see sipixelobjects::PixelFEDLink::roc(unsigned int id), not necessarily sorted in the same direction.
153  // PixelFEDChannelCollection MUST be filled such that ch.roc_first (ch.roc_last) correspond to the lowest (highest) 'idInDetUnit' in the channel
154  for (path.roc=1; path.roc<=(ch.roc_last-ch.roc_first)+1; path.roc++) {
155  const sipixelobjects::PixelROC *roc = cablingMap->findItem(path);
156  if (roc==nullptr) continue;
157  assert(roc->rawId()==disabledChannels.detId());
158  if (roc->idInDetUnit()==ch.roc_first) roc_first=roc;
159  if (roc->idInDetUnit()==ch.roc_last) roc_last=roc;
160  }
161  if (roc_first==nullptr || roc_last==nullptr) {
162  edm::LogError("PixelFEDChannelCollection")<<"Do not find either roc_first or roc_last in the cabling map.";
163  continue;
164  }
165  const PixelGeomDetUnit * theGeomDet = dynamic_cast<const PixelGeomDetUnit*> (trackerGeom.idToDet(roc_first->rawId()));
166  PixelTopology const * topology = &(theGeomDet->specificTopology());
167  sipixelobjects::LocalPixel::RocRowCol local = {topology->rowsperroc()/2, topology->colsperroc()/2}; //corresponding to center of ROC row, col
169  LocalPoint lp1 = topology->localPosition(MeasurementPoint(global.row, global.col));
170  global = roc_last->toGlobal(sipixelobjects::LocalPixel(local));
171  LocalPoint lp2 = topology->localPosition(MeasurementPoint(global.row, global.col));
172  LocalPoint ll(std::min(lp1.x(), lp2.x()), std::min(lp1.y(), lp2.y()), std::min(lp1.z(), lp2.z()));
173  LocalPoint ur(std::max(lp1.x(), lp2.x()), std::max(lp1.y(), lp2.y()), std::max(lp1.z(), lp2.z()));
174  positions.push_back(std::make_pair(ll, ur));
175  } // loop on channels
176  if (!positions.empty()) {
177  i=thePxDets.find(disabledChannels.detId(),i);
178  assert(i!=thePxDets.size() && thePxDets.id(i)==disabledChannels.detId());
179  thePxDets.addBadFEDChannelPositions(i, positions);
180  }
181  } // loop on DetId-s
182  } // loop on labels
183  } // if collection labels are populated
184 
185  // Pixel Clusters
186  if( thePixelClusterLabel.isUninitialized() ) { //clusters have not been produced
188  thePxDets.setActiveThisEvent(false);
189  }
190  }else{
191 
193  if(event.getByToken(thePixelClusterLabel, pixelClusters)) {
194 
195  const edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
196 
197 
198  if (switchOffPixelsIfEmpty_ && pixelCollection->empty()) {
199  thePxDets.setActiveThisEvent(false);
200  } else {
201 
202  //std::cout <<"updatePixels "<<pixelCollection->dataSize()<<std::endl;
203  pixelClustersToSkip.resize(pixelCollection->dataSize());
204  std::fill(pixelClustersToSkip.begin(),pixelClustersToSkip.end(),false);
205 
208  //and get the collection of pixel ref to skip
209  event.getByToken(thePixelClusterMask,pixelClusterMask);
210  LogDebug("MeasurementTracker")<<"getting pxl refs to skip";
211  if (pixelClusterMask.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the pixel clusters to skip";
212  if (pixelClusterMask->refProd().id()!=pixelClusters.id()){
213  edm::LogError("ProductIdMismatch")<<"The pixel masking does not point to the proper collection of clusters: "<<pixelClusterMask->refProd().id()<<"!="<<pixelClusters.id();
214  }
215  pixelClusterMask->copyMaskTo(pixelClustersToSkip);
216  }
217 
218 
219  // FIXME: should check if lower_bound is better
220  int i = 0, endDet = thePxDets.size();
221  for (edmNew::DetSetVector<SiPixelCluster>::const_iterator it = pixelCollection->begin(), ed = pixelCollection->end(); it != ed; ++it) {
223  unsigned int id = set.id();
224  while ( id != thePxDets.id(i)) {
225  ++i;
226  if (endDet==i) throw "we have a problem!!!!";
227  }
228  // push cluster range in det
229  if ( thePxDets.isActive(i) ) {
230  thePxDets.update(i,set);
231  }
232  }
233  }
234  } else {
236  labelsForToken(thePixelClusterLabel, labels);
237  edm::LogWarning("MeasurementTrackerEventProducer") << "input pixel clusters collection " << labels.module << " is not valid";
238  }
239  }
240 }
#define LogDebug(id)
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
size_type dataSize() const
virtual int rowsperroc() const =0
CaloTopology const * topology(0)
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
const_iterator end() const
Definition: EDCollection.h:153
T y() const
Definition: PV3DBase.h:63
const edm::Handle< edmNew::DetSetVector< SiPixelCluster > > & handle() const
std::vector< std::pair< LocalPoint, LocalPoint > > BadFEDChannelPositions
identify pixel inside single ROC
Definition: LocalPixel.h:7
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
unsigned int id(int i) const
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > theBadPixelFEDChannelsLabels
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual int colsperroc() const =0
bool isActive(int i) const
T z() const
Definition: PV3DBase.h:64
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:40
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
Definition: PixelROC.h:37
T min(T a, T b)
Definition: MathUtil.h:58
void update(int i, const PixelDetSet &detSet)
void addBadFEDChannelPositions(int i, BadFEDChannelPositions &positions)
char const * module
Definition: ProductLabels.h:5
bool failedToGet() const
Definition: HandleBase.h:78
const_iterator begin() const
Definition: EDCollection.h:146
T const * product() const
Definition: Handle.h:81
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
row and collumn in ROC representation
Definition: LocalPixel.h:15
const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &path) const final
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
void setActiveThisEvent(bool active)
T get() const
Definition: EventSetup.h:63
const TrackerGeomDet * idToDet(DetId) const override
id_type id() const
Definition: DetSetNew.h:81
int find(unsigned int jd, int i=0) const
bool isUninitialized() const
Definition: EDGetToken.h:73
T x() const
Definition: PV3DBase.h:62
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
const_iterator begin(bool update=false) const
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:59
void MeasurementTrackerEventProducer::updateStacks ( const edm::Event ,
Phase2OTMeasurementDetSet theStDets 
) const
inlineprotected

Definition at line 31 of file MeasurementTrackerEventProducer.h.

Referenced by produce().

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

Definition at line 243 of file MeasurementTrackerEventProducer.cc.

References edm::HandleBase::failedToGet(), StMeasurementDetSet::find(), edm::Event::getByToken(), getInactiveStrips(), StMeasurementDetSet::handle(), mps_fire::i, triggerObjects_cff::id, edm::HandleBase::id(), StMeasurementDetSet::id(), StMeasurementDetSet::isActive(), edm::EDGetTokenT< T >::isUninitialized(), tablePrinter::labels, LogDebug, edm::ProductLabels::module, edm::Handle< T >::product(), selfUpdateSkipClusters_, StMeasurementDetSet::setActiveThisEvent(), StMeasurementDetSet::setEmpty(), StMeasurementDetSet::size(), theStripClusterLabel, theStripClusterMask, mitigatedMETSequence_cff::U, and StMeasurementDetSet::update().

Referenced by produce().

244 {
245  typedef edmNew::DetSet<SiStripCluster> StripDetSet;
246 
247  std::vector<uint32_t> rawInactiveDetIds;
248  getInactiveStrips(event,rawInactiveDetIds);
249 
250  // Strip Clusters
251  //first clear all of them
252  theStDets.setEmpty();
253 
254 
255  if( theStripClusterLabel.isUninitialized() ) return; //clusters have not been produced
256 
257  const int endDet = theStDets.size();
258 
259 
260  // mark as inactive if in rawInactiveDetIds
261  int i=0;
262  unsigned int idp=0;
263  for ( auto id : rawInactiveDetIds) {
264  if (id==idp) continue; // skip multiple id
265  idp=id;
266  i=theStDets.find(id,i);
267  assert(i!=endDet && id == theStDets.id(i));
268  theStDets.setActiveThisEvent(i,false);
269  }
270 
271  //========= actually load cluster =============
272  {
274  if (event.getByToken(theStripClusterLabel, clusterHandle)) {
275  const edmNew::DetSetVector<SiStripCluster>* clusterCollection = clusterHandle.product();
276 
277 
280  //and get the collection of pixel ref to skip
281  LogDebug("MeasurementTracker")<<"getting strp refs to skip";
282  event.getByToken(theStripClusterMask,stripClusterMask);
283  if (stripClusterMask.failedToGet()) edm::LogError("MeasurementTracker")<<"not getting the strip clusters to skip";
284  if (stripClusterMask->refProd().id()!=clusterHandle.id()){
285  edm::LogError("ProductIdMismatch")<<"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().id()<<"!="<<clusterHandle.id();
286  }
287  stripClusterMask->copyMaskTo(stripClustersToSkip);
288  }
289 
290  theStDets.handle() = clusterHandle;
291  int i=0;
292  // cluster and det and in order (both) and unique so let's use set intersection
293  for ( auto j = 0U; j< (*clusterCollection).size(); ++j) {
294  unsigned int id = (*clusterCollection).id(j);
295  while ( id != theStDets.id(i)) { // eventually change to lower_bound
296  ++i;
297  if (endDet==i) throw "we have a problem in strips!!!!";
298  }
299 
300  // push cluster range in det
301  if ( theStDets.isActive(i) )
302  theStDets.update(i,j);
303  }
304  } else {
306  labelsForToken(theStripClusterLabel, labels);
307  edm::LogWarning("MeasurementTrackerEventProducer") << "input strip cluster collection " << labels.module << " is not valid";
308  }
309  }
310 }
#define LogDebug(id)
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
void update(int i, const StripDetset &detSet)
unsigned int id(int i) const
int find(unsigned int jd, int i=0) const
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 ...
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
char const * module
Definition: ProductLabels.h:5
bool failedToGet() const
Definition: HandleBase.h:78
T const * product() const
Definition: Handle.h:81
bool isActive(int i) const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
bool isUninitialized() const
Definition: EDGetToken.h:73
edm::Handle< edmNew::DetSetVector< SiStripCluster > > & handle()
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask

Member Data Documentation

bool MeasurementTrackerEventProducer::isPhase2
protected
std::string MeasurementTrackerEventProducer::measurementTrackerLabel_
protected

Definition at line 35 of file MeasurementTrackerEventProducer.h.

Referenced by produce().

std::string MeasurementTrackerEventProducer::pixelCablingMapLabel_
protected
bool MeasurementTrackerEventProducer::selfUpdateSkipClusters_
protected
bool MeasurementTrackerEventProducer::switchOffPixelsIfEmpty_
protected

Definition at line 48 of file MeasurementTrackerEventProducer.h.

Referenced by updatePixels().

std::vector<edm::EDGetTokenT<PixelFEDChannelCollection> > MeasurementTrackerEventProducer::theBadPixelFEDChannelsLabels
protected
std::vector<edm::EDGetTokenT<DetIdCollection> > MeasurementTrackerEventProducer::theInactivePixelDetectorLabels
protected
std::vector<edm::EDGetTokenT<DetIdCollection> > MeasurementTrackerEventProducer::theInactiveStripDetectorLabels
protected
edm::EDGetTokenT<edmNew::DetSetVector<Phase2TrackerCluster1D> > MeasurementTrackerEventProducer::thePh2OTClusterLabel
protected
edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > MeasurementTrackerEventProducer::thePixelClusterLabel
protected
edm::EDGetTokenT<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > > MeasurementTrackerEventProducer::thePixelClusterMask
protected
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > MeasurementTrackerEventProducer::theStripClusterLabel
protected
edm::EDGetTokenT<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > > MeasurementTrackerEventProducer::theStripClusterMask
protected