30 if(trackSelectionAlgorithm==
"filter"){
32 }
else if (trackSelectionAlgorithm==
"filterWithThreshold"){
35 throw VertexException(
"PrimaryVertexProducerAlgorithm: unknown track selection algorithm: " + trackSelectionAlgorithm);
41 if (clusteringAlgorithm==
"gap"){
43 }
else if(clusteringAlgorithm==
"DA"){
47 #ifdef __GXX_EXPERIMENTAL_CXX0X__
48 else if(clusteringAlgorithm ==
"DA_vect") {
55 throw VertexException(
"PrimaryVertexProducerAlgorithm: unknown clustering algorithm: " + clusteringAlgorithm);
60 if (conf.
exists(
"vertexCollections")){
63 for( std::vector< edm::ParameterSet >::const_iterator algoconf = vertexCollections.begin(); algoconf != vertexCollections.end(); algoconf++){
67 if (fitterAlgorithm==
"KalmanVertexFitter") {
69 }
else if( fitterAlgorithm==
"AdaptiveVertexFitter") {
72 throw VertexException(
"PrimaryVertexProducerAlgorithm: unknown algorithm: " + fitterAlgorithm);
75 algorithm.
minNdof = algoconf->getParameter<
double>(
"minNdof");
80 produces<reco::VertexCollection>(algorithm.
label);
83 edm::LogWarning(
"MisConfiguration")<<
"this module's configuration has changed, please update to have a vertexCollections=cms.VPSet parameter.";
87 if (fitterAlgorithm==
"KalmanVertexFitter") {
89 }
else if( fitterAlgorithm==
"AdaptiveVertexFitter") {
92 throw VertexException(
"PrimaryVertexProducerAlgorithm: unknown algorithm: " + fitterAlgorithm);
101 produces<reco::VertexCollection>(algorithm.
label);
126 if (recoBeamSpotHandle.
isValid()){
127 beamSpot = *recoBeamSpotHandle;
129 edm::LogError(
"UnusableBeamSpot") <<
"No beam spot available from EventSetup";
134 if ( (beamVertexState.
error().
cxx() <= 0.) ||
135 (beamVertexState.
error().
cyy() <= 0.) ||
136 (beamVertexState.
error().
czz() <= 0.) ) {
151 std::vector<reco::TransientTrack> t_tks = (*theB).build(tks, beamSpot);
153 <<
"Found: " << t_tks.size() <<
" reconstructed tracks" <<
"\n";
163 if (
fVerbose){
std::cout <<
" clustering returned "<< clusters.size() <<
" clusters from " << seltks.size() <<
" selected tracks" <<std::endl;}
174 std::vector<TransientVertex> pvs;
175 for (std::vector< std::vector<reco::TransientTrack> >::const_iterator iclus
176 = clusters.begin(); iclus != clusters.end(); iclus++) {
180 if(
algorithm->useBeamConstraint && validBS &&((*iclus).size()>1) ){
182 v =
algorithm->fitter->vertex(*iclus, beamSpot);
184 }
else if( !(
algorithm->useBeamConstraint) && ((*iclus).size()>1) ) {
193 else std::cout <<
"Invalid fitted vertex\n";
198 && (!validBS || (*(
algorithm->vertexSelector))(
v,beamVertexState))
203 std::cout <<
"PrimaryVertexProducerAlgorithm::vertices candidates =" << pvs.size() << std::endl;
207 if (clusters.size()>2 && clusters.size() > 2*pvs.size())
208 edm::LogWarning(
"PrimaryVertexProducer") <<
"more than half of candidate vertices lost " << pvs.size() <<
' ' << clusters.size();
210 if (pvs.empty() && seltks.size()>5)
211 edm::LogWarning(
"PrimaryVertexProducer") <<
"no vertex found with " << seltks.size() <<
" tracks and " << clusters.size() <<
" vertex-candidates";
221 for (std::vector<TransientVertex>::const_iterator iv = pvs.begin();
222 iv != pvs.end(); iv++) {
229 if ( (bse.cxx() <= 0.) ||
231 (bse.czz() <= 0.) ) {
233 we(0,0)=10000; we(1,1)=10000; we(2,2)=10000;
236 std::cout <<
"RecoVertex/PrimaryVertexProducer: "
237 <<
"Beamspot with invalid errors "<<bse.matrix()<<std::endl;
238 std::cout <<
"Will put Vertex derived from dummy-fake BeamSpot into Event.\n";
244 std::cout <<
"RecoVertex/PrimaryVertexProducer: "
245 <<
" will put Vertex derived from BeamSpot into Event.\n";
252 for(reco::VertexCollection::const_iterator
v=vColl.begin();
253 v!=vColl.end(); ++
v){
255 <<
"#trk " << std::setw(3) <<
v->tracksSize()
256 <<
" chi2 " << std::setw(4) <<
v->chi2()
257 <<
" ndof " << std::setw(3) <<
v->ndof()
258 <<
" x " << std::setw(6) <<
v->position().x()
259 <<
" dx " << std::setw(6) <<
v->xError()
260 <<
" y " << std::setw(6) <<
v->position().y()
261 <<
" dy " << std::setw(6) <<
v->yError()
262 <<
" z " << std::setw(6) <<
v->position().z()
263 <<
" dz " << std::setw(6) <<
v->zError()
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::BeamSpot > bsToken
VertexFitter< 5 > * fitter
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::TrackCollection > trkToken
const AlgebraicSymMatrix33 & matrix() const
TrackClusterizerInZ * theTrackClusterizer
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< Vertex > VertexCollection
collection of Vertex objects
virtual std::vector< std::vector< reco::TransientTrack > > clusterize(const std::vector< reco::TransientTrack > &tracks) const =0
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
float degreesOfFreedom() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
VertexCompatibleWithBeam * vertexSelector
GlobalPoint position() const
TrackFilterForPVFindingBase * theTrackFilter
virtual std::vector< reco::TransientTrack > select(const std::vector< reco::TransientTrack > &tracks) const =0
virtual void produce(edm::Event &, const edm::EventSetup &)
std::vector< algo > algorithms
PrimaryVertexProducer(const edm::ParameterSet &)
GlobalError error() const
const Point & position() const
position
Covariance3DMatrix rotatedCovariance3D() const