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)
72 produces<MeasurementTrackerEvent>();
86 desc.add<std::vector<edm::InputTag>>(
"inactivePixelDetectorLabels",
88 ->setComment(
"One or more DetIdCollections of modules to mask on the fly for a given event");
89 desc.add<std::vector<edm::InputTag>>(
"badPixelFEDChannelCollectionLabels", std::vector<edm::InputTag>())
90 ->setComment(
"One or more PixelFEDChannelCollections of modules+ROCs to mask on the fly for a given event");
93 desc.add<std::vector<edm::InputTag>>(
"inactiveStripDetectorLabels",
95 ->setComment(
"One or more DetIdCollections of modules to mask on the fly for a given event");
97 desc.add<
bool>(
"switchOffPixelsIfEmpty",
true)->setComment(
"let's keep it like this, for cosmics");
99 descriptions.
add(
"measurementTrackerEventDefault",
desc);
107 auto stripData = std::make_unique<StMeasurementDetSet>(
measurementTracker->stripDetConditions());
108 auto pixelData = std::make_unique<PxMeasurementDetSet>(
measurementTracker->pixelDetConditions());
109 auto phase2OTData = std::make_unique<Phase2OTMeasurementDetSet>(
measurementTracker->phase2DetConditions());
111 std::vector<bool> stripClustersToSkip;
112 std::vector<bool> pixelClustersToSkip;
113 std::vector<bool> phase2ClustersToSkip;
133 phase2OTData.release(),
135 phase2OTVectorHitsRej,
138 phase2ClustersToSkip));
143 std::vector<bool>& pixelClustersToSkip,
149 std::vector<uint32_t> rawInactiveDetIds;
153 if (
event.getByToken(tk, detIds)) {
154 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
156 static std::atomic<bool> iFailedAlready{
false};
157 bool expected =
false;
158 if (iFailedAlready.compare_exchange_strong(expected,
true, std::memory_order_acq_rel)) {
160 <<
"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
164 if (!rawInactiveDetIds.empty())
165 std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
167 int i = 0, endDet = thePxDets.
size();
168 unsigned int idp = 0;
169 for (
auto id : rawInactiveDetIds) {
173 i = thePxDets.
find(
id,
i);
185 if (!
event.getByToken(tk, pixelFEDChannelCollectionHandle))
188 for (
const auto& disabledChannels : *pixelFEDChannelCollectionHandle) {
190 for (
const auto& ch : disabledChannels) {
196 for (
path.roc = 1;
path.roc <= (ch.roc_last - ch.roc_first) + 1;
path.roc++) {
200 assert(
roc->rawId() == disabledChannels.detId());
201 if (
roc->idInDetUnit() == ch.roc_first)
203 if (
roc->idInDetUnit() == ch.roc_last)
206 if (roc_first ==
nullptr || roc_last ==
nullptr) {
208 <<
"Do not find either roc_first or roc_last in the cabling map.";
212 dynamic_cast<const PixelGeomDetUnit*>(trackerGeom.
idToDet(roc_first->
rawId()));
222 positions.push_back(std::make_pair(ll, ur));
224 if (!positions.empty()) {
225 i = thePxDets.
find(disabledChannels.detId(),
i);
226 assert(
i != thePxDets.
size() && thePxDets.
id(
i) == disabledChannels.detId());
247 pixelClustersToSkip.resize(pixelCollection->
dataSize());
248 std::fill(pixelClustersToSkip.begin(), pixelClustersToSkip.end(),
false);
254 LogDebug(
"MeasurementTracker") <<
"getting pxl refs to skip";
256 edm::LogError(
"MeasurementTracker") <<
"not getting the pixel clusters to skip";
259 <<
"The pixel masking does not point to the proper collection of clusters: "
262 pixelClusterMask->copyMaskTo(pixelClustersToSkip);
266 int i = 0, endDet = thePxDets.
size();
268 ed = pixelCollection->
end();
272 unsigned int id = set.
id();
273 while (
id != thePxDets.
id(
i)) {
276 throw "we have a problem!!!!";
288 <<
"input pixel clusters collection " <<
labels.module <<
" is not valid";
295 std::vector<bool>& stripClustersToSkip)
const {
298 std::vector<uint32_t> rawInactiveDetIds;
308 const int endDet = theStDets.
size();
312 unsigned int idp = 0;
313 for (
auto id : rawInactiveDetIds) {
317 i = theStDets.
find(
id,
i);
331 LogDebug(
"MeasurementTracker") <<
"getting strp refs to skip";
334 edm::LogError(
"MeasurementTracker") <<
"not getting the strip clusters to skip";
335 if (stripClusterMask->refProd().
id() != clusterHandle.
id()) {
337 <<
"The strip masking does not point to the proper collection of clusters: "
338 << stripClusterMask->refProd().
id() <<
"!=" << clusterHandle.
id();
340 stripClusterMask->copyMaskTo(stripClustersToSkip);
343 theStDets.
handle() = clusterHandle;
346 for (
auto j = 0
U;
j < (*clusterCollection).size(); ++
j) {
347 unsigned int id = (*clusterCollection).id(
j);
348 while (
id != theStDets.
id(
i)) {
351 throw "we have a problem in strips!!!!";
362 <<
"input strip cluster collection " <<
labels.module <<
" is not valid";
381 int i = 0, endDet = thePh2OTDets.
size();
383 ed = phase2OTCollection->
end();
387 unsigned int id = set.
id();
388 while (
id != thePh2OTDets.
id(
i)) {
391 throw "we have a problem!!!!";
402 <<
"input Phase2TrackerCluster1D collection " <<
labels.module <<
" is not valid";
410 std::vector<uint32_t>& rawInactiveDetIds)
const {
414 if (
event.getByToken(tk, detIds)) {
415 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
418 if (!rawInactiveDetIds.empty())
419 std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());