112 : m_useweight( iConfig.getParameter< bool >(
"useWeight" ) )
113 , m_useVisibleVertices( iConfig.getParameter< bool >(
"useVisibleVertices" ) )
115 , m_doubleToken( consumes< double >( iConfig.getParameter< edm::InputTag >(
"weightProduct" ) ) )
116 , m_vecPileupSummaryInfoToken( consumes< std::vector<
PileupSummaryInfo> >( iConfig.getParameter< edm::InputTag >(
"pileupSummaryCollection" ) ) )
117 , m_recoVertexCollectionToken( consumes<
reco::
VertexCollection >( iConfig.getParameter< edm::InputTag >(
"pvCollection" ) ) )
118 , m_hepMCProductToken( consumes< edm::
HepMCProduct >( iConfig.getParameter< edm::InputTag >(
"mcTruthCollection" ) ) )
126 m_hrecovsmcnvtx2d = tfserv->
make<TH2F>(
"recovsmcnvtx2d",
"Number of reco vertices vs pileup interactions",60,-0.5,59.5,60,-0.5,59.5);
128 m_hrecovsmcnvtxprof = tfserv->
make<TProfile>(
"recovsmcnvtxprof",
"Mean number of reco vs pileup vertices",60,-0.5,59.5);
131 m_hrecovsmclumi2d = tfserv->
make<TH2F>(
"recovsmclumi2d",
"Number of reco vertices vs ave pileup interactions",200,0.,50.,60,-0.5,59.5);
133 m_hrecovsmclumiprof = tfserv->
make<TProfile>(
"recovsmclumiprof",
"Mean number of reco vs ave pileup vertices",200,0.,50.);
146 m_hdeltazfirst = tfserv->
make<TH1F>(
"deltazfirst",
"Reco-MC vertex z position (first vertex)",
152 m_hdeltazclose = tfserv->
make<TH1F>(
"deltazclose",
"Reco-MC vertex z position (closest vertex)",
158 m_hclosestvtx = tfserv->
make<TH1F>(
"closestvtx",
"Closest reco vtx ID",30,-0.5,29.5);
161 m_hdeltazfirstvsnpu = tfserv->
make<TH2F>(
"deltazfirstvsnpu",
"Reco-MC vertex z position (first vertex) vs Npileup",30,-0.5,29.5,
167 m_hdeltazclosevsnpu = tfserv->
make<TH2F>(
"deltazclosevsnpu",
"Reco-MC vertex z position (closest vertex) v Npileup",30,-0.5,29.5,
173 m_hclosestvtxvsnpu = tfserv->
make<TH2F>(
"closestvtxvsnpu",
"Closest reco vtx ID vs Npileup",30,-0.5,29.5,30,-0.5,29.5);
203 weight = *weightprod;
212 std::vector<PileupSummaryInfo>::const_iterator pileupinfo;
214 for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) {
216 if(pileupinfo->getBunchCrossing()==0)
break;
228 if(pileupinfo->getBunchCrossing()!=0) {
230 edm::LogError(
"NoInTimePileUpInfo") <<
"Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing();
235 int npileup = pileupinfo->getPU_NumInteractions();
254 const HepMC::GenEvent* Evt = EvtHandle->GetEvent();
258 if(pvcoll->size() !=0) {
259 if(!(*pvcoll)[0].isFake()) {
261 if(Evt->vertices_begin() != Evt->vertices_end()) {
270 double minabsdist = -1.;
271 double mindist = -999.;
274 for(
unsigned int ivtx = 0 ; ivtx < pvcoll->size() ; ++ivtx) {
276 if(closestvtx < 0 || minabsdist >
std::abs((*pvcoll)[ivtx].
z()-(*Evt->vertices_begin())->point3d().z()/10.)) {
277 mindist = (*pvcoll)[ivtx].z()-(*Evt->vertices_begin())->point3d().z()/10.;
283 if(closestvtx >= 0) {
TProfile * m_hrecovsmclumiweightedprof
T getUntrackedParameter(std::string const &, T const &) const
TProfile * m_hrecovsmcnvtxprof
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TH2F * m_hdeltazclosevsnpu
#define DEFINE_FWK_MODULE(type)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
TH2F * m_hdeltazfirstvsnpu
std::vector< Vertex > VertexCollection
collection of Vertex objects
TH2F * m_hclosestvtxvsnpu
T * make(const Args &...args) const
make new ROOT object
edm::EDGetTokenT< reco::VertexCollection > m_recoVertexCollectionToken
TProfile * m_hrecovsmcnvtxweightedprof
Abs< T >::type abs(const T &t)
const bool m_useVisibleVertices
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
edm::EDGetTokenT< edm::HepMCProduct > m_hepMCProductToken
MCvsRecoVerticesAnalyzer(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_vecPileupSummaryInfoToken
edm::EDGetTokenT< double > m_doubleToken
~MCvsRecoVerticesAnalyzer()
const edm::ParameterSet m_histoParameters
virtual void endRun(const edm::Run &, const edm::EventSetup &)
TProfile * m_hrecovsmclumiprof