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)
46 if (selfUpdateSkipClusters_)
53 if (selfUpdateSkipClusters_)
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;
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);
171 assert(i != endDet &&
id == thePxDets.
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++) {
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";
253 if (pixelClusterMask->refProd().
id() != pixelClusters.
id()) {
255 <<
"The pixel masking does not point to the proper collection of clusters: "
256 << pixelClusterMask->refProd().
id() <<
"!=" << pixelClusters.
id();
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);
314 assert(i != endDet &&
id == theStDets.
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 = 0U;
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!!!!";
391 thePh2OTDets.
update(i, set);
398 <<
"input Phase2TrackerCluster1D collection " << labels.
module <<
" is not valid";
406 std::vector<uint32_t>& rawInactiveDetIds)
const {
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
void setComment(std::string const &value)
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
size_type dataSize() const
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
bool selfUpdateSkipClusters_
uint16_t *__restrict__ id
bool isActive(int i) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
virtual int rowsperroc() const =0
constexpr bool isUninitialized() const noexcept
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > pixelCablingMapToken_
MeasurementTrackerEventProducer(const edm::ParameterSet &iConfig)
void updateStrips(const edm::Event &, StMeasurementDetSet &theStDets, std::vector< bool > &stripClustersToSkip) const
void update(int i, const StripDetset &detSet)
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::Handle< edmNew::DetSetVector< SiPixelCluster > > & handle() const
Log< level::Error, false > LogError
identify pixel inside single ROC
global coordinates (row and column in DetUnit, as in PixelDigi)
unsigned int id(int i) const
unsigned int id(int i) const
bool getData(T &iHolder) const
int find(unsigned int jd, int i=0) const
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > theBadPixelFEDChannelsLabels
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
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
void updatePhase2OT(const edm::Event &, Phase2OTMeasurementDetSet &thePh2OTDets) const
const edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D > > & handle() const
bool isActive(int i) const
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsRejLabel
bool get(ProductID const &oid, Handle< PROD > &result) const
void updateStacks(const edm::Event &, Phase2OTMeasurementDetSet &theStDets) const
void update(int i, const PixelDetSet &detSet)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void addBadFEDChannelPositions(int i, BadFEDChannelPositions &positions)
const TrackerGeomDet * idToDet(DetId) const override
void produce(edm::Event &, const edm::EventSetup &) override
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
T const * product() const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
row and collumn in ROC representation
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool isActive(int i) const
void updatePixels(const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip, const TrackerGeometry &trackerGeom, const edm::EventSetup &iSetup) const
edm::ESGetToken< MeasurementTracker, CkfComponentsRecord > measurementTrackerToken_
void setActiveThisEvent(bool active)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
bool switchOffPixelsIfEmpty_
edm::EDGetTokenT< VectorHitCollection > thePh2OTVectorHitsLabel
int find(unsigned int jd, int i=0) const
void setActiveThisEvent(bool active)
edm::Handle< edmNew::DetSetVector< SiStripCluster > > & handle()
Log< level::Warning, false > LogWarning
unsigned int id(int i) const
void update(int i, const Phase2DetSet &detSet)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask
const_iterator begin(bool update=false) const
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels
GlobalPixel toGlobal(const LocalPixel &loc) const