CMS 3D CMS Logo

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, edm::ConsumesCollector &&iC)
 
void select (edm::Handle< reco::TrackCollection > &TCH, const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
size_t size () const
 

Private Attributes

edm::InputTag beamSpot_
 
edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
double maxD0Significance_
 
double minZCut_
 
double nSigmaZ_
 
double ptMin_
 
container selected_
 
edm::InputTag vertexCollection_
 
edm::EDGetTokenT< reco::VertexCollectionvertexCollectionToken_
 

Detailed Description

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

Definition at line 26 of file HIProtoTrackSelector.h.

Member Typedef Documentation

Definition at line 31 of file HIProtoTrackSelector.h.

typedef container::const_iterator HIProtoTrackSelector::const_iterator

Definition at line 37 of file HIProtoTrackSelector.h.

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

Definition at line 34 of file HIProtoTrackSelector.h.

Constructor & Destructor Documentation

HIProtoTrackSelector::HIProtoTrackSelector ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 40 of file HIProtoTrackSelector.h.

40  :
41  vertexCollection_(iConfig.getParameter<edm::InputTag>("VertexCollection")),
43  beamSpot_(iConfig.getParameter<edm::InputTag>("beamSpotLabel")),
45  ptMin_(iConfig.getParameter<double>("ptMin")),
46  nSigmaZ_(iConfig.getParameter<double>("nSigmaZ")),
47  minZCut_(iConfig.getParameter<double>("minZCut")),
48  maxD0Significance_(iConfig.getParameter<double>("maxD0Significance"))
49  {};
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< reco::VertexCollection > vertexCollectionToken_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_

Member Function Documentation

const_iterator HIProtoTrackSelector::begin ( void  ) const
inline

Definition at line 127 of file HIProtoTrackSelector.h.

References selected_.

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

Definition at line 130 of file HIProtoTrackSelector.h.

References selected_.

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

Definition at line 52 of file HIProtoTrackSelector.h.

References ecalDrivenElectronSeedsParameters_cff::beamSpot, beamSpot_, beamSpotToken_, reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthY(), EnergyCorrector::c, allConversions_cfi::d0, edm::Event::getByToken(), edm::HandleBase::isValid(), SiStripPI::max, maxD0Significance_, minZCut_, nSigmaZ_, reco::BeamSpot::position(), edm::Handle< T >::product(), ptMin_, selected_, mathSSE::sqrt(), vertexCollectionToken_, and electrons_cff::vertices.

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

Definition at line 133 of file HIProtoTrackSelector.h.

References selected_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

133 { return selected_.size(); }

Member Data Documentation

edm::InputTag HIProtoTrackSelector::beamSpot_
private

Definition at line 140 of file HIProtoTrackSelector.h.

Referenced by select().

edm::EDGetTokenT<reco::BeamSpot> HIProtoTrackSelector::beamSpotToken_
private

Definition at line 141 of file HIProtoTrackSelector.h.

Referenced by select().

double HIProtoTrackSelector::maxD0Significance_
private

Definition at line 145 of file HIProtoTrackSelector.h.

Referenced by select().

double HIProtoTrackSelector::minZCut_
private

Definition at line 144 of file HIProtoTrackSelector.h.

Referenced by select().

double HIProtoTrackSelector::nSigmaZ_
private

Definition at line 143 of file HIProtoTrackSelector.h.

Referenced by select().

double HIProtoTrackSelector::ptMin_
private

Definition at line 142 of file HIProtoTrackSelector.h.

Referenced by select().

container HIProtoTrackSelector::selected_
private

Definition at line 137 of file HIProtoTrackSelector.h.

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

edm::InputTag HIProtoTrackSelector::vertexCollection_
private

Definition at line 138 of file HIProtoTrackSelector.h.

edm::EDGetTokenT<reco::VertexCollection> HIProtoTrackSelector::vertexCollectionToken_
private

Definition at line 139 of file HIProtoTrackSelector.h.

Referenced by select().