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 DetIdVectors 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 (not
event.getByToken(tk, pixelFEDChannelCollectionHandle))
184 for (
const auto& disabledChannels : *pixelFEDChannelCollectionHandle) {
186 for (
const auto& ch : disabledChannels) {
192 assert(ch.roc_last >= ch.roc_first);
193 for (
path.roc = 1;
path.roc <= (ch.roc_last - ch.roc_first) + 1; ++
path.roc) {
197 assert(
roc->rawId() == disabledChannels.detId());
198 if (
roc->idInDetUnit() == ch.roc_first)
200 if (
roc->idInDetUnit() == ch.roc_last)
203 if (roc_first ==
nullptr || roc_last ==
nullptr) {
205 <<
"Do not find either roc_first or roc_last in the cabling map.";
219 positions.push_back(std::make_pair(ll, ur));
221 if (not positions.empty()) {
222 i = thePxDets.
find(disabledChannels.detId(),
i);
223 assert(
i != thePxDets.
size() && thePxDets.
id(
i) == disabledChannels.detId());
244 pixelClustersToSkip.resize(pixelCollection->
dataSize());
245 std::fill(pixelClustersToSkip.begin(), pixelClustersToSkip.end(),
false);
251 LogDebug(
"MeasurementTracker") <<
"getting pxl refs to skip";
253 edm::LogError(
"MeasurementTracker") <<
"not getting the pixel clusters to skip";
256 <<
"The pixel masking does not point to the proper collection of clusters: " 259 pixelClusterMask->copyMaskTo(pixelClustersToSkip);
263 int i = 0, endDet = thePxDets.
size();
265 ed = pixelCollection->
end();
269 unsigned int id =
set.
id();
270 while (
id != thePxDets.
id(
i)) {
273 throw "we have a problem!!!!";
285 <<
"input pixel clusters collection " <<
labels.module <<
" is not valid";
292 std::vector<bool>& stripClustersToSkip)
const {
295 std::vector<uint32_t> rawInactiveDetIds;
305 const int endDet = theStDets.
size();
309 unsigned int idp = 0;
310 for (
auto id : rawInactiveDetIds) {
314 i = theStDets.
find(
id,
i);
328 LogDebug(
"MeasurementTracker") <<
"getting strp refs to skip";
331 edm::LogError(
"MeasurementTracker") <<
"not getting the strip clusters to skip";
332 if (stripClusterMask->refProd().
id() != clusterHandle.
id()) {
334 <<
"The strip masking does not point to the proper collection of clusters: " 335 << stripClusterMask->refProd().
id() <<
"!=" << clusterHandle.
id();
337 stripClusterMask->copyMaskTo(stripClustersToSkip);
340 theStDets.
handle() = clusterHandle;
343 for (
auto j = 0
U;
j < (*clusterCollection).size(); ++
j) {
344 unsigned int id = (*clusterCollection).id(
j);
345 while (
id != theStDets.
id(
i)) {
348 throw "we have a problem in strips!!!!";
359 <<
"input strip cluster collection " <<
labels.module <<
" is not valid";
378 int i = 0, endDet = thePh2OTDets.
size();
380 ed = phase2OTCollection->
end();
384 unsigned int id =
set.
id();
385 while (
id != thePh2OTDets.
id(
i)) {
388 throw "we have a problem!!!!";
399 <<
"input Phase2TrackerCluster1D collection " <<
labels.module <<
" is not valid";
407 std::vector<uint32_t>& rawInactiveDetIds)
const {
411 if (
event.getByToken(tk, detIds)) {
412 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
415 if (!rawInactiveDetIds.empty())
416 std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
std::vector< std::pair< LocalPoint, LocalPoint > > BadFEDChannelPositions
size_type dataSize() const
T getParameter(std::string const &) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void updatePixels(const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip, const TrackerGeometry &trackerGeom, const edm::EventSetup &iSetup) const
bool selfUpdateSkipClusters_
unsigned int id(int i) const
unsigned int id(int i) const
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 ...
GlobalPixel toGlobal(const LocalPixel &loc) const
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsRejLabel
#define DEFINE_FWK_MODULE(type)
void updatePhase2OT(const edm::Event &, Phase2OTMeasurementDetSet &thePh2OTDets) const
std::vector< edm::EDGetTokenT< DetIdVector > > theInactiveStripDetectorLabels
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