120 usesResource(
"TFileService");
123 m_hrecovsmcnvtx2d = tfserv->
make<TH2F>(
"recovsmcnvtx2d",
"Number of reco vertices vs pileup interactions",60,-0.5,59.5,60,-0.5,59.5);
125 m_hrecovsmcnvtxprof = tfserv->
make<TProfile>(
"recovsmcnvtxprof",
"Mean number of reco vs pileup vertices",60,-0.5,59.5);
128 m_hrecovsmclumi2d = tfserv->
make<TH2F>(
"recovsmclumi2d",
"Number of reco vertices vs ave pileup interactions",200,0.,50.,60,-0.5,59.5);
130 m_hrecovsmclumiprof = tfserv->
make<TProfile>(
"recovsmclumiprof",
"Mean number of reco vs ave pileup vertices",200,0.,50.);
143 m_hdeltazfirst = tfserv->
make<TH1F>(
"deltazfirst",
"Reco-MC vertex z position (first vertex)",
149 m_hdeltazclose = tfserv->
make<TH1F>(
"deltazclose",
"Reco-MC vertex z position (closest vertex)",
155 m_hclosestvtx = tfserv->
make<TH1F>(
"closestvtx",
"Closest reco vtx ID",30,-0.5,29.5);
158 m_hdeltazfirstvsnpu = tfserv->
make<TH2F>(
"deltazfirstvsnpu",
"Reco-MC vertex z position (first vertex) vs Npileup",30,-0.5,29.5,
164 m_hdeltazclosevsnpu = tfserv->
make<TH2F>(
"deltazclosevsnpu",
"Reco-MC vertex z position (closest vertex) v Npileup",30,-0.5,29.5,
170 m_hclosestvtxvsnpu = tfserv->
make<TH2F>(
"closestvtxvsnpu",
"Closest reco vtx ID vs Npileup",30,-0.5,29.5,30,-0.5,29.5);
200 weight = *weightprod;
209 std::vector<PileupSummaryInfo>::const_iterator pileupinfo;
211 for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) {
213 if(pileupinfo->getBunchCrossing()==0)
break;
225 if(pileupinfo->getBunchCrossing()!=0) {
227 edm::LogError(
"NoInTimePileUpInfo") <<
"Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing();
232 int npileup = pileupinfo->getPU_NumInteractions();
251 const HepMC::GenEvent* Evt = EvtHandle->
GetEvent();
255 if(pvcoll->size() !=0) {
256 if(!(*pvcoll)[0].isFake()) {
258 if(Evt->vertices_begin() != Evt->vertices_end()) {
267 double minabsdist = -1.;
268 double mindist = -999.;
271 for(
unsigned int ivtx = 0 ; ivtx < pvcoll->size() ; ++ivtx) {
273 if(closestvtx < 0 || minabsdist >
std::abs((*pvcoll)[ivtx].
z()-(*Evt->vertices_begin())->point3d().z()/10.)) {
274 mindist = (*pvcoll)[ivtx].z()-(*Evt->vertices_begin())->point3d().z()/10.;
280 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)
TH2F * m_hdeltazfirstvsnpu
std::vector< Vertex > VertexCollection
collection of Vertex objects
TH2F * m_hclosestvtxvsnpu
T * make(const Args &...args) const
make new ROOT object
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::VertexCollection > m_recoVertexCollectionToken
TProfile * m_hrecovsmcnvtxweightedprof
Abs< T >::type abs(const T &t)
const bool m_useVisibleVertices
edm::EDGetTokenT< edm::HepMCProduct > m_hepMCProductToken
MCvsRecoVerticesAnalyzer(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > m_vecPileupSummaryInfoToken
const HepMC::GenEvent * GetEvent() const
edm::EDGetTokenT< double > m_doubleToken
~MCvsRecoVerticesAnalyzer()
const edm::ParameterSet m_histoParameters
TProfile * m_hrecovsmclumiprof