test
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 | Private Member Functions | Private Attributes
ClusterCompatibilityProducer Class Reference
Inheritance diagram for ClusterCompatibilityProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  ContainedHits
 
struct  VertexHit
 

Public Member Functions

 ClusterCompatibilityProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~ClusterCompatibilityProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 ()
 

Private Member Functions

ContainedHits getContainedHits (const std::vector< VertexHit > &hits, double z0) const
 

Private Attributes

edm::InputTag inputTag_
 
edm::EDGetTokenT
< SiPixelRecHitCollection
inputToken_
 
double maxZ_
 
double minZ_
 
double zStep_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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 37 of file ClusterCompatibilityProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 71 of file ClusterCompatibilityProducer.cc.

References inputTag_, inputToken_, and LogDebug.

71  :
72  inputTag_ (config.getParameter<edm::InputTag>("inputTag")),
73  minZ_ (config.getParameter<double>("minZ")),
74  maxZ_ (config.getParameter<double>("maxZ")),
75  zStep_ (config.getParameter<double>("zStep"))
76 {
77  inputToken_ = consumes<SiPixelRecHitCollection>(inputTag_);
78  LogDebug("") << "Using the " << inputTag_ << " input collection";
79  produces<reco::ClusterCompatibility>();
80 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::EDGetTokenT< SiPixelRecHitCollection > inputToken_
ClusterCompatibilityProducer::~ClusterCompatibilityProducer ( )

Definition at line 82 of file ClusterCompatibilityProducer.cc.

82 {}

Member Function Documentation

ClusterCompatibilityProducer::ContainedHits ClusterCompatibilityProducer::getContainedHits ( const std::vector< VertexHit > &  hits,
double  z0 
) const
private

Definition at line 153 of file ClusterCompatibilityProducer.cc.

References ClusterCompatibilityProducer::ContainedHits::chi, gen::n, ClusterCompatibilityProducer::ContainedHits::nHit, convertSQLitetoXML_cfg::output, AlCaHLTBitMon_ParallelJobs::p, hit::z, and ClusterCompatibilityProducer::ContainedHits::z0.

Referenced by produce().

154 {
155 
156  // Calculate number of hits contained in v-shaped window in cluster y-width vs. z-position.
157  int n = 0;
158  double chi = 0.;
159 
160  for(std::vector<VertexHit>::const_iterator hit = hits.begin(); hit!= hits.end(); hit++) {
161  // the calculation of the predicted cluster width p was
162  // marked 'FIXME' in the HLTPixelClusterShapeFilter. It should
163  // be revisited but is retained as it was for compatibility with the
164  // older filter.
165  double p = 2 * fabs(hit->z - z0)/hit->r + 0.5;
166  if(fabs(p - hit->w) <= 1.) {
167  chi += fabs(p - hit->w);
168  n++;
169  }
170  }
172  output.z0 = z0;
173  output.nHit = n;
174  output.chi = chi;
175  return output;
176 }
void ClusterCompatibilityProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 85 of file ClusterCompatibilityProducer.cc.

References EnergyCorrector::c, ClusterCompatibilityProducer::ContainedHits::chi, edmNew::DetSetVector< T >::data(), end, edm::EventSetup::get(), edm::Event::getByToken(), getContainedHits(), TrackerGeometry::idToDet(), inputToken_, PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), edm::HandleBase::isValid(), maxZ_, minZ_, ClusterCompatibilityProducer::ContainedHits::nHit, PixelSubdetector::PixelBarrel, edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), ClusterCompatibilityProducer::VertexHit::r, PixelGeomDetUnit::specificTopology(), GeomDet::toGlobal(), ClusterCompatibilityProducer::VertexHit::w, hit::x, hit::y, ClusterCompatibilityProducer::VertexHit::z, hit::z, ClusterCompatibilityProducer::ContainedHits::z0, and zStep_.

86 {
87  std::auto_ptr<reco::ClusterCompatibility> creco(new reco::ClusterCompatibility());
88 
89  // get hold of products from Event
91  iEvent.getByToken(inputToken_, hRecHits);
92 
93  // get tracker geometry
94  if (hRecHits.isValid()) {
95  edm::ESHandle<TrackerGeometry> trackerHandle;
96  iSetup.get<TrackerDigiGeometryRecord>().get(trackerHandle);
97  const TrackerGeometry *tgeo = trackerHandle.product();
98  const SiPixelRecHitCollection *hits = hRecHits.product();
99 
100  // loop over pixel rechits
101  int nPxlHits=0;
102  std::vector<VertexHit> vhits;
104  end = hits->data().end(); hit != end; ++hit) {
105  if (!hit->isValid())
106  continue;
107  ++nPxlHits;
108  DetId id(hit->geographicalId());
109  if(id.subdetId() != int(PixelSubdetector::PixelBarrel))
110  continue;
111  const PixelGeomDetUnit *pgdu = static_cast<const PixelGeomDetUnit*>(tgeo->idToDet(id));
112  const PixelTopology *pixTopo = &(pgdu->specificTopology());
113  std::vector<SiPixelCluster::Pixel> pixels(hit->cluster()->pixels());
114  bool pixelOnEdge = false;
115  for(std::vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin();
116  pixel != pixels.end(); ++pixel) {
117  int pixelX = pixel->x;
118  int pixelY = pixel->y;
119  if(pixTopo->isItEdgePixelInX(pixelX) || pixTopo->isItEdgePixelInY(pixelY)) {
120  pixelOnEdge = true;
121  break;
122  }
123  }
124  if (pixelOnEdge)
125  continue;
126 
127  LocalPoint lpos = LocalPoint(hit->localPosition().x(),
128  hit->localPosition().y(),
129  hit->localPosition().z());
130  GlobalPoint gpos = pgdu->toGlobal(lpos);
131  VertexHit vh;
132  vh.z = gpos.z();
133  vh.r = gpos.perp();
134  vh.w = hit->cluster()->sizeY();
135  vhits.push_back(vh);
136  }
137 
138  creco->setNValidPixelHits(nPxlHits);
139 
140  // append cluster compatibility for each z-position
141  for(double z0 = minZ_; z0 <= maxZ_; z0 += zStep_)
142  {
143  ContainedHits c = getContainedHits(vhits, z0);
144  creco->append(c.z0, c.nHit, c.chi);
145  }
146 
147  }
148  iEvent.put(creco);
149 
150 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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 isItEdgePixelInX(int ixbin) const =0
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
ContainedHits getContainedHits(const std::vector< VertexHit > &hits, double z0) const
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
edm::EDGetTokenT< SiPixelRecHitCollection > inputToken_
virtual bool isItEdgePixelInY(int iybin) const =0
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
const TrackerGeomDet * idToDet(DetId) const

Member Data Documentation

edm::InputTag ClusterCompatibilityProducer::inputTag_
private

Definition at line 48 of file ClusterCompatibilityProducer.cc.

Referenced by ClusterCompatibilityProducer().

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

Definition at line 47 of file ClusterCompatibilityProducer.cc.

Referenced by ClusterCompatibilityProducer(), and produce().

double ClusterCompatibilityProducer::maxZ_
private

Definition at line 50 of file ClusterCompatibilityProducer.cc.

Referenced by produce().

double ClusterCompatibilityProducer::minZ_
private

Definition at line 49 of file ClusterCompatibilityProducer.cc.

Referenced by produce().

double ClusterCompatibilityProducer::zStep_
private

Definition at line 51 of file ClusterCompatibilityProducer.cc.

Referenced by produce().