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 Attributes
ConversionVertexFinder Class Reference

#include <ConversionVertexFinder.h>

Public Member Functions

 ConversionVertexFinder (const edm::ParameterSet &config)
 
TransientVertex run (const std::vector< reco::TransientTrack > &pair)
 
bool run (const std::vector< reco::TransientTrack > &pair, reco::Vertex &the_vertex)
 
 ~ConversionVertexFinder ()
 

Private Attributes

edm::ParameterSet conf_
 
KinematicConstrainedVertexFitterkcvFitter_
 
double maxDelta_
 
int maxNbrOfIterations_
 
double maxReducedChiSq_
 
double minChiSqImprovement_
 

Detailed Description

Author
N. Marinelli - Univ. of Notre Dame
Version

Definition at line 29 of file ConversionVertexFinder.h.

Constructor & Destructor Documentation

ConversionVertexFinder::ConversionVertexFinder ( const edm::ParameterSet config)

Definition at line 25 of file ConversionVertexFinder.cc.

References conf_, edm::ParameterSet::getParameter(), kcvFitter_, LogDebug, maxDelta_, maxNbrOfIterations_, maxReducedChiSq_, and minChiSqImprovement_.

25  :
26  conf_(config)
27 {
28  LogDebug("ConversionVertexFinder") << "ConversionVertexFinder CTOR " << "\n";
29  maxDelta_ = conf_.getParameter<double>("maxDelta");
30  maxReducedChiSq_ = conf_.getParameter<double>("maxReducedChiSq");
31  minChiSqImprovement_ = conf_.getParameter<double>("minChiSqImprovement");
32  maxNbrOfIterations_ = conf_.getParameter<int>("maxNbrOfIterations");
34  kcvFitter_->setParameters(conf_);
35 
36 }
#define LogDebug(id)
T getParameter(std::string const &) const
KinematicConstrainedVertexFitter * kcvFitter_
ConversionVertexFinder::~ConversionVertexFinder ( )

Definition at line 38 of file ConversionVertexFinder.cc.

References kcvFitter_, and LogDebug.

38  {
39 
40  LogDebug("ConversionVertexFinder") << "ConversionVertexFinder DTOR " << "\n";
41  delete kcvFitter_;
42 
43 }
#define LogDebug(id)
KinematicConstrainedVertexFitter * kcvFitter_

Member Function Documentation

TransientVertex ConversionVertexFinder::run ( const std::vector< reco::TransientTrack > &  pair)

Definition at line 142 of file ConversionVertexFinder.cc.

References alignCSCRings::e, cms::Exception::explainSelf(), LogDebug, metname, AlCaHLTBitMon_QueryRunRegistry::string, and KalmanVertexFitter::vertex().

Referenced by ConvertedPhotonProducer::buildCollections(), and ConversionProducer::checkVertex().

142  {
143  LogDebug("ConversionVertexFinder") << "ConversionVertexFinder run pair size " << pair.size() << "\n";
144 
145  //for ( std::vector<reco::TransientTrack>::const_iterator iTk=pair.begin(); iTk!=pair.end(); ++iTk) {
146  // LogDebug("ConversionVertexFinder") << " ConversionVertexFinder Tracks in the pair charge " << iTk->charge() << " Num of RecHits " << iTk->recHitsSize() << " inner momentum " << iTk->track().innerMomentum() << "\n";
147  //}
148 
149 
150  reco::Vertex theVertex;
151  KalmanVertexFitter fitter(true);
152  TransientVertex transientVtx;
153 
154  const std::string metname = "ConversionVertexFinder| ConversionVertexFinder";
155  try{
156 
157  transientVtx = fitter.vertex(pair);
158 
159  } catch ( cms::Exception& e ) {
160 
161 
162  edm::LogWarning(metname) << "cms::Exception caught in ConversionVertexFinder::run\n"
163  << e.explainSelf();
164 
165  }
166 
167 
168  return transientVtx;
169 
170 
171 
172 }
#define LogDebug(id)
const std::string metname
virtual std::string explainSelf() const
Definition: Exception.cc:146
bool ConversionVertexFinder::run ( const std::vector< reco::TransientTrack > &  pair,
reco::Vertex the_vertex 
)

Definition at line 45 of file ConversionVertexFinder.cc.

References ChiSquaredProbability(), conf_, gather_cfg::cout, KinematicConstrainedVertexFitter::fit(), KinematicConstrainedVertexFitterT< nTrk, nConstraint >::fit(), newFWLiteAna::found, KinematicConstrainedVertexFitter::getNit(), KinematicConstrainedVertexFitterT< nTrk, nConstraint >::getNit(), kcvFitter_, GetRecoTauVFromDQM_MC_cff::kk, KinematicParticleFactoryFromTransientTrack::particle(), ColinearityKinematicConstraint::PhiTheta, and KinematicConstrainedVertexFitterT< nTrk, nConstraint >::setParameters().

45  {
46  std::vector<reco::TransientTrack> pair = _pair;
47  bool found= false;
48 
49  if ( pair.size() < 2) return found;
50 
51  float sigma = 0.00000001;
52  float chi = 0.;
53  float ndf = 0.;
54  float mass = 0.000511;
55 
56 
58 
59  std::vector<RefCountedKinematicParticle> particles;
60 
61  particles.push_back(pFactory.particle (pair[0],mass,chi,ndf,sigma,*pair[0].innermostMeasurementState().freeState()));
62  particles.push_back(pFactory.particle (pair[1],mass,chi,ndf,sigma,*pair[1].innermostMeasurementState().freeState()));
63 
64 
65 #ifdef OldKineFit
67 
68  RefCountedKinematicTree myTree = kcvFitter_->fit(particles, &constr);
69 #else
70 
71  // bizzare way to the get the field...
72  const MagneticField* mf = pair[0].field();
73 
76  kcvFitter.setParameters(conf_);
77  RefCountedKinematicTree myTree = kcvFitter.fit(particles, &constr);
78 
79 #ifdef KineFitDebug
80 
82 
83  RefCountedKinematicTree oldTree = kcvFitter_->fit(particles, &oldconstr);
84 
85 
86  if( oldTree->isValid() ) {
87  std::cout << "old " << kcvFitter_->getNit() << std::endl;
88  RefCountedKinematicVertex gamma_dec_vertex = oldTree->currentDecayVertex();
89  if( gamma_dec_vertex->vertexIsValid())
90  std::cout << gamma_dec_vertex->chiSquared() << " " << gamma_dec_vertex->degreesOfFreedom() << std::endl;
91  std::cout << oldTree->currentParticle()->currentState().globalMomentum() <<
92  oldTree->currentParticle()->currentState().globalPosition()<< std::endl;
93  std::vector<RefCountedKinematicParticle> fStates=oldTree->finalStateParticles();
94  for (unsigned int kk=0; kk<fStates.size(); kk++) {
95  std::cout << fStates[kk]->currentState().globalMomentum() <<
96  fStates[kk]->currentState().globalPosition() << std::endl;
97  std::cout << fStates[kk]->currentState().kinematicParametersError().matrix()<<std::endl;
98  }
99  } else std::cout << "old invalid " << kcvFitter_->getNit() << std::endl;
100 
101  if( myTree->isValid() ) {
102  std::cout << "new " << kcvFitter.getNit() << std::endl;
103  RefCountedKinematicVertex gamma_dec_vertex = myTree->currentDecayVertex();
104  if( gamma_dec_vertex->vertexIsValid())
105  std::cout << gamma_dec_vertex->chiSquared() << " " << gamma_dec_vertex->degreesOfFreedom() << std::endl;
106  std::cout << myTree->currentParticle()->currentState().globalMomentum() <<
107  myTree->currentParticle()->currentState().globalPosition()<< std::endl;
108  std::vector<RefCountedKinematicParticle> fStates=myTree->finalStateParticles();
109  for (unsigned int kk=0; kk<fStates.size(); kk++) {
110  std::cout << fStates[kk]->currentState().globalMomentum() <<
111  fStates[kk]->currentState().globalPosition() << std::endl;
112  std::cout << fStates[kk]->currentState().kinematicParametersError().matrix()<<std::endl;
113  }
114  } else std::cout << "new invalid " << kcvFitter.getNit() << std::endl;
115 
116 #endif // TemplateKineFitDebug
117 
118 #endif
119 
120  if( myTree->isValid() ) {
121  myTree->movePointerToTheTop();
122  RefCountedKinematicParticle the_photon = myTree->currentParticle();
123  if (the_photon->currentState().isValid()){
124  //const ParticleMass photon_mass = the_photon->currentState().mass();
125  RefCountedKinematicVertex gamma_dec_vertex;
126  gamma_dec_vertex = myTree->currentDecayVertex();
127  if( gamma_dec_vertex->vertexIsValid() ){
128  const float chi2Prob = ChiSquaredProbability(gamma_dec_vertex->chiSquared(), gamma_dec_vertex->degreesOfFreedom());
129  if (chi2Prob>0.){// no longer cut here, only ask positive probability here
130  //const math::XYZPoint vtxPos(gamma_dec_vertex->position());
131  the_vertex = *gamma_dec_vertex;
132  found = true;
133  }
134  }
135  }
136  }
137 
138  return found;
139 }
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &part)
float ChiSquaredProbability(double chiSquared, double nrDOF)
KinematicConstrainedVertexFitter * kcvFitter_
RefCountedKinematicParticle particle(const reco::TransientTrack &initialTrack, const ParticleMass &massGuess, float chiSquared, float degreesOfFr, float &m_sigma) const
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

edm::ParameterSet ConversionVertexFinder::conf_
private

Definition at line 45 of file ConversionVertexFinder.h.

Referenced by ConversionVertexFinder(), and run().

KinematicConstrainedVertexFitter* ConversionVertexFinder::kcvFitter_
private

Definition at line 50 of file ConversionVertexFinder.h.

Referenced by ConversionVertexFinder(), run(), and ~ConversionVertexFinder().

double ConversionVertexFinder::maxDelta_
private

Definition at line 46 of file ConversionVertexFinder.h.

Referenced by ConversionVertexFinder().

int ConversionVertexFinder::maxNbrOfIterations_
private

Definition at line 49 of file ConversionVertexFinder.h.

Referenced by ConversionVertexFinder().

double ConversionVertexFinder::maxReducedChiSq_
private

Definition at line 47 of file ConversionVertexFinder.h.

Referenced by ConversionVertexFinder().

double ConversionVertexFinder::minChiSqImprovement_
private

Definition at line 48 of file ConversionVertexFinder.h.

Referenced by ConversionVertexFinder().