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 else if(clusteringAlgorithm ==
"DA_vect") {
53 throw VertexException(
"PrimaryVertexProducerAlgorithm: unknown clustering algorithm: " + clusteringAlgorithm);
58 if (conf.
exists(
"vertexCollections")){
61 for( std::vector< edm::ParameterSet >::const_iterator algoconf = vertexCollections.begin(); algoconf != vertexCollections.end(); algoconf++){
65 if (fitterAlgorithm==
"KalmanVertexFitter") {
67 }
else if( fitterAlgorithm==
"AdaptiveVertexFitter") {
70 throw VertexException(
"PrimaryVertexProducerAlgorithm: unknown algorithm: " + fitterAlgorithm);
73 algorithm.
minNdof = algoconf->getParameter<
double>(
"minNdof");
78 produces<reco::VertexCollection>(algorithm.
label);
81 edm::LogWarning(
"MisConfiguration")<<
"this module's configuration has changed, please update to have a vertexCollections=cms.VPSet parameter.";
85 if (fitterAlgorithm==
"KalmanVertexFitter") {
87 }
else if( fitterAlgorithm==
"AdaptiveVertexFitter") {
90 throw VertexException(
"PrimaryVertexProducerAlgorithm: unknown algorithm: " + fitterAlgorithm);
99 produces<reco::VertexCollection>(algorithm.
label);
124 if (recoBeamSpotHandle.
isValid()){
125 beamSpot = *recoBeamSpotHandle;
127 edm::LogError(
"UnusableBeamSpot") <<
"No beam spot available from EventSetup";
132 if ( (beamVertexState.
error().
cxx() <= 0.) ||
133 (beamVertexState.
error().
cyy() <= 0.) ||
134 (beamVertexState.
error().
czz() <= 0.) ) {
149 std::vector<reco::TransientTrack> t_tks = (*theB).build(tks, beamSpot);
151 <<
"Found: " << t_tks.size() <<
" reconstructed tracks" <<
"\n";
161 if (
fVerbose){
std::cout <<
" clustering returned "<< clusters.size() <<
" clusters from " << seltks.size() <<
" selected tracks" <<std::endl;}
172 std::vector<TransientVertex> pvs;
173 for (std::vector< std::vector<reco::TransientTrack> >::const_iterator iclus
174 = clusters.begin(); iclus != clusters.end(); iclus++) {
178 if(
algorithm->useBeamConstraint && validBS &&((*iclus).size()>1) ){
180 v =
algorithm->fitter->vertex(*iclus, beamSpot);
182 }
else if( !(
algorithm->useBeamConstraint) && ((*iclus).size()>1) ) {
191 else std::cout <<
"Invalid fitted vertex\n";
196 && (!validBS || (*(
algorithm->vertexSelector))(
v,beamVertexState))
201 std::cout <<
"PrimaryVertexProducerAlgorithm::vertices candidates =" << pvs.size() << std::endl;
205 if (clusters.size()>2 && clusters.size() > 2*pvs.size())
206 edm::LogWarning(
"PrimaryVertexProducer") <<
"more than half of candidate vertices lost " << pvs.size() <<
' ' << clusters.size();
208 if (pvs.empty() && seltks.size()>5)
209 edm::LogWarning(
"PrimaryVertexProducer") <<
"no vertex found with " << seltks.size() <<
" tracks and " << clusters.size() <<
" vertex-candidates";
219 for (std::vector<TransientVertex>::const_iterator iv = pvs.begin();
220 iv != pvs.end(); iv++) {
227 if ( (bse.cxx() <= 0.) ||
229 (bse.czz() <= 0.) ) {
231 we(0,0)=10000; we(1,1)=10000; we(2,2)=10000;
234 std::cout <<
"RecoVertex/PrimaryVertexProducer: "
235 <<
"Beamspot with invalid errors "<<bse.matrix()<<std::endl;
236 std::cout <<
"Will put Vertex derived from dummy-fake BeamSpot into Event.\n";
242 std::cout <<
"RecoVertex/PrimaryVertexProducer: "
243 <<
" will put Vertex derived from BeamSpot into Event.\n";
250 for(reco::VertexCollection::const_iterator
v=vColl.begin();
251 v!=vColl.end(); ++
v){
253 <<
"#trk " << std::setw(3) <<
v->tracksSize()
254 <<
" chi2 " << std::setw(4) <<
v->chi2()
255 <<
" ndof " << std::setw(3) <<
v->ndof()
256 <<
" x " << std::setw(6) <<
v->position().x()
257 <<
" dx " << std::setw(6) <<
v->xError()
258 <<
" y " << std::setw(6) <<
v->position().y()
259 <<
" dy " << std::setw(6) <<
v->yError()
260 <<
" z " << std::setw(6) <<
v->position().z()
261 <<
" 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