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 std::auto_ptr<std::vector<VTX> > bvertColl(
new std::vector<VTX>);
138 for(
typename std::vector<VertexProxy>::const_iterator it=vertexProxyColl.begin(); it!=vertexProxyColl.end(); ++it) bvertColl->push_back((*it).vert);
139 iEvent.
put(bvertColl);
142 std::auto_ptr<std::vector<VTX> > bvertCollEmpty(
new std::vector<VTX>);
143 iEvent.
put(bvertCollEmpty);
147 template<
typename VTX>
155 template<
typename VTX>
163 template<
typename VTX>
190 using namespace reco;
209 momentumNear = momentum2;
210 momentumFar = momentum1;
216 double cosPA = nearToFar.dot(momentumFar) / momentumFar.mag()/ nearToFar.mag();
217 double cosa = pvToNear.
dot(momentumFar) / pvToNear.mag() / momentumFar.mag();
218 double ptrel =
sqrt(1.0 - cosa*cosa)* momentumFar.mag();
223 std::set<reco::TrackRef> trackrefs;
226 if(sv1.trackWeight(*ti)>0.5){
233 if(sv2.trackWeight(*ti)>0.5){
240 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> > mother;
241 for(std::set<reco::TrackRef>::const_iterator it = trackrefs.begin(); it!= trackrefs.end(); ++it){
242 ROOT::Math::LorentzVector<ROOT::Math::PxPyPzM4D<double> >
temp ( (*it)->px(),(*it)->py(),(*it)->pz(),
ParticleMasses::piPlus );
248 if(vertexDeltaR<maxDRForUnique && mother.M()<maxvecSumIMCUTForUnique && cosPA>minCosPAtomerge &&
std::abs(ptrel)<maxPtreltomerge ) {
253 bool bFoundDuplicate=
false;
256 if (it==sv1.tracks_end()) coll[i].vert.add( *ti, sv2.refittedTrack(*ti), sv2.trackWeight(*ti) );
257 else bFoundDuplicate=
true;
264 std::vector<TrackBaseRef >
tracks_;
265 std::vector<Track> refittedTracks_;
266 std::vector<float> weights_;
268 tracks_.push_back( *it);
269 refittedTracks_.push_back( coll[i].vert.refittedTrack(*it));
270 weights_.push_back( coll[i].vert.trackWeight(*it) );
273 coll[
i].vert.removeTracks();
274 std::vector<Track>::iterator it2 = refittedTracks_.begin();
275 std::vector<float>::iterator it3 = weights_.begin();
278 float weight2= sv2.trackWeight(*it);
279 Track refittedTrackWithLargerWeight = *it2;
280 if( weight2 >weight) {
282 refittedTrackWithLargerWeight = sv2.refittedTrack(*it);
284 coll[
i].vert.add(*it , refittedTrackWithLargerWeight , weight);
289 coll.erase( coll.begin() +
k );
296 using namespace reco;
317 momentumNear = momentum2;
318 momentumFar = momentum1;
324 double cosPA = nearToFar.dot(momentumFar) / momentumFar.mag()/ nearToFar.mag();
325 double cosa = pvToNear.
dot(momentumFar) / pvToNear.mag() / momentumFar.mag();
326 double ptrel =
sqrt(1.0 - cosa*cosa)* momentumFar.mag();
331 std::set<reco::CandidatePtr> trackrefs;
333 for(
size_t i=0; i < sv1.numberOfSourceCandidatePtrs(); ++
i)
334 trackrefs.insert(sv1.daughterPtr(i));
336 for(
size_t i=0; i < sv2.numberOfSourceCandidatePtrs(); ++
i)
337 trackrefs.insert(sv2.daughterPtr(i));
341 for(std::set<reco::CandidatePtr>::const_iterator it = trackrefs.begin(); it!= trackrefs.end(); ++it){
347 if(vertexDeltaR<maxDRForUnique && mother.M()<maxvecSumIMCUTForUnique && cosPA>minCosPAtomerge &&
std::abs(ptrel)<maxPtreltomerge ) {
351 const std::vector<reco::CandidatePtr> & tracks1 = sv1.daughterPtrVector();
352 const std::vector<reco::CandidatePtr> & tracks2 = sv2.daughterPtrVector();
353 for(std::vector<reco::CandidatePtr>::const_iterator ti = tracks2.begin(); ti!=tracks2.end(); ++ti){
354 std::vector<reco::CandidatePtr>::const_iterator it =
find(tracks1.begin(), tracks1.end(), *ti);
355 if (it==tracks1.end()) {
356 coll[
i].vert.addDaughter( *ti );
357 coll[
i].vert.setP4( (*ti)->p4() + coll[
i].vert.p4() );
362 coll.erase( coll.begin() +
k );
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)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
double maxvecSumIMCUTForUnique
Abs< T >::type abs(const T &t)
double z() const
y 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