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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 62 of file SeedClusterRemoverPhase2.cc.

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

63  : doOuterTracker_(iConfig.existsAs<bool>("doOuterTracker") ? iConfig.getParameter<bool>("doOuterTracker") : true),
64  doPixel_(iConfig.existsAs<bool>("doPixel") ? iConfig.getParameter<bool>("doPixel") : true),
65  mergeOld_(iConfig.exists("oldClusterRemovalInfo")) {
66  produces<edm::ContainerMask<edmNew::DetSetVector<SiPixelCluster> > >();
67  produces<edm::ContainerMask<edmNew::DetSetVector<Phase2TrackerCluster1D> > >();
68 
69  trajectories_ = consumes<TrajectorySeedCollection>(iConfig.getParameter<InputTag>("trajectories"));
70  if (doPixel_)
71  pixelClusters_ = consumes<edmNew::DetSetVector<SiPixelCluster> >(iConfig.getParameter<InputTag>("pixelClusters"));
72  if (doOuterTracker_)
74  consumes<edmNew::DetSetVector<Phase2TrackerCluster1D> >(iConfig.getParameter<InputTag>("phase2OTClusters"));
75  if (mergeOld_) {
76  oldPxlMaskToken_ = consumes<PixelMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
77  oldPh2OTMaskToken_ = consumes<Phase2OTMaskContainer>(iConfig.getParameter<InputTag>("oldClusterRemovalInfo"));
78  }
79 }
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:160
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 produce().

81  {
82  DetId detid = hit->geographicalId();
83  uint32_t subdet = detid.subdetId();
84 
85  assert(subdet > 0);
86 
87  const type_info &hitType = typeid(*hit);
88  if (hitType == typeid(SiPixelRecHit)) {
89  if (!doPixel_)
90  return;
91 
92  const SiPixelRecHit *pixelHit = static_cast<const SiPixelRecHit *>(hit);
93  SiPixelRecHit::ClusterRef cluster = pixelHit->cluster();
94  LogDebug("SeedClusterRemoverPhase2") << "Plain Pixel RecHit in det " << detid.rawId();
95 
96  if (cluster.id() != pixelSourceProdID)
97  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  if (!doOuterTracker_)
111  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)
118  throw cms::Exception("Inconsistent Data")
119  << "SeedClusterRemoverPhase2: strip cluster ref from Product ID = " << cluster.id()
120  << " does not match with source cluster collection (ID = " << outerTrackerSourceProdID << ")\n.";
121 
122  assert(cluster.id() == outerTrackerSourceProdID);
123 
124  OTs[cluster.key()] = false;
125  assert(collectedOuterTrackers_.size() > cluster.key());
126  collectedOuterTrackers_[cluster.key()] = true;
127 
128  } else
129  throw cms::Exception("NOT IMPLEMENTED")
130  << "I received a hit that was neither SiPixelRecHit nor Phase2TrackerRecHit1D but " << hitType.name()
131  << " on detid " << detid.rawId() << "\n";
132 }
#define LogDebug(id)
std::vector< bool > collectedPixels_
std::vector< bool > collectedOuterTrackers_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
key_type key() const
Accessor for product key.
Definition: Ref.h:250
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
DetId geographicalId() const
Our base class.
Definition: SiPixelRecHit.h:23
void SeedClusterRemoverPhase2::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 134 of file SeedClusterRemoverPhase2.cc.

References collectedOuterTrackers_, collectedPixels_, edm::ContainerMask< T >::copyMaskTo(), KineDebug3::count(), DEFINE_FWK_MODULE, doOuterTracker_, doPixel_, ntuplemaker::fill, edm::EventSetup::get(), edm::Event::getByToken(), hfClusterShapes_cfi::hits, edm::HandleBase::id(), LogDebug, mergeOld_, oldPh2OTMaskToken_, oldPxlMaskToken_, OTs, outerTrackerSourceProdID, seedClusterRemoverPhase2_cfi::phase2OTClusters, phase2OTClusters_, LumiMonitor_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  if (doOuterTracker_) {
155  OTs.resize(phase2OTClusters->dataSize());
156  fill(OTs.begin(), OTs.end(), true);
157  }
158  if (doPixel_) {
159  pixels.resize(pixelClusters->dataSize());
160  fill(pixels.begin(), pixels.end(), true);
161  }
162  if (mergeOld_) {
165  iEvent.getByToken(oldPxlMaskToken_, oldPxlMask);
166  iEvent.getByToken(oldPh2OTMaskToken_, oldPh2OTMask);
167  LogDebug("SeedClusterRemoverPhase2") << "to merge in, " << oldPh2OTMask->size() << " strp and "
168  << oldPxlMask->size() << " pxl";
169  oldPh2OTMask->copyMaskTo(collectedOuterTrackers_);
170  oldPxlMask->copyMaskTo(collectedPixels_);
171  assert(phase2OTClusters->dataSize() >= collectedOuterTrackers_.size());
172  collectedOuterTrackers_.resize(phase2OTClusters->dataSize(), false); // for ondemand
173  } else {
174  collectedOuterTrackers_.resize(phase2OTClusters->dataSize(), false);
175  collectedPixels_.resize(pixelClusters->dataSize(), false);
176  }
177 
179  iEvent.getByToken(trajectories_, seeds);
180 
181  for (auto const &seed : (*seeds)) {
182  auto hits = seed.recHits();
183  auto hit = hits.first;
184  for (; hit != hits.second; ++hit) {
185  if (!hit->isValid())
186  continue;
187  process(&(*hit), 0., tgh.product());
188  }
189  }
190 
191  pixels.clear();
192  OTs.clear();
193 
194  LogDebug("SeedClusterRemoverPhase2") << "total strip to skip: "
195  << std::count(
196  collectedOuterTrackers_.begin(), collectedOuterTrackers_.end(), true);
197  iEvent.put(std::make_unique<Phase2OTMaskContainer>(
199 
200  LogDebug("SeedClusterRemoverPhase2") << "total pxl to skip: "
201  << std::count(collectedPixels_.begin(), collectedPixels_.end(), true);
202  iEvent.put(std::make_unique<PixelMaskContainer>(edm::RefProd<edmNew::DetSetVector<SiPixelCluster> >(pixelClusters),
204 
205  collectedOuterTrackers_.clear();
206  collectedPixels_.clear();
207 }
#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:131
ProductID id() const
Definition: HandleBase.cc:13
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
void copyMaskTo(std::vector< bool > &) const
Definition: ContainerMask.h:87
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:53
edm::EDGetTokenT< Phase2OTMaskContainer > oldPh2OTMaskToken_
edm::EDGetTokenT< edmNew::DetSetVector< Phase2TrackerCluster1D > > phase2OTClusters_
T get() const
Definition: EventSetup.h:73
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().