11 measurementTrackerLabel_(iConfig.getParameter<
std::
string>(
"measurementTracker")),
14 std::vector<edm::InputTag> inactivePixelDetectorTags(iConfig.
getParameter<std::vector<edm::InputTag> >(
"inactivePixelDetectorLabels"));
17 std::vector<edm::InputTag> inactiveStripDetectorTags(iConfig.
getParameter<std::vector<edm::InputTag> >(
"inactiveStripDetectorLabels"));
43 produces<MeasurementTrackerEvent>();
53 auto stripData = std::make_unique<StMeasurementDetSet>(measurementTracker->
stripDetConditions());
54 auto pixelData= std::make_unique<PxMeasurementDetSet>(measurementTracker->
pixelDetConditions());
55 auto phase2OTData = std::make_unique<Phase2OTMeasurementDetSet>(measurementTracker->
phase2DetConditions());
56 std::vector<bool> stripClustersToSkip;
57 std::vector<bool> pixelClustersToSkip;
58 std::vector<bool> phase2ClustersToSkip;
68 std::make_unique<MeasurementTrackerEvent>(*measurementTracker,
69 stripData.release(), pixelData.release(), phase2OTData.release(),
70 stripClustersToSkip, pixelClustersToSkip, phase2ClustersToSkip)
81 std::vector<uint32_t> rawInactiveDetIds;
86 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
88 static std::atomic<bool> iFailedAlready{
false};
89 bool expected =
false;
90 if (iFailedAlready.compare_exchange_strong(expected,
true,std::memory_order_acq_rel)){
91 edm::LogError(
"MissingProduct")<<
"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
95 if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
97 int i=0, endDet = thePxDets.
size();
99 for (
auto id : rawInactiveDetIds) {
100 if (
id==idp)
continue;
102 i=thePxDets.
find(
id,i);
103 assert(i!=endDet &&
id == thePxDets.
id(i));
110 if( pixelClusterProducer.empty() ) {
111 if (switchOffPixelsIfEmpty) {
122 if (switchOffPixelsIfEmpty && pixelCollection->
empty()) {
127 pixelClustersToSkip.resize(pixelCollection->
dataSize());
128 std::fill(pixelClustersToSkip.begin(),pixelClustersToSkip.end(),
false);
134 LogDebug(
"MeasurementTracker")<<
"getting pxl refs to skip";
136 if (pixelClusterMask->refProd().
id()!=pixelClusters.
id()){
137 edm::LogError(
"ProductIdMismatch")<<
"The pixel masking does not point to the proper collection of clusters: "<<pixelClusterMask->refProd().
id()<<
"!="<<pixelClusters.
id();
139 pixelClusterMask->copyMaskTo(pixelClustersToSkip);
144 int i = 0, endDet = thePxDets.
size();
147 unsigned int id =
set.
id();
148 while (
id != thePxDets.
id(i)) {
150 if (endDet==i)
throw "we have a problem!!!!";
169 std::vector<uint32_t> rawInactiveDetIds;
178 if( !stripClusterProducer.compare(
"") )
return;
180 const int endDet = theStDets.
size();
186 for (
auto id : rawInactiveDetIds) {
187 if (
id==idp)
continue;
189 i=theStDets.
find(
id,i);
190 assert(i!=endDet &&
id == theStDets.
id(i));
204 LogDebug(
"MeasurementTracker")<<
"getting strp refs to skip";
207 if (stripClusterMask->refProd().
id()!=clusterHandle.
id()){
208 edm::LogError(
"ProductIdMismatch")<<
"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().
id()<<
"!="<<clusterHandle.
id();
210 stripClusterMask->copyMaskTo(stripClustersToSkip);
213 theStDets.
handle() = clusterHandle;
216 for (
auto j = 0
U; j< (*clusterCollection).size(); ++j) {
217 unsigned int id = (*clusterCollection).
id(j);
218 while (
id != theStDets.
id(i)) {
220 if (endDet==i)
throw "we have a problem in strips!!!!";
242 if( phase2ClusterProducer.empty() ) {
250 int i = 0, endDet = thePh2OTDets.
size();
254 unsigned int id =
set.
id();
255 while (
id != thePh2OTDets.
id(i)) {
257 if (endDet==i)
throw "we have a problem!!!!";
261 thePh2OTDets.
update(i,
set);
280 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->
begin(), detIds->
end());
283 if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
T getParameter(std::string const &) const
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
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
bool selfUpdateSkipClusters_
bool isActive(int i) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
const_iterator end() const
MeasurementTrackerEventProducer(const edm::ParameterSet &iConfig)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
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
const edm::Handle< edmNew::DetSetVector< SiPixelCluster > > & handle() const
virtual const Phase2OTMeasurementConditionSet & phase2DetConditions() const =0
void updatePixels(const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip) const
unsigned int id(int i) const
unsigned int id(int i) const
int find(unsigned int jd, int i=0) 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 ...
void updatePhase2OT(const edm::Event &, Phase2OTMeasurementDetSet &thePh2OTDets) const
const edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D > > & handle() const
bool isActive(int i) const
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
void updateStacks(const edm::Event &, Phase2OTMeasurementDetSet &theStDets) const
void update(int i, const PixelDetSet &detSet)
virtual void produce(edm::Event &, const edm::EventSetup &) override
const edm::ParameterSet & pset_
const_iterator begin() const
T const * product() const
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
std::string measurementTrackerLabel_
virtual const StMeasurementConditionSet & stripDetConditions() const =0
Provide templates to be filled in.
bool isActive(int i) const
void setActiveThisEvent(bool active)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
virtual const PxMeasurementConditionSet & pixelDetConditions() const =0
int find(unsigned int jd, int i=0) 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
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask
const_iterator begin(bool update=false) const
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels