CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SeedClusterRemoverPhase2 Class Reference
Inheritance diagram for SeedClusterRemoverPhase2:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 SeedClusterRemoverPhase2 (const edm::ParameterSet &iConfig)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Types

typedef edm::ContainerMask< edmNew::DetSetVector< Phase2TrackerCluster1D > > Phase2OTMaskContainer
 
typedef edm::ContainerMask< edmNew::DetSetVector< SiPixelCluster > > PixelMaskContainer
 

Private Member Functions

void process (const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
 

Private Attributes

std::vector< bool > collectedOuterTrackers_
 
std::vector< bool > collectedPixels_
 
bool doOuterTracker_
 
bool doPixel_
 
bool mergeOld_
 
edm::EDGetTokenT< Phase2OTMaskContaineroldPh2OTMaskToken_
 
edm::EDGetTokenT< PixelMaskContaineroldPxlMaskToken_
 
std::vector< uint8_t > OTs
 
edm::ProductID outerTrackerSourceProdID
 
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > phase2OTClusters_
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
 
std::vector< uint8_t > pixels
 
edm::ProductID pixelSourceProdID
 
edm::EDGetTokenT< TrajectorySeedCollectiontrajectories_
 

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
 

Detailed Description

Definition at line 34 of file SeedClusterRemoverPhase2.cc.

Member Typedef Documentation

Definition at line 43 of file SeedClusterRemoverPhase2.cc.

Definition at line 42 of file SeedClusterRemoverPhase2.cc.

Constructor & Destructor Documentation

SeedClusterRemoverPhase2::SeedClusterRemoverPhase2 ( const edm::ParameterSet iConfig)

Definition at line 63 of file SeedClusterRemoverPhase2.cc.

References doOuterTracker_, doPixel_, edm::ParameterSet::getParameter(), mergeOld_, oldPh2OTMaskToken_, oldPxlMaskToken_, phase2OTClusters_, pixelClusters_, and trajectories_.

63  :
64  doOuterTracker_(iConfig.existsAs<bool>("doOuterTracker") ? iConfig.getParameter<bool>("doOuterTracker") : true),
65  doPixel_(iConfig.existsAs<bool>("doPixel") ? iConfig.getParameter<bool>("doPixel") : true),
66  mergeOld_(iConfig.exists("oldClusterRemovalInfo"))
67 {
68  produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
69  produces<edm::ContainerMask<edmNew::DetSetVector<Phase2TrackerCluster1D> > >();
70 
71  trajectories_ = consumes<TrajectorySeedCollection>(iConfig.getParameter<InputTag>("trajectories"));
72  if (doPixel_) pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<InputTag>("pixelClusters"));
73  if (doOuterTracker_) phase2OTClusters_ = consumes<edmNew::DetSetVector<Phase2TrackerCluster1D> >(iConfig.getParameter<InputTag>("phase2OTClusters"));
74  if (mergeOld_) {
75  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
76  oldPh2OTMaskToken_ = consumes<Phase2OTMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
77  }
78 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< TrajectorySeedCollection > trajectories_
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
edm::EDGetTokenT< Phase2OTMaskContainer > oldPh2OTMaskToken_
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > phase2OTClusters_

Member Function Documentation

void SeedClusterRemoverPhase2::process ( const TrackingRecHit hit,
float  chi2,
const TrackerGeometry tg 
)
inlineprivate

Definition at line 81 of file SeedClusterRemoverPhase2.cc.

References Phase2TrackerRecHit1D::cluster(), SiPixelRecHit::cluster(), collectedOuterTrackers_, collectedPixels_, doOuterTracker_, doPixel_, Exception, TrackingRecHit::geographicalId(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::key(), LogDebug, OTs, outerTrackerSourceProdID, pixels, pixelSourceProdID, DetId::rawId(), and DetId::subdetId().

Referenced by ConfigBuilder.ConfigBuilder::addExtraStream(), 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().

81  {
82 
83  DetId detid = hit->geographicalId();
84  uint32_t subdet = detid.subdetId();
85 
86  assert(subdet > 0);
87 
88  const type_info &hitType = typeid(*hit);
89  if (hitType == typeid(SiPixelRecHit)) {
90 
91  if(!doPixel_) return;
92 
93  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
94  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
95  LogDebug("SeedClusterRemoverPhase2") << "Plain Pixel RecHit in det " << detid.rawId();
96 
97  if (cluster.id() != pixelSourceProdID) throw cms::Exception("Inconsistent Data") <<
98  "SeedClusterRemoverPhase2: pixel cluster ref from Product ID = " << cluster.id() <<
99  " does not match with source cluster collection (ID = " << pixelSourceProdID << ")\n.";
100 
101  assert(cluster.id() == pixelSourceProdID);
102 
103  // mark as used
104  pixels[cluster.key()] = false;
105 
106  assert(collectedPixels_.size() > cluster.key());
107  collectedPixels_[cluster.key()]=true;
108 
109  } else if (hitType == typeid(Phase2TrackerRecHit1D)) {
110 
111  if(!doOuterTracker_) return;
112 
113  const Phase2TrackerRecHit1D *ph2OThit = static_cast<const Phase2TrackerRecHit1D*>(hit);
114  LogDebug("SeedClusterRemoverPhase2") << "Plain Phase2TrackerRecHit1D in det " << detid.rawId();
115 
116  Phase2TrackerRecHit1D::CluRef cluster = ph2OThit->cluster();
117  if (cluster.id() != outerTrackerSourceProdID) throw cms::Exception("Inconsistent Data") <<
118  "SeedClusterRemoverPhase2: strip cluster ref from Product ID = " << cluster.id() <<
119  " does not match with source cluster collection (ID = " << outerTrackerSourceProdID << ")\n.";
120 
121  assert(cluster.id() == outerTrackerSourceProdID);
122 
123  OTs[cluster.key()] = false;
124  assert(collectedOuterTrackers_.size() > cluster.key());
125  collectedOuterTrackers_[cluster.key()]=true;
126 
127  } else throw cms::Exception("NOT IMPLEMENTED") << "I received a hit that was neither SiPixelRecHit nor Phase2TrackerRecHit1D but " << hitType.name() << " on detid " << detid.rawId() << "\n";
128 
129 
130 }
#define LogDebug(id)
std::vector< bool > collectedPixels_
std::vector< bool > collectedOuterTrackers_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
key_type key() const
Accessor for product key.
Definition: Ref.h:265
ProductID id() const
Accessor for product ID.
Definition: Ref.h:259
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Definition: DetId.h:18
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
DetId geographicalId() const
Our base class.
Definition: SiPixelRecHit.h:23
void SeedClusterRemoverPhase2::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 133 of file SeedClusterRemoverPhase2.cc.

References collectedOuterTrackers_, collectedPixels_, edm::ContainerMask< T >::copyMaskTo(), KineDebug3::count(), DEFINE_FWK_MODULE, doOuterTracker_, doPixel_, lumiContext::fill, edm::EventSetup::get(), edm::Event::getByToken(), hfClusterShapes_cfi::hits, edm::HandleBase::id(), LogDebug, mergeOld_, oldPh2OTMaskToken_, oldPxlMaskToken_, OTs, outerTrackerSourceProdID, seedClusterRemoverPhase2_cfi::phase2OTClusters, phase2OTClusters_, HiRegitMuonDetachedTripletStep_cff::pixelClusters, pixelClusters_, pixels, pixelSourceProdID, process(), edm::ESHandle< T >::product(), edm::Event::put(), SurveyInfoScenario_cff::seed, edm::ContainerMask< T >::size(), and trajectories_.

134 {
135  ProductID pixelOldProdID, stripOldProdID;
136 
138  iSetup.get<TrackerDigiGeometryRecord>().get("",tgh); //is it correct to use "" ?
139 
141  if (doPixel_) {
142  iEvent.getByToken(pixelClusters_, pixelClusters);
143  pixelSourceProdID = pixelClusters.id();
144  }
145  LogDebug("SeedClusterRemoverPhase2") << "Read pixel with id " << pixelSourceProdID << std::endl;
146 
148  if (doOuterTracker_) {
149  iEvent.getByToken(phase2OTClusters_, phase2OTClusters);
150  outerTrackerSourceProdID = phase2OTClusters.id();
151  }
152  LogDebug("SeedClusterRemoverPhase2") << "Read OT cluster with id " << outerTrackerSourceProdID << std::endl;
153 
154 
155  if (doOuterTracker_) {
156  OTs.resize(phase2OTClusters->dataSize()); fill(OTs.begin(), OTs.end(), true);
157  }
158  if (doPixel_) {
159  pixels.resize(pixelClusters->dataSize()); fill(pixels.begin(), pixels.end(), true);
160  }
161  if(mergeOld_) {
164  iEvent.getByToken(oldPxlMaskToken_ ,oldPxlMask);
165  iEvent.getByToken(oldPh2OTMaskToken_ ,oldPh2OTMask);
166  LogDebug("SeedClusterRemoverPhase2") << "to merge in, "<<oldPh2OTMask->size()<<" strp and "<<oldPxlMask->size()<<" pxl";
167  oldPh2OTMask->copyMaskTo(collectedOuterTrackers_);
168  oldPxlMask->copyMaskTo(collectedPixels_);
169  assert(phase2OTClusters->dataSize()>=collectedOuterTrackers_.size());
170  collectedOuterTrackers_.resize(phase2OTClusters->dataSize(),false); // for ondemand
171  }else {
172  collectedOuterTrackers_.resize(phase2OTClusters->dataSize(), false);
173  collectedPixels_.resize(pixelClusters->dataSize(), false);
174  }
175 
176 
178  iEvent.getByToken(trajectories_,seeds);
179 
180  for (auto const & seed : (*seeds) ){
181  auto hits=seed.recHits();
182  auto hit=hits.first;
183  for (;hit!=hits.second;++hit){
184  if (!hit->isValid()) continue;
185  process( &(*hit), 0. , tgh.product());
186  }
187  }
188 
189 
190  pixels.clear(); OTs.clear();
191 
192 
193  LogDebug("SeedClusterRemoverPhase2")<<"total strip to skip: "<<std::count(collectedOuterTrackers_.begin(),collectedOuterTrackers_.end(),true);
194  iEvent.put(std::make_unique<Phase2OTMaskContainer>(edm::RefProd<edmNew::DetSetVector<Phase2TrackerCluster1D> >(phase2OTClusters),collectedOuterTrackers_));
195 
196  LogDebug("SeedClusterRemoverPhase2")<<"total pxl to skip: "<<std::count(collectedPixels_.begin(),collectedPixels_.end(),true);
197  iEvent.put(std::make_unique<PixelMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiPixelCluster> >(pixelClusters),collectedPixels_));
198 
199  collectedOuterTrackers_.clear();
200  collectedPixels_.clear();
201 
202 }
#define LogDebug(id)
std::vector< bool > collectedPixels_
std::vector< bool > collectedOuterTrackers_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
void copyMaskTo(std::vector< bool > &) const
Definition: ContainerMask.h:91
void process(const TrackingRecHit *hit, float chi2, const TrackerGeometry *tg)
edm::EDGetTokenT< TrajectorySeedCollection > trajectories_
edm::EDGetTokenT< PixelMaskContainer > oldPxlMaskToken_
size_t size() const
Definition: ContainerMask.h:55
edm::EDGetTokenT< Phase2OTMaskContainer > oldPh2OTMaskToken_
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > phase2OTClusters_
T get() const
Definition: EventSetup.h:63
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

std::vector<bool> SeedClusterRemoverPhase2::collectedOuterTrackers_
private

Definition at line 55 of file SeedClusterRemoverPhase2.cc.

Referenced by process(), and produce().

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

Definition at line 56 of file SeedClusterRemoverPhase2.cc.

Referenced by process(), and produce().

bool SeedClusterRemoverPhase2::doOuterTracker_
private

Definition at line 40 of file SeedClusterRemoverPhase2.cc.

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

bool SeedClusterRemoverPhase2::doPixel_
private

Definition at line 40 of file SeedClusterRemoverPhase2.cc.

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

bool SeedClusterRemoverPhase2::mergeOld_
private

Definition at line 41 of file SeedClusterRemoverPhase2.cc.

Referenced by produce(), and SeedClusterRemoverPhase2().

edm::EDGetTokenT<Phase2OTMaskContainer> SeedClusterRemoverPhase2::oldPh2OTMaskToken_
private

Definition at line 47 of file SeedClusterRemoverPhase2.cc.

Referenced by produce(), and SeedClusterRemoverPhase2().

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

Definition at line 46 of file SeedClusterRemoverPhase2.cc.

Referenced by produce(), and SeedClusterRemoverPhase2().

std::vector<uint8_t> SeedClusterRemoverPhase2::OTs
private

Definition at line 50 of file SeedClusterRemoverPhase2.cc.

Referenced by process(), and produce().

edm::ProductID SeedClusterRemoverPhase2::outerTrackerSourceProdID
private

Definition at line 51 of file SeedClusterRemoverPhase2.cc.

Referenced by process(), and produce().

edm::EDGetTokenT<edmNew::DetSetVector<Phase2TrackerCluster1D> > SeedClusterRemoverPhase2::phase2OTClusters_
private

Definition at line 45 of file SeedClusterRemoverPhase2.cc.

Referenced by produce(), and SeedClusterRemoverPhase2().

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

Definition at line 44 of file SeedClusterRemoverPhase2.cc.

Referenced by produce(), and SeedClusterRemoverPhase2().

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

Definition at line 50 of file SeedClusterRemoverPhase2.cc.

Referenced by process(), and produce().

edm::ProductID SeedClusterRemoverPhase2::pixelSourceProdID
private

Definition at line 51 of file SeedClusterRemoverPhase2.cc.

Referenced by process(), and produce().

edm::EDGetTokenT<TrajectorySeedCollection> SeedClusterRemoverPhase2::trajectories_
private

Definition at line 48 of file SeedClusterRemoverPhase2.cc.

Referenced by produce(), and SeedClusterRemoverPhase2().