CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackVertexArbitrator Class Reference
Inheritance diagram for TrackVertexArbitrator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &event, const edm::EventSetup &es)
 
 TrackVertexArbitrator (const edm::ParameterSet &params)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

bool trackFilter (const reco::TrackRef &track) const
 

Private Attributes

edm::InputTag beamSpotCollection
 
double distCut
 
double dLenFraction
 
double dRCut
 
edm::InputTag primaryVertexCollection
 
edm::InputTag secondaryVertexCollection
 
double sigCut
 
edm::InputTag trackCollection
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 42 of file TrackVertexArbitrator.cc.

Constructor & Destructor Documentation

TrackVertexArbitrator::TrackVertexArbitrator ( const edm::ParameterSet params)

Definition at line 62 of file TrackVertexArbitrator.cc.

62  :
63  primaryVertexCollection(params.getParameter<edm::InputTag>("primaryVertices")),
64  secondaryVertexCollection(params.getParameter<edm::InputTag>("secondaryVertices")),
65  trackCollection(params.getParameter<edm::InputTag>("tracks")),
66  beamSpotCollection(params.getParameter<edm::InputTag>("beamSpot")),
67  dRCut(params.getParameter<double>("dRCut")),
68  distCut(params.getParameter<double>("distCut")),
69  sigCut(params.getParameter<double>("sigCut")),
70  dLenFraction(params.getParameter<double>("dLenFraction"))
71 {
72  produces<reco::VertexCollection>();
73 }
T getParameter(std::string const &) const
edm::InputTag primaryVertexCollection
edm::InputTag secondaryVertexCollection

Member Function Documentation

void TrackVertexArbitrator::produce ( edm::Event event,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 86 of file TrackVertexArbitrator.cc.

References IPTools::absoluteImpactParameter3D(), ExpressReco_HICollisions_FallBack::beamSpot, beamSpotCollection, deltaR(), distCut, dLenFraction, dRCut, reco::TrackBase::eta(), edm::EventSetup::get(), TransientVertex::isValid(), reco::TrackBase::phi(), primaryVertexCollection, dt_offlineAnalysis_common_cff::reco, secondaryVertexCollection, reco::TransientTrack::setBeamSpot(), sigCut, reco::TransientTrack::track(), ExpressReco_HICollisions_FallBack::track, trackCollection, trackFilter(), testEve_cfg::tracks, Measurement1D::value(), and AdaptiveVertexFitter::vertex().

87 {
88  using namespace reco;
89 
90  edm::Handle<VertexCollection> secondaryVertices;
91  event.getByLabel(secondaryVertexCollection, secondaryVertices);
92 
93  edm::Handle<VertexCollection> primaryVertices;
94  event.getByLabel(primaryVertexCollection, primaryVertices);
95 
97  event.getByLabel(trackCollection, tracks);
98 
100  es.get<TransientTrackRecord>().get("TransientTrackBuilder",
101  trackBuilder);
102 
104  event.getByLabel(beamSpotCollection, beamSpot);
105 
106  const reco::Vertex &pv = (*primaryVertices)[0];
107 // std::cout << "PV: " << pv.position() << std::endl;
108  VertexDistance3D dist;
109 
110  double sigmacut = 3.0;
111  double Tini = 256.;
112  double ratio = 0.25;
113 
114  AdaptiveVertexFitter theAdaptiveFitter(
115  GeometricAnnealing(sigmacut, Tini, ratio),
120 
121 
122 
123  std::auto_ptr<VertexCollection> recoVertices(new VertexCollection);
124 
125  VertexDistance3D vdist;
126 
127 for(std::vector<reco::Vertex>::const_iterator sv = secondaryVertices->begin();
128  sv != secondaryVertices->end(); ++sv) {
129 /* recoVertices->push_back(*sv);
130 
131 
132  for(std::vector<reco::Vertex>::iterator sv = recoVertices->begin();
133  sv != recoVertices->end(); ++sv) {
134 */
135  GlobalPoint ppv(pv.position().x(),pv.position().y(),pv.position().z());
136  GlobalPoint ssv(sv->position().x(),sv->position().y(),sv->position().z());
137  GlobalVector flightDir = ssv-ppv;
138 // std::cout << "Vertex : " << sv-secondaryVertices->begin() << " " << sv->position() << std::endl;
139  Measurement1D dlen= vdist.distance(pv,*sv);
140  std::vector<reco::TransientTrack> selTracks;
141 
142  for(TrackCollection::const_iterator track = tracks->begin();
143  track != tracks->end(); ++track) {
144 
145  TrackRef ref(tracks, track - tracks->begin());
146  if (!trackFilter(ref)) continue;
147 
148  TransientTrack tt = trackBuilder->build(ref);
149  tt.setBeamSpot(*beamSpot);
150  float w = sv->trackWeight(ref);
151  std::pair<bool,Measurement1D> ipv = IPTools::absoluteImpactParameter3D(tt,pv);
152  std::pair<bool,Measurement1D> isv = IPTools::absoluteImpactParameter3D(tt,*sv);
153  if( w > 0 || ( isv.second.significance() < sigCut && isv.second.value() < distCut && isv.second.value() < dlen.value()*dLenFraction ) )
154  {
155  float dR = deltaR(flightDir.eta(), flightDir.phi(), tt.track().eta(), tt.track().phi());
156 
157  if(isv.second.value() < ipv.second.value() && isv.second.value() < distCut && isv.second.value() < dlen.value()*dLenFraction
158  && dR < dRCut )
159  {
160 // if(w > 0.5) std::cout << " = ";
161  // else std::cout << " + ";
162  selTracks.push_back(tt);
163  } else
164  {
165 // if(w > 0.5 && isv.second.value() > ipv.second.value() ) std::cout << " - ";
166  // else std::cout << " ";
167  //add also the tracks used in previous fitting that are still closer to Sv than Pv
168  if(w > 0.5 && isv.second.value() < ipv.second.value() && dR < dRCut) selTracks.push_back(tt);
169  }
170 
171  // std::cout << "t : " << track-tracks->begin() << " w: " << w
172  // << " svip: " << isv.second.significance() << " " << isv.second.value()
173  // << " pvip: " << ipv.second.significance() << " " << ipv.second.value() << " dr: " << dR << std::endl;
174 
175  }
176  }
177 
178  if(selTracks.size() >= 2)
179  {
180  TransientVertex singleFitVertex;
181  singleFitVertex = theAdaptiveFitter.vertex(selTracks,ssv);
182  if(singleFitVertex.isValid()) recoVertices->push_back(singleFitVertex);
183  }
184  }
185  event.put(recoVertices);
186 }
void setBeamSpot(const reco::BeamSpot &beamSpot)
std::pair< bool, Measurement1D > absoluteImpactParameter3D(const reco::TransientTrack &transientTrack, const reco::Vertex &vertex)
Definition: IPTools.cc:37
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:138
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:140
edm::InputTag primaryVertexCollection
bool trackFilter(const reco::TrackRef &track) const
edm::InputTag secondaryVertexCollection
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
const Track & track() const
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
double value() const
Definition: Measurement1D.h:28
bool isValid() const
bool TrackVertexArbitrator::trackFilter ( const reco::TrackRef track) const
private

Definition at line 75 of file TrackVertexArbitrator.cc.

Referenced by produce().

76 {
77  if (track->hitPattern().trackerLayersWithMeasurement() < 4)
78  return false;
79  if (track->pt() < 0.4 )
80  return false;
81 
82  return true;
83 }

Member Data Documentation

edm::InputTag TrackVertexArbitrator::beamSpotCollection
private

Definition at line 55 of file TrackVertexArbitrator.cc.

Referenced by produce().

double TrackVertexArbitrator::distCut
private

Definition at line 57 of file TrackVertexArbitrator.cc.

Referenced by produce().

double TrackVertexArbitrator::dLenFraction
private

Definition at line 59 of file TrackVertexArbitrator.cc.

Referenced by produce().

double TrackVertexArbitrator::dRCut
private

Definition at line 56 of file TrackVertexArbitrator.cc.

Referenced by produce().

edm::InputTag TrackVertexArbitrator::primaryVertexCollection
private

Definition at line 52 of file TrackVertexArbitrator.cc.

Referenced by produce().

edm::InputTag TrackVertexArbitrator::secondaryVertexCollection
private

Definition at line 53 of file TrackVertexArbitrator.cc.

Referenced by produce().

double TrackVertexArbitrator::sigCut
private

Definition at line 58 of file TrackVertexArbitrator.cc.

Referenced by produce().

edm::InputTag TrackVertexArbitrator::trackCollection
private

Definition at line 54 of file TrackVertexArbitrator.cc.

Referenced by produce().