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 266 of file MeasurementTrackerEventProducer.cc.

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

Referenced by updateStrips().

267 {
268  if (!theInactiveStripDetectorLabels.empty()) {
271  if (event.getByToken(tk, detIds)){
272  rawInactiveDetIds.insert(rawInactiveDetIds.end(), detIds->begin(), detIds->end());
273  }
274  }
275  if (!rawInactiveDetIds.empty()) std::sort(rawInactiveDetIds.begin(), rawInactiveDetIds.end());
276  }
277 
278 }
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 230 of file MeasurementTrackerEventProducer.cc.

References edmNew::DetSetVector< T >::begin(), edmNew::DetSetVector< T >::end(), edm::ParameterSet::getParameter(), Phase2OTMeasurementDetSet::handle(), 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().

230  {
231 
232 
233  // Phase2OT Clusters
234  if ( isPhase2 ) {
235 
236  std::string phase2ClusterProducer = pset_.getParameter<std::string>("Phase2TrackerCluster1DProducer");
237  if( phase2ClusterProducer.empty() ) { //clusters have not been produced
238  thePh2OTDets.setActiveThisEvent(false);
239  } else {
240 
242  event.getByToken(thePh2OTClusterLabel, phase2OTClusters);
243  const edmNew::DetSetVector<Phase2TrackerCluster1D>* phase2OTCollection = phase2OTClusters.product();
244 
245  int i = 0, endDet = thePh2OTDets.size();
246  for (edmNew::DetSetVector<Phase2TrackerCluster1D>::const_iterator it = phase2OTCollection->begin(), ed = phase2OTCollection->end(); it != ed; ++it) {
247 
249  unsigned int id = set.id();
250  while ( id != thePh2OTDets.id(i)) {
251  ++i;
252  if (endDet==i) throw "we have a problem!!!!";
253  }
254  // push cluster range in det
255  if ( thePh2OTDets.isActive(i) ) {
256  thePh2OTDets.update(i,set);
257  }
258  }
259  }
260 
261  }
262  return;
263 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
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(), 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  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  }
159 
160 }
#define LogDebug(id)
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
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:79
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 163 of file MeasurementTrackerEventProducer.cc.

References edm::HandleBase::failedToGet(), StMeasurementDetSet::find(), getInactiveStrips(), edm::ParameterSet::getParameter(), StMeasurementDetSet::handle(), i, hcalTTPDigis_cfi::id, edm::HandleBase::id(), StMeasurementDetSet::id(), StMeasurementDetSet::isActive(), j, 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().

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