15 : measurementTrackerToken_(
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)
23 std::vector<edm::InputTag> badPixelFEDChannelCollectionTags =
24 iConfig.
getParameter<std::vector<edm::InputTag>>(
"badPixelFEDChannelCollectionLabels");
25 if (!badPixelFEDChannelCollectionTags.empty()) {
26 for (
auto&
t : badPixelFEDChannelCollectionTags)
31 std::vector<edm::InputTag> inactiveStripDetectorTags(
32 iConfig.
getParameter<std::vector<edm::InputTag>>(
"inactiveStripDetectorLabels"));
33 for (
auto&
t : inactiveStripDetectorTags)
70 produces<MeasurementTrackerEvent>();
84 desc.add<std::vector<edm::InputTag>>(
"inactivePixelDetectorLabels",
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");
91 desc.add<std::vector<edm::InputTag>>(
"inactiveStripDetectorLabels",
93 ->setComment(
"One or more DetIdCollections of modules to mask on the fly for a given event");
95 desc.add<
bool>(
"switchOffPixelsIfEmpty",
true)->setComment(
"let's keep it like this, for cosmics");
97 descriptions.
add(
"measurementTrackerEventDefault",
desc);
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());
108 std::vector<bool> stripClustersToSkip;
109 std::vector<bool> pixelClustersToSkip;
110 std::vector<bool> phase2ClustersToSkip;
130 phase2OTData.release(),
132 phase2OTVectorHitsRej,
135 phase2ClustersToSkip));
140 std::vector<bool>& pixelClustersToSkip,
146 std::vector<uint32_t> rawInactiveDetIds;
150 if (
event.getByToken(tk, detIds)) {
151 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
153 static std::atomic<bool> iFailedAlready{
false};
154 bool expected =
false;
155 if (iFailedAlready.compare_exchange_strong(expected,
true, std::memory_order_acq_rel)) {
157 <<
"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
161 if (!rawInactiveDetIds.empty())
162 std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
164 int i = 0, endDet = thePxDets.
size();
165 unsigned int idp = 0;
166 for (
auto id : rawInactiveDetIds) {
170 i = thePxDets.
find(
id,
i);
181 if (!
event.getByToken(tk, pixelFEDChannelCollectionHandle))
184 for (
const auto& disabledChannels : *pixelFEDChannelCollectionHandle) {
186 for (
const auto& ch : disabledChannels) {
192 for (
path.roc = 1;
path.roc <= (ch.roc_last - ch.roc_first) + 1;
path.roc++) {
196 assert(
roc->rawId() == disabledChannels.detId());
197 if (
roc->idInDetUnit() == ch.roc_first)
199 if (
roc->idInDetUnit() == ch.roc_last)
202 if (roc_first ==
nullptr || roc_last ==
nullptr) {
204 <<
"Do not find either roc_first or roc_last in the cabling map.";
218 positions.push_back(std::make_pair(ll, ur));
220 if (!positions.empty()) {
221 i = thePxDets.
find(disabledChannels.detId(),
i);
222 assert(
i != thePxDets.
size() && thePxDets.
id(
i) == disabledChannels.detId());
243 pixelClustersToSkip.resize(pixelCollection->
dataSize());
244 std::fill(pixelClustersToSkip.begin(), pixelClustersToSkip.end(),
false);
250 LogDebug(
"MeasurementTracker") <<
"getting pxl refs to skip";
252 edm::LogError(
"MeasurementTracker") <<
"not getting the pixel clusters to skip";
255 <<
"The pixel masking does not point to the proper collection of clusters: " 258 pixelClusterMask->copyMaskTo(pixelClustersToSkip);
262 int i = 0, endDet = thePxDets.
size();
264 ed = pixelCollection->
end();
268 unsigned int id =
set.
id();
269 while (
id != thePxDets.
id(
i)) {
272 throw "we have a problem!!!!";
284 <<
"input pixel clusters collection " <<
labels.module <<
" is not valid";
291 std::vector<bool>& stripClustersToSkip)
const {
294 std::vector<uint32_t> rawInactiveDetIds;
304 const int endDet = theStDets.
size();
308 unsigned int idp = 0;
309 for (
auto id : rawInactiveDetIds) {
313 i = theStDets.
find(
id,
i);
327 LogDebug(
"MeasurementTracker") <<
"getting strp refs to skip";
330 edm::LogError(
"MeasurementTracker") <<
"not getting the strip clusters to skip";
331 if (stripClusterMask->refProd().
id() != clusterHandle.
id()) {
333 <<
"The strip masking does not point to the proper collection of clusters: " 334 << stripClusterMask->refProd().
id() <<
"!=" << clusterHandle.
id();
336 stripClusterMask->copyMaskTo(stripClustersToSkip);
339 theStDets.
handle() = clusterHandle;
342 for (
auto j = 0
U;
j < (*clusterCollection).size(); ++
j) {
343 unsigned int id = (*clusterCollection).id(
j);
344 while (
id != theStDets.
id(
i)) {
347 throw "we have a problem in strips!!!!";
358 <<
"input strip cluster collection " <<
labels.module <<
" is not valid";
377 int i = 0, endDet = thePh2OTDets.
size();
379 ed = phase2OTCollection->
end();
383 unsigned int id =
set.
id();
384 while (
id != thePh2OTDets.
id(
i)) {
387 throw "we have a problem!!!!";
398 <<
"input Phase2TrackerCluster1D collection " <<
labels.module <<
" is not valid";
406 std::vector<uint32_t>& rawInactiveDetIds)
const {
410 if (
event.getByToken(tk, detIds)) {
411 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
414 if (!rawInactiveDetIds.empty())
415 std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
std::vector< std::pair< LocalPoint, LocalPoint > > BadFEDChannelPositions
size_type dataSize() const
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
void updatePixels(const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip, const TrackerGeometry &trackerGeom, const edm::EventSetup &iSetup) const
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
bool selfUpdateSkipClusters_
unsigned int id(int i) const
#define DEFINE_FWK_MODULE(type)
unsigned int id(int i) const
virtual int rowsperroc() const =0
T const * product() const
constexpr bool isUninitialized() const noexcept
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > pixelCablingMapToken_
MeasurementTrackerEventProducer(const edm::ParameterSet &iConfig)
void update(int i, const StripDetset &detSet)
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Error, false > LogError
bool isActive(int i) const
const edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D > > & handle() const
identify pixel inside single ROC
const_iterator end(bool update=false) const
global coordinates (row and column in DetUnit, as in PixelDigi)
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > theBadPixelFEDChannelsLabels
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
void updateStrips(const edm::Event &, StMeasurementDetSet &theStDets, std::vector< bool > &stripClustersToSkip) const
unsigned int id(int i) const
bool isActive(int i) 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 ...
virtual int colsperroc() const =0
GlobalPixel toGlobal(const LocalPixel &loc) const
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsRejLabel
void updatePhase2OT(const edm::Event &, Phase2OTMeasurementDetSet &thePh2OTDets) const
bool getData(T &iHolder) const
void update(int i, const PixelDetSet &detSet)
void addBadFEDChannelPositions(int i, BadFEDChannelPositions &positions)
const TrackerGeomDet * idToDet(DetId) const override
const_iterator begin() const
void updateStacks(const edm::Event &, Phase2OTMeasurementDetSet &theStDets) const
void produce(edm::Event &, const edm::EventSetup &) override
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
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTrackerToken_
void setActiveThisEvent(bool active)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
int find(unsigned int jd, int i=0) const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
bool switchOffPixelsIfEmpty_
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsLabel
void setActiveThisEvent(bool active)
edm::Handle< edmNew::DetSetVector< SiStripCluster > > & handle()
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
void update(int i, const Phase2DetSet &detSet)
bool isActive(int i) const
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels