CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
HLTTrackClusterRemoverNew Class Referencefinal
Inheritance diagram for HLTTrackClusterRemoverNew:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  ParamBlock
 

Public Member Functions

 HLTTrackClusterRemoverNew (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~HLTTrackClusterRemoverNew () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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 & itemsToGetFrom (BranchType iType) 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)
 

Private Types

typedef edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
 
typedef edm::ContainerMask< edmNew::DetSetVector< SiStripCluster > > StripMaskContainer
 

Private Member Functions

template<typename T >
std::unique_ptr< edmNew::DetSetVector< T > > cleanup (const edmNew::DetSetVector< T > &oldClusters, const std::vector< uint8_t > &isGood, reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices *oldRefs)
 
void mergeOld (reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
 
void process (const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
 
void process (const OmniClusterRef &cluRef, uint32_t subdet)
 
void readPSet (const edm::ParameterSet &iConfig, const std::string &name, int id1=-1, int id2=-1, int id3=-1, int id4=-1, int id5=-1, int id6=-1)
 

Private Attributes

std::vector< bool > collectedPixels_
 
std::vector< bool > collectedRegStrips_
 
bool doPixel_
 
bool doPixelChargeCheck_
 
bool doStrip_
 
bool doStripChargeCheck_
 
bool doTracks_
 
bool makeProducts_
 
bool mergeOld_
 
edm::EDGetTokenT< PixelMaskContaineroldPxlMaskToken_
 
edm::EDGetTokenT< StripMaskContaineroldStrMaskToken_
 
ParamBlock pblocks_ [NumberOfParamBlocks]
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
 
std::vector< uint8_t > pixels
 
edm::ProductID pixelSourceProdID
 
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
 
std::vector< uint8_t > strips
 
edm::ProductID stripSourceProdID
 
edm::EDGetTokenT< std::vector< Trajectory > > trajectories_
 

Static Private Attributes

static const unsigned int NumberOfParamBlocks = 6
 

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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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)
 
- 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)
 

Detailed Description

Definition at line 39 of file HLTTrackClusterRemoverNew.cc.

Member Typedef Documentation

Definition at line 68 of file HLTTrackClusterRemoverNew.cc.

Definition at line 69 of file HLTTrackClusterRemoverNew.cc.

Constructor & Destructor Documentation

HLTTrackClusterRemoverNew::HLTTrackClusterRemoverNew ( const edm::ParameterSet iConfig)

Definition at line 126 of file HLTTrackClusterRemoverNew.cc.

References doPixel_, doPixelChargeCheck_, doStrip_, doStripChargeCheck_, doTracks_, Exception, edm::ParameterSet::exists(), lumiContext::fill, edm::ParameterSet::getParameter(), mps_fire::i, mergeOld_, NumberOfParamBlocks, oldPxlMaskToken_, oldStrMaskToken_, pblocks_, pixelClusters_, readPSet(), stripClusters_, and trajectories_.

127  : doTracks_(iConfig.exists("trajectories"))
128  , doStrip_ (iConfig.existsAs<bool>("doStrip") ? iConfig.getParameter<bool>("doStrip") : true)
129  , doPixel_ (iConfig.existsAs<bool>("doPixel") ? iConfig.getParameter<bool>("doPixel") : true)
130  , mergeOld_(false)
131  , makeProducts_(true)
132  , doStripChargeCheck_(iConfig.existsAs<bool>("doStripChargeCheck") ? iConfig.getParameter<bool>("doStripChargeCheck") : false)
133  , doPixelChargeCheck_(iConfig.existsAs<bool>("doPixelChargeCheck") ? iConfig.getParameter<bool>("doPixelChargeCheck") : false)
134 
135 {
136 
137  if (iConfig.exists("oldClusterRemovalInfo"))
138  {
139  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
140  oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
141  if (not (iConfig.getParameter<InputTag>("oldClusterRemovalInfo")== edm::InputTag())) mergeOld_=true;
142  }
143 
145  throw cms::Exception("Configuration Error") << "HLTTrackClusterRemoverNew: Charge check asked without cluster collection ";
147  throw cms::Exception("Configuration Error") << "HLTTrackClusterRemoverNew: Pixel cluster charge check not yet implemented";
148 
149  fill(pblocks_, pblocks_+NumberOfParamBlocks, ParamBlock());
150  readPSet(iConfig, "Common",-1);
151  if (doPixel_) {
152  readPSet(iConfig, "Pixel" , 0,1);
153  readPSet(iConfig, "PXB" , 0);
154  readPSet(iConfig, "PXE" , 1);
155  }
156  if (doStrip_) {
157  readPSet(iConfig, "Strip" , 2,3,4,5);
158  readPSet(iConfig, "StripInner" ,2,3);
159  readPSet(iConfig, "StripOuter" ,4,5);
160  readPSet(iConfig, "TIB" , 2);
161  readPSet(iConfig, "TID" , 3);
162  readPSet(iConfig, "TOB" , 4);
163  readPSet(iConfig, "TEC" , 5);
164  }
165 
166  bool usingCharge = false;
167  for (size_t i = 0; i < NumberOfParamBlocks; ++i) {
168  if (!pblocks_[i].isSet_) throw cms::Exception("Configuration Error") << "HLTTrackClusterRemoverNew: Missing configuration for detector with subDetID = " << (i+1);
169  if (pblocks_[i].usesCharge_ && !usingCharge) {
170  throw cms::Exception("Configuration Error") << "HLTTrackClusterRemoverNew: Configuration for subDetID = " << (i+1) << " uses cluster charge, which is not enabled.";
171  }
172  }
173 
174  // trajectories_ = consumes<vector<Trajectory> >(iConfig.getParameter<InputTag>("trajectories"));
175  if (doTracks_) trajectories_ = consumes<vector<Trajectory> > (iConfig.getParameter<InputTag>("trajectories") );
176  if (doPixel_) pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<InputTag>("pixelClusters"));
177  if (doStrip_) stripClusters_ = consumes<edmNew::DetSetVector<SiStripCluster> > (iConfig.getParameter<InputTag>("stripClusters"));
178  if (mergeOld_) {
179  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
180  oldStrMaskToken_ = consumes<StripMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
181  }
182 
183  //produces<edmNew::DetSetVector<SiPixelClusterRefNew> >();
184  //produces<edmNew::DetSetVector<SiStripRecHit1D::ClusterRegionalRef> >();
185 
186  produces< edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
187  produces< edm::ContainerMask<edmNew::DetSetVector<SiStripCluster> > >();
188 
189 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
static const unsigned int NumberOfParamBlocks
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
void readPSet(const edm::ParameterSet &iConfig, const std::string &name, int id1=-1, int id2=-1, int id3=-1, int id4=-1, int id5=-1, int id6=-1)
ParamBlock pblocks_[NumberOfParamBlocks]
edm::EDGetTokenT< std::vector< Trajectory > > trajectories_
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
HLTTrackClusterRemoverNew::~HLTTrackClusterRemoverNew ( )
override

Definition at line 192 of file HLTTrackClusterRemoverNew.cc.

193 {
194 }

Member Function Documentation

template<typename T >
std::unique_ptr< edmNew::DetSetVector< T > > HLTTrackClusterRemoverNew::cleanup ( const edmNew::DetSetVector< T > &  oldClusters,
const std::vector< uint8_t > &  isGood,
reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)
private

Definition at line 207 of file HLTTrackClusterRemoverNew.cc.

References edmNew::DetSetVector< T >::begin(), collectedRegStrips_, edmNew::DetSetVector< T >::data(), edmNew::DetSetVector< T >::dataSize(), edmNew::DetSetVector< T >::end(), OmniClusterRef::id(), diffTreeTool::index, OmniClusterRef::key(), mergeOld(), convertSQLitetoXML_cfg::output, process(), edmNew::DetSetVector< T >::size(), and stripSourceProdID.

208  {
209  typedef typename edmNew::DetSetVector<T> DSV;
210  typedef typename edmNew::DetSetVector<T>::FastFiller DSF;
211  typedef typename edmNew::DetSet<T> DS;
212  auto output = std::make_unique<DSV>();
213  output->reserve(oldClusters.size(), oldClusters.dataSize());
214 
215  unsigned int countOld=0;
216  unsigned int countNew=0;
217 
218  // cluster removal loop
219  const T * firstOffset = & oldClusters.data().front();
220  for (typename DSV::const_iterator itdet = oldClusters.begin(), enddet = oldClusters.end(); itdet != enddet; ++itdet) {
221  DS oldDS = *itdet;
222 
223  if (oldDS.empty()) continue; // skip empty detsets
224 
225  uint32_t id = oldDS.detId();
226  DSF outds(*output, id);
227 
228  for (typename DS::const_iterator it = oldDS.begin(), ed = oldDS.end(); it != ed; ++it) {
229  uint32_t index = ((&*it) - firstOffset);
230  countOld++;
231  if (isGood[index]) {
232  outds.push_back(*it);
233  countNew++;
234  refs.push_back(index);
235  //std::cout << "HLTTrackClusterRemoverNew::cleanup " << typeid(T).name() << " reference " << index << " to " << (refs.size() - 1) << std::endl;
236  }
237 
238  }
239  if (outds.empty()) outds.abort(); // not write in an empty DSV
240  }
241  // double fraction = countNew / (double) countOld;
242  // std::cout<<"fraction: "<<fraction<<std::endl;
243  if (oldRefs != nullptr) mergeOld(refs, *oldRefs);
244  return output;
245 }
const_iterator end(bool update=false) const
size_type dataSize() const
data_type const * data(size_t cell) const
void mergeOld(reco::ClusterRemovalInfo::Indices &refs, const reco::ClusterRemovalInfo::Indices &oldRefs)
size_type size() const
long double T
const_iterator begin(bool update=false) const
void HLTTrackClusterRemoverNew::mergeOld ( reco::ClusterRemovalInfo::Indices refs,
const reco::ClusterRemovalInfo::Indices oldRefs 
)
private

Definition at line 196 of file HLTTrackClusterRemoverNew.cc.

References mps_fire::i, and gen::n.

Referenced by cleanup().

198 {
199  for (size_t i = 0, n = refs.size(); i < n; ++i) {
200  refs[i] = oldRefs[refs[i]];
201  }
202 }
void HLTTrackClusterRemoverNew::process ( const TrackingRecHit hit,
float  chi2,
const TrackerGeometry tg 
)
inlineprivate

Definition at line 263 of file HLTTrackClusterRemoverNew.cc.

References SiPixelRecHit::cluster(), collectedPixels_, doPixel_, doStrip_, Exception, TrackingRecHit::geographicalId(), TrackerGeometry::geomDetSubDetector(), edm::Ref< C, T, F >::id(), GeomDetEnumerators::isTrackerPixel(), edm::Ref< C, T, F >::key(), HLTTrackClusterRemoverNew::ParamBlock::maxSize_, SiStripMatchedRecHit2D::monoClusterRef(), NumberOfParamBlocks, TrackerSingleRecHit::omniClusterRef(), ProjectedSiStripRecHit2D::originalHit(), pblocks_, pixelSourceProdID, DetId::rawId(), SiStripMatchedRecHit2D::stereoClusterRef(), and DetId::subdetId().

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), cleanup(), ConfigBuilder.ConfigBuilder::completeInputCommand(), ConfigBuilder.ConfigBuilder::doNotInlineEventContent(), ConfigBuilder.ConfigBuilder.PrintAllModules::leave(), ConfigBuilder.ConfigBuilder::prepare(), ConfigBuilder.ConfigBuilder::prepare_ALCA(), ConfigBuilder.ConfigBuilder::prepare_DQM(), ConfigBuilder.ConfigBuilder::prepare_HLT(), ConfigBuilder.ConfigBuilder::prepare_LHE(), ConfigBuilder.ConfigBuilder::prepare_PATFILTER(), ConfigBuilder.ConfigBuilder::prepare_VALIDATION(), produce(), ConfigBuilder.ConfigBuilder::renameHLTprocessInSequence(), ConfigBuilder.ConfigBuilder::renameInputTagsInSequence(), and ConfigBuilder.ConfigBuilder::scheduleSequence().

263  {
264  DetId detid = hit->geographicalId();
265  uint32_t subdet = detid.subdetId();
266 
267 
268  assert ((subdet > 0) && (subdet <= NumberOfParamBlocks));
269 
270  // chi2 cut
271  if (chi2 > pblocks_[subdet-1].maxChi2_) return;
272 
274  // std::cout<<"process pxl hit"<<std::endl;
275  if (!doPixel_) return;
276  // this is a pixel, and i *know* it is
277  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
278 
279  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
280  if (cluster.id() != pixelSourceProdID) throw cms::Exception("Inconsistent Data") <<
281  "HLTTrackClusterRemoverNew: pixel cluster ref from Product ID = " << cluster.id() <<
282  " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
283 
284  assert(cluster.id() == pixelSourceProdID);
285  //DBG// cout << "HIT NEW PIXEL DETID = " << detid.rawId() << ", Cluster [ " << cluster.key().first << " / " << cluster.key().second << " ] " << endl;
286 
287  // if requested, cut on cluster size
288  if (pblocks_[subdet-1].usesSize_ && (cluster->pixels().size() > pblocks_[subdet-1].maxSize_)) return;
289 
290  // mark as used
291  //pixels[cluster.key()] = false;
292  assert(collectedPixels_.size() > cluster.key());
293  collectedPixels_[cluster.key()]=true;
294  } else { // aka Strip
295  if (!doStrip_) return;
296  const type_info &hitType = typeid(*hit);
297  if (hitType == typeid(SiStripRecHit2D)) {
298  const SiStripRecHit2D *stripHit = static_cast<const SiStripRecHit2D *>(hit);
299  //DBG// cout << "Plain RecHit 2D: " << endl;
300  process(stripHit->omniClusterRef(),subdet);
301  // int clusCharge=0;
302  // for ( auto cAmp : stripHit->omniClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
303  // std::cout << "[HLTTrackClusterRemoverNew::process (SiStripRecHit2D) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
304  } else if (hitType == typeid(SiStripRecHit1D)) {
305  const SiStripRecHit1D *hit1D = static_cast<const SiStripRecHit1D *>(hit);
306  process(hit1D->omniClusterRef(),subdet);
307  // int clusCharge=0;
308  // for ( auto cAmp : hit1D->omniClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
309  // std::cout << "[HLTTrackClusterRemoverNew::process (SiStripRecHit1D) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
310  } else if (hitType == typeid(SiStripMatchedRecHit2D)) {
311  const SiStripMatchedRecHit2D *matchHit = static_cast<const SiStripMatchedRecHit2D *>(hit);
312  //DBG// cout << "Matched RecHit 2D: " << endl;
313  process(matchHit->monoClusterRef(), subdet);
314  // int clusCharge=0;
315  // for ( auto cAmp : matchHit->monoClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
316  // std::cout << "[HLTTrackClusterRemoverNew::process (SiStripMatchedRecHit2D:mono) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
317 
318  process(matchHit->stereoClusterRef(),subdet);
319  // clusCharge=0;
320  // for ( auto cAmp : matchHit->stereoClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
321  // std::cout << "[HLTTrackClusterRemoverNew::process (SiStripMatchedRecHit2D:stereo) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
322 
323  } else if (hitType == typeid(ProjectedSiStripRecHit2D)) {
324  const ProjectedSiStripRecHit2D *projHit = static_cast<const ProjectedSiStripRecHit2D *>(hit);
325  //DBG// cout << "Projected RecHit 2D: " << endl;
326  process(projHit->originalHit().omniClusterRef(),subdet);
327  // int clusCharge=0;
328  // for ( auto cAmp : projHit->originalHit().omniClusterRef().stripCluster().amplitudes() ) clusCharge+=cAmp;
329  // std::cout << "[HLTTrackClusterRemoverNew::process (ProjectedSiStripRecHit2D) chi2: " << chi2 << " [" << subdet << " --> charge: " << clusCharge << "]" << std::endl;
330  } else throw cms::Exception("NOT IMPLEMENTED") << "Don't know how to handle " << hitType.name() << " on detid " << detid.rawId() << "\n";
331  }
332 }
const GeomDetEnumerators::SubDetector geomDetSubDetector(int subdet) const
static const unsigned int NumberOfParamBlocks
OmniClusterRef const & stereoClusterRef() const
key_type key() const
Accessor for product key.
Definition: Ref.h:265
ProductID id() const
Accessor for product ID.
Definition: Ref.h:259
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
ParamBlock pblocks_[NumberOfParamBlocks]
OmniClusterRef const & monoClusterRef() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
SiStripRecHit2D originalHit() const
Definition: DetId.h:18
OmniClusterRef const & omniClusterRef() const
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
DetId geographicalId() const
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
Our base class.
Definition: SiPixelRecHit.h:23
void HLTTrackClusterRemoverNew::process ( const OmniClusterRef cluRef,
uint32_t  subdet 
)
inlineprivate
void HLTTrackClusterRemoverNew::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 346 of file HLTTrackClusterRemoverNew.cc.

References fastPrimaryVertexProducer_cfi::clusters, collectedPixels_, collectedRegStrips_, edm::ContainerMask< T >::copyMaskTo(), KineDebug3::count(), DEFINE_FWK_MODULE, doPixel_, doStrip_, doStripChargeCheck_, edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, edm::HandleBase::id(), TrackingRecHit::isValid(), LogDebug, Trajectory::measurements(), mergeOld_, oldPxlMaskToken_, oldStrMaskToken_, pblocks_, HiRegitMuonDetachedTripletStep_cff::pixelClusters, pixelClusters_, pixelSourceProdID, process(), edm::ESHandle< T >::product(), edm::Event::put(), edm::ContainerMask< T >::size(), HiRegitMuonDetachedTripletStep_cff::stripClusters, stripClusters_, stripSourceProdID, DetId::subdetId(), HiRegitMuonDetachedTripletStep_cff::trajectories, and trajectories_.

347 {
348  ProductID pixelOldProdID, stripOldProdID;
349 
351  iSetup.get<TrackerDigiGeometryRecord>().get(tgh);
352 
354  if (doPixel_) {
355  iEvent.getByToken(pixelClusters_, pixelClusters);
356  pixelSourceProdID = pixelClusters.id();
357  }
358 
360  if (doStrip_) {
361  iEvent.getByToken(stripClusters_, stripClusters);
362  stripSourceProdID = stripClusters.id();
363  }
364 
365  //Handle<TrajTrackAssociationCollection> trajectories;
367  iEvent.getByToken(trajectories_, trajectories);
368 
369  if(mergeOld_) {
372  iEvent.getByToken(oldPxlMaskToken_ ,oldPxlMask);
373  iEvent.getByToken(oldStrMaskToken_ ,oldStrMask);
374  LogDebug("TrackClusterRemover")<<"to merge in, "<<oldStrMask->size()<<" strp and "<<oldPxlMask->size()<<" pxl";
375  oldStrMask->copyMaskTo(collectedRegStrips_);
376  oldPxlMask->copyMaskTo(collectedPixels_);
377  collectedRegStrips_.resize(stripClusters->dataSize(),false);
378  }else {
379  collectedRegStrips_.resize(stripClusters->dataSize(), false);
380  collectedPixels_.resize(pixelClusters->dataSize(), false);
381  }
382 
383 
384  //for (TrajTrackAssociationCollection::const_iterator it = trajectories->begin(), ed = trajectories->end(); it != ed; ++it) {
385  // const Trajectory &tj = * it->key;
386 
387  for (std::vector<Trajectory>::const_iterator it = trajectories->begin(), ed = trajectories->end(); it != ed; ++it) {
388  const Trajectory &tj = * it;
389  const std::vector<TrajectoryMeasurement> &tms = tj.measurements();
390 
391  std::vector<TrajectoryMeasurement>::const_iterator itm, endtm;
392  for (itm = tms.begin(), endtm = tms.end(); itm != endtm; ++itm) {
393 
394  const TrackingRecHit *hit = itm->recHit()->hit();
395  if (!hit->isValid()) continue;
396  // std::cout<<"process hit"<<std::endl;
397  process( hit, itm->estimate() , tgh.product());
398  }
399  }
400 
401 
402  // std::cout << " => collectedRegStrips_: " << collectedRegStrips_.size() << std::endl;
403  // std::cout << " total strip to skip (before charge check): "<<std::count(collectedRegStrips_.begin(),collectedRegStrips_.end(),true) << std::endl;
404 
405 
406  // checks only cluster already found! creates regression
407  if (doStripChargeCheck_) {
408  // std::cout << "[HLTTrackClusterRemoverNew::produce] doStripChargeCheck_: " << (doStripChargeCheck_ ? "true" : "false") << " stripClusters: " << stripClusters->size() << std::endl;
409 
410 
411  auto const & clusters = stripClusters->data();
412  for (auto const & item : stripClusters->ids()) {
413 
414  if (!item.isValid()) continue; // not umpacked
415 
416  DetId detid = item.id;
417  uint32_t subdet = detid.subdetId();
418  if (!pblocks_[subdet-1].cutOnStripCharge_) continue;
419 
420  // std::cout << " i: " << i << " --> detid: " << detid << " --> subdet: " << subdet << std::endl;
421 
422  for (int i = item.offset; i<item.offset+int(item.size); ++i) {
423  int clusCharge=0;
424  for ( auto cAmp : clusters[i].amplitudes() ) clusCharge+=cAmp;
425 
426  // if (clusCharge < pblocks_[subdet-1].minGoodStripCharge_) std::cout << " clusCharge: " << clusCharge << std::endl;
427  if(clusCharge < pblocks_[subdet-1].minGoodStripCharge_) collectedRegStrips_[i] = true; // (|= does not work!)
428  }
429 
430  }
431  }
432 
433  // std::cout << " => collectedRegStrips_: " << collectedRegStrips_.size() << std::endl;
434  // std::cout << " total strip to skip: "<<std::count(collectedRegStrips_.begin(),collectedRegStrips_.end(),true) << std::endl;
435  LogDebug("TrackClusterRemover")<<"total strip to skip: "<<std::count(collectedRegStrips_.begin(),collectedRegStrips_.end(),true);
436  // std::cout << "TrackClusterRemover" <<" total strip to skip: "<<std::count(collectedRegStrips_.begin(),collectedRegStrips_.end(),true)<<std::endl;
437  iEvent.put(std::make_unique<StripMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiStripCluster> >(stripClusters),collectedRegStrips_));
438 
439  LogDebug("TrackClusterRemover")<<"total pxl to skip: "<<std::count(collectedPixels_.begin(),collectedPixels_.end(),true);
440  iEvent.put(std::make_unique<PixelMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiPixelCluster> >(pixelClusters),collectedPixels_));
441 
442  collectedRegStrips_.clear();
443  collectedPixels_.clear();
444 
445 
446 }
#define LogDebug(id)
edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > stripClusters_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
ProductID id() const
Definition: HandleBase.cc:15
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
void copyMaskTo(std::vector< bool > &) const
Definition: ContainerMask.h:90
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
DataContainer const & measurements() const
Definition: Trajectory.h:196
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
ParamBlock pblocks_[NumberOfParamBlocks]
edm::EDGetTokenT< std::vector< Trajectory > > trajectories_
size_t size() const
Definition: ContainerMask.h:54
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
const T & get() const
Definition: EventSetup.h:55
bool isValid() const
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< StripMaskContainer > oldStrMaskToken_
void HLTTrackClusterRemoverNew::readPSet ( const edm::ParameterSet iConfig,
const std::string &  name,
int  id1 = -1,
int  id2 = -1,
int  id3 = -1,
int  id4 = -1,
int  id5 = -1,
int  id6 = -1 
)
private

Definition at line 108 of file HLTTrackClusterRemoverNew.cc.

References edm::ParameterSet::exists(), lumiContext::fill, edm::ParameterSet::getParameter(), globals_cff::id1, globals_cff::id2, NumberOfParamBlocks, and pblocks_.

Referenced by HLTTrackClusterRemoverNew().

110 {
111  if (iConfig.exists(name)) {
112  ParamBlock pblock(iConfig.getParameter<ParameterSet>(name));
113  if (id1 == -1) {
115  } else {
116  pblocks_[id1] = pblock;
117  if (id2 != -1) pblocks_[id2] = pblock;
118  if (id3 != -1) pblocks_[id3] = pblock;
119  if (id4 != -1) pblocks_[id4] = pblock;
120  if (id5 != -1) pblocks_[id5] = pblock;
121  if (id6 != -1) pblocks_[id6] = pblock;
122  }
123  }
124 }
T getParameter(std::string const &) const
static const unsigned int NumberOfParamBlocks
bool exists(std::string const &parameterName) const
checks if a parameter exists
ParamBlock pblocks_[NumberOfParamBlocks]

Member Data Documentation

std::vector<bool> HLTTrackClusterRemoverNew::collectedPixels_
private

Definition at line 98 of file HLTTrackClusterRemoverNew.cc.

Referenced by process(), and produce().

std::vector<bool> HLTTrackClusterRemoverNew::collectedRegStrips_
private

Definition at line 97 of file HLTTrackClusterRemoverNew.cc.

Referenced by cleanup(), and produce().

bool HLTTrackClusterRemoverNew::doPixel_
private

Definition at line 65 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), process(), and produce().

bool HLTTrackClusterRemoverNew::doPixelChargeCheck_
private

Definition at line 96 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew().

bool HLTTrackClusterRemoverNew::doStrip_
private

Definition at line 65 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), process(), and produce().

bool HLTTrackClusterRemoverNew::doStripChargeCheck_
private

Definition at line 96 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

bool HLTTrackClusterRemoverNew::doTracks_
private

Definition at line 64 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew().

bool HLTTrackClusterRemoverNew::makeProducts_
private

Definition at line 95 of file HLTTrackClusterRemoverNew.cc.

bool HLTTrackClusterRemoverNew::mergeOld_
private

Definition at line 66 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

const unsigned int HLTTrackClusterRemoverNew::NumberOfParamBlocks = 6
staticprivate

Definition at line 62 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), process(), and readPSet().

edm::EDGetTokenT<PixelMaskContainer> HLTTrackClusterRemoverNew::oldPxlMaskToken_
private

Definition at line 72 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

edm::EDGetTokenT<StripMaskContainer> HLTTrackClusterRemoverNew::oldStrMaskToken_
private

Definition at line 73 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

ParamBlock HLTTrackClusterRemoverNew::pblocks_[NumberOfParamBlocks]
private

Definition at line 77 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), process(), produce(), and readPSet().

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > HLTTrackClusterRemoverNew::pixelClusters_
private

Definition at line 70 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

std::vector<uint8_t> HLTTrackClusterRemoverNew::pixels
private

Definition at line 81 of file HLTTrackClusterRemoverNew.cc.

edm::ProductID HLTTrackClusterRemoverNew::pixelSourceProdID
private

Definition at line 82 of file HLTTrackClusterRemoverNew.cc.

Referenced by process(), and produce().

edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > HLTTrackClusterRemoverNew::stripClusters_
private

Definition at line 71 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().

std::vector<uint8_t> HLTTrackClusterRemoverNew::strips
private

Definition at line 81 of file HLTTrackClusterRemoverNew.cc.

edm::ProductID HLTTrackClusterRemoverNew::stripSourceProdID
private

Definition at line 82 of file HLTTrackClusterRemoverNew.cc.

Referenced by cleanup(), and produce().

edm::EDGetTokenT<std::vector<Trajectory> > HLTTrackClusterRemoverNew::trajectories_
private

Definition at line 74 of file HLTTrackClusterRemoverNew.cc.

Referenced by HLTTrackClusterRemoverNew(), and produce().