CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
HIProtoTrackSelector Class Reference

#include <HIProtoTrackSelector.h>

Public Types

typedef reco::TrackCollection collection
 
typedef container::const_iterator const_iterator
 
typedef std::vector< const
reco::Track * > 
container
 

Public Member Functions

const_iterator begin () const
 
const_iterator end () const
 
 HIProtoTrackSelector (const edm::ParameterSet &iConfig)
 
void select (edm::Handle< reco::TrackCollection > &TCH, const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
size_t size () const
 

Private Attributes

edm::InputTag beamSpotLabel_
 
double maxD0Significance_
 
double minZCut_
 
double nSigmaZ_
 
double ptMin_
 
container selected_
 
edm::InputTag vertexCollection_
 

Detailed Description

Selector to select prototracks that pass certain kinematic cuts based on fast vertex

Definition at line 22 of file HIProtoTrackSelector.h.

Member Typedef Documentation

Definition at line 27 of file HIProtoTrackSelector.h.

typedef container::const_iterator HIProtoTrackSelector::const_iterator

Definition at line 33 of file HIProtoTrackSelector.h.

typedef std::vector<const reco::Track *> HIProtoTrackSelector::container

Definition at line 30 of file HIProtoTrackSelector.h.

Constructor & Destructor Documentation

HIProtoTrackSelector::HIProtoTrackSelector ( const edm::ParameterSet iConfig)
inline

Definition at line 36 of file HIProtoTrackSelector.h.

36  :
37  vertexCollection_(iConfig.getParameter<edm::InputTag>("VertexCollection")),
38  beamSpotLabel_(iConfig.getParameter<edm::InputTag>("beamSpotLabel")),
39  ptMin_(iConfig.getParameter<double>("ptMin")),
40  nSigmaZ_(iConfig.getParameter<double>("nSigmaZ")),
41  minZCut_(iConfig.getParameter<double>("minZCut")),
42  maxD0Significance_(iConfig.getParameter<double>("maxD0Significance"))
43  {};
T getParameter(std::string const &) const

Member Function Documentation

const_iterator HIProtoTrackSelector::begin ( void  ) const
inline

Definition at line 121 of file HIProtoTrackSelector.h.

References selected_.

121 { return selected_.begin(); }
const_iterator HIProtoTrackSelector::end ( void  ) const
inline

Definition at line 124 of file HIProtoTrackSelector.h.

References selected_.

124 { return selected_.end(); }
void HIProtoTrackSelector::select ( edm::Handle< reco::TrackCollection > &  TCH,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
inline

Definition at line 46 of file HIProtoTrackSelector.h.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotLabel_, reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthY(), trackerHits::c, edm::Event::getByLabel(), edm::HandleBase::isValid(), max(), maxD0Significance_, minZCut_, nSigmaZ_, reco::BeamSpot::position(), edm::Handle< T >::product(), ptMin_, selected_, mathSSE::sqrt(), and vertexCollection_.

47  {
48  selected_.clear();
49 
50  const collection & c = *(TCH.product());
51 
52  // Get fast reco vertex
54  iEvent.getByLabel(vertexCollection_, vc);
55  const reco::VertexCollection * vertices = vc.product();
56 
57  math::XYZPoint vtxPoint(0.0,0.0,0.0);
58  double vzErr =0.0;
59 
60  if(vertices->size()>0) {
61  vtxPoint=vertices->begin()->position();
62  vzErr=vertices->begin()->zError();
63  edm::LogInfo("HeavyIonVertexing") << "Select prototracks compatible with median vertex"
64  << "\n vz = " << vtxPoint.Z()
65  << "\n " << nSigmaZ_ << " vz sigmas = " << vzErr*nSigmaZ_
66  << "\n cut at = " << std::max(vzErr*nSigmaZ_,minZCut_);
67  }
68  // Supress this warning, since events w/ no vertex are expected
69  //else {
70  //edm::LogError("HeavyIonVertexing") << "No vertex found in collection '" << vertexCollection_ << "'";
71  //}
72 
73  // Get beamspot
75  edm::Handle<reco::BeamSpot> beamSpotHandle;
76  iEvent.getByLabel(beamSpotLabel_, beamSpotHandle);
77 
78  math::XYZPoint bsPoint(0.0,0.0,0.0);
79  double bsWidth = 0.0;
80 
81  if ( beamSpotHandle.isValid() ) {
82  beamSpot = *beamSpotHandle;
83  bsPoint = beamSpot.position();
84  bsWidth = sqrt(beamSpot.BeamWidthX()*beamSpot.BeamWidthY());
85  edm::LogInfo("HeavyIonVertexing") << "Select prototracks compatible with beamspot"
86  << "\n (x,y,z) = (" << bsPoint.X() << "," << bsPoint.Y() << "," << bsPoint.Z() << ")"
87  << "\n width = " << bsWidth
88  << "\n cut at d0/d0sigma = " << maxD0Significance_;
89  } else {
90  edm::LogError("HeavyIonVertexing") << "No beam spot available from '" << beamSpotLabel_ << "\n";
91  }
92 
93 
94  // Do selection
95  int nSelected=0;
96  int nRejected=0;
97  double d0=0.0;
98  double d0sigma=0.0;
99  for (reco::TrackCollection::const_iterator trk = c.begin(); trk != c.end(); ++ trk)
100  {
101 
102  d0 = -1.*trk->dxy(bsPoint);
103  d0sigma = sqrt(trk->d0Error()*trk->d0Error() + bsWidth*bsWidth);
104  if ( trk->pt() > ptMin_ // keep only tracks above ptMin
105  && fabs(d0/d0sigma) < maxD0Significance_ // keep only tracks with D0 significance less than cut
106  && fabs(trk->dz(vtxPoint)) < std::max(vzErr*nSigmaZ_,minZCut_) // within minZCut, nSigmaZ of fast vertex
107  )
108  {
109  nSelected++;
110  selected_.push_back( & * trk );
111  }
112  else
113  nRejected++;
114  }
115 
116  edm::LogInfo("HeavyIonVertexing") << "selected " << nSelected << " prototracks out of " << nRejected+nSelected << "\n";
117 
118  }
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const T & max(const T &a, const T &b)
T sqrt(T t)
Definition: SSEVec.h:48
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:87
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
reco::TrackCollection collection
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:89
T const * product() const
Definition: Handle.h:74
const Point & position() const
position
Definition: BeamSpot.h:63
size_t HIProtoTrackSelector::size ( void  ) const
inline

Definition at line 127 of file HIProtoTrackSelector.h.

References selected_.

127 { return selected_.size(); }

Member Data Documentation

edm::InputTag HIProtoTrackSelector::beamSpotLabel_
private

Definition at line 133 of file HIProtoTrackSelector.h.

Referenced by select().

double HIProtoTrackSelector::maxD0Significance_
private

Definition at line 137 of file HIProtoTrackSelector.h.

Referenced by select().

double HIProtoTrackSelector::minZCut_
private

Definition at line 136 of file HIProtoTrackSelector.h.

Referenced by select().

double HIProtoTrackSelector::nSigmaZ_
private

Definition at line 135 of file HIProtoTrackSelector.h.

Referenced by select().

double HIProtoTrackSelector::ptMin_
private

Definition at line 134 of file HIProtoTrackSelector.h.

Referenced by select().

container HIProtoTrackSelector::selected_
private

Definition at line 131 of file HIProtoTrackSelector.h.

Referenced by begin(), end(), select(), and size().

edm::InputTag HIProtoTrackSelector::vertexCollection_
private

Definition at line 132 of file HIProtoTrackSelector.h.

Referenced by select().