CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HLTPixelClusterShapeFilter Class Reference
Inheritance diagram for HLTPixelClusterShapeFilter:
HLTFilter edm::global::EDFilter<> edm::global::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  VertexHit
 

Public Member Functions

 HLTPixelClusterShapeFilter (const edm::ParameterSet &)
 
 ~HLTPixelClusterShapeFilter () override
 
- Public Member Functions inherited from HLTFilter
 HLTFilter (const edm::ParameterSet &config)
 
int module (edm::Event const &) const
 
const std::string * moduleLabel () const
 
int path (edm::Event const &) const
 
const std::string * pathName (edm::Event const &) const
 
std::pair< int, int > pmid (edm::Event const &) const
 
bool saveTags () const
 
 ~HLTFilter () override
 
- Public Member Functions inherited from edm::global::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilterBase () 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)
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from HLTFilter
static void makeHLTFilterDescription (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from edm::global::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

int getContainedHits (const std::vector< VertexHit > &hits, double z0, double &chi) const
 
bool hltFilter (edm::Event &, const edm::EventSetup &, trigger::TriggerFilterObjectWithRefs &filterproduct) const override
 

Private Attributes

std::vector< double > clusterPars_
 
double clusterTrunc_
 
edm::InputTag inputTag_
 
edm::EDGetTokenT< SiPixelRecHitCollectioninputToken_
 
double maxZ_
 
double minZ_
 
int nhitsTrunc_
 
double zStep_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDFilterBase
typedef EDFilterBase 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
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 13 of file HLTPixelClusterShapeFilter.cc.

Constructor & Destructor Documentation

HLTPixelClusterShapeFilter::HLTPixelClusterShapeFilter ( const edm::ParameterSet config)
explicit

Definition at line 64 of file HLTPixelClusterShapeFilter.cc.

References inputTag_, inputToken_, LogDebug, and ~HLTPixelClusterShapeFilter().

64  : HLTFilter(config),
65  inputTag_ (config.getParameter<edm::InputTag>("inputTag")),
66  minZ_ (config.getParameter<double>("minZ")),
67  maxZ_ (config.getParameter<double>("maxZ")),
68  zStep_ (config.getParameter<double>("zStep")),
69  clusterPars_ (config.getParameter< std::vector<double> >("clusterPars")),
70  nhitsTrunc_ (config.getParameter<int>("nhitsTrunc")),
71  clusterTrunc_ (config.getParameter<double>("clusterTrunc"))
72 {
73  inputToken_ = consumes<SiPixelRecHitCollection>(inputTag_);
74  LogDebug("") << "Using the " << inputTag_ << " input collection";
75 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::EDGetTokenT< SiPixelRecHitCollection > inputToken_
HLTFilter(const edm::ParameterSet &config)
Definition: HLTFilter.cc:20
HLTPixelClusterShapeFilter::~HLTPixelClusterShapeFilter ( )
overridedefault

Member Function Documentation

void HLTPixelClusterShapeFilter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 80 of file HLTPixelClusterShapeFilter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), HLTFilter::makeHLTFilterDescription(), and groupFilesInBlocks::temp.

80  {
83  desc.add<edm::InputTag>("inputTag",edm::InputTag("hltSiPixelRecHits"));
84  desc.add<double>("minZ",-20.0);
85  desc.add<double>("maxZ",20.05);
86  desc.add<double>("zStep",0.2);
87  std::vector<double> temp; temp.push_back(0.0); temp.push_back(0.0045);
88  desc.add<std::vector<double> >("clusterPars",temp);
89  desc.add<int>("nhitsTrunc",150.);
90  desc.add<double>("clusterTrunc",2.0);
91  descriptions.add("hltPixelClusterShapeFilter",desc);
92 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void makeHLTFilterDescription(edm::ParameterSetDescription &desc)
Definition: HLTFilter.cc:29
void add(std::string const &label, ParameterSetDescription const &psetDescription)
int HLTPixelClusterShapeFilter::getContainedHits ( const std::vector< VertexHit > &  hits,
double  z0,
double &  chi 
) const
private

Definition at line 208 of file HLTPixelClusterShapeFilter.cc.

References DEFINE_FWK_MODULE, gen::n, AlCaHLTBitMon_ParallelJobs::p, and hit::z.

Referenced by hltFilter().

209 {
210  // Calculate number of hits contained in v-shaped window in cluster y-width vs. z-position.
211  int n = 0;
212  chi = 0.;
213 
214  for(auto hit : hits) {
215  double p = 2 * fabs(hit.z - z0)/hit.r + 0.5; // FIXME
216  if(fabs(p - hit.w) <= 1.) {
217  chi += fabs(p - hit.w);
218  n++;
219  }
220  }
221  return n;
222 }
bool HLTPixelClusterShapeFilter::hltFilter ( edm::Event event,
const edm::EventSetup iSetup,
trigger::TriggerFilterObjectWithRefs filterproduct 
) const
overrideprivatevirtual

Implements HLTFilter.

Definition at line 99 of file HLTPixelClusterShapeFilter.cc.

References accept(), trigger::TriggerFilterObjectWithRefs::addCollectionTag(), clusterPars_, clusterTrunc_, edmNew::DetSetVector< T >::data(), MillePedeFileConverter_cfg::e, edm::EventSetup::get(), getContainedHits(), hfClusterShapes_cfi::hits, mps_fire::i, triggerObjects_cff::id, TrackerGeometry::idToDet(), inputTag_, inputToken_, createfilelist::int, PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), edm::HandleBase::isValid(), maxZ_, minZ_, nhits, nhitsTrunc_, digitizers_cfi::pixel, PixelSubdetector::PixelBarrel, funct::pow(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), HLTPixelClusterShapeFilter::VertexHit::r, HLTFilter::saveTags(), PixelGeomDetUnit::specificTopology(), GeomDet::toGlobal(), HLTPixelClusterShapeFilter::VertexHit::w, hit::x, hit::y, HLTPixelClusterShapeFilter::VertexHit::z, hit::z, and zStep_.

100 {
101  // All HLT filters must create and fill an HLT filter object,
102  // recording any reconstructed physics objects satisfying (or not)
103  // this HLT filter, and place it in the Event.
104 
105  // The filter object
106  if (saveTags()) filterproduct.addCollectionTag(inputTag_);
107  bool accept = true;
108 
109  // get hold of products from Event
111  event.getByToken(inputToken_, hRecHits);
112 
113  // get tracker geometry
114  if (hRecHits.isValid()) {
115  edm::ESHandle<TrackerGeometry> trackerHandle;
116  iSetup.get<TrackerDigiGeometryRecord>().get(trackerHandle);
117  const TrackerGeometry *tgeo = trackerHandle.product();
118  const SiPixelRecHitCollection *hits = hRecHits.product();
119 
120  // loop over pixel rechits
121  int nPxlHits=0;
122  std::vector<VertexHit> vhits;
123  for(auto const & hit : hits->data()) {
124  if (!hit.isValid())
125  continue;
126  ++nPxlHits;
127  DetId id(hit.geographicalId());
128  if(id.subdetId() != int(PixelSubdetector::PixelBarrel))
129  continue;
130  const PixelGeomDetUnit *pgdu = static_cast<const PixelGeomDetUnit*>(tgeo->idToDet(id));
131  if (true) {
132  const PixelTopology *pixTopo = &(pgdu->specificTopology());
133  std::vector<SiPixelCluster::Pixel> pixels(hit.cluster()->pixels());
134  bool pixelOnEdge = false;
135  for(std::vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin();
136  pixel != pixels.end(); ++pixel) {
137  int pixelX = pixel->x;
138  int pixelY = pixel->y;
139  if(pixTopo->isItEdgePixelInX(pixelX) || pixTopo->isItEdgePixelInY(pixelY)) {
140  pixelOnEdge = true;
141  break;
142  }
143  }
144  if (pixelOnEdge)
145  continue;
146  }
147 
148  LocalPoint lpos = LocalPoint(hit.localPosition().x(),
149  hit.localPosition().y(),
150  hit.localPosition().z());
151  GlobalPoint gpos = pgdu->toGlobal(lpos);
152  VertexHit vh;
153  vh.z = gpos.z();
154  vh.r = gpos.perp();
155  vh.w = hit.cluster()->sizeY();
156  vhits.push_back(vh);
157  }
158 
159  // estimate z-position from cluster lengths
160  double zest = 0.0;
161  int nhits = 0, nhits_max = 0;
162  double chi = 0, chi_max = 1e+9;
163  for(double z0 = minZ_; z0 <= maxZ_; z0 += zStep_) {
164  nhits = getContainedHits(vhits, z0, chi);
165  if(nhits == 0)
166  continue;
167  if(nhits > nhits_max) {
168  chi_max = 1e+9;
169  nhits_max = nhits;
170  }
171  if(nhits >= nhits_max && chi < chi_max) {
172  chi_max = chi;
173  zest = z0;
174  }
175  }
176 
177  chi = 0;
178  int nbest=0, nminus=0, nplus=0;
179  nbest = getContainedHits(vhits,zest,chi);
180  nminus = getContainedHits(vhits,zest-10.,chi);
181  nplus = getContainedHits(vhits,zest+10.,chi);
182 
183  double clusVtxQual=0.0;
184  if ((nminus+nplus)> 0)
185  clusVtxQual = (2.0*nbest)/(nminus+nplus); // A/B
186  else if (nbest>0)
187  clusVtxQual = 1000.0; // A/0 (set to arbitrarily large number)
188  else
189  clusVtxQual = 0; // 0/0 (already the default)
190 
191  // construct polynomial cut on cluster vertex quality vs. npixelhits
192  double polyCut=0;
193  for(unsigned int i=0; i < clusterPars_.size(); i++) {
194  polyCut += clusterPars_[i]*std::pow((double)nPxlHits,(int)i);
195  }
196  if(nPxlHits < nhitsTrunc_)
197  polyCut=0; // don't use cut below nhitsTrunc_ pixel hits
198  if(polyCut > clusterTrunc_ && clusterTrunc_ > 0)
199  polyCut=clusterTrunc_; // no cut above clusterTrunc_
200 
201  if (clusVtxQual < polyCut) accept = false;
202  }
203 
204  // return with final filter decision
205  return accept;
206 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
virtual bool isItEdgePixelInX(int ixbin) const =0
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
virtual bool isItEdgePixelInY(int iybin) const =0
int getContainedHits(const std::vector< VertexHit > &hits, double z0, double &chi) const
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
edm::EDGetTokenT< SiPixelRecHitCollection > inputToken_
T z() const
Definition: PV3DBase.h:64
data_type const * data(size_t cell) const
bool isValid() const
Definition: HandleBase.h:74
Definition: DetId.h:18
T const * product() const
Definition: Handle.h:74
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
void addCollectionTag(const edm::InputTag &collectionTag)
collectionTags
bool saveTags() const
Definition: HLTFilter.h:45
T get() const
Definition: EventSetup.h:71
const TrackerGeomDet * idToDet(DetId) const override
T const * product() const
Definition: ESHandle.h:86
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

std::vector<double> HLTPixelClusterShapeFilter::clusterPars_
private

Definition at line 27 of file HLTPixelClusterShapeFilter.cc.

Referenced by hltFilter().

double HLTPixelClusterShapeFilter::clusterTrunc_
private

Definition at line 29 of file HLTPixelClusterShapeFilter.cc.

Referenced by hltFilter().

edm::InputTag HLTPixelClusterShapeFilter::inputTag_
private

Definition at line 22 of file HLTPixelClusterShapeFilter.cc.

Referenced by hltFilter(), and HLTPixelClusterShapeFilter().

edm::EDGetTokenT<SiPixelRecHitCollection> HLTPixelClusterShapeFilter::inputToken_
private

Definition at line 21 of file HLTPixelClusterShapeFilter.cc.

Referenced by hltFilter(), and HLTPixelClusterShapeFilter().

double HLTPixelClusterShapeFilter::maxZ_
private

Definition at line 24 of file HLTPixelClusterShapeFilter.cc.

Referenced by hltFilter().

double HLTPixelClusterShapeFilter::minZ_
private

Definition at line 23 of file HLTPixelClusterShapeFilter.cc.

Referenced by hltFilter().

int HLTPixelClusterShapeFilter::nhitsTrunc_
private

Definition at line 28 of file HLTPixelClusterShapeFilter.cc.

Referenced by hltFilter().

double HLTPixelClusterShapeFilter::zStep_
private

Definition at line 25 of file HLTPixelClusterShapeFilter.cc.

Referenced by hltFilter().