197 std::multimap<float, edm::Ptr<reco::ConversionTrack> > convTrackMap;
199 convTrackMap.insert(std::make_pair((*tk_ref)->track()->eta(),*tk_ref));
206 if (!vertexHandle.isValid()) {
208 <<
"Error! Can't get the product primary Vertex Collection "<<
"\n";
231 std::multimap<double, reco::CaloClusterPtr> basicClusterPtrs;
232 std::multimap<double, reco::CaloClusterPtr> superClusterPtrs;
237 buildCollection( iEvent, iSetup, convTrackMap, superClusterPtrs, basicClusterPtrs, the_pvtx, outputConvPhotonCollection);
239 outputConvPhotonCollection_p->assign(outputConvPhotonCollection.begin(), outputConvPhotonCollection.end());
246 std::multimap<double, reco::CaloClusterPtr>& basicClusterPtrs,
247 std::multimap<double, reco::CaloClusterPtr>& superClusterPtrs){
252 if (!scBarrelHandle.
isValid()) {
254 <<
"Error! Can't get the barrel superclusters!";
260 if (!scEndcapHandle.
isValid()) {
262 <<
"Error! Can't get the endcap superclusters!";
270 if (!bcBarrelHandle.
isValid()) {
272 <<
"Error! Can't get the barrel basic clusters!";
276 if (! bcEndcapHandle.
isValid()) {
278 <<
"Error! Can't get the endcap basic clusters!";
285 for (
unsigned jj = 0;
jj < 2; ++
jj ){
286 for (
unsigned ii = 0;
ii < bcHandle->size(); ++
ii ) {
288 basicClusterPtrs.insert(std::make_pair(bcHandle->ptrAt(
ii)->position().eta(), bcHandle->ptrAt(
ii)));
290 bcHandle = bcEndcapHandle;
296 for (
unsigned jj = 0;
jj < 2; ++
jj ){
297 for (
unsigned ii = 0;
ii < scHandle->size(); ++
ii ) {
299 superClusterPtrs.insert(std::make_pair(scHandle->ptrAt(
ii)->position().eta(), scHandle->ptrAt(
ii)));
301 scHandle = scEndcapHandle;
311 const std::multimap<double, reco::CaloClusterPtr>& superClusterPtrs,
312 const std::multimap<double, reco::CaloClusterPtr>& basicClusterPtrs,
339 std::map<edm::Ptr<reco::ConversionTrack>,
math::XYZPointF> trackImpactPosition;
348 const reco::Track* tk = tk_ref->second->trackRef().get() ;
354 trackImpactPosition[tk_ref->second] = ew;
359 trackMatchedBC[tk_ref->second] = closest_bc;
370 bool track1HighPurity=
true;
379 if (dynamic_cast<const reco::GsfTrack*>(left.
get())) {
392 if (!(
trackD0Cut(left, the_pvtx))) track1HighPurity=
false;
394 if (!(
trackD0Cut(left))) track1HighPurity=
false;
397 std::vector<int> right_candidates;
398 std::vector<double> right_candidate_theta, right_candidate_approach;
399 std::vector<std::pair<bool, reco::Vertex> > vertex_candidates;
403 std::multimap<float, edm::Ptr<reco::ConversionTrack> >::const_iterator
rr = ll;
405 for (; rr !=
allTracks.lower_bound(etasearch); ++
rr ) {
406 bool track2HighPurity =
true;
407 bool highPurityPair =
true;
414 if (dynamic_cast<const reco::GsfTrack*>(right.
get())) {
434 double approachDist = -999.;
459 highPurityPair=
false;
463 if (!(
trackD0Cut(right, the_pvtx))) track2HighPurity=
false;
465 if (!(
trackD0Cut(right))) track2HighPurity=
false;
470 std::vector<edm::RefToBase<reco::Track> > trackPairRef;
471 trackPairRef.push_back(left);
472 trackPairRef.push_back(right);
474 std::vector<math::XYZVectorF> trackPin;
475 std::vector<math::XYZVectorF> trackPout;
476 std::vector<math::XYZPointF> trackInnPos;
477 std::vector<uint8_t> nHitsBeforeVtx;
478 std::vector<Measurement1DFloat> dlClosestHitToVtx;
489 if (ll->second->trajRef().isNonnull() && rr->second->trajRef().isNonnull()) {
490 std::pair<uint8_t,Measurement1DFloat> leftWrongHits = hitChecker.
nHitsBeforeVtx(*ll->second->trajRef().get(),theConversionVertex);
491 std::pair<uint8_t,Measurement1DFloat> rightWrongHits = hitChecker.
nHitsBeforeVtx(*rr->second->trajRef().get(),theConversionVertex);
492 nHitsBeforeVtx.push_back(leftWrongHits.first);
493 nHitsBeforeVtx.push_back(rightWrongHits.first);
494 dlClosestHitToVtx.push_back(leftWrongHits.second);
495 dlClosestHitToVtx.push_back(rightWrongHits.second);
502 if (theConversionVertex.
isValid()){
504 if (chi2Prob<
vtxChi2_) highPurityPair=
false;
508 std::vector<math::XYZPointF> trkPositionAtEcal;
509 std::vector<reco::CaloClusterPtr> matchingBC;
515 std::map<edm::Ptr<reco::ConversionTrack>,
math::XYZPointF>::const_iterator trackImpactPositionLeft = trackImpactPosition.find(ll->second);
516 std::map<edm::Ptr<reco::ConversionTrack>,
math::XYZPointF>::const_iterator trackImpactPositionRight = trackImpactPosition.find(rr->second);
517 std::map<edm::Ptr<reco::ConversionTrack>,
reco::CaloClusterPtr>::const_iterator trackMatchedBCLeft = trackMatchedBC.find(ll->second);
518 std::map<edm::Ptr<reco::ConversionTrack>,
reco::CaloClusterPtr>::const_iterator trackMatchedBCRight = trackMatchedBC.find(rr->second);
520 if (trackImpactPositionLeft!=trackImpactPosition.end()) {
521 trkPositionAtEcal.push_back(trackImpactPositionLeft->second);
526 if (trackImpactPositionRight!=trackImpactPosition.end()) {
527 trkPositionAtEcal.push_back(trackImpactPositionRight->second);
530 double total_e_bc = 0.;
531 if (trackMatchedBCLeft!=trackMatchedBC.end()) {
532 matchingBC.push_back(trackMatchedBCLeft->second);
533 total_e_bc += trackMatchedBCLeft->second->energy();
538 if (trackMatchedBCRight!=trackMatchedBC.end()) {
539 matchingBC.push_back(trackMatchedBCRight->second);
540 total_e_bc += trackMatchedBCRight->second->energy();
544 highPurityPair =
false;
550 highPurityPair = highPurityPair && track1HighPurity && track2HighPurity && goodVertex &&
checkPhi(left, right, trackerGeom, magField, theConversionVertex) ;
564 const float minAppDist = approachDist;
568 reco::Conversion newCandidate(scPtrVec, trackPairRef, trkPositionAtEcal, theConversionVertex, matchingBC, minAppDist, trackInnPos, trackPin, trackPout, nHitsBeforeVtx, dlClosestHitToVtx, nSharedHits, dummy, algo );
570 if (
matchingSC ( superClusterPtrs, newCandidate, scPtrVec) )
576 bool generalTracksOnly = ll->second->isTrackerOnly() && rr->second->isTrackerOnly() && !
dynamic_cast<const reco::GsfTrack*
>(ll->second->trackRef().get()) && !dynamic_cast<const reco::GsfTrack*>(rr->second->trackRef().get());
577 bool arbitratedEcalSeeded = ll->second->isArbitratedEcalSeeded() && rr->second->isArbitratedEcalSeeded();
578 bool arbitratedMerged = ll->second->isArbitratedMerged() && rr->second->isArbitratedMerged();
579 bool arbitratedMergedEcalGeneral = ll->second->isArbitratedMergedEcalGeneral() && rr->second->isArbitratedMergedEcalGeneral();
586 outputConvPhotonCollection.push_back(newCandidate);
646 -barrelHalfLength, barrelHalfLength)));
657 stateAtECAL = propag.
propagate(myTSOS, *theBarrel_);
661 stateAtECAL = propag.
propagate(myTSOS, *thePositiveEtaEndcap_);
663 stateAtECAL = propag.
propagate(myTSOS, *theNegativeEtaEndcap_);
686 for (std::multimap<double, reco::CaloClusterPtr>::const_iterator scItr = scMap.begin(); scItr != scMap.end(); scItr++) {
689 double sceta = sc->eta();
691 const double delta_eta = fabs(conveta - sceta);
692 if ( fabs(delta_eta) < fabs(detaMin) && fabs(delta_phi) < fabs(dphiMin) ) {
693 detaMin= fabs(delta_eta);
694 dphiMin= fabs(delta_phi);
709 const double track_eta = trackImpactPosition.eta();
710 const double track_phi = trackImpactPosition.phi();
712 double min_eta = 999., min_phi = 999.;
714 for (std::multimap<double, reco::CaloClusterPtr>::const_iterator bc = bcMap.lower_bound(track_eta -
halfWayEta_);
715 bc != bcMap.upper_bound(track_eta +
halfWayEta_); ++bc){
717 const double delta_eta = track_eta-(ebc->position().eta());
720 if (fabs(min_eta)>fabs(delta_eta) && fabs(min_phi)>fabs(delta_phi)){
723 closest_bc = bc->second;
730 closestBC = closest_bc;
755 double recoPhoR = vtx.
position().Rho();
767 stateAtVtx1 = propag.
propagate(myTSOS1, *theBarrel_);
769 stateAtVtx1 = propag.
propagate(myTSOS1, *theDisk_);
774 stateAtVtx2 = propag.
propagate(myTSOS2, *theBarrel_);
776 stateAtVtx2 = propag.
propagate(myTSOS2, *theDisk_);
818 double rho = tangentPoint.
perp();
829 std::pair<GlobalTrajectoryParameters,GlobalTrajectoryParameters> trajs = tangent.
trajectoryParameters();
832 if (
std::abs(trajs.first.position().z() - trajs.second.position().z()) >
dzCut_) {
837 float minApproach = tangent.
perpdist();
838 appDist = minApproach;
858 double total_e_bc = 0;
859 if (bc_l.
isNonnull()) total_e_bc += bc_l->energy();
862 total_e_bc += bc_r->energy();
878 std::vector<reco::TransientTrack> pair;
879 pair.push_back(ttk_l);
880 pair.push_back(ttk_r);
894 const float PI = 3.1415927;
897 const float R_ECAL = 136.5;
904 float ZEcal = R_ECAL*sinh(EtaParticle)+Zvertex;
906 if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
907 if(Theta<0.0) Theta = Theta+
PI ;
910 if( fabs(ETA) > etaBarrelEndcap )
913 if(EtaParticle<0.0 ) Zend = -Zend ;
914 float Zlen = Zend - Zvertex ;
915 float RR = Zlen/sinh(EtaParticle);
916 Theta = atan(RR/Zend);
917 if(Theta<0.0) Theta = Theta+
PI ;
918 ETA = -
log(
tan(0.5*Theta));
T getParameter(std::string const &) const
unsigned int maxNumOfTrackInPU_
ConversionVertexFinder * theVertexFinder_
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
double d0Error() const
error on d0
edm::EDGetTokenT< reco::VertexCollection > vertexProducer_
static std::vector< std::string > checklist log
double delta_eta(double eta1, double eta2)
TransientVertex run(const std::vector< reco::TransientTrack > &pair)
static float barrelHalfLength()
double d0() const
dxy parameter in perigee convention (d0 = - dxy)
bool getTrackImpactPosition(const reco::Track *tk_ref, const TrackerGeometry *trackerGeom, const MagneticField *magField, math::XYZPointF &ew)
const TrackExtraRef & extra() const
reference to "extra" object
std::pair< GlobalTrajectoryParameters, GlobalTrajectoryParameters > trajectoryParameters() const
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double dxyError() const
error on dxy
void push_back(Ptr< T > const &iPtr)
std::pair< uint8_t, Measurement1DFloat > nHitsBeforeVtx(const Trajectory &traj, const reco::Vertex &vtx, double sigmaTolerance=3.0) const
const TransientTrackBuilder * thettbuilder_
void setQuality(ConversionQuality q, bool b)
bool isValid() const
Tells whether the vertex is valid.
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
void buildCollection(edm::Event &iEvent, const edm::EventSetup &iSetup, const std::multimap< float, edm::Ptr< reco::ConversionTrack > > &allTracks, const std::multimap< double, reco::CaloClusterPtr > &superClusterPtrs, const std::multimap< double, reco::CaloClusterPtr > &basicClusterPtrs, const reco::Vertex &the_pvtx, reco::ConversionCollection &outputConvPhotonCollection)
reco::TransientTrack build(const reco::Track *p) const
double zOfPrimaryVertexFromTracks(const math::XYZPoint &myBeamSpot=math::XYZPoint()) const
static ConversionAlgorithm algoByName(const std::string &name)
void buildSuperAndBasicClusterGeoMap(const edm::Event &, std::multimap< double, reco::CaloClusterPtr > &basicClusterPtrs, std::multimap< double, reco::CaloClusterPtr > &superClusterPtrs)
GlobalPoint globalPosition() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
const Point & position() const
position
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
TrajectoryStateOnSurface innermostMeasurementState() const
bool matchingSC(const std::multimap< double, reco::CaloClusterPtr > &scMap, reco::Conversion &conv, reco::CaloClusterPtrVector &mSC)
virtual GlobalPoint crossingPoint() const
virtual GlobalPoint crossingPoint() const
const math::XYZPoint & innerPosition() const
position of the innermost hit
TrackAlgorithm algo() const
static float endcapRadius()
bool isNonnull() const
Checks for non-null.
bool isNonnull() const
Checks for non-null.
double dPhi(double phi1, double phi2)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
math::XYZVectorF toFConverterV(const math::XYZVector &val)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
double chi2() const
chi-squares
float ChiSquaredProbability(double chiSquared, double nrDOF)
edm::EDGetTokenT< edm::View< reco::CaloCluster > > scEndcapProducer_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > bcBarrelCollection_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > bcEndcapCollection_
uint8_t nSharedHits(const reco::Track &trk1, const reco::Track &trk2) const
bool getMatchedBC(const std::multimap< double, reco::CaloClusterPtr > &bcMap, const math::XYZPointF &trackImpactPosition, reco::CaloClusterPtr &closestBC)
double delta_phi(double ph11, double phi2)
bool checkTrackPair(const std::pair< edm::RefToBase< reco::Track >, reco::CaloClusterPtr > &ll, const std::pair< edm::RefToBase< reco::Track >, reco::CaloClusterPtr > &rr)
bool trackQualityFilter(const edm::RefToBase< reco::Track > &ref, bool isLeft)
double deltaPhi(double phi1, double phi2)
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
const Track & track() const
double dPhicutForSCmatching_
bool trackD0Cut(const edm::RefToBase< reco::Track > &ref)
REF castTo() const
cast to a concrete type
T const * product() const
bool bypassPreselEcalEcal_
std::string ConvertedPhotonCollection_
static const float etaBarrelEndcap
static const float Z_Endcap
edm::EDGetTokenT< edm::View< reco::ConversionTrack > > src_
edm::EDGetTokenT< edm::View< reco::CaloCluster > > scBarrelProducer_
virtual bool status() const
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
unsigned short found() const
Number of valid hits on track.
static const float R_ECAL
double etaTransformation(float EtaParticle, float Zvertex)
int charge() const
track electric charge
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
math::XYZPointF toFConverterP(const math::XYZPoint &val)
virtual void produce(edm::Event &, const edm::EventSetup &)
bool preselectTrackPair(const reco::TransientTrack &ttk_l, const reco::TransientTrack &ttk_r, double &appDist)
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
value_type const * get() const
void setMatchingSuperCluster(const reco::CaloClusterPtrVector &sc)
bool checkPhi(const edm::RefToBase< reco::Track > &tk_l, const edm::RefToBase< reco::Track > &tk_r, const TrackerGeometry *trackerGeom, const MagneticField *magField, const reco::Vertex &the_vertex)
virtual bool status() const
static float barrelRadius()
double dEtacutForSCmatching_
GlobalVector globalDirection() const
ConversionProducer(const edm::ParameterSet &)
bool checkVertex(const reco::TransientTrack &ttk_l, const reco::TransientTrack &ttk_r, const MagneticField *magField, reco::Vertex &the_vertex)