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>
84 token_secondaryVertex(consumes<edm::
View<VTX> >(params.getParameter<edm::
InputTag>(
"secondaryVertices"))),
85 maxDRForUnique(params.getParameter<double>(
"maxDRUnique")),
86 maxvecSumIMCUTForUnique(params.getParameter<double>(
"maxvecSumIMifsmallDRUnique")),
87 minCosPAtomerge(params.getParameter<double>(
"minCosPAtomerge")),
88 maxPtreltomerge(params.getParameter<double>(
"maxPtreltomerge"))
92 produces<std::vector<VTX> >();
95 template<
typename VTX>
101 iEvent.
getByToken(token_primaryVertex, PVcoll);
103 if(PVcoll->size()!=0) {
110 iEvent.
getByToken(token_secondaryVertex, secondaryVertices);
115 std::vector<VertexProxy> vertexProxyColl;
117 sv != secondaryVertices->end(); ++sv) {
118 vertexProxyColl.push_back( buildVertexProxy(*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){
132 resolveBtoDchain(vertexProxyColl, 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 );
247 if(vertexDeltaR<maxDRForUnique && mother.M()<maxvecSumIMCUTForUnique && cosPA>minCosPAtomerge &&
std::abs(ptrel)<maxPtreltomerge ) {
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){
346 if(vertexDeltaR<maxDRForUnique && mother.M()<maxvecSumIMCUTForUnique && cosPA>minCosPAtomerge &&
std::abs(ptrel)<maxPtreltomerge ) {
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
virtual const Point & vertex() const
vertex position (overwritten by PF...)
#define DEFINE_FWK_MODULE(type)
double y() const
y coordinate
Measurement1D dist3d() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
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)
GlobalVector flightDirection(const reco::Vertex &pv, const reco::Vertex &sv)
friend bool operator<(VertexProxy v1, VertexProxy v2)
double maxvecSumIMCUTForUnique
Abs< T >::type abs(const T &t)
double z() const
z coordinate
virtual size_type numberOfSourceCandidatePtrs() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
double deltaR(double eta1, double eta2, double phi1, double phi2)
double x() const
x coordinate
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)
virtual void produce(edm::Event &event, const edm::EventSetup &es)
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