18 : measurementTrackerLabel_(iConfig.getParameter<
std::
string>(
"measurementTracker")),
19 switchOffPixelsIfEmpty_(iConfig.getParameter<
bool>(
"switchOffPixelsIfEmpty")) {
20 std::vector<edm::InputTag> inactivePixelDetectorTags(
21 iConfig.
getParameter<std::vector<edm::InputTag>>(
"inactivePixelDetectorLabels"));
22 for (
auto&
t : inactivePixelDetectorTags)
25 std::vector<edm::InputTag> badPixelFEDChannelCollectionTags =
26 iConfig.
getParameter<std::vector<edm::InputTag>>(
"badPixelFEDChannelCollectionLabels");
27 if (!badPixelFEDChannelCollectionTags.empty()) {
28 for (
auto&
t : badPixelFEDChannelCollectionTags)
33 std::vector<edm::InputTag> inactiveStripDetectorTags(
34 iConfig.
getParameter<std::vector<edm::InputTag>>(
"inactiveStripDetectorLabels"));
35 for (
auto&
t : inactiveStripDetectorTags)
64 produces<MeasurementTrackerEvent>();
76 desc.
add<std::vector<edm::InputTag>>(
"inactivePixelDetectorLabels",
78 ->setComment(
"One or more DetIdCollections of modules to mask on the fly for a given event");
79 desc.
add<std::vector<edm::InputTag>>(
"badPixelFEDChannelCollectionLabels", std::vector<edm::InputTag>())
80 ->setComment(
"One or more PixelFEDChannelCollections of modules+ROCs to mask on the fly for a given event");
83 desc.
add<std::vector<edm::InputTag>>(
"inactiveStripDetectorLabels",
85 ->setComment(
"One or more DetIdCollections of modules to mask on the fly for a given event");
87 desc.
add<
bool>(
"switchOffPixelsIfEmpty",
true)->setComment(
"let's keep it like this, for cosmics");
89 descriptions.
add(
"measurementTrackerEventDefault", desc);
97 auto stripData = std::make_unique<StMeasurementDetSet>(
measurementTracker->stripDetConditions());
98 auto pixelData = std::make_unique<PxMeasurementDetSet>(
measurementTracker->pixelDetConditions());
99 auto phase2OTData = std::make_unique<Phase2OTMeasurementDetSet>(
measurementTracker->phase2DetConditions());
100 std::vector<bool> stripClustersToSkip;
101 std::vector<bool> pixelClustersToSkip;
102 std::vector<bool> phase2ClustersToSkip;
118 phase2OTData.release(),
121 phase2ClustersToSkip));
126 std::vector<bool>& pixelClustersToSkip,
132 std::vector<uint32_t> rawInactiveDetIds;
136 if (
event.getByToken(tk, detIds)) {
137 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
139 static std::atomic<bool> iFailedAlready{
false};
140 bool expected =
false;
141 if (iFailedAlready.compare_exchange_strong(expected,
true, std::memory_order_acq_rel)) {
143 <<
"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
147 if (!rawInactiveDetIds.empty())
148 std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
150 int i = 0, endDet = thePxDets.
size();
151 unsigned int idp = 0;
152 for (
auto id : rawInactiveDetIds) {
156 i = thePxDets.
find(
id,
i);
168 if (!
event.getByToken(tk, pixelFEDChannelCollectionHandle))
171 for (
const auto& disabledChannels : *pixelFEDChannelCollectionHandle) {
173 for (
const auto& ch : disabledChannels) {
179 for (
path.roc = 1;
path.roc <= (ch.roc_last - ch.roc_first) + 1;
path.roc++) {
183 assert(
roc->rawId() == disabledChannels.detId());
184 if (
roc->idInDetUnit() == ch.roc_first)
186 if (
roc->idInDetUnit() == ch.roc_last)
189 if (roc_first ==
nullptr || roc_last ==
nullptr) {
191 <<
"Do not find either roc_first or roc_last in the cabling map.";
195 dynamic_cast<const PixelGeomDetUnit*>(trackerGeom.
idToDet(roc_first->
rawId()));
205 positions.push_back(std::make_pair(ll, ur));
207 if (!positions.empty()) {
208 i = thePxDets.
find(disabledChannels.detId(),
i);
209 assert(
i != thePxDets.
size() && thePxDets.
id(
i) == disabledChannels.detId());
230 pixelClustersToSkip.resize(pixelCollection->
dataSize());
231 std::fill(pixelClustersToSkip.begin(), pixelClustersToSkip.end(),
false);
237 LogDebug(
"MeasurementTracker") <<
"getting pxl refs to skip";
239 edm::LogError(
"MeasurementTracker") <<
"not getting the pixel clusters to skip";
242 <<
"The pixel masking does not point to the proper collection of clusters: "
245 pixelClusterMask->copyMaskTo(pixelClustersToSkip);
249 int i = 0, endDet = thePxDets.
size();
251 ed = pixelCollection->
end();
255 unsigned int id = set.
id();
256 while (
id != thePxDets.
id(
i)) {
259 throw "we have a problem!!!!";
271 <<
"input pixel clusters collection " <<
labels.module <<
" is not valid";
278 std::vector<bool>& stripClustersToSkip)
const {
281 std::vector<uint32_t> rawInactiveDetIds;
291 const int endDet = theStDets.
size();
295 unsigned int idp = 0;
296 for (
auto id : rawInactiveDetIds) {
300 i = theStDets.
find(
id,
i);
314 LogDebug(
"MeasurementTracker") <<
"getting strp refs to skip";
317 edm::LogError(
"MeasurementTracker") <<
"not getting the strip clusters to skip";
318 if (stripClusterMask->refProd().
id() != clusterHandle.
id()) {
320 <<
"The strip masking does not point to the proper collection of clusters: "
321 << stripClusterMask->refProd().
id() <<
"!=" << clusterHandle.
id();
323 stripClusterMask->copyMaskTo(stripClustersToSkip);
326 theStDets.
handle() = clusterHandle;
329 for (
auto j = 0
U;
j < (*clusterCollection).size(); ++
j) {
330 unsigned int id = (*clusterCollection).id(
j);
331 while (
id != theStDets.
id(
i)) {
334 throw "we have a problem in strips!!!!";
345 <<
"input strip cluster collection " <<
labels.module <<
" is not valid";
362 int i = 0, endDet = thePh2OTDets.
size();
364 ed = phase2OTCollection->
end();
368 unsigned int id = set.
id();
369 while (
id != thePh2OTDets.
id(
i)) {
372 throw "we have a problem!!!!";
383 <<
"input Phase2TrackerCluster1D collection " <<
labels.module <<
" is not valid";
391 std::vector<uint32_t>& rawInactiveDetIds)
const {
395 if (
event.getByToken(tk, detIds)) {
396 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
399 if (!rawInactiveDetIds.empty())
400 std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());