29 for(std::vector<reco::CandidatePtr>::const_iterator
track = tracks.begin();
track != tracks.end(); ++
track) {
30 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > vec;
31 vec.SetPx((*track)->px());
32 vec.SetPy((*track)->py());
33 vec.SetPz((*track)->pz());
40 template<
typename VTX>
81 template<
typename VTX>
92 produces<std::vector<VTX> >();
95 template<
typename VTX>
103 if(!PVcoll->empty()) {
115 std::vector<VertexProxy> vertexProxyColl;
117 sv != secondaryVertices->end(); ++sv) {
122 sort( vertexProxyColl.begin(), vertexProxyColl.end());
126 for(
unsigned int iVtx=0; iVtx < vertexProxyColl.size(); ++iVtx){
130 for(
unsigned int kVtx=vertexProxyColl.size()-1; kVtx>iVtx; --kVtx){
137 auto bvertColl = std::make_unique<std::vector<VTX>>();
138 for(
typename std::vector<VertexProxy>::const_iterator it=vertexProxyColl.begin(); it!=vertexProxyColl.end(); ++it) bvertColl->push_back((*it).vert);
142 iEvent.
put(std::make_unique<std::vector<VTX>>());
146 template<
typename VTX>
154 template<
typename VTX>
162 template<
typename VTX>
189 using namespace reco;
208 momentumNear = momentum2;
209 momentumFar = momentum1;
215 double cosPA = nearToFar.
dot(momentumFar) / momentumFar.
mag()/ nearToFar.
mag();
216 double cosa = pvToNear.
dot(momentumFar) / pvToNear.
mag() / momentumFar.
mag();
217 double ptrel =
sqrt(1.0 - cosa*cosa)* momentumFar.
mag();
222 std::set<reco::TrackRef> trackrefs;
225 if(sv1.trackWeight(*ti)>0.5){
232 if(sv2.trackWeight(*ti)>0.5){
239 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > mother;
240 for(std::set<reco::TrackRef>::const_iterator it = trackrefs.begin(); it!= trackrefs.end(); ++it){
241 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> >
temp ( (*it)->px(),(*it)->py(),(*it)->pz(),
ParticleMasses::piPlus );
252 bool bFoundDuplicate=
false;
255 if (it==sv1.tracks_end()) coll[i].vert.add( *ti, sv2.refittedTrack(*ti), sv2.trackWeight(*ti) );
256 else bFoundDuplicate=
true;
263 std::vector<TrackBaseRef >
tracks_;
264 std::vector<Track> refittedTracks_;
265 std::vector<float> weights_;
267 tracks_.push_back( *it);
268 refittedTracks_.push_back( coll[i].vert.refittedTrack(*it));
269 weights_.push_back( coll[i].vert.trackWeight(*it) );
272 coll[
i].vert.removeTracks();
273 std::vector<Track>::iterator it2 = refittedTracks_.begin();
274 std::vector<float>::iterator it3 = weights_.begin();
277 float weight2= sv2.trackWeight(*it);
278 Track refittedTrackWithLargerWeight = *it2;
279 if( weight2 >weight) {
281 refittedTrackWithLargerWeight = sv2.refittedTrack(*it);
283 coll[
i].vert.add(*it , refittedTrackWithLargerWeight , weight);
288 coll.erase( coll.begin() +
k );
295 using namespace reco;
316 momentumNear = momentum2;
317 momentumFar = momentum1;
323 double cosPA = nearToFar.
dot(momentumFar) / momentumFar.
mag()/ nearToFar.
mag();
324 double cosa = pvToNear.
dot(momentumFar) / pvToNear.
mag() / momentumFar.
mag();
325 double ptrel =
sqrt(1.0 - cosa*cosa)* momentumFar.
mag();
330 std::set<reco::CandidatePtr> trackrefs;
332 for(
size_t i=0; i < sv1.numberOfSourceCandidatePtrs(); ++
i)
333 trackrefs.insert(sv1.daughterPtr(i));
335 for(
size_t i=0; i < sv2.numberOfSourceCandidatePtrs(); ++
i)
336 trackrefs.insert(sv2.daughterPtr(i));
340 for(std::set<reco::CandidatePtr>::const_iterator it = trackrefs.begin(); it!= trackrefs.end(); ++it){
350 const std::vector<reco::CandidatePtr> & tracks1 = sv1.daughterPtrVector();
351 const std::vector<reco::CandidatePtr> & tracks2 = sv2.daughterPtrVector();
352 for(std::vector<reco::CandidatePtr>::const_iterator ti = tracks2.begin(); ti!=tracks2.end(); ++ti){
353 std::vector<reco::CandidatePtr>::const_iterator it =
find(tracks1.begin(), tracks1.end(), *ti);
354 if (it==tracks1.end()) {
355 coll[
i].vert.addDaughter( *ti );
356 coll[
i].vert.setP4( (*ti)->p4() + coll[
i].vert.p4() );
361 coll.erase( coll.begin() +
k );
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
reco::TemplatedSecondaryVertex< VTX > SecondaryVertex
const std::vector< reco::PFCandidatePtr > & tracks_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
double y() const
y coordinate
Measurement1D dist3d() const
size_type numberOfSourceCandidatePtrs() const override
std::vector< Vertex > VertexCollection
collection of Vertex objects
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
void produce(edm::Event &event, const edm::EventSetup &es) override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
BtoCharmDecayVertexMergerT< reco::Vertex > BtoCharmDecayVertexMerger
VertexProxy buildVertexProxy(const VTX &vtx)
friend bool operator<(VertexProxy v1, VertexProxy v2)
double maxvecSumIMCUTForUnique
const Point & vertex() const override
vertex position (overwritten by PF...)
Abs< T >::type abs(const T &t)
double z() const
z coordinate
double deltaR(double eta1, double eta2, double phi1, double phi2)
double x() const
x coordinate
T const * product() const
BtoCharmDecayVertexMergerT(const edm::ParameterSet ¶ms)
math::XYZTLorentzVectorD p4(float mass=0.13957018, float minWeight=0.5) const
Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products...
void resolveBtoDchain(std::vector< VertexProxy > &coll, unsigned int i, unsigned int k)
GlobalVector flightDirection(const reco::Vertex &v1, const reco::Vertex &v2)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
BtoCharmDecayVertexMergerT< reco::VertexCompositePtrCandidate > CandidateBtoCharmDecayVertexMerger
reco::Candidate::LorentzVector vtxP4(const reco::VertexCompositePtrCandidate &vtx)
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
edm::EDGetTokenT< edm::View< VTX > > token_secondaryVertex
const daughters & daughterPtrVector() const
references to daughtes
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
edm::EDGetTokenT< reco::VertexCollection > token_primaryVertex
size_t tracksSize() const
number of tracks
Global3DVector GlobalVector