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
HIPixelClusterVtxProducer Class Reference

#include <HIPixelClusterVtxProducer.h>

Inheritance diagram for HIPixelClusterVtxProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  VertexHit
 

Public Member Functions

 HIPixelClusterVtxProducer (const edm::ParameterSet &ps)
 
 ~HIPixelClusterVtxProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

int getContainedHits (const std::vector< VertexHit > &hits, double z0, double &chi)
 
virtual void produce (edm::Event &ev, const edm::EventSetup &es)
 

Private Attributes

double maxZ_
 
double minZ_
 
std::string srcPixels_
 
double zStep_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 11 of file HIPixelClusterVtxProducer.h.

Constructor & Destructor Documentation

HIPixelClusterVtxProducer::HIPixelClusterVtxProducer ( const edm::ParameterSet ps)
explicit

Definition at line 31 of file HIPixelClusterVtxProducer.cc.

32  : srcPixels_(ps.getParameter<std::string>("pixelRecHits")),
33  minZ_(ps.getParameter<double>("minZ")),
34  maxZ_(ps.getParameter<double>("maxZ")),
35  zStep_(ps.getParameter<double>("zStep"))
36 
37 {
38  // Constructor
39  produces<reco::VertexCollection>();
40 }
T getParameter(std::string const &) const
HIPixelClusterVtxProducer::~HIPixelClusterVtxProducer ( )

Definition at line 44 of file HIPixelClusterVtxProducer.cc.

45 {
46  // Destructor
47 }

Member Function Documentation

int HIPixelClusterVtxProducer::getContainedHits ( const std::vector< VertexHit > &  hits,
double  z0,
double &  chi 
)
private

Definition at line 139 of file HIPixelClusterVtxProducer.cc.

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

Referenced by produce().

140 {
141  // Calculate number of hits contained in v-shaped window in cluster y-width vs. z-position.
142  int n = 0;
143  chi = 0.;
144 
145  for(std::vector<VertexHit>::const_iterator hit = hits.begin(); hit!= hits.end(); hit++) {
146  double p = 2 * fabs(hit->z - z0)/hit->r + 0.5; // FIXME
147  if(TMath::Abs(p - hit->w) <= 1.) {
148  chi += fabs(p - hit->w);
149  n++;
150  }
151  }
152  return n;
153 }
void HIPixelClusterVtxProducer::produce ( edm::Event ev,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 51 of file HIPixelClusterVtxProducer.cc.

References edmNew::DetSetVector< T >::data(), alignCSCRings::e, end, edm::EventSetup::get(), edm::Event::getByLabel(), getContainedHits(), TrackerGeometry::idToDet(), PixelTopology::isItEdgePixelInX(), PixelTopology::isItEdgePixelInY(), edm::HandleBase::isValid(), LogTrace, maxZ_, minZ_, PixelSubdetector::PixelBarrel, edm::Handle< T >::product(), edm::ESHandle< class >::product(), edm::Event::put(), HIPixelClusterVtxProducer::VertexHit::r, PixelGeomDetUnit::specificTopology(), srcPixels_, GeomDet::toGlobal(), HIPixelClusterVtxProducer::VertexHit::w, hit::x, hit::y, HIPixelClusterVtxProducer::VertexHit::z, hit::z, and zStep_.

52 {
53 
54  // new vertex collection
55  std::auto_ptr<reco::VertexCollection> vertices(new reco::VertexCollection);
56 
57  // get pixel rechits
59  ev.getByLabel(edm::InputTag(srcPixels_),hRecHits);
60 
61  // get tracker geometry
62  if (hRecHits.isValid()) {
63  edm::ESHandle<TrackerGeometry> trackerHandle;
64  es.get<TrackerDigiGeometryRecord>().get(trackerHandle);
65  const TrackerGeometry *tgeo = trackerHandle.product();
66  const SiPixelRecHitCollection *hits = hRecHits.product();
67 
68  // loop over pixel rechits
69  std::vector<VertexHit> vhits;
71  end = hits->data().end(); hit != end; ++hit) {
72  if (!hit->isValid())
73  continue;
74  DetId id(hit->geographicalId());
75  if(id.subdetId() != int(PixelSubdetector::PixelBarrel))
76  continue;
77  const PixelGeomDetUnit *pgdu = static_cast<const PixelGeomDetUnit*>(tgeo->idToDet(id));
78  if (1) {
79  const PixelTopology *pixTopo = &(pgdu->specificTopology());
80  std::vector<SiPixelCluster::Pixel> pixels(hit->cluster()->pixels());
81  bool pixelOnEdge = false;
82  for(std::vector<SiPixelCluster::Pixel>::const_iterator pixel = pixels.begin();
83  pixel != pixels.end(); ++pixel) {
84  int pixelX = pixel->x;
85  int pixelY = pixel->y;
86  if(pixTopo->isItEdgePixelInX(pixelX) || pixTopo->isItEdgePixelInY(pixelY)) {
87  pixelOnEdge = true;
88  break;
89  }
90  }
91  if (pixelOnEdge)
92  continue;
93  }
94 
95  LocalPoint lpos = LocalPoint(hit->localPosition().x(),
96  hit->localPosition().y(),
97  hit->localPosition().z());
98  GlobalPoint gpos = pgdu->toGlobal(lpos);
99  VertexHit vh;
100  vh.z = gpos.z();
101  vh.r = gpos.perp();
102  vh.w = hit->cluster()->sizeY();
103  vhits.push_back(vh);
104  }
105 
106  // estimate z-position from cluster lengths
107  double zest = 0.0;
108  int nhits = 0, nhits_max = 0;
109  double chi = 0, chi_max = 1e+9;
110  for(double z0 = minZ_; z0 <= maxZ_; z0 += zStep_) {
111  nhits = getContainedHits(vhits, z0, chi);
112  if(nhits == 0)
113  continue;
114  if(nhits > nhits_max) {
115  chi_max = 1e+9;
116  nhits_max = nhits;
117  }
118  if(nhits >= nhits_max && chi < chi_max) {
119  chi_max = chi;
120  zest = z0;
121  }
122  }
123 
124  LogTrace("MinBiasTracking")
125  << " [vertex position] estimated = " << zest
126  << " | pixel barrel hits = " << vhits.size();
127 
128  // put 1-d vertex and dummy errors into collection
130  err(2,2) = 0.6 * 0.6;
131  reco::Vertex ver(reco::Vertex::Point(0,0,zest), err, 0, 1, 1);
132  vertices->push_back(ver);
133  }
134 
135  ev.put(vertices);
136 }
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
int getContainedHits(const std::vector< VertexHit > &hits, double z0, double &chi)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
virtual bool isItEdgePixelInX(int ixbin) const =0
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
data_type const * data(size_t cell) const
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
#define end
Definition: vmac.h:37
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:402
#define LogTrace(id)
Definition: DetId.h:18
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:55
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
T const * product() const
Definition: ESHandle.h:86
virtual bool isItEdgePixelInY(int iybin) const =0
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
virtual const TrackerGeomDet * idToDet(DetId) const

Member Data Documentation

double HIPixelClusterVtxProducer::maxZ_
private

Definition at line 31 of file HIPixelClusterVtxProducer.h.

Referenced by produce().

double HIPixelClusterVtxProducer::minZ_
private

Definition at line 30 of file HIPixelClusterVtxProducer.h.

Referenced by produce().

std::string HIPixelClusterVtxProducer::srcPixels_
private

Definition at line 28 of file HIPixelClusterVtxProducer.h.

Referenced by produce().

double HIPixelClusterVtxProducer::zStep_
private

Definition at line 32 of file HIPixelClusterVtxProducer.h.

Referenced by produce().