New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track cuts redone #19428
Track cuts redone #19428
Changes from all commits
7dc633f
79d0797
f46fd43
b60327f
94ba37c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,25 +21,39 @@ | |
#include "DataFormats/TrackReco/interface/Track.h" | ||
#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" | ||
#include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h" | ||
#include "DataFormats/VertexReco/interface/Vertex.h" | ||
|
||
|
||
SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig) : | ||
SiPixelPhase1Base(iConfig) | ||
{ | ||
clustersToken_ = consumes<edmNew::DetSetVector<SiPixelCluster>>(iConfig.getParameter<edm::InputTag>("clusters")); | ||
|
||
tracksToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks")); | ||
|
||
offlinePrimaryVerticesToken_ = consumes<reco::VertexCollection>(std::string("offlinePrimaryVertices")); | ||
|
||
applyVertexCut_=iConfig.getUntrackedParameter<bool>("VertexCut",true); | ||
} | ||
|
||
void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { | ||
|
||
if (! (histo.size() > ONTRACK_SIZE_VS_ETA)) return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a QUICK fix. |
||
|
||
// get geometry | ||
edm::ESHandle<TrackerGeometry> tracker; | ||
iSetup.get<TrackerDigiGeometryRecord>().get(tracker); | ||
assert(tracker.isValid()); | ||
|
||
edm::Handle<reco::VertexCollection> vertices; | ||
iEvent.getByToken(offlinePrimaryVerticesToken_, vertices); | ||
|
||
if (applyVertexCut_ && (!vertices.isValid() || vertices->size() == 0)) return; | ||
|
||
//get the map | ||
edm::Handle<reco::TrackCollection> tracks; | ||
iEvent.getByToken( tracksToken_, tracks); | ||
|
||
if ( !tracks.isValid() ) { | ||
edm::LogWarning("SiPixelPhase1TrackClusters") << "track collection is not valid"; | ||
return; | ||
|
@@ -48,6 +62,7 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev | |
// get clusters | ||
edm::Handle< edmNew::DetSetVector<SiPixelCluster> > clusterColl; | ||
iEvent.getByToken( clustersToken_, clusterColl ); | ||
|
||
if ( !clusterColl.isValid() ) { | ||
edm::LogWarning("SiPixelPhase1TrackClusters") << "pixel cluster collection is not valid"; | ||
return; | ||
|
@@ -59,9 +74,12 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev | |
// corr_charge is not strictly needed but cleaner to have it. | ||
std::vector<bool> ontrack (clusterColl->data().size(), false); | ||
std::vector<float> corr_charge(clusterColl->data().size(), -1.0f); | ||
std::vector<float> etatk(clusterColl->data().size(), -1.0f); | ||
|
||
for (auto const & track : *tracks) { | ||
|
||
if (applyVertexCut_ && (track.pt() < 0.75 || std::abs( track.dxy(vertices->at(0).position()) ) > 5*track.dxyError())) continue; | ||
|
||
bool isBpixtrack = false, isFpixtrack = false, crossesPixVol=false; | ||
|
||
// find out whether track crosses pixel fiducial volume (for cosmic tracks) | ||
|
@@ -100,6 +118,7 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev | |
1.0/pow( tan(clust_beta ), 2 ) + | ||
1.0 )); | ||
corr_charge[clust.key()] = (float) corrCharge; | ||
etatk[clust.key()]=(float) track.eta(); | ||
} | ||
|
||
// statistics on tracks | ||
|
@@ -142,6 +161,7 @@ void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::Ev | |
histo[ONTRACK_SIZE ].fill(double(cluster.size() ), id, &iEvent); | ||
histo[ONTRACK_POSITION_B].fill(clustgp.z(), clustgp.phi(), id, &iEvent); | ||
histo[ONTRACK_POSITION_F].fill(clustgp.x(), clustgp.y(), id, &iEvent); | ||
histo[ONTRACK_SIZE_VS_ETA].fill(etatk[key], cluster.sizeY(), id, &iEvent); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. strickly speaking one should take into account bigpixel for instance as |
||
} else { | ||
histo[OFFTRACK_NCLUSTERS ].fill(id, &iEvent); | ||
histo[OFFTRACK_CHARGE ].fill(double(cluster.charge()), id, &iEvent); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @fioriNTU - please do the getByToken (and the consumes above) only if applyVertexCut_ is true
Also replace vertices->size()==0 by vertices->empty()