18 measurementTrackerLabel_(iConfig.getParameter<
std::
string>(
"measurementTracker")),
19 switchOffPixelsIfEmpty_(iConfig.getParameter<
bool>(
"switchOffPixelsIfEmpty"))
21 std::vector<edm::InputTag> inactivePixelDetectorTags(iConfig.
getParameter<std::vector<edm::InputTag> >(
"inactivePixelDetectorLabels"));
24 std::vector<edm::InputTag> badPixelFEDChannelCollectionTags = iConfig.
getParameter<std::vector<edm::InputTag> >(
"badPixelFEDChannelCollectionLabels");
25 if (!badPixelFEDChannelCollectionTags.empty()) {
30 std::vector<edm::InputTag> inactiveStripDetectorTags(iConfig.
getParameter<std::vector<edm::InputTag> >(
"inactiveStripDetectorLabels"));
52 produces<MeasurementTrackerEvent>();
64 desc.
add<std::vector<edm::InputTag>>(
"inactivePixelDetectorLabels", std::vector<edm::InputTag>{{
edm::InputTag(
"siPixelDigis")}})->setComment(
"One or more DetIdCollections of modules to mask on the fly for a given event");
65 desc.
add<std::vector<edm::InputTag>>(
"badPixelFEDChannelCollectionLabels", std::vector<edm::InputTag>())->
setComment(
"One or more PixelFEDChannelCollections of modules+ROCs to mask on the fly for a given event");
68 desc.
add<std::vector<edm::InputTag>>(
"inactiveStripDetectorLabels", std::vector<edm::InputTag>{{
edm::InputTag(
"siStripDigis")}})->setComment(
"One or more DetIdCollections of modules to mask on the fly for a given event");
70 desc.
add<
bool>(
"switchOffPixelsIfEmpty",
true)->setComment(
"let's keep it like this, for cosmics");
72 descriptions.
add(
"measurementTrackerEventDefault",desc);
83 auto stripData = std::make_unique<StMeasurementDetSet>(measurementTracker->
stripDetConditions());
84 auto pixelData= std::make_unique<PxMeasurementDetSet>(measurementTracker->
pixelDetConditions());
85 auto phase2OTData = std::make_unique<Phase2OTMeasurementDetSet>(measurementTracker->
phase2DetConditions());
86 std::vector<bool> stripClustersToSkip;
87 std::vector<bool> pixelClustersToSkip;
88 std::vector<bool> phase2ClustersToSkip;
91 updatePixels(iEvent, *pixelData, pixelClustersToSkip, dynamic_cast<const TrackerGeometry&>(*(measurementTracker->
geomTracker())), iSetup);
98 std::make_unique<MeasurementTrackerEvent>(*measurementTracker,
99 stripData.release(), pixelData.release(), phase2OTData.release(),
100 stripClustersToSkip, pixelClustersToSkip, phase2ClustersToSkip)
111 std::vector<uint32_t> rawInactiveDetIds;
116 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
118 static std::atomic<bool> iFailedAlready{
false};
119 bool expected =
false;
120 if (iFailedAlready.compare_exchange_strong(expected,
true,std::memory_order_acq_rel)){
121 edm::LogError(
"MissingProduct")<<
"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
125 if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
127 int i=0, endDet = thePxDets.
size();
129 for (
auto id : rawInactiveDetIds) {
130 if (
id==idp)
continue;
132 i=thePxDets.
find(
id,i);
133 assert(i!=endDet &&
id == thePxDets.
id(i));
144 if (!event.
getByToken(tk, pixelFEDChannelCollectionHandle))
continue;
146 for (
const auto& disabledChannels: *pixelFEDChannelCollectionHandle) {
148 for(
const auto& ch: disabledChannels) {
154 for (path.
roc=1; path.
roc<=(ch.roc_last-ch.roc_first)+1; path.
roc++) {
156 if (roc==
nullptr)
continue;
157 assert(roc->
rawId()==disabledChannels.detId());
158 if (roc->
idInDetUnit()==ch.roc_first) roc_first=roc;
161 if (roc_first==
nullptr || roc_last==
nullptr) {
162 edm::LogError(
"PixelFEDChannelCollection")<<
"Do not find either roc_first or roc_last in the cabling map.";
174 positions.push_back(std::make_pair(ll, ur));
176 if (!positions.empty()) {
177 i=thePxDets.
find(disabledChannels.detId(),
i);
178 assert(i!=thePxDets.
size() && thePxDets.
id(i)==disabledChannels.detId());
203 pixelClustersToSkip.resize(pixelCollection->
dataSize());
204 std::fill(pixelClustersToSkip.begin(),pixelClustersToSkip.end(),
false);
210 LogDebug(
"MeasurementTracker")<<
"getting pxl refs to skip";
212 if (pixelClusterMask->refProd().
id()!=pixelClusters.
id()){
213 edm::LogError(
"ProductIdMismatch")<<
"The pixel masking does not point to the proper collection of clusters: "<<pixelClusterMask->refProd().
id()<<
"!="<<pixelClusters.
id();
215 pixelClusterMask->copyMaskTo(pixelClustersToSkip);
220 int i = 0, endDet = thePxDets.
size();
223 unsigned int id =
set.
id();
224 while (
id != thePxDets.
id(i)) {
226 if (endDet==i)
throw "we have a problem!!!!";
237 edm::LogWarning(
"MeasurementTrackerEventProducer") <<
"input pixel clusters collection " << labels.
module <<
" is not valid";
247 std::vector<uint32_t> rawInactiveDetIds;
257 const int endDet = theStDets.
size();
263 for (
auto id : rawInactiveDetIds) {
264 if (
id==idp)
continue;
266 i=theStDets.
find(
id,i);
267 assert(i!=endDet &&
id == theStDets.
id(i));
281 LogDebug(
"MeasurementTracker")<<
"getting strp refs to skip";
284 if (stripClusterMask->refProd().
id()!=clusterHandle.
id()){
285 edm::LogError(
"ProductIdMismatch")<<
"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().
id()<<
"!="<<clusterHandle.
id();
287 stripClusterMask->copyMaskTo(stripClustersToSkip);
290 theStDets.
handle() = clusterHandle;
293 for (
auto j = 0
U; j< (*clusterCollection).size(); ++j) {
294 unsigned int id = (*clusterCollection).
id(j);
295 while (
id != theStDets.
id(i)) {
297 if (endDet==i)
throw "we have a problem in strips!!!!";
307 edm::LogWarning(
"MeasurementTrackerEventProducer") <<
"input strip cluster collection " << labels.
module <<
" is not valid";
328 int i = 0, endDet = thePh2OTDets.
size();
332 unsigned int id =
set.
id();
333 while (
id != thePh2OTDets.
id(i)) {
335 if (endDet==i)
throw "we have a problem!!!!";
339 thePh2OTDets.
update(i,
set);
345 edm::LogWarning(
"MeasurementTrackerEventProducer") <<
"input Phase2TrackerCluster1D collection " << labels.
module <<
" is not valid";
360 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
363 if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
T getParameter(std::string const &) const
void setComment(std::string const &value)
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
size_type dataSize() const
virtual int rowsperroc() const =0
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
bool selfUpdateSkipClusters_
bool isActive(int i) const
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const_iterator end() const
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
std::vector< std::pair< LocalPoint, LocalPoint > > BadFEDChannelPositions
virtual const Phase2OTMeasurementConditionSet & phase2DetConditions() const =0
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
int find(unsigned int jd, int i=0) const
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > theBadPixelFEDChannelsLabels
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
#define DEFINE_FWK_MODULE(type)
virtual int colsperroc() const =0
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 ...
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
const TrackingGeometry * geomTracker() 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)
void produce(edm::Event &, const edm::EventSetup &) override
const_iterator begin() const
T const * product() const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
row and collumn in ROC representation
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::string measurementTrackerLabel_
const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &path) const final
virtual const StMeasurementConditionSet & stripDetConditions() const =0
Provide templates to be filled in.
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
bool isActive(int i) const
void updatePixels(const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip, const TrackerGeometry &trackerGeom, const edm::EventSetup &iSetup) const
void setActiveThisEvent(bool active)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
const TrackerGeomDet * idToDet(DetId) const override
virtual const PxMeasurementConditionSet & pixelDetConditions() const =0
bool switchOffPixelsIfEmpty_
int find(unsigned int jd, int i=0) const
bool isUninitialized() const
void setActiveThisEvent(bool active)
edm::Handle< edmNew::DetSetVector< SiStripCluster > > & handle()
unsigned int id(int i) const
void update(int i, const Phase2DetSet &detSet)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
std::string pixelCablingMapLabel_
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