12 measurementTrackerLabel_(iConfig.getParameter<std::
string>(
"measurementTracker")),
14 theInactivePixelDetectorLabels(iConfig.getParameter<std::vector<edm::InputTag> >(
"inactivePixelDetectorLabels")),
15 theInactiveStripDetectorLabels(iConfig.getParameter<std::vector<edm::InputTag> >(
"inactiveStripDetectorLabels"))
26 produces<MeasurementTrackerEvent>();
36 std::auto_ptr<StMeasurementDetSet> stripData(
new StMeasurementDetSet(measurementTracker->stripDetConditions()));
37 std::auto_ptr<PxMeasurementDetSet> pixelData(
new PxMeasurementDetSet(measurementTracker->pixelDetConditions()));
39 std::vector<bool> stripClustersToSkip;
40 std::vector<bool> pixelClustersToSkip;
47 std::auto_ptr<MeasurementTrackerEvent>
out(
new MeasurementTrackerEvent(*measurementTracker, stripData.release(), pixelData.release(), stripClustersToSkip, pixelClustersToSkip));
59 bool switchOffPixelsIfEmpty = (!
pset_.
existsAs<
bool>(
"switchOffPixelsIfEmpty")) ||
61 std::vector<uint32_t> rawInactiveDetIds;
67 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
69 static std::atomic<bool> iFailedAlready{
false};
70 bool expected =
false;
71 if (iFailedAlready.compare_exchange_strong(expected,
true,std::memory_order_acq_rel)){
72 edm::LogError(
"MissingProduct")<<
"I fail to get the list of inactive pixel modules, because of 4.2/4.4 event content change.";
76 if (!rawInactiveDetIds.empty())
std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
78 int i=0, endDet = thePxDets.
size();
80 for (
auto id : rawInactiveDetIds) {
81 if (
id==idp)
continue;
83 i=thePxDets.
find(
id,i);
84 assert(i!=endDet &&
id == thePxDets.
id(i));
91 if( pixelClusterProducer.empty() ) {
92 if (switchOffPixelsIfEmpty) {
98 event.getByLabel(pixelClusterProducer, pixelClusters);
102 if (switchOffPixelsIfEmpty && pixelCollection->
empty()) {
107 pixelClustersToSkip.resize(pixelCollection->
dataSize());
108 std::fill(pixelClustersToSkip.begin(),pixelClustersToSkip.end(),
false);
114 LogDebug(
"MeasurementTracker")<<
"getting pxl refs to skip";
116 if (pixelClusterMask->refProd().
id()!=pixelClusters.
id()){
117 edm::LogError(
"ProductIdMismatch")<<
"The pixel masking does not point to the proper collection of clusters: "<<pixelClusterMask->refProd().
id()<<
"!="<<pixelClusters.
id();
119 pixelClusterMask->copyMaskTo(pixelClustersToSkip);
124 int i = 0, endDet = thePxDets.
size();
127 unsigned int id = set.
id();
128 while (
id != thePxDets.
id(i)) {
130 if (endDet==i)
throw "we have a problem!!!!";
147 std::vector<uint32_t> rawInactiveDetIds;
156 if( !stripClusterProducer.compare(
"") )
return;
158 const int endDet = theStDets.
size();
164 for (
auto id : rawInactiveDetIds) {
165 if (
id==idp)
continue;
167 i=theStDets.
find(
id,i);
168 assert(i!=endDet &&
id == theStDets.
id(i));
175 event.getByLabel(stripClusterProducer, clusterHandle);
182 LogDebug(
"MeasurementTracker")<<
"getting strp refs to skip";
185 if (stripClusterMask->refProd().
id()!=clusterHandle.
id()){
186 edm::LogError(
"ProductIdMismatch")<<
"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().
id()<<
"!="<<clusterHandle.
id();
188 stripClusterMask->copyMaskTo(stripClustersToSkip);
191 theStDets.
handle() = clusterHandle;
194 for (
auto j = 0U;
j< (*clusterCollection).size(); ++
j) {
195 unsigned int id = (*clusterCollection).
id(
j);
196 while (
id != theStDets.
id(i)) {
198 if (endDet==i)
throw "we have a problem in strips!!!!";
207 throw cms::Exception(
"NotSupported") <<
"Regional non-on-demand unpacking is not supported." << std::endl;
211 event.getByLabel(stripClusterProducer, refClusterHandle);
215 event.getByLabel(lazyGetter,lazyClusterHandle);
219 LogDebug(
"MeasurementTracker")<<
"getting reg strp refs to skip";
222 if (stripClusterMask->refProd().
id()!=lazyClusterHandle.id()){
223 edm::LogError(
"ProductIdMismatch")<<
"The strip masking does not point to the proper collection of clusters: "<<stripClusterMask->refProd().
id()<<
"!="<<lazyClusterHandle.id();
225 stripClusterMask->copyMaskTo(stripClustersToSkip);
231 std::vector<SiStripCluster>::const_iterator beginIterator;
233 for(;iregion!=refClusterHandle->end();++iregion) {
235 std::vector<SiStripCluster>::const_iterator icluster = region.
begin();
236 const std::vector<SiStripCluster>::const_iterator endIterator = region.
end();
237 tmpId = icluster->geographicalId();
238 beginIterator = icluster;
242 for (;icluster!=endIterator;icluster++) {
247 if( icluster->geographicalId() != tmpId){
251 theStDets.
update(concreteDetUpdatable(tmpId)->
index(),beginIterator,icluster);
253 tmpId = icluster->geographicalId();
254 beginIterator = icluster;
255 if( icluster == (endIterator-1)){
256 theStDets.
update(concreteDetUpdatable(tmpId)->
index(),icluster,endIterator);
258 }
else if( icluster == (endIterator-1)){
259 theStDets.
update(concreteDetUpdatable(tmpId)->
index(),beginIterator,endIterator);
275 event.getByLabel(*itt, detIds);
276 rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
278 if (!rawInactiveDetIds.empty())
std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
size_type dataSize() const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
bool selfUpdateSkipClusters_
#define DEFINE_FWK_MODULE(type)
const_iterator end() const
Get off the end iterator.
MeasurementTrackerEventProducer(const edm::ParameterSet &iConfig)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::Handle< edm::LazyGetter< SiStripCluster > > & regionalHandle()
tuple MeasurementTrackerEvent
void updateStrips(const edm::Event &, StMeasurementDetSet &theStDets, std::vector< bool > &stripClustersToSkip) const
void update(int i, const StripDetset &detSet)
const edm::Handle< edmNew::DetSetVector< SiPixelCluster > > & handle() const
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 ...
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
const std::vector< edm::InputTag > theInactiveStripDetectorLabels
bool isActive(int i) const
void getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
const std::vector< edm::InputTag > theInactivePixelDetectorLabels
void update(int i, const PixelDetSet &detSet)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
const_iterator begin() const
Get begin iterator.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const edm::ParameterSet & pset_
boost::indirect_iterator< typename collection_type::const_iterator > const_iterator
std::string measurementTrackerLabel_
T const * product() const
bool isActive(int i) const
void setActiveThisEvent(bool active)
const_iterator end(bool update=true) const
int find(unsigned int jd, int i=0) const
edm::Handle< edmNew::DetSetVector< SiStripCluster > > & handle()
virtual void produce(edm::Event &, const edm::EventSetup &)
const_iterator begin(bool update=true) const