CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
MeasurementTrackerEventProducer Class Referencefinal

#include <MeasurementTrackerEventProducer.h>

Inheritance diagram for MeasurementTrackerEventProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MeasurementTrackerEventProducer (const edm::ParameterSet &iConfig)
 
 ~MeasurementTrackerEventProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void getInactiveStrips (const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
 
void updatePhase2OT (const edm::Event &, Phase2OTMeasurementDetSet &thePh2OTDets) const
 
void updatePixels (const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip) const
 
void updateStacks (const edm::Event &, Phase2OTMeasurementDetSet &theStDets) const
 
void updateStrips (const edm::Event &, StMeasurementDetSet &theStDets, std::vector< bool > &stripClustersToSkip) const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Protected Attributes

bool isPhase2
 
std::string measurementTrackerLabel_
 
const edm::ParameterSetpset_
 
bool selfUpdateSkipClusters_
 
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels
 
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
 
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
 
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
 
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
 
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 14 of file MeasurementTrackerEventProducer.h.

Constructor & Destructor Documentation

MeasurementTrackerEventProducer::MeasurementTrackerEventProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 10 of file MeasurementTrackerEventProducer.cc.

References edm::ParameterSet::exists(), edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), isPhase2, LogDebug, pset_, selfUpdateSkipClusters_, createPayload::skip, AlCaHLTBitMon_QueryRunRegistry::string, lumiQTWidget::t, theInactivePixelDetectorLabels, theInactiveStripDetectorLabels, thePh2OTClusterLabel, thePixelClusterLabel, thePixelClusterMask, theStripClusterLabel, and theStripClusterMask.

10  :
11  measurementTrackerLabel_(iConfig.getParameter<std::string>("measurementTracker")),
12  pset_(iConfig)
13 {
14  std::vector<edm::InputTag> inactivePixelDetectorTags(iConfig.getParameter<std::vector<edm::InputTag> >("inactivePixelDetectorLabels"));
15  for (auto &t : inactivePixelDetectorTags) theInactivePixelDetectorLabels.push_back(consumes<DetIdCollection>(t));
16 
17  std::vector<edm::InputTag> inactiveStripDetectorTags(iConfig.getParameter<std::vector<edm::InputTag> >("inactiveStripDetectorLabels"));
18  for (auto &t : inactiveStripDetectorTags) theInactiveStripDetectorLabels.push_back(consumes<DetIdCollection>(t));
19 
20  //the measurement tracking is set to skip clusters, the other option is set from outside
21  selfUpdateSkipClusters_=iConfig.exists("skipClusters");
23  {
24  edm::InputTag skip=iConfig.getParameter<edm::InputTag>("skipClusters");
25  if (skip==edm::InputTag("")) selfUpdateSkipClusters_=false;
26  }
27  LogDebug("MeasurementTracker")<<"skipping clusters: "<<selfUpdateSkipClusters_;
28  isPhase2 = false;
29 
30  if (pset_.getParameter<std::string>("stripClusterProducer") != "") {
31  theStripClusterLabel = consumes<edmNew::DetSetVector<SiStripCluster> >(edm::InputTag(pset_.getParameter<std::string>("stripClusterProducer")));
32  if (selfUpdateSkipClusters_) theStripClusterMask = consumes<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster>>>(iConfig.getParameter<edm::InputTag>("skipClusters"));
33  }
34  if (pset_.getParameter<std::string>("pixelClusterProducer") != "") {
35  thePixelClusterLabel = consumes<edmNew::DetSetVector<SiPixelCluster> >(edm::InputTag(pset_.getParameter<std::string>("pixelClusterProducer")));
36  if (selfUpdateSkipClusters_) thePixelClusterMask = consumes<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster>>>(iConfig.getParameter<edm::InputTag>("skipClusters"));
37  }
38  if (pset_.existsAs<std::string>("Phase2TrackerCluster1DProducer")) {
39  thePh2OTClusterLabel = consumes<edmNew::DetSetVector<Phase2TrackerCluster1D> >(edm::InputTag(pset_.getParameter<std::string>("Phase2TrackerCluster1DProducer")));
40  isPhase2 = true;
41  }
42 
43  produces<MeasurementTrackerEvent>();
44 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels
MeasurementTrackerEventProducer::~MeasurementTrackerEventProducer ( )
inline

Definition at line 17 of file MeasurementTrackerEventProducer.h.

References edm::stream::EDProducerBase::produce().

17 {}

Member Function Documentation

void MeasurementTrackerEventProducer::getInactiveStrips ( const edm::Event event,
std::vector< uint32_t > &  rawInactiveDetIds 
) const
protected

Definition at line 274 of file MeasurementTrackerEventProducer.cc.

References edm::EDCollection< T >::begin(), DEFINE_FWK_MODULE, edm::EDCollection< T >::end(), edm::Event::getByToken(), and theInactiveStripDetectorLabels.

Referenced by updateStrips().

275 {
276  if (!theInactiveStripDetectorLabels.empty()) {
279  if (event.getByToken(tk, detIds)){
280  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
281  }
282  }
283  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
284  }
285 
286 }
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactiveStripDetectorLabels
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const_iterator end() const
Definition: EDCollection.h:153
const_iterator begin() const
Definition: EDCollection.h:146
void MeasurementTrackerEventProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 47 of file MeasurementTrackerEventProducer.cc.

References edm::EventSetup::get(), MeasurementTrackerEventProducer_cfi::measurementTracker, measurementTrackerLabel_, eostools::move(), MeasurementTracker::phase2DetConditions(), MeasurementTracker::pixelDetConditions(), edm::Event::put(), MeasurementTracker::stripDetConditions(), updatePhase2OT(), updatePixels(), updateStacks(), and updateStrips().

48 {
50  iSetup.get<CkfComponentsRecord>().get(measurementTrackerLabel_, measurementTracker);
51 
52  // create new data structures from templates
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;
59  // fill them
60  updateStrips(iEvent, *stripData, stripClustersToSkip);
61  updatePixels(iEvent, *pixelData, pixelClustersToSkip);
62  updatePhase2OT(iEvent, *phase2OTData);
63  updateStacks(iEvent, *phase2OTData);
64 
65  // put into MTE
66  // put into event
67  iEvent.put(std::move(
68  std::make_unique<MeasurementTrackerEvent>(*measurementTracker,
69  stripData.release(), pixelData.release(), phase2OTData.release(),
70  stripClustersToSkip, pixelClustersToSkip, phase2ClustersToSkip)
71  ));
72 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
void updateStrips(const edm::Event &, StMeasurementDetSet &theStDets, std::vector< bool > &stripClustersToSkip) const
virtual const Phase2OTMeasurementConditionSet & phase2DetConditions() const =0
void updatePixels(const edm::Event &, PxMeasurementDetSet &thePxDets, std::vector< bool > &pixelClustersToSkip) const
void updatePhase2OT(const edm::Event &, Phase2OTMeasurementDetSet &thePh2OTDets) const
void updateStacks(const edm::Event &, Phase2OTMeasurementDetSet &theStDets) const
const T & get() const
Definition: EventSetup.h:56
virtual const StMeasurementConditionSet & stripDetConditions() const =0
Provide templates to be filled in.
virtual const PxMeasurementConditionSet & pixelDetConditions() const =0
def move(src, dest)
Definition: eostools.py:510
void MeasurementTrackerEventProducer::updatePhase2OT ( const edm::Event event,
Phase2OTMeasurementDetSet thePh2OTDets 
) const
protected

Definition at line 235 of file MeasurementTrackerEventProducer.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::end(), edm::Event::getByToken(), edm::ParameterSet::getParameter(), Phase2OTMeasurementDetSet::handle(), mps_fire::i, edmNew::DetSet< T >::id(), Phase2OTMeasurementDetSet::id(), Phase2OTMeasurementDetSet::isActive(), isPhase2, seedClusterRemoverPhase2_cfi::phase2OTClusters, edm::Handle< T >::product(), pset_, Phase2OTMeasurementDetSet::setActiveThisEvent(), Phase2OTMeasurementDetSet::size(), AlCaHLTBitMon_QueryRunRegistry::string, thePh2OTClusterLabel, and Phase2OTMeasurementDetSet::update().

Referenced by produce().

235  {
236 
237 
238  // Phase2OT Clusters
239  if ( isPhase2 ) {
240 
241  std::string phase2ClusterProducer = pset_.getParameter<std::string>("Phase2TrackerCluster1DProducer");
242  if( phase2ClusterProducer.empty() ) { //clusters have not been produced
243  thePh2OTDets.setActiveThisEvent(false);
244  } else {
245 
247  if (event.getByToken(thePh2OTClusterLabel, phase2OTClusters)) {
248  const edmNew::DetSetVector<Phase2TrackerCluster1D>* phase2OTCollection = phase2OTClusters.product();
249 
250  int i = 0, endDet = thePh2OTDets.size();
251  for (edmNew::DetSetVector<Phase2TrackerCluster1D>::const_iterator it = phase2OTCollection->begin(), ed = phase2OTCollection->end(); it != ed; ++it) {
252 
254  unsigned int id = set.id();
255  while ( id != thePh2OTDets.id(i)) {
256  ++i;
257  if (endDet==i) throw "we have a problem!!!!";
258  }
259  // push cluster range in det
260  if ( thePh2OTDets.isActive(i) ) {
261  thePh2OTDets.update(i,set);
262  }
263  }
264  } else {
265  edm::LogWarning("MeasurementTrackerEventProducer") << "input Phase2TrackerCluster1D collection " << pset_.getParameter<std::string>("Phase2TrackerCluster1DProducer") << " is not valid";
266  }
267  }
268 
269  }
270  return;
271 }
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > thePh2OTClusterLabel
const edm::Handle< edmNew::DetSetVector< Phase2TrackerCluster1D > > & handle() const
T const * product() const
Definition: Handle.h:81
id_type id() const
Definition: DetSetNew.h:81
void setActiveThisEvent(bool active)
unsigned int id(int i) const
void update(int i, const Phase2DetSet &detSet)
const_iterator begin(bool update=false) const
void MeasurementTrackerEventProducer::updatePixels ( const edm::Event event,
PxMeasurementDetSet thePxDets,
std::vector< bool > &  pixelClustersToSkip 
) const
protected

Definition at line 75 of file MeasurementTrackerEventProducer.cc.

References edm::EDCollection< T >::begin(), edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::dataSize(), edmNew::DetSetVector< T >::empty(), edm::EDCollection< T >::end(), edmNew::DetSetVector< T >::end(), edm::HandleBase::failedToGet(), lumiContext::fill, PxMeasurementDetSet::find(), edm::Event::getByToken(), edm::ParameterSet::getParameter(), PxMeasurementDetSet::handle(), mps_fire::i, hcalTTPDigis_cfi::id, edmNew::DetSet< T >::id(), edm::HandleBase::id(), PxMeasurementDetSet::id(), PxMeasurementDetSet::isActive(), LogDebug, nuclearRemainingHits_cff::pixelClusterProducer, hiDetachedTripletStep_cff::pixelClusters, edm::Handle< T >::product(), pset_, selfUpdateSkipClusters_, PxMeasurementDetSet::setActiveThisEvent(), PxMeasurementDetSet::setEmpty(), PxMeasurementDetSet::size(), AlCaHLTBitMon_QueryRunRegistry::string, MeasurementTrackerEventProducer_cfi::switchOffPixelsIfEmpty, theInactivePixelDetectorLabels, thePixelClusterLabel, thePixelClusterMask, and PxMeasurementDetSet::update().

Referenced by produce().

76 {
77  // start by clearinng everything
78  thePxDets.setEmpty();
79 
80  bool switchOffPixelsIfEmpty = pset_.getParameter<bool>("switchOffPixelsIfEmpty");
81  std::vector<uint32_t> rawInactiveDetIds;
82  if (!theInactivePixelDetectorLabels.empty()) {
85  if (event.getByToken(tk, detIds)){
86  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
87  }else{
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.";
92  }
93  }
94  }
95  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
96  // mark as inactive if in rawInactiveDetIds
97  int i=0, endDet = thePxDets.size();
98  unsigned int idp=0;
99  for ( auto id : rawInactiveDetIds) {
100  if (id==idp) continue; // skip multiple id
101  idp=id;
102  i=thePxDets.find(id,i);
103  assert(i!=endDet && id == thePxDets.id(i));
104  thePxDets.setActiveThisEvent(i,false);
105  }
106  }
107 
108  // Pixel Clusters
110  if( pixelClusterProducer.empty() ) { //clusters have not been produced
111  if (switchOffPixelsIfEmpty) {
112  thePxDets.setActiveThisEvent(false);
113  }
114  }else{
115 
117  if(event.getByToken(thePixelClusterLabel, pixelClusters)) {
118 
119  const edmNew::DetSetVector<SiPixelCluster>* pixelCollection = pixelClusters.product();
120 
121 
122  if (switchOffPixelsIfEmpty && pixelCollection->empty()) {
123  thePxDets.setActiveThisEvent(false);
124  } else {
125 
126  //std::cout <<"updatePixels "<<pixelCollection->dataSize()<<std::endl;
127  pixelClustersToSkip.resize(pixelCollection->dataSize());
128  std::fill(pixelClustersToSkip.begin(),pixelClustersToSkip.end(),false);
129 
132  //and get the collection of pixel ref to skip
133  event.getByToken(thePixelClusterMask,pixelClusterMask);
134  LogDebug("MeasurementTracker")<<"getting pxl refs to skip";
135  if (pixelClusterMask.failedToGet())edm::LogError("MeasurementTracker")<<"not getting the pixel clusters 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();
138  }
139  pixelClusterMask->copyMaskTo(pixelClustersToSkip);
140  }
141 
142 
143  // FIXME: should check if lower_bound is better
144  int i = 0, endDet = thePxDets.size();
145  for (edmNew::DetSetVector<SiPixelCluster>::const_iterator it = pixelCollection->begin(), ed = pixelCollection->end(); it != ed; ++it) {
147  unsigned int id = set.id();
148  while ( id != thePxDets.id(i)) {
149  ++i;
150  if (endDet==i) throw "we have a problem!!!!";
151  }
152  // push cluster range in det
153  if ( thePxDets.isActive(i) ) {
154  thePxDets.update(i,set);
155  }
156  }
157  }
158  } else {
159  edm::LogWarning("MeasurementTrackerEventProducer") << "input pixel clusters collection " << pset_.getParameter<std::string>("pixelClusterProducer") << " is not valid";
160  }
161  }
162 }
#define LogDebug(id)
T getParameter(std::string const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
size_type dataSize() const
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const_iterator end() const
Definition: EDCollection.h:153
const edm::Handle< edmNew::DetSetVector< SiPixelCluster > > & handle() const
unsigned int id(int i) const
bool isActive(int i) const
void update(int i, const PixelDetSet &detSet)
bool failedToGet() const
Definition: HandleBase.h:78
const_iterator begin() const
Definition: EDCollection.h:146
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > > thePixelClusterMask
void setActiveThisEvent(bool active)
id_type id() const
Definition: DetSetNew.h:81
int find(unsigned int jd, int i=0) const
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > thePixelClusterLabel
const_iterator begin(bool update=false) const
std::vector< edm::EDGetTokenT< DetIdCollection > > theInactivePixelDetectorLabels
void MeasurementTrackerEventProducer::updateStacks ( const edm::Event ,
Phase2OTMeasurementDetSet theStDets 
) const
inlineprotected

Definition at line 26 of file MeasurementTrackerEventProducer.h.

Referenced by produce().

26 {};
void MeasurementTrackerEventProducer::updateStrips ( const edm::Event event,
StMeasurementDetSet theStDets,
std::vector< bool > &  stripClustersToSkip 
) const
protected

Definition at line 165 of file MeasurementTrackerEventProducer.cc.

References edm::HandleBase::failedToGet(), StMeasurementDetSet::find(), edm::Event::getByToken(), getInactiveStrips(), edm::ParameterSet::getParameter(), StMeasurementDetSet::handle(), mps_fire::i, hcalTTPDigis_cfi::id, edm::HandleBase::id(), StMeasurementDetSet::id(), StMeasurementDetSet::isActive(), LogDebug, edm::Handle< T >::product(), pset_, selfUpdateSkipClusters_, StMeasurementDetSet::setActiveThisEvent(), StMeasurementDetSet::setEmpty(), StMeasurementDetSet::size(), AlCaHLTBitMon_QueryRunRegistry::string, nuclearRemainingHits_cff::stripClusterProducer, theStripClusterLabel, theStripClusterMask, mitigatedMETSequence_cff::U, and StMeasurementDetSet::update().

Referenced by produce().

166 {
167  typedef edmNew::DetSet<SiStripCluster> StripDetSet;
168 
169  std::vector<uint32_t> rawInactiveDetIds;
170  getInactiveStrips(event,rawInactiveDetIds);
171 
172  // Strip Clusters
174  //first clear all of them
175  theStDets.setEmpty();
176 
177 
178  if( !stripClusterProducer.compare("") ) return; //clusters have not been produced
179 
180  const int endDet = theStDets.size();
181 
182 
183  // mark as inactive if in rawInactiveDetIds
184  int i=0;
185  unsigned int idp=0;
186  for ( auto id : rawInactiveDetIds) {
187  if (id==idp) continue; // skip multiple id
188  idp=id;
189  i=theStDets.find(id,i);
190  assert(i!=endDet && id == theStDets.id(i));
191  theStDets.setActiveThisEvent(i,false);
192  }
193 
194  //========= actually load cluster =============
195  {
197  if (event.getByToken(theStripClusterLabel, clusterHandle)) {
198  const edmNew::DetSetVector<SiStripCluster>* clusterCollection = clusterHandle.product();
199 
200 
203  //and get the collection of pixel ref to skip
204  LogDebug("MeasurementTracker")<<"getting strp refs to skip";
205  event.getByToken(theStripClusterMask,stripClusterMask);
206  if (stripClusterMask.failedToGet()) edm::LogError("MeasurementTracker")<<"not getting the strip clusters 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();
209  }
210  stripClusterMask->copyMaskTo(stripClustersToSkip);
211  }
212 
213  theStDets.handle() = clusterHandle;
214  int i=0;
215  // cluster and det and in order (both) and unique so let's use set intersection
216  for ( auto j = 0U; j< (*clusterCollection).size(); ++j) {
217  unsigned int id = (*clusterCollection).id(j);
218  while ( id != theStDets.id(i)) { // eventually change to lower_bound
219  ++i;
220  if (endDet==i) throw "we have a problem in strips!!!!";
221  }
222 
223  // push cluster range in det
224  if ( theStDets.isActive(i) )
225  theStDets.update(i,j);
226  }
227  } else {
228  edm::LogWarning("MeasurementTrackerEventProducer") << "input strip cluster collection " << pset_.getParameter<std::string>("stripClusterProducer") << " is not valid";
229  }
230  }
231 }
#define LogDebug(id)
T getParameter(std::string const &) const
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void update(int i, const StripDetset &detSet)
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 getInactiveStrips(const edm::Event &event, std::vector< uint32_t > &rawInactiveDetIds) const
bool failedToGet() const
Definition: HandleBase.h:78
T const * product() const
Definition: Handle.h:81
bool isActive(int i) const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > theStripClusterLabel
edm::Handle< edmNew::DetSetVector< SiStripCluster > > & handle()
edm::EDGetTokenT< edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > > theStripClusterMask

Member Data Documentation

bool MeasurementTrackerEventProducer::isPhase2
protected
std::string MeasurementTrackerEventProducer::measurementTrackerLabel_
protected

Definition at line 30 of file MeasurementTrackerEventProducer.h.

Referenced by produce().

const edm::ParameterSet& MeasurementTrackerEventProducer::pset_
protected
bool MeasurementTrackerEventProducer::selfUpdateSkipClusters_
protected
std::vector<edm::EDGetTokenT<DetIdCollection> > MeasurementTrackerEventProducer::theInactivePixelDetectorLabels
protected
std::vector<edm::EDGetTokenT<DetIdCollection> > MeasurementTrackerEventProducer::theInactiveStripDetectorLabels
protected
edm::EDGetTokenT<edmNew::DetSetVector<Phase2TrackerCluster1D> > MeasurementTrackerEventProducer::thePh2OTClusterLabel
protected
edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > MeasurementTrackerEventProducer::thePixelClusterLabel
protected
edm::EDGetTokenT<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > > MeasurementTrackerEventProducer::thePixelClusterMask
protected
edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > MeasurementTrackerEventProducer::theStripClusterLabel
protected
edm::EDGetTokenT<edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > > MeasurementTrackerEventProducer::theStripClusterMask
protected