Skip to content

Commit

Permalink
minor cleanup and variable name rationalization
Browse files Browse the repository at this point in the history
  • Loading branch information
bendavid committed Sep 19, 2017
1 parent bf86758 commit 2e974d5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
16 changes: 8 additions & 8 deletions CommonTools/RecoAlgos/src/PrimaryVertexAssignment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ PrimaryVertexAssignment::chargedHadronVertex( const reco::VertexCollection& vert
double distmin = std::numeric_limits<double>::max();
double dzmin = std::numeric_limits<double>::max();
double dtmin = std::numeric_limits<double>::max();
int vtxIdMinDist = -1;
int vtxIdMinSignif = -1;
for(IV iv=vertices.begin(); iv!=vertices.end(); ++iv) {
double dz = std::abs(track->dz(iv->position()));
double dt = std::abs(time-iv->t());
Expand All @@ -82,18 +82,18 @@ PrimaryVertexAssignment::chargedHadronVertex( const reco::VertexCollection& vert
distmin = dist;
dzmin = dz;
dtmin = dt;
vtxIdMinDist = iv-vertices.begin();
vtxIdMinSignif = iv-vertices.begin();
}
}

// first use "closest in Z" with tight cuts (targetting primary particles)
const float add_cov = vtxIdMinDist >= 0 ? vertices[vtxIdMinDist].covariance(2,2) : 0.f;
const float add_cov = vtxIdMinSignif >= 0 ? vertices[vtxIdMinSignif].covariance(2,2) : 0.f;
const float dzE=sqrt(track->dzError()*track->dzError()+add_cov);
if(vtxIdMinDist>=0 and
if(vtxIdMinSignif>=0 and
(dzmin < maxDzForPrimaryAssignment_ and dzmin/dzE < maxDzSigForPrimaryAssignment_ and track->dzError()<maxDzErrorForPrimaryAssignment_) and
(!useTime or dtmin/timeReso < maxDtSigForPrimaryAssignment_) )
{
iVertex=vtxIdMinDist;
iVertex=vtxIdMinSignif;
}

if(iVertex >= 0 ) return std::pair<int,PrimaryVertexAssignment::Quality>(iVertex,PrimaryVertexAssignment::PrimaryDz);
Expand Down Expand Up @@ -147,13 +147,13 @@ PrimaryVertexAssignment::chargedHadronVertex( const reco::VertexCollection& vert
// if the track is not compatible with other PVs but is compatible with the BeamSpot, we may simply have not reco'ed the PV!
// we still point it to the closest in Z, but flag it as possible orphan-primary
if(!vertices.empty() && std::abs(track->dxy(vertices[0].position()))<maxDxyForNotReconstructedPrimary_ && std::abs(track->dxy(vertices[0].position())/track->dxyError())<maxDxySigForNotReconstructedPrimary_)
return std::pair<int,PrimaryVertexAssignment::Quality>(vtxIdMinDist,PrimaryVertexAssignment::NotReconstructedPrimary);
return std::pair<int,PrimaryVertexAssignment::Quality>(vtxIdMinSignif,PrimaryVertexAssignment::NotReconstructedPrimary);

//FIXME: here we could better handle V0s and NucInt

// all other tracks could be non-B secondaries and we just attach them with closest Z
if(vtxIdMinDist>=0)
return std::pair<int,PrimaryVertexAssignment::Quality>(vtxIdMinDist,PrimaryVertexAssignment::OtherDz);
if(vtxIdMinSignif>=0)
return std::pair<int,PrimaryVertexAssignment::Quality>(vtxIdMinSignif,PrimaryVertexAssignment::OtherDz);
//If for some reason even the dz failed (when?) we consider the track not assigned
return std::pair<int,PrimaryVertexAssignment::Quality>(-1,PrimaryVertexAssignment::Unassigned);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class TrackTimeValueMapProducer : public edm::global::EDProducer<> {
DEFINE_FWK_MODULE(TrackTimeValueMapProducer);

namespace {
constexpr float fakeBeamSpotTimeWidth = 0.300f; // ns
constexpr float m_pion = 139.57061e-3;
const std::string resolution("Resolution");

Expand Down
18 changes: 9 additions & 9 deletions TrackingTools/TransientTrack/src/TransientTrackBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using namespace std;
using namespace edm;

namespace {
constexpr float fakeBeamSpotTimeWidth = 0.175f;
constexpr float defaultInvalidTrackReso = 0.350f;
}

TransientTrack TransientTrackBuilder::build (const Track * t) const {
Expand Down Expand Up @@ -106,10 +106,10 @@ TransientTrackBuilder::build ( const edm::Handle<reco::TrackCollection> & trkCol
TrackRef ref(trkColl, i);
double time = trackTimes[ref];
double timeReso = trackTimeResos[ref];
timeReso = ( timeReso > 1e-6 ? timeReso : 2.0*fakeBeamSpotTimeWidth ); // make the error much larger than the BS time width
timeReso = ( timeReso > 1e-6 ? timeReso : defaultInvalidTrackReso ); // make the error much larger than the BS time width
if( edm::isNotFinite(time) ) {
time = 0.0;
timeReso = 2.0*fakeBeamSpotTimeWidth;
timeReso = defaultInvalidTrackReso;
}
ttVect.push_back(TransientTrack(ref, time, timeReso, theField, theTrackingGeometry));
}
Expand All @@ -127,10 +127,10 @@ TransientTrackBuilder::build (const edm::Handle<reco::GsfTrackCollection> & trkC
GsfTrackRef ref(trkColl, i);
double time = trackTimes[ref];
double timeReso = trackTimeResos[ref];
timeReso = ( timeReso > 1e-6 ? timeReso : 2.0*fakeBeamSpotTimeWidth ); // make the error much larger than the BS time width
timeReso = ( timeReso > 1e-6 ? timeReso : defaultInvalidTrackReso ); // make the error much larger than the BS time width
if( edm::isNotFinite(time) ) {
time = 0.0;
timeReso = 2.0*fakeBeamSpotTimeWidth;
timeReso = defaultInvalidTrackReso;
}
ttVect.push_back( TransientTrack(
new GsfTransientTrack(ref, time, timeReso, theField, theTrackingGeometry)) );
Expand All @@ -152,21 +152,21 @@ TransientTrackBuilder::build (const edm::Handle<edm::View<Track> > & trkColl,
GsfTrackRef ref = RefToBase<Track>(trkColl, i).castTo<GsfTrackRef>();
double time = trackTimes[ref];
double timeReso = trackTimeResos[ref];
timeReso = ( timeReso > 1e-6 ? timeReso : 2.0*fakeBeamSpotTimeWidth ); // make the error much larger than the BS time width
timeReso = ( timeReso > 1e-6 ? timeReso : defaultInvalidTrackReso ); // make the error much larger than the BS time width
if( edm::isNotFinite(time) ) {
time = 0.0;
timeReso = 2.0*fakeBeamSpotTimeWidth;
timeReso = defaultInvalidTrackReso;
}
ttVect.push_back( TransientTrack(
new GsfTransientTrack(RefToBase<Track>(trkColl, i).castTo<GsfTrackRef>(), time, timeReso, theField, theTrackingGeometry)) );
} else { // gsf
TrackRef ref = RefToBase<Track>(trkColl, i).castTo<TrackRef>();
double time = trackTimes[ref];
double timeReso = trackTimeResos[ref];
timeReso = ( timeReso > 1e-6 ? timeReso : 2.0*fakeBeamSpotTimeWidth ); // make the error much larger than the BS time width
timeReso = ( timeReso > 1e-6 ? timeReso : defaultInvalidTrackReso ); // make the error much larger than the BS time width
if( edm::isNotFinite(time) ) {
time = 0.0;
timeReso = 2.0*fakeBeamSpotTimeWidth;
timeReso = defaultInvalidTrackReso;
}
ttVect.push_back(TransientTrack(RefToBase<Track>(trkColl, i).castTo<TrackRef>(), time, timeReso, theField, theTrackingGeometry));
}
Expand Down

0 comments on commit 2e974d5

Please sign in to comment.