CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- 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
 
virtual ~HLTFilter ()
 
- Public Member Functions inherited from edm::global::EDFilter<>
 EDFilter ()=default
 
- Public Member Functions inherited from edm::global::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
virtual 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
< SiPixelRecHitCollection
inputToken_
 
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
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 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_, and LogDebug.

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 ( )

Definition at line 77 of file HLTPixelClusterShapeFilter.cc.

78 {
79 }

Member Function Documentation

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

Definition at line 82 of file HLTPixelClusterShapeFilter.cc.

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

82  {
85  desc.add<edm::InputTag>("inputTag",edm::InputTag("hltSiPixelRecHits"));
86  desc.add<double>("minZ",-20.0);
87  desc.add<double>("maxZ",20.05);
88  desc.add<double>("zStep",0.2);
89  std::vector<double> temp; temp.push_back(0.0); temp.push_back(0.0045);
90  desc.add<std::vector<double> >("clusterPars",temp);
91  desc.add<int>("nhitsTrunc",150.);
92  desc.add<double>("clusterTrunc",2.0);
93  descriptions.add("hltPixelClusterShapeFilter",desc);
94 }
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 211 of file HLTPixelClusterShapeFilter.cc.

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

Referenced by hltFilter().

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

Implements HLTFilter.

Definition at line 101 of file HLTPixelClusterShapeFilter.cc.

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

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

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().