Skip to content

Commit

Permalink
Adding Vertex Recovery for peripheral events for 2018 PbPb (cms-sw#174)
Browse files Browse the repository at this point in the history
* Vertex Recovery added for 2018 PbPb data

* updated other configs

* moved checking for vtx before transientTrack builder to increase speed significantly

* changed from vString to vInputTag for mass replace to work
  • Loading branch information
abaty authored and bi-ran committed Jan 24, 2019
1 parent 40004e8 commit 6278d00
Show file tree
Hide file tree
Showing 9 changed files with 551 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,17 @@
process.rechitanalyzerpp.zdcRecHitSrc = cms.untracked.InputTag("QWzdcreco")

###############################################################################
#Recover peripheral primary vertices
#https://twiki.cern.ch/twiki/bin/view/CMS/HITracking2018PbPb#Peripheral%20Vertex%20Recovery
process.load("RecoVertex.PrimaryVertexProducer.OfflinePrimaryVerticesRecovery_cfi")


#########################
# Main analysis list
#########################

process.ana_step = cms.Path(
process.offlinePrimaryVerticesRecovery +
process.HiForest +
process.hltanalysis +
process.hltobject +
Expand Down Expand Up @@ -248,6 +253,10 @@

process.pAna = cms.EndPath(process.skimanalysis)

from HLTrigger.Configuration.CustomConfigs import MassReplaceInputTag
process = MassReplaceInputTag(process,"offlinePrimaryVertices","offlinePrimaryVerticesRecovery")
process.offlinePrimaryVerticesRecovery.oldVertexLabel = "offlinePrimaryVertices"

###############################################################################

# Customization
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,16 @@
process.load('HeavyIonsAnalysis.JetAnalysis.rechitanalyzer_cfi')

###############################################################################
#Recover peripheral primary vertices
#https://twiki.cern.ch/twiki/bin/view/CMS/HITracking2018PbPb#Peripheral%20Vertex%20Recovery
process.load("RecoVertex.PrimaryVertexProducer.OfflinePrimaryVerticesRecovery_cfi")

#########################
# Main analysis list
#########################

process.ana_step = cms.Path(
process.offlinePrimaryVerticesRecovery +
process.HiForest +
process.runAnalyzer +
process.hltanalysis +
Expand Down Expand Up @@ -251,5 +255,9 @@

process.pAna = cms.EndPath(process.skimanalysis)

from HLTrigger.Configuration.CustomConfigs import MassReplaceInputTag
process = MassReplaceInputTag(process,"offlinePrimaryVertices","offlinePrimaryVerticesRecovery")
process.offlinePrimaryVerticesRecovery.oldVertexLabel = "offlinePrimaryVertices"

# Customization
###############################################################################
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,16 @@
process.load('HeavyIonsAnalysis.JetAnalysis.rechitanalyzer_cfi')

###############################################################################
#Recover peripheral primary vertices
#https://twiki.cern.ch/twiki/bin/view/CMS/HITracking2018PbPb#Peripheral%20Vertex%20Recovery
process.load("RecoVertex.PrimaryVertexProducer.OfflinePrimaryVerticesRecovery_cfi")

#########################
# Main analysis list
#########################

process.ana_step = cms.Path(
process.offlinePrimaryVerticesRecovery +
process.HiForest +
process.runAnalyzer +
process.hltanalysis +
Expand Down Expand Up @@ -249,5 +253,8 @@

process.pAna = cms.EndPath(process.skimanalysis)

from HLTrigger.Configuration.CustomConfigs import MassReplaceInputTag
process = MassReplaceInputTag(process,"offlinePrimaryVertices","offlinePrimaryVerticesRecovery")
process.offlinePrimaryVerticesRecovery.oldVertexLabel = "offlinePrimaryVertices"
# Customization
###############################################################################
2 changes: 1 addition & 1 deletion HeavyIonsAnalysis/TrackAnalysis/python/TrkAnalyzers_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
anaTrack = ppTrack.clone(
trackPtMin = 0.49,
trackSrc = cms.InputTag("hiGeneralTracks"),
vertexSrc = cms.vstring('hiSelectedVertex'),
vertexSrc = cms.VInputTag('hiSelectedVertex'),
mvaSrc = cms.InputTag('hiGeneralTracks','MVAVals'),
pfCandSrc = cms.InputTag("particleFlowTmp"),
doMVA = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'TrackAnalyzer',
trackPtMin = cms.untracked.double(0.01),
simTrackPtMin = cms.untracked.double(0.1),
vertexSrc = cms.vstring('offlinePrimaryVertices'),
vertexSrc = cms.VInputTag('offlinePrimaryVertices'),
trackSrc = cms.InputTag('generalTracks'),
mvaSrc = cms.InputTag("generalTracks","MVAValues"),
particleSrc = cms.InputTag('genParticles'),
Expand Down
2 changes: 1 addition & 1 deletion HeavyIonsAnalysis/TrackAnalysis/src/TrackAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ TrackAnalyzer::TrackAnalyzer(const edm::ParameterSet& iConfig)
associatorMapRS_ = consumes<reco::RecoToSimCollection>(iConfig.getParameter<edm::InputTag>("associatorMap"));
}

std::vector<std::string> vertexSrcString_ = iConfig.getParameter<std::vector<std::string>>("vertexSrc");
std::vector<edm::InputTag> vertexSrcString_ = iConfig.getParameter<std::vector<edm::InputTag>>("vertexSrc");
for (const auto& src : vertexSrcString_) {
vertexSrc_.push_back(consumes<reco::VertexCollection>(edm::InputTag(src)));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// -*- C++ -*-
//
// Package: PrimaryVertexProducer
// Class: PrimaryVertexProducer
//
/**\class PrimaryVertexProducer PrimaryVertexProducer.cc RecoVertex/PrimaryVertexProducer/src/PrimaryVertexProducer.cc
Description: steers tracker primary vertex reconstruction and storage
Implementation:
<Notes on implementation>
*/
//
// Original Author: Pascal Vanlaer
// Created: Tue Feb 28 11:06:34 CET 2006
//
//


// system include files
#include <memory>

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"

//#include "RecoVertex/PrimaryVertexProducer/interface/PrimaryVertexProducerAlgorithm.h"
#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
#include "RecoVertex/PrimaryVertexProducer/interface/TrackFilterForPVFindingBase.h"
#include "RecoVertex/PrimaryVertexProducer/interface/TrackClusterizerInZ.h"
#include "RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZ_vect.h"
#include "RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZT_vect.h"


#include "RecoVertex/PrimaryVertexProducer/interface/TrackFilterForPVFinding.h"
#include "RecoVertex/PrimaryVertexProducer/interface/HITrackFilterForPVFinding.h"
#include "RecoVertex/PrimaryVertexProducer/interface/GapClusterizerInZ.h"
#include "RecoVertex/PrimaryVertexProducer/interface/DAClusterizerInZ.h"
#include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h"
#include "RecoVertex/AdaptiveVertexFit/interface/AdaptiveVertexFitter.h"
//#include "RecoVertex/VertexTools/interface/VertexDistanceXY.h"
#include "RecoVertex/VertexPrimitives/interface/VertexException.h"
#include <algorithm>
#include "RecoVertex/PrimaryVertexProducer/interface/VertexHigherPtSquared.h"
#include "RecoVertex/VertexTools/interface/VertexCompatibleWithBeam.h"
#include "DataFormats/Common/interface/ValueMap.h"
#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
//
// class declaration
//

class PrimaryVertexRecoveryProducer : public edm::stream::EDProducer<> {
public:
PrimaryVertexRecoveryProducer(const edm::ParameterSet&);
~PrimaryVertexRecoveryProducer() override;

void produce(edm::Event&, const edm::EventSetup&) override;

// access to config
edm::ParameterSet config() const { return theConfig; }

private:
// ----------member data ---------------------------
TrackFilterForPVFindingBase* theTrackFilter;
TrackClusterizerInZ* theTrackClusterizer;

// vtx fitting algorithms
struct algo {
VertexFitter<5> * fitter;
VertexCompatibleWithBeam * vertexSelector;
std::string label;
bool useBeamConstraint;
double minNdof;
};

std::vector< algo > algorithms;

edm::ParameterSet theConfig;
bool fVerbose;

edm::EDGetTokenT<reco::BeamSpot> bsToken;
bool redoAllVertices;
edm::EDGetTokenT<reco::VertexCollection> oldVtxToken;
edm::EDGetTokenT<reco::TrackCollection> trkToken;
edm::EDGetTokenT<edm::ValueMap<float> > trkTimesToken;
edm::EDGetTokenT<edm::ValueMap<float> > trkTimeResosToken;

bool f4D;
};
Loading

0 comments on commit 6278d00

Please sign in to comment.