CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
PrimaryVertexAnalyzer4PUSlimmed Class Reference

#include <Validation/RecoVertex/src/PrimaryVertexAnalyzer4PUSlimmed.cc>

Inheritance diagram for PrimaryVertexAnalyzer4PUSlimmed:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  recoPrimaryVertex
 
struct  simPrimaryVertex
 

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 PrimaryVertexAnalyzer4PUSlimmed (const edm::ParameterSet &)
 
 ~PrimaryVertexAnalyzer4PUSlimmed ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef math::XYZTLorentzVector LorentzVector
 
enum  SignalVertexKind { HIGHEST_PT = 0, IS_ASSOC2FIRST_RECO = 1, IS_ASSOC2ANY_RECO = 2 }
 

Private Member Functions

template<class T >
void computePairDistance (const T &collection, MonitorElement *me)
 
void fillGenAssociatedRecoVertexHistograms (const std::string &, int, recoPrimaryVertex &v)
 
void fillGenericGenVertexHistograms (const simPrimaryVertex &v)
 
void fillRecoAssociatedGenVertexHistograms (const std::string &, const simPrimaryVertex &v)
 
std::vector
< PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex
getRecoPVs (const edm::Handle< reco::VertexCollection >)
 
std::vector
< PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex
getSimPVs (const edm::Handle< TrackingVertexCollection >)
 
void matchReco2SimVertices (std::vector< recoPrimaryVertex > &, const TrackingVertexCollection &, const std::vector< simPrimaryVertex > &)
 
void matchSim2RecoVertices (std::vector< simPrimaryVertex > &, const reco::VertexCollection &)
 
void resetSimPVAssociation (std::vector< simPrimaryVertex > &)
 

Private Attributes

double abs_z_match_
 
const TrackAssociatorBaseassociatorByHits_
 
edm::EDGetTokenT< edm::View
< reco::Track > > 
edmView_recoTrack_Token_
 
std::map< std::string,
std::map< std::string,
MonitorElement * > > 
mes_
 
reco::RecoToSimCollection r2s_
 
std::vector< edm::EDGetTokenT
< reco::VertexCollection > > 
reco_vertex_collection_tokens_
 
std::vector< edm::InputTagreco_vertex_collections_
 
edm::EDGetTokenT
< reco::TrackCollection
recoTrackCollectionToken_
 
std::string root_folder_
 
reco::SimToRecoCollection s2r_
 
double sigma_z_match_
 
edm::EDGetTokenT
< TrackingParticleCollection
trackingParticleCollectionToken_
 
edm::EDGetTokenT
< TrackingVertexCollection
trackingVertexCollectionToken_
 
bool use_only_charged_tracks_
 
bool use_TP_associator_
 
edm::EDGetTokenT< std::vector
< PileupSummaryInfo > > 
vecPileupSummaryInfoToken_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: primary vertex analyzer for events with pile-up

Implementation: <Notes on="" implementation>="">

Definition at line 60 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Member Typedef Documentation

Definition at line 61 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

PrimaryVertexAnalyzer4PUSlimmed::PrimaryVertexAnalyzer4PUSlimmed ( const edm::ParameterSet iConfig)
explicit

Definition at line 25 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References edm::ParameterSet::getParameter(), prof2calltree::l, reco_vertex_collection_tokens_, and reco_vertex_collections_.

27  : verbose_(iConfig.getUntrackedParameter<bool>("verbose", false)),
29  "use_only_charged_tracks", true)),
31  iConfig.getUntrackedParameter<bool>("use_TP_associator", false)),
33  iConfig.getUntrackedParameter<double>("sigma_z_match", 3.0)),
35  iConfig.getUntrackedParameter<double>("abs_z_match", 0.1)),
37  iConfig.getUntrackedParameter<std::string>("root_folder",
38  "Validation/Vertices")),
39  vecPileupSummaryInfoToken_(consumes<std::vector<PileupSummaryInfo> >(
40  edm::InputTag(std::string("addPileupInfo")))),
41  recoTrackCollectionToken_(consumes<reco::TrackCollection>(edm::InputTag(
42  iConfig.getUntrackedParameter<std::string>("recoTrackProducer")))),
44  iConfig.getUntrackedParameter<std::string>("recoTrackProducer")))),
45  trackingParticleCollectionToken_(consumes<TrackingParticleCollection>(
46  edm::InputTag(std::string("mix"), std::string("MergedTrackTruth")))),
47  trackingVertexCollectionToken_(consumes<TrackingVertexCollection>(
48  edm::InputTag(std::string("mix"), std::string("MergedTrackTruth")))) {
49  reco_vertex_collections_ = iConfig.getParameter<std::vector<edm::InputTag> >(
50  "vertexRecoCollections");
51  for (auto const& l : reco_vertex_collections_) {
54  consumes<reco::VertexCollection>(l)));
55  }
56 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< reco::Track > > edmView_recoTrack_Token_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > vecPileupSummaryInfoToken_
edm::EDGetTokenT< reco::TrackCollection > recoTrackCollectionToken_
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollectionToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< edm::EDGetTokenT< reco::VertexCollection > > reco_vertex_collection_tokens_
std::vector< edm::InputTag > reco_vertex_collections_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleCollectionToken_
PrimaryVertexAnalyzer4PUSlimmed::~PrimaryVertexAnalyzer4PUSlimmed ( )

Definition at line 58 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

58 {}

Member Function Documentation

void PrimaryVertexAnalyzer4PUSlimmed::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 950 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References TrackAssociatorBase::associateRecoToSim(), TrackAssociatorBase::associateSimToReco(), associatorByHits_, begin, computePairDistance(), gather_cfg::cout, edmView_recoTrack_Token_, end, HcalObjRepresent::Fill(), fillGenAssociatedRecoVertexHistograms(), fillGenericGenVertexHistograms(), fillRecoAssociatedGenVertexHistograms(), spr::find(), edm::EventSetup::get(), edm::Event::getByToken(), getRecoPVs(), getSimPVs(), HIGHEST_PT, IS_ASSOC2ANY_RECO, IS_ASSOC2FIRST_RECO, diffTwoXMLs::label, matchReco2SimVertices(), matchSim2RecoVertices(), mes_, AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< class >::product(), r2s_, dt_dqm_sourceclient_common_cff::reco, reco_vertex_collection_tokens_, reco_vertex_collections_, recoTrackCollectionToken_, resetSimPVAssociation(), s2r_, AlCaHLTBitMon_QueryRunRegistry::string, trackingParticleCollectionToken_, trackingVertexCollectionToken_, use_TP_associator_, findQualityFiles::v, vecPileupSummaryInfoToken_, and verbose_.

951  {
952  using std::vector;
953  using std::cout;
954  using std::endl;
955  using edm::Handle;
956  using edm::View;
957  using edm::LogInfo;
958  using namespace reco;
959 
960  std::vector<float> pileUpInfo_z;
961 
962  // get the pileup information
964  if (iEvent.getByToken(vecPileupSummaryInfoToken_, puinfoH)) {
965  for (auto const& pu_info : *puinfoH.product()) {
966  mes_["root_folder"]["GenVtx_vs_BX"]
967  ->Fill(pu_info.getBunchCrossing(), pu_info.getPU_NumInteractions());
968  if (pu_info.getBunchCrossing() == 0) {
969  pileUpInfo_z = pu_info.getPU_zpositions();
970  if (verbose_) {
971  for (auto const& p : pileUpInfo_z) {
972  std::cout << "PileUpInfo on Z vertex: " << p << std::endl;
973  }
974  }
975  break;
976  }
977  }
978  }
979 
980  Handle<reco::TrackCollection> recTrks;
981  iEvent.getByToken(recoTrackCollectionToken_, recTrks);
982 
983  // for the associator
984  Handle<View<Track> > trackCollectionH;
985  iEvent.getByToken(edmView_recoTrack_Token_, trackCollectionH);
986 
989  bool gotTP =
990  iEvent.getByToken(trackingParticleCollectionToken_, TPCollectionH);
991  bool gotTV = iEvent.getByToken(trackingVertexCollectionToken_, TVCollectionH);
992 
993  // TODO(rovere) the idea is to put in case a track-selector in front
994  // of this module and then use its label to get the selected tracks
995  // out of the event instead of making an hard-coded selection in the
996  // code.
997 
998  if (gotTP) {
999  // TODO(rovere) fetch an already existing collection from the
1000  // event instead of making another association on the fly???
1001  if (use_TP_associator_) {
1002  edm::ESHandle<TrackAssociatorBase> theHitsAssociator;
1003  iSetup.get<TrackAssociatorRecord>().get("TrackAssociatorByHits",
1004  theHitsAssociator);
1005  associatorByHits_ = reinterpret_cast<const TrackAssociatorBase*>(
1006  theHitsAssociator.product());
1008  trackCollectionH, TPCollectionH, &iEvent, &iSetup);
1010  trackCollectionH, TPCollectionH, &iEvent, &iSetup);
1011  }
1012  }
1013 
1014  std::vector<simPrimaryVertex> simpv; // a list of simulated primary
1015  // MC vertices
1016  // TODO(rovere) use move semantic?
1017  simpv = getSimPVs(TVCollectionH);
1018  // TODO(rovere) 1 vertex is not, by definition, pileup, and should
1019  // probably be subtracted?
1020  int kind_of_signal_vertex = 0;
1021  int num_pileup_vertices = simpv.size();
1022  mes_["root_folder"]["GenAllV_NumVertices"]->Fill(simpv.size());
1023  bool signal_is_highest_pt = std::max_element(simpv.begin(), simpv.end(),
1024  [](const simPrimaryVertex& lhs,
1025  const simPrimaryVertex& rhs) {
1026  return lhs.ptsq < rhs.ptsq;
1027  }) == simpv.begin();
1028  kind_of_signal_vertex = (kind_of_signal_vertex & ~(1<<HIGHEST_PT)) |
1029  (signal_is_highest_pt << HIGHEST_PT);
1030  mes_["root_folder"]["SignalIsHighestPt2"]->Fill(
1031  signal_is_highest_pt ? 1. : 0.);
1032  computePairDistance(simpv,
1033  mes_["root_folder"]["GenAllV_PairDistanceZ"]);
1034 
1035  int label_index = -1;
1036  for (auto const& vertex_token : reco_vertex_collection_tokens_) {
1037  std::vector<recoPrimaryVertex> recopv; // a list of reconstructed
1038  // primary MC vertices
1039  std::string label = reco_vertex_collections_[++label_index].label();
1040  Handle<reco::VertexCollection> recVtxs;
1041  if (!iEvent.getByToken(vertex_token, recVtxs)) {
1042  LogInfo("PrimaryVertexAnalyzer4PUSlimmed")
1043  << "Skipping vertex collection: " << label << " since it is missing."
1044  << std::endl;
1045  continue;
1046  }
1047  if (gotTV) {
1048  resetSimPVAssociation(simpv);
1049  matchSim2RecoVertices(simpv, *recVtxs.product());
1050  recopv = getRecoPVs(recVtxs);
1051  computePairDistance(recopv,
1052  mes_[label]["RecoAllAssoc2Gen_PairDistanceZ"]);
1053  matchReco2SimVertices(recopv, *TVCollectionH.product(), simpv);
1054  }
1055 
1056  int num_total_gen_vertices_assoc2reco = 0;
1057  int num_total_reco_vertices_assoc2gen = 0;
1058  int num_total_gen_vertices_multiassoc2reco = 0;
1059  int num_total_reco_vertices_multiassoc2gen = 0;
1060  int num_total_reco_vertices_duplicate = 0;
1061  for (auto const& v : simpv) {
1062  float mistag = 0.;
1063  // TODO(rovere) put selectors here in front of fill* methods.
1064  if (v.eventId.event() == 0) {
1065  if (std::find(v.rec_vertices.begin(), v.rec_vertices.end(),
1066  &((*recVtxs.product())[0])) != v.rec_vertices.end()) {
1067  mistag = 1.;
1068  kind_of_signal_vertex =
1069  (kind_of_signal_vertex & ~(1<<IS_ASSOC2FIRST_RECO)) |
1070  (signal_is_highest_pt << IS_ASSOC2FIRST_RECO);
1071  } else {
1072  if (v.rec_vertices.size()) {
1073  kind_of_signal_vertex =
1074  (kind_of_signal_vertex & ~(1<<IS_ASSOC2ANY_RECO)) |
1075  (signal_is_highest_pt << IS_ASSOC2ANY_RECO);
1076  }
1077  }
1078  mes_[label]["KindOfSignalPV"]->Fill(kind_of_signal_vertex);
1079  mes_[label]["MisTagRate"]->Fill(mistag);
1080  mes_[label]["MisTagRate_vs_PU"]->Fill(simpv.size(), mistag);
1081  mes_[label]["MisTagRate_vs_sum-pt2"]->Fill(v.ptsq, mistag);
1082  mes_[label]["MisTagRate_vs_Z"]->Fill(v.z, mistag);
1083  mes_[label]["MisTagRate_vs_R"]->Fill(v.r, mistag);
1084  mes_[label]["MisTagRate_vs_NumTracks"]->Fill(v.nGenTrk, mistag);
1085  if (signal_is_highest_pt) {
1086  mes_[label]["MisTagRateSignalIsHighest"]->Fill(mistag);
1087  mes_[label]["MisTagRateSignalIsHighest_vs_PU"]->Fill(simpv.size(),
1088  mistag);
1089  mes_[label]["MisTagRateSignalIsHighest_vs_sum-pt2"]->Fill(v.ptsq,
1090  mistag);
1091  mes_[label]["MisTagRateSignalIsHighest_vs_Z"]->Fill(v.z, mistag);
1092  mes_[label]["MisTagRateSignalIsHighest_vs_R"]->Fill(v.r, mistag);
1093  mes_[label]["MisTagRateSignalIsHighest_vs_NumTracks"]->Fill(v.nGenTrk,
1094  mistag);
1095  } else {
1096  mes_[label]["MisTagRateSignalIsNotHighest"]->Fill(mistag);
1097  mes_[label]["MisTagRateSignalIsNotHighest_vs_PU"]->Fill(simpv.size(),
1098  mistag);
1099  mes_[label]["MisTagRateSignalIsNotHighest_vs_sum-pt2"]->Fill(v.ptsq,
1100  mistag);
1101  mes_[label]["MisTagRateSignalIsNotHighest_vs_Z"]->Fill(v.z, mistag);
1102  mes_[label]["MisTagRateSignalIsNotHighest_vs_R"]->Fill(v.r, mistag);
1103  mes_[label]["MisTagRateSignalIsNotHighest_vs_NumTracks"]->
1104  Fill(v.nGenTrk, mistag);
1105  }
1106  // Now check at which location the Simulated PV has been
1107  // reconstructed in the primary vertex collection
1108  // at-hand. Mark it with fake index -1 if it was not
1109  // reconstructed at all.
1110 
1111  auto iv = (*recVtxs.product()).begin();
1112  for (int pv_position_in_reco_collection = 0;
1113  iv != (*recVtxs.product()).end();
1114  ++pv_position_in_reco_collection, ++iv) {
1115  if (std::find(v.rec_vertices.begin(), v.rec_vertices.end(),
1116  &(*iv)) != v.rec_vertices.end()) {
1117  mes_[label]["TruePVLocationIndex"]
1118  ->Fill(pv_position_in_reco_collection);
1119  mes_[label]["TruePVLocationIndexCumulative"]
1120  ->Fill(pv_position_in_reco_collection > 0 ? 1 : 0);
1121  if (signal_is_highest_pt) {
1122  mes_[label]["TruePVLocationIndexSignalIsHighest"]
1123  ->Fill(pv_position_in_reco_collection);
1124  } else {
1125  mes_[label]["TruePVLocationIndexSignalIsNotHighest"]
1126  ->Fill(pv_position_in_reco_collection);
1127  }
1128  break;
1129  }
1130  }
1131 
1132  // If we reached the end, it means that the Simulated PV has not
1133  // been associated to any reconstructed vertex: mark it as
1134  // missing in the reconstructed vertex collection using the fake
1135  // index -1.
1136  if (iv == (*recVtxs.product()).end()) {
1137  mes_[label]["TruePVLocationIndex"]->Fill(-1.);
1138  if (signal_is_highest_pt)
1139  mes_[label]["TruePVLocationIndexSignalIsHighest"]->Fill(-1.);
1140  else
1141  mes_[label]["TruePVLocationIndexSignalIsNotHighest"]->Fill(-1.);
1142  }
1143  }
1144 
1145  if (v.rec_vertices.size()) num_total_gen_vertices_assoc2reco++;
1146  if (v.rec_vertices.size() > 1) num_total_gen_vertices_multiassoc2reco++;
1147  // No need to N-tplicate the Gen-related cumulative histograms:
1148  // fill them only at the first iteration
1149  if (label_index == 0) fillGenericGenVertexHistograms(v);
1151  }
1152  mes_[label]["GenAllAssoc2Reco_NumVertices"]
1153  ->Fill(simpv.size(), simpv.size());
1154  mes_[label]["GenAllAssoc2RecoMatched_NumVertices"]
1155  ->Fill(simpv.size(), num_total_gen_vertices_assoc2reco);
1156  mes_[label]["GenAllAssoc2RecoMultiMatched_NumVertices"]
1157  ->Fill(simpv.size(), num_total_gen_vertices_multiassoc2reco);
1158  for (auto & v : recopv) {
1159  fillGenAssociatedRecoVertexHistograms(label, num_pileup_vertices, v);
1160  if (v.sim_vertices.size()) {
1161  num_total_reco_vertices_assoc2gen++;
1162  if (v.sim_vertices_internal[0]->rec_vertices.size() > 1) {
1163  num_total_reco_vertices_duplicate++;
1164  }
1165  }
1166  if (v.sim_vertices.size() > 1) num_total_reco_vertices_multiassoc2gen++;
1167  }
1168  mes_[label]["RecoAllAssoc2Gen_NumVertices"]
1169  ->Fill(recopv.size(), recopv.size());
1170  mes_[label]["RecoAllAssoc2GenMatched_NumVertices"]
1171  ->Fill(recopv.size(), num_total_reco_vertices_assoc2gen);
1172  mes_[label]["RecoAllAssoc2GenMultiMatched_NumVertices"]
1173  ->Fill(recopv.size(), num_total_reco_vertices_multiassoc2gen);
1174  mes_[label]["RecoAllAssoc2MultiMatchedGen_NumVertices"]
1175  ->Fill(recopv.size(), num_total_reco_vertices_duplicate);
1176  mes_[label]["RecoVtx_vs_GenVtx"]->Fill(simpv.size(), recopv.size());
1177  mes_[label]["MatchedRecoVtx_vs_GenVtx"]
1178  ->Fill(simpv.size(), num_total_reco_vertices_assoc2gen);
1179  }
1180 } // end of analyze
void matchSim2RecoVertices(std::vector< simPrimaryVertex > &, const reco::VertexCollection &)
void fillGenAssociatedRecoVertexHistograms(const std::string &, int, recoPrimaryVertex &v)
edm::EDGetTokenT< edm::View< reco::Track > > edmView_recoTrack_Token_
void resetSimPVAssociation(std::vector< simPrimaryVertex > &)
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > vecPileupSummaryInfoToken_
void computePairDistance(const T &collection, MonitorElement *me)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::EDGetTokenT< reco::TrackCollection > recoTrackCollectionToken_
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollectionToken_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex > getSimPVs(const edm::Handle< TrackingVertexCollection >)
std::vector< PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex > getRecoPVs(const edm::Handle< reco::VertexCollection >)
std::vector< edm::EDGetTokenT< reco::VertexCollection > > reco_vertex_collection_tokens_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
#define end
Definition: vmac.h:37
virtual reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
void fillGenericGenVertexHistograms(const simPrimaryVertex &v)
virtual reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
void matchReco2SimVertices(std::vector< recoPrimaryVertex > &, const TrackingVertexCollection &, const std::vector< simPrimaryVertex > &)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
void fillRecoAssociatedGenVertexHistograms(const std::string &, const simPrimaryVertex &v)
std::vector< edm::InputTag > reco_vertex_collections_
#define begin
Definition: vmac.h:30
std::map< std::string, std::map< std::string, MonitorElement * > > mes_
tuple cout
Definition: gather_cfg.py:121
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleCollectionToken_
void PrimaryVertexAnalyzer4PUSlimmed::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 63 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), DQMStore::IBooker::bookProfile(), prof2calltree::l, diffTwoXMLs::label, mes_, reco_vertex_collections_, root_folder_, DQMStore::IBooker::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

64  {
65  // TODO(rovere) make this booking method shorter and smarter,
66  // factorizing similar histograms with different prefix in a single
67  // method call.
68  float log_bins[31] = {
69  0.0, 0.0002, 0.0004, 0.0006, 0.0008, 0.001, 0.002,
70  0.004, 0.006, 0.008, 0.01, 0.02,
71  0.04, 0.06, 0.08, 0.1, 0.2,
72  0.4, 0.6, 0.8, 1.0, 2.0,
73  4.0, 6.0, 8.0, 10.0, 20.0,
74  40.0, 60.0, 80.0, 100.0
75  };
76  float log_mergez_bins[18] = {
77  0.0, 0.0025, 0.005, 0.0075, 0.01, 0.025, 0.05, 0.075, 0.1,
78  0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
79  };
80  float log_pt2_bins[16] = {
81  0.0, 0.1, 0.5,
82  1.0, 2.0, 5.0,
83  10.0, 20.0, 50.0,
84  100.0, 200.0, 500.0,
85  1000.0, 2000.0, 5000.0,10000.0
86  };
87  float log_ntrk_bins[25] = {
88  0., 2.0, 4.0, 6.0, 8.0, 10.,
89  12.0, 14.0, 16.0, 18.0, 22.0,
90  26.0, 30.0, 35.0, 40.0,
91  45.0, 50.0, 55.0, 60.0, 70.0,
92  80.0, 90.0, 100.0, 150.0, 200.0
93  };
94  // TODO(rovere) Possibly change or add the main DQMStore booking
95  // interface to allow booking a TProfile with variable bin-width
96  // using an array of floats, as done for the TH1F case, not of
97  // doubles.
98  double log_pt2_bins_double[16] = {
99  0.0, 0.1, 0.5,
100  1.0, 2.0, 5.0,
101  10.0, 20.0, 50.0,
102  100.0, 200.0, 500.0,
103  1000.0, 2000.0, 5000.0,10000.0
104  };
105 
107  mes_["root_folder"]["GenVtx_vs_BX"] =
108  i.book2D("GenVtx_vs_BX", "GenVtx_vs_BX", 16, -12.5, 3.5, 200, 0., 200.);
109  // Generated Primary Vertex Plots
110  mes_["root_folder"]["GenPV_X"] =
111  i.book1D("GenPV_X", "GeneratedPV_X", 120, -0.6, 0.6);
112  mes_["root_folder"]["GenPV_Y"] =
113  i.book1D("GenPV_Y", "GeneratedPV_Y", 120, -0.6, 0.6);
114  mes_["root_folder"]["GenPV_Z"] =
115  i.book1D("GenPV_Z", "GeneratedPV_Z", 120, -60., 60.);
116  mes_["root_folder"]["GenPV_R"] =
117  i.book1D("GenPV_R", "GeneratedPV_R", 120, 0, 0.6);
118  mes_["root_folder"]["GenPV_Pt2"] =
119  i.book1D("GenPV_Pt2", "GeneratedPV_Sum-pt2", 15, &log_pt2_bins[0]);
120  mes_["root_folder"]["GenPV_NumTracks"] =
121  i.book1D("GenPV_NumTracks", "GeneratedPV_NumTracks", 24, &log_ntrk_bins[0]);
122  mes_["root_folder"]["GenPV_ClosestDistanceZ"] =
123  i.book1D("GenPV_ClosestDistanceZ", "GeneratedPV_ClosestDistanceZ", 30,
124  &log_bins[0]);
125 
126  // All Generated Vertices, used for efficiency plots
127  mes_["root_folder"]["GenAllV_NumVertices"] = i.book1D(
128  "GenAllV_NumVertices", "GeneratedAllV_NumVertices", 100, 0., 200.);
129  mes_["root_folder"]["GenAllV_X"] =
130  i.book1D("GenAllV_X", "GeneratedAllV_X", 120, -0.6, 0.6);
131  mes_["root_folder"]["GenAllV_Y"] =
132  i.book1D("GenAllV_Y", "GeneratedAllV_Y", 120, -0.6, 0.6);
133  mes_["root_folder"]["GenAllV_Z"] =
134  i.book1D("GenAllV_Z", "GeneratedAllV_Z", 120, -60, 60);
135  mes_["root_folder"]["GenAllV_R"] =
136  i.book1D("GenAllV_R", "GeneratedAllV_R", 120, 0, 0.6);
137  mes_["root_folder"]["GenAllV_Pt2"] =
138  i.book1D("GenAllV_Pt2", "GeneratedAllV_Sum-pt2", 15, &log_pt2_bins[0]);
139  mes_["root_folder"]["GenAllV_NumTracks"] =
140  i.book1D("GenAllV_NumTracks", "GeneratedAllV_NumTracks", 24, &log_ntrk_bins[0]);
141  mes_["root_folder"]["GenAllV_ClosestDistanceZ"] =
142  i.book1D("GenAllV_ClosestDistanceZ", "GeneratedAllV_ClosestDistanceZ", 30,
143  &log_bins[0]);
144  mes_["root_folder"]["GenAllV_PairDistanceZ"] =
145  i.book1D("GenAllV_PairDistanceZ", "GeneratedAllV_PairDistanceZ",
146  1000, 0, 20);
147  mes_["root_folder"]["SignalIsHighestPt2"] =
148  i.book1D("SignalIsHighestPt2", "SignalIsHighestPt2", 2, -0.5, 1.5);
149 
150  for (auto const& l : reco_vertex_collections_) {
151  std::string label = l.label();
152  std::string current_folder = root_folder_ + "/" + label;
153  i.setCurrentFolder(current_folder);
154 
155  mes_[label]["RecoVtx_vs_GenVtx"] = i.bookProfile(
156  "RecoVtx_vs_GenVtx", "RecoVtx_vs_GenVtx", 125, 0., 250., 250, 0., 250.);
157  mes_[label]["MatchedRecoVtx_vs_GenVtx"] =
158  i.bookProfile("MatchedRecoVtx_vs_GenVtx", "MatchedRecoVtx_vs_GenVtx",
159  125, 0., 250., 250, 0., 250.);
160  mes_[label]["KindOfSignalPV"] =
161  i.book1D("KindOfSignalPV", "KindOfSignalPV", 9, -0.5, 8.5);
162  mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(1, "!Highest!Assoc2Any");
163  mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(2, "Highest!Assoc2Any");
164  mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(3, "!HighestAssoc2First");
165  mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(4, "HighestAssoc2First");
166  mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(5, "!HighestAssoc2!First");
167  mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(6, "HighestAssoc2!First");
168  mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(7, "!HighestAssoc2First");
169  mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(8, "HighestAssoc2First");
170  mes_[label]["MisTagRate"] =
171  i.book1D("MisTagRate", "MisTagRate", 2, -0.5, 1.5);
172  mes_[label]["MisTagRate_vs_PU"] =
173  i.bookProfile("MisTagRate_vs_PU", "MisTagRate_vs_PU", 125, 0., 250.,
174  2, 0., 1.);
175  mes_[label]["MisTagRate_vs_sum-pt2"] =
176  i.bookProfile("MisTagRate_vs_sum-pt2", "MisTagRate_vs_sum-pt2",
177  15, &log_pt2_bins_double[0], 2, 0., 1.);
178  mes_[label]["MisTagRate_vs_Z"] =
179  i.bookProfile("MisTagRate_vs_Z", "MisTagRate_vs_Z",
180  120, -60., 60., 2, 0., 1.);
181  mes_[label]["MisTagRate_vs_R"] =
182  i.bookProfile("MisTagRate_vs_R", "MisTagRate_vs_R",
183  120, 0., 0.6, 2, 0., 1.);
184  mes_[label]["MisTagRate_vs_NumTracks"] =
185  i.bookProfile("MisTagRate_vs_NumTracks", "MisTagRate_vs_NumTracks",
186  100, 0., 200, 2, 0., 1.);
187  mes_[label]["MisTagRateSignalIsHighest"] =
188  i.book1D("MisTagRateSignalIsHighest",
189  "MisTagRateSignalIsHighest", 2, -0.5, 1.5);
190  mes_[label]["MisTagRateSignalIsHighest_vs_PU"] =
191  i.bookProfile("MisTagRateSignalIsHighest_vs_PU",
192  "MisTagRateSignalIsHighest_vs_PU", 125, 0., 250.,
193  2, 0., 1.);
194  mes_[label]["MisTagRateSignalIsHighest_vs_sum-pt2"] =
195  i.bookProfile("MisTagRateSignalIsHighest_vs_sum-pt2",
196  "MisTagRateSignalIsHighest_vs_sum-pt2",
197  15, &log_pt2_bins_double[0], 2, 0., 1.);
198  mes_[label]["MisTagRateSignalIsHighest_vs_Z"] =
199  i.bookProfile("MisTagRateSignalIsHighest_vs_Z",
200  "MisTagRateSignalIsHighest_vs_Z",
201  120, -60., 60., 2, 0., 1.);
202  mes_[label]["MisTagRateSignalIsHighest_vs_R"] =
203  i.bookProfile("MisTagRateSignalIsHighest_vs_R",
204  "MisTagRateSignalIsHighest_vs_R",
205  120, 0., 0.6, 2, 0., 1.);
206  mes_[label]["MisTagRateSignalIsHighest_vs_NumTracks"] =
207  i.bookProfile("MisTagRateSignalIsHighest_vs_NumTracks",
208  "MisTagRateSignalIsHighest_vs_NumTracks",
209  100, 0., 200, 2, 0., 1.);
210  mes_[label]["MisTagRateSignalIsNotHighest"] =
211  i.book1D("MisTagRateSignalIsNotHighest",
212  "MisTagRateSignalIsNotHighest", 2, -0.5, 1.5);
213  mes_[label]["MisTagRateSignalIsNotHighest_vs_PU"] =
214  i.bookProfile("MisTagRateSignalIsNotHighest_vs_PU",
215  "MisTagRateSignalIsNotHighest_vs_PU", 125, 0., 250.,
216  2, 0., 1.);
217  mes_[label]["MisTagRateSignalIsNotHighest_vs_sum-pt2"] =
218  i.bookProfile("MisTagRateSignalIsNotHighest_vs_sum-pt2",
219  "MisTagRateSignalIsNotHighest_vs_sum-pt2",
220  15, &log_pt2_bins_double[0], 2, 0., 1.);
221  mes_[label]["MisTagRateSignalIsNotHighest_vs_Z"] =
222  i.bookProfile("MisTagRateSignalIsNotHighest_vs_Z",
223  "MisTagRateSignalIsNotHighest_vs_Z",
224  120, -60., 60., 2, 0., 1.);
225  mes_[label]["MisTagRateSignalIsNotHighest_vs_R"] =
226  i.bookProfile("MisTagRateSignalIsNotHighest_vs_R",
227  "MisTagRateSignalIsNotHighest_vs_R",
228  120, 0., 0.6, 2, 0., 1.);
229  mes_[label]["MisTagRateSignalIsNotHighest_vs_NumTracks"] =
230  i.bookProfile("MisTagRateSignalIsNotHighest_vs_NumTracks",
231  "MisTagRateSignalIsNotHighest_vs_NumTracks",
232  100, 0., 200, 2, 0., 1.);
233  mes_[label]["TruePVLocationIndex"] =
234  i.book1D("TruePVLocationIndex",
235  "TruePVLocationIndexInRecoVertexCollection", 12, -1.5, 10.5);
236  mes_[label]["TruePVLocationIndexCumulative"] =
237  i.book1D("TruePVLocationIndexCumulative",
238  "TruePVLocationIndexInRecoVertexCollectionCumulative",
239  3, -1.5, 1.5);
240  mes_[label]["TruePVLocationIndexSignalIsHighest"] =
241  i.book1D("TruePVLocationIndexSignalIsHighest",
242  "TruePVLocationIndexSignalIsHighestInRecoVertexCollection",
243  12, -1.5, 10.5);
244  mes_[label]["TruePVLocationIndexSignalIsNotHighest"] =
245  i.book1D("TruePVLocationIndexSignalIsNotHighest",
246  "TruePVLocationIndexSignalIsNotHighestInRecoVertexCollection",
247  12, -1.5, 10.5);
248  // All Generated Vertices. Used for Efficiency plots We kind of
249  // duplicate plots here in case we want to perform more detailed
250  // studies on a selection of generated vertices, not on all of them.
251  mes_[label]["GenAllAssoc2Reco_NumVertices"] =
252  i.book1D("GenAllAssoc2Reco_NumVertices",
253  "GeneratedAllAssoc2Reco_NumVertices", 100, 0., 200.);
254  mes_[label]["GenAllAssoc2Reco_X"] = i.book1D(
255  "GenAllAssoc2Reco_X", "GeneratedAllAssoc2Reco_X", 120, -0.6, 0.6);
256  mes_[label]["GenAllAssoc2Reco_Y"] = i.book1D(
257  "GenAllAssoc2Reco_Y", "GeneratedAllAssoc2Reco_Y", 120, -0.6, 0.6);
258  mes_[label]["GenAllAssoc2Reco_Z"] = i.book1D(
259  "GenAllAssoc2Reco_Z", "GeneratedAllAssoc2Reco_Z", 120, -60, 60);
260  mes_[label]["GenAllAssoc2Reco_R"] =
261  i.book1D("GenAllAssoc2Reco_R", "GeneratedAllAssoc2Reco_R", 120, 0, 0.6);
262  mes_[label]["GenAllAssoc2Reco_Pt2"] =
263  i.book1D("GenAllAssoc2Reco_Pt2", "GeneratedAllAssoc2Reco_Sum-pt2", 15,
264  &log_pt2_bins[0]);
265  mes_[label]["GenAllAssoc2Reco_NumTracks"] =
266  i.book1D("GenAllAssoc2Reco_NumTracks",
267  "GeneratedAllAssoc2Reco_NumTracks", 24, &log_ntrk_bins[0]);
268  mes_[label]["GenAllAssoc2Reco_ClosestDistanceZ"] =
269  i.book1D("GenAllAssoc2Reco_ClosestDistanceZ",
270  "GeneratedAllAssoc2Reco_ClosestDistanceZ", 30, &log_bins[0]);
271 
272  // All Generated Vertices Matched to a Reconstructed vertex. Used
273  // for Efficiency plots
274  mes_[label]["GenAllAssoc2RecoMatched_NumVertices"] =
275  i.book1D("GenAllAssoc2RecoMatched_NumVertices",
276  "GeneratedAllAssoc2RecoMatched_NumVertices", 100, 0., 200.);
277  mes_[label]["GenAllAssoc2RecoMatched_X"] =
278  i.book1D("GenAllAssoc2RecoMatched_X", "GeneratedAllAssoc2RecoMatched_X",
279  120, -0.6, 0.6);
280  mes_[label]["GenAllAssoc2RecoMatched_Y"] =
281  i.book1D("GenAllAssoc2RecoMatched_Y", "GeneratedAllAssoc2RecoMatched_Y",
282  120, -0.6, 0.6);
283  mes_[label]["GenAllAssoc2RecoMatched_Z"] =
284  i.book1D("GenAllAssoc2RecoMatched_Z", "GeneratedAllAssoc2RecoMatched_Z",
285  120, -60, 60);
286  mes_[label]["GenAllAssoc2RecoMatched_R"] =
287  i.book1D("GenAllAssoc2RecoMatched_R", "GeneratedAllAssoc2RecoMatched_R",
288  120, 0, 0.6);
289  mes_[label]["GenAllAssoc2RecoMatched_Pt2"] =
290  i.book1D("GenAllAssoc2RecoMatched_Pt2",
291  "GeneratedAllAssoc2RecoMatched_Sum-pt2", 15, &log_pt2_bins[0]);
292  mes_[label]["GenAllAssoc2RecoMatched_NumTracks"] =
293  i.book1D("GenAllAssoc2RecoMatched_NumTracks",
294  "GeneratedAllAssoc2RecoMatched_NumTracks", 24, &log_ntrk_bins[0]);
295  mes_[label]["GenAllAssoc2RecoMatched_ClosestDistanceZ"] = i.book1D(
296  "GenAllAssoc2RecoMatched_ClosestDistanceZ",
297  "GeneratedAllAssoc2RecoMatched_ClosestDistanceZ", 30, &log_bins[0]);
298 
299  // All Generated Vertices Multi-Matched to a Reconstructed vertex. Used
300  // for Duplicate rate plots
301  mes_[label]["GenAllAssoc2RecoMultiMatched_NumVertices"] = i.book1D(
302  "GenAllAssoc2RecoMultiMatched_NumVertices",
303  "GeneratedAllAssoc2RecoMultiMatched_NumVertices", 100, 0., 200.);
304  mes_[label]["GenAllAssoc2RecoMultiMatched_X"] =
305  i.book1D("GenAllAssoc2RecoMultiMatched_X",
306  "GeneratedAllAssoc2RecoMultiMatched_X", 120, -0.6, 0.6);
307  mes_[label]["GenAllAssoc2RecoMultiMatched_Y"] =
308  i.book1D("GenAllAssoc2RecoMultiMatched_Y",
309  "GeneratedAllAssoc2RecoMultiMatched_Y", 120, -0.6, 0.6);
310  mes_[label]["GenAllAssoc2RecoMultiMatched_Z"] =
311  i.book1D("GenAllAssoc2RecoMultiMatched_Z",
312  "GeneratedAllAssoc2RecoMultiMatched_Z", 120, -60, 60);
313  mes_[label]["GenAllAssoc2RecoMultiMatched_R"] =
314  i.book1D("GenAllAssoc2RecoMultiMatched_R",
315  "GeneratedAllAssoc2RecoMultiMatched_R", 120, 0, 0.6);
316  mes_[label]["GenAllAssoc2RecoMultiMatched_Pt2"] =
317  i.book1D("GenAllAssoc2RecoMultiMatched_Pt2",
318  "GeneratedAllAssoc2RecoMultiMatched_Sum-pt2",
319  15, &log_pt2_bins[0]);
320  mes_[label]["GenAllAssoc2RecoMultiMatched_NumTracks"] =
321  i.book1D("GenAllAssoc2RecoMultiMatched_NumTracks",
322  "GeneratedAllAssoc2RecoMultiMatched_NumTracks", 24, &log_ntrk_bins[0]);
323  mes_[label]["GenAllAssoc2RecoMultiMatched_ClosestDistanceZ"] = i.book1D(
324  "GenAllAssoc2RecoMultiMatched_ClosestDistanceZ",
325  "GeneratedAllAssoc2RecoMultiMatched_ClosestDistanceZ",
326  30, &log_bins[0]);
327 
328  // All Reco Vertices. Used for {Fake,Duplicate}-Rate plots
329  mes_[label]["RecoAllAssoc2Gen_NumVertices"] =
330  i.book1D("RecoAllAssoc2Gen_NumVertices",
331  "ReconstructedAllAssoc2Gen_NumVertices", 100, 0., 200.);
332  mes_[label]["RecoAllAssoc2Gen_X"] = i.book1D(
333  "RecoAllAssoc2Gen_X", "ReconstructedAllAssoc2Gen_X", 120, -0.6, 0.6);
334  mes_[label]["RecoAllAssoc2Gen_Y"] = i.book1D(
335  "RecoAllAssoc2Gen_Y", "ReconstructedAllAssoc2Gen_Y", 120, -0.6, 0.6);
336  mes_[label]["RecoAllAssoc2Gen_Z"] = i.book1D(
337  "RecoAllAssoc2Gen_Z", "ReconstructedAllAssoc2Gen_Z", 120, -60, 60);
338  mes_[label]["RecoAllAssoc2Gen_R"] = i.book1D(
339  "RecoAllAssoc2Gen_R", "ReconstructedAllAssoc2Gen_R", 120, 0, 0.6);
340  mes_[label]["RecoAllAssoc2Gen_Pt2"] =
341  i.book1D("RecoAllAssoc2Gen_Pt2", "ReconstructedAllAssoc2Gen_Sum-pt2",
342  15, &log_pt2_bins[0]);
343  mes_[label]["RecoAllAssoc2Gen_Ndof"] =
344  i.book1D("RecoAllAssoc2Gen_Ndof",
345  "ReconstructedAllAssoc2Gen_Ndof", 120, 0., 240.);
346  mes_[label]["RecoAllAssoc2Gen_NumTracks"] =
347  i.book1D("RecoAllAssoc2Gen_NumTracks",
348  "ReconstructedAllAssoc2Gen_NumTracks", 24, &log_ntrk_bins[0]);
349  mes_[label]["RecoAllAssoc2Gen_PU"] =
350  i.book1D("RecoAllAssoc2Gen_PU",
351  "ReconstructedAllAssoc2Gen_PU", 125, 0., 250.);
352  mes_[label]["RecoAllAssoc2Gen_ClosestDistanceZ"] =
353  i.book1D("RecoAllAssoc2Gen_ClosestDistanceZ",
354  "ReconstructedAllAssoc2Gen_ClosestDistanceZ",
355  30, &log_bins[0]);
356  mes_[label]["RecoAllAssoc2GenProperties"] =
357  i.book1D("RecoAllAssoc2GenProperties",
358  "ReconstructedAllAssoc2Gen_Properties", 8, -0.5, 7.5);
359  mes_[label]["RecoAllAssoc2Gen_PairDistanceZ"] =
360  i.book1D("RecoAllAssoc2Gen_PairDistanceZ",
361  "RecoAllAssoc2Gen_PairDistanceZ", 1000, 0, 20);
362 
363  // All Reconstructed Vertices Matched to a Generated vertex. Used
364  // for Fake-Rate plots
365  mes_[label]["RecoAllAssoc2GenMatched_NumVertices"] =
366  i.book1D("RecoAllAssoc2GenMatched_NumVertices",
367  "ReconstructedAllAssoc2GenMatched_NumVertices", 100, 0., 200.);
368  mes_[label]["RecoAllAssoc2GenMatched_X"] =
369  i.book1D("RecoAllAssoc2GenMatched_X",
370  "ReconstructedAllAssoc2GenMatched_X", 120, -0.6, 0.6);
371  mes_[label]["RecoAllAssoc2GenMatched_Y"] =
372  i.book1D("RecoAllAssoc2GenMatched_Y",
373  "ReconstructedAllAssoc2GenMatched_Y", 120, -0.6, 0.6);
374  mes_[label]["RecoAllAssoc2GenMatched_Z"] =
375  i.book1D("RecoAllAssoc2GenMatched_Z",
376  "ReconstructedAllAssoc2GenMatched_Z", 120, -60, 60);
377  mes_[label]["RecoAllAssoc2GenMatched_R"] =
378  i.book1D("RecoAllAssoc2GenMatched_R",
379  "ReconstructedAllAssoc2GenMatched_R", 120, 0, 0.6);
380  mes_[label]["RecoAllAssoc2GenMatched_Pt2"] =
381  i.book1D("RecoAllAssoc2GenMatched_Pt2",
382  "ReconstructedAllAssoc2GenMatched_Sum-pt2",
383  15, &log_pt2_bins[0]);
384  mes_[label]["RecoAllAssoc2GenMatched_Ndof"] =
385  i.book1D("RecoAllAssoc2GenMatched_Ndof",
386  "ReconstructedAllAssoc2GenMatched_Ndof", 120, 0., 240.);
387  mes_[label]["RecoAllAssoc2GenMatched_NumTracks"] =
388  i.book1D("RecoAllAssoc2GenMatched_NumTracks",
389  "ReconstructedAllAssoc2GenMatched_NumTracks", 24, &log_ntrk_bins[0]);
390  mes_[label]["RecoAllAssoc2GenMatched_PU"] =
391  i.book1D("RecoAllAssoc2GenMatched_PU",
392  "ReconstructedAllAssoc2GenMatched_PU", 125, 0., 250.);
393  mes_[label]["RecoAllAssoc2GenMatched_ClosestDistanceZ"] = i.book1D(
394  "RecoAllAssoc2GenMatched_ClosestDistanceZ",
395  "ReconstructedAllAssoc2GenMatched_ClosestDistanceZ", 30, &log_bins[0]);
396 
397  // All Reconstructed Vertices Multi-Matched to a Generated vertex. Used
398  // for Merge-Rate plots
399  mes_[label]["RecoAllAssoc2GenMultiMatched_NumVertices"] = i.book1D(
400  "RecoAllAssoc2GenMultiMatched_NumVertices",
401  "ReconstructedAllAssoc2GenMultiMatched_NumVertices", 100, 0., 200.);
402  mes_[label]["RecoAllAssoc2GenMultiMatched_X"] =
403  i.book1D("RecoAllAssoc2GenMultiMatched_X",
404  "ReconstructedAllAssoc2GenMultiMatched_X", 120, -0.6, 0.6);
405  mes_[label]["RecoAllAssoc2GenMultiMatched_Y"] =
406  i.book1D("RecoAllAssoc2GenMultiMatched_Y",
407  "ReconstructedAllAssoc2GenMultiMatched_Y", 120, -0.6, 0.6);
408  mes_[label]["RecoAllAssoc2GenMultiMatched_Z"] =
409  i.book1D("RecoAllAssoc2GenMultiMatched_Z",
410  "ReconstructedAllAssoc2GenMultiMatched_Z", 120, -60, 60);
411  mes_[label]["RecoAllAssoc2GenMultiMatched_R"] =
412  i.book1D("RecoAllAssoc2GenMultiMatched_R",
413  "ReconstructedAllAssoc2GenMultiMatched_R", 120, 0, 0.6);
414  mes_[label]["RecoAllAssoc2GenMultiMatched_Pt2"] = i.book1D(
415  "RecoAllAssoc2GenMultiMatched_Pt2",
416  "ReconstructedAllAssoc2GenMultiMatched_Sum-pt2", 15, &log_pt2_bins[0]);
417  mes_[label]["RecoAllAssoc2GenMultiMatched_NumTracks"] = i.book1D(
418  "RecoAllAssoc2GenMultiMatched_NumTracks",
419  "ReconstructedAllAssoc2GenMultiMatched_NumTracks", 24, &log_ntrk_bins[0]);
420  mes_[label]["RecoAllAssoc2GenMultiMatched_PU"] =
421  i.book1D("RecoAllAssoc2GenMultiMatched_PU",
422  "ReconstructedAllAssoc2GenMultiMatched_PU", 125, 0., 250.);
423  mes_[label]["RecoAllAssoc2GenMultiMatched_ClosestDistanceZ"] =
424  i.book1D("RecoAllAssoc2GenMultiMatched_ClosestDistanceZ",
425  "ReconstructedAllAssoc2GenMultiMatched_ClosestDistanceZ",
426  17, &log_mergez_bins[0]);
427 
428  // All Reconstructed Vertices Matched to a Multi-Matched Gen
429  // Vertex. Used for Duplicate rate plots done w.r.t. Reco
430  // Quantities. We basically want to ask how many times a RecoVTX
431  // has been reconstructed and associated to a SimulatedVTX that
432  // has been linked to at least another RecoVTX. In this sense this
433  // RecoVTX is a duplicate of the same, real GenVTX.
434  mes_[label]["RecoAllAssoc2MultiMatchedGen_NumVertices"] = i.book1D(
435  "RecoAllAssoc2MultiMatchedGen_NumVertices",
436  "RecoAllAssoc2MultiMatchedGen_NumVertices", 100, 0., 200.);
437  mes_[label]["RecoAllAssoc2MultiMatchedGen_X"] =
438  i.book1D("RecoAllAssoc2MultiMatchedGen_X",
439  "RecoAllAssoc2MultiMatchedGen_X", 120, -0.6, 0.6);
440  mes_[label]["RecoAllAssoc2MultiMatchedGen_Y"] =
441  i.book1D("RecoAllAssoc2MultiMatchedGen_Y",
442  "RecoAllAssoc2MultiMatchedGen_Y", 120, -0.6, 0.6);
443  mes_[label]["RecoAllAssoc2MultiMatchedGen_Z"] =
444  i.book1D("RecoAllAssoc2MultiMatchedGen_Z",
445  "RecoAllAssoc2MultiMatchedGen_Z", 120, -60, 60);
446  mes_[label]["RecoAllAssoc2MultiMatchedGen_R"] =
447  i.book1D("RecoAllAssoc2MultiMatchedGen_R",
448  "RecoAllAssoc2MultiMatchedGen_R", 120, 0, 0.6);
449  mes_[label]["RecoAllAssoc2MultiMatchedGen_Pt2"] =
450  i.book1D("RecoAllAssoc2MultiMatchedGen_Pt2",
451  "RecoAllAssoc2MultiMatchedGen_Sum-pt2", 15, &log_pt2_bins[0]);
452  mes_[label]["RecoAllAssoc2MultiMatchedGen_NumTracks"] =
453  i.book1D("RecoAllAssoc2MultiMatchedGen_NumTracks",
454  "RecoAllAssoc2MultiMatchedGen_NumTracks", 24, &log_ntrk_bins[0]);
455  mes_[label]["RecoAllAssoc2MultiMatchedGen_PU"] =
456  i.book1D("RecoAllAssoc2MultiMatchedGen_PU",
457  "RecoAllAssoc2MultiMatchedGen_PU", 125, 0., 250.);
458  mes_[label]["RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ"] = i.book1D(
459  "RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ",
460  "RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ", 30, &log_bins[0]);
461  mes_[label]["RecoAllAssoc2GenSimForMerge_ClosestDistanceZ"] = i.book1D(
462  "RecoAllAssoc2GenSimForMerge_ClosestDistanceZ",
463  "RecoAllAssoc2GenSimForMerge_ClosestDistanceZ",
464  17, &log_mergez_bins[0]);
465  }
466 }
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
std::vector< edm::InputTag > reco_vertex_collections_
std::map< std::string, std::map< std::string, MonitorElement * > > mes_
template<class T >
void PrimaryVertexAnalyzer4PUSlimmed::computePairDistance ( const T collection,
MonitorElement me 
)
private

Definition at line 1183 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References funct::abs(), MonitorElement::Fill(), i, j, and detailsBasic3DVector::z.

Referenced by analyze().

1184  {
1185  for (unsigned int i = 0; i < collection.size(); ++i) {
1186  for (unsigned int j = i+1; j < collection.size(); ++j) {
1187  me->Fill(
1189  }
1190  }
1191 }
int i
Definition: DBlmapReader.cc:9
float float float z
void Fill(long long x)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
void PrimaryVertexAnalyzer4PUSlimmed::fillGenAssociatedRecoVertexHistograms ( const std::string &  label,
int  num_pileup_vertices,
PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex v 
)
private

Definition at line 528 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::closest_vertex_distance_z, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::DUPLICATE, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::kind_of_vertex, diffTwoXMLs::label, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::MATCHED, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::MERGED, mes_, reco::Vertex::ndof(), PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::nRecoTrk, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::ptsq, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::r, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::recVtx, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::sim_vertices, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::sim_vertices_internal, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::x, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::y, and PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::z.

Referenced by analyze().

531  {
532  mes_[label]["RecoAllAssoc2Gen_X"]->Fill(v.x);
533  mes_[label]["RecoAllAssoc2Gen_Y"]->Fill(v.y);
534  mes_[label]["RecoAllAssoc2Gen_Z"]->Fill(v.z);
535  mes_[label]["RecoAllAssoc2Gen_R"]->Fill(v.r);
536  mes_[label]["RecoAllAssoc2Gen_Pt2"]->Fill(v.ptsq);
537  mes_[label]["RecoAllAssoc2Gen_Ndof"]->Fill(v.recVtx->ndof());
538  mes_[label]["RecoAllAssoc2Gen_NumTracks"]->Fill(v.nRecoTrk);
539  mes_[label]["RecoAllAssoc2Gen_PU"]->Fill(num_pileup_vertices);
540  if (v.closest_vertex_distance_z > 0.)
541  mes_[label]["RecoAllAssoc2Gen_ClosestDistanceZ"]
542  ->Fill(v.closest_vertex_distance_z);
543  if (v.sim_vertices.size()) {
545  mes_[label]["RecoAllAssoc2GenMatched_X"]->Fill(v.x);
546  mes_[label]["RecoAllAssoc2GenMatched_Y"]->Fill(v.y);
547  mes_[label]["RecoAllAssoc2GenMatched_Z"]->Fill(v.z);
548  mes_[label]["RecoAllAssoc2GenMatched_R"]->Fill(v.r);
549  mes_[label]["RecoAllAssoc2GenMatched_Pt2"]->Fill(v.ptsq);
550  mes_[label]["RecoAllAssoc2GenMatched_Ndof"]->Fill(v.recVtx->ndof());
551  mes_[label]["RecoAllAssoc2GenMatched_NumTracks"]->Fill(v.nRecoTrk);
552  mes_[label]["RecoAllAssoc2GenMatched_PU"]->Fill(num_pileup_vertices);
553  if (v.closest_vertex_distance_z > 0.)
554  mes_[label]["RecoAllAssoc2GenMatched_ClosestDistanceZ"]
555  ->Fill(v.closest_vertex_distance_z);
556  // Now keep track of all RecoVTX associated to a SimVTX that
557  // itself is associated to more than one RecoVTX, for
558  // duplicate-rate plots on reco quantities.
559  if (v.sim_vertices_internal[0]->rec_vertices.size() > 1) {
561  mes_[label]["RecoAllAssoc2MultiMatchedGen_X"]->Fill(v.x);
562  mes_[label]["RecoAllAssoc2MultiMatchedGen_Y"]->Fill(v.y);
563  mes_[label]["RecoAllAssoc2MultiMatchedGen_Z"]->Fill(v.z);
564  mes_[label]["RecoAllAssoc2MultiMatchedGen_R"]->Fill(v.r);
565  mes_[label]["RecoAllAssoc2MultiMatchedGen_Pt2"]->Fill(v.ptsq);
566  mes_[label]["RecoAllAssoc2MultiMatchedGen_NumTracks"]->Fill(v.nRecoTrk);
567  mes_[label]["RecoAllAssoc2MultiMatchedGen_PU"]->Fill(num_pileup_vertices);
568  if (v.closest_vertex_distance_z > 0.)
569  mes_[label]["RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ"]
570  ->Fill(v.closest_vertex_distance_z);
571  }
572  // This is meant to be used as "denominator" for the merge-rate
573  // plots produced starting from reco quantities. We enter here
574  // only if the reco vertex has been associated, since we need info
575  // from the SimVTX associated to it. In this regard, the final
576  // merge-rate plot coming from reco is not to be intended as a
577  // pure efficiency-like plot, since the normalization is biased.
578  if (v.sim_vertices_internal[0]->closest_vertex_distance_z > 0.)
579  mes_[label]["RecoAllAssoc2GenSimForMerge_ClosestDistanceZ"]
580  ->Fill(v.sim_vertices_internal[0]->closest_vertex_distance_z);
581  }
582  // this plots are meant to be used to compute the merge rate
583  if (v.sim_vertices.size() > 1) {
585  mes_[label]["RecoAllAssoc2GenMultiMatched_X"]->Fill(v.x);
586  mes_[label]["RecoAllAssoc2GenMultiMatched_Y"]->Fill(v.y);
587  mes_[label]["RecoAllAssoc2GenMultiMatched_Z"]->Fill(v.z);
588  mes_[label]["RecoAllAssoc2GenMultiMatched_R"]->Fill(v.r);
589  mes_[label]["RecoAllAssoc2GenMultiMatched_Pt2"]->Fill(v.ptsq);
590  mes_[label]["RecoAllAssoc2GenMultiMatched_NumTracks"]->Fill(v.nRecoTrk);
591  mes_[label]["RecoAllAssoc2GenMultiMatched_PU"]->Fill(num_pileup_vertices);
592  if (v.sim_vertices_internal[0]->closest_vertex_distance_z > 0.)
593  mes_[label]["RecoAllAssoc2GenMultiMatched_ClosestDistanceZ"]
594  ->Fill(v.sim_vertices_internal[0]->closest_vertex_distance_z);
595  }
596  mes_[label]["RecoAllAssoc2GenProperties"]->Fill(v.kind_of_vertex);
597 }
double ndof() const
Definition: Vertex.h:102
std::map< std::string, std::map< std::string, MonitorElement * > > mes_
void PrimaryVertexAnalyzer4PUSlimmed::fillGenericGenVertexHistograms ( const simPrimaryVertex v)
private

Definition at line 468 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::closest_vertex_distance_z, EncodedEventId::event(), PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::eventId, mes_, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::nGenTrk, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::ptsq, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::r, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::x, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::y, and PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::z.

Referenced by analyze().

469  {
470  if (v.eventId.event() == 0) {
471  mes_["root_folder"]["GenPV_X"]->Fill(v.x);
472  mes_["root_folder"]["GenPV_Y"]->Fill(v.y);
473  mes_["root_folder"]["GenPV_Z"]->Fill(v.z);
474  mes_["root_folder"]["GenPV_R"]->Fill(v.r);
475  mes_["root_folder"]["GenPV_Pt2"]->Fill(v.ptsq);
476  mes_["root_folder"]["GenPV_NumTracks"]->Fill(v.nGenTrk);
477  if (v.closest_vertex_distance_z > 0.)
478  mes_["root_folder"]["GenPV_ClosestDistanceZ"]
479  ->Fill(v.closest_vertex_distance_z);
480  }
481  mes_["root_folder"]["GenAllV_X"]->Fill(v.x);
482  mes_["root_folder"]["GenAllV_Y"]->Fill(v.y);
483  mes_["root_folder"]["GenAllV_Z"]->Fill(v.z);
484  mes_["root_folder"]["GenAllV_R"]->Fill(v.r);
485  mes_["root_folder"]["GenAllV_Pt2"]->Fill(v.ptsq);
486  mes_["root_folder"]["GenAllV_NumTracks"]->Fill(v.nGenTrk);
487  if (v.closest_vertex_distance_z > 0.)
488  mes_["root_folder"]["GenAllV_ClosestDistanceZ"]
489  ->Fill(v.closest_vertex_distance_z);
490 }
std::map< std::string, std::map< std::string, MonitorElement * > > mes_
void PrimaryVertexAnalyzer4PUSlimmed::fillRecoAssociatedGenVertexHistograms ( const std::string &  label,
const simPrimaryVertex v 
)
private

Definition at line 492 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::closest_vertex_distance_z, diffTwoXMLs::label, mes_, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::nGenTrk, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::ptsq, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::r, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::rec_vertices, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::x, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::y, and PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::z.

Referenced by analyze().

494  {
495  mes_[label]["GenAllAssoc2Reco_X"]->Fill(v.x);
496  mes_[label]["GenAllAssoc2Reco_Y"]->Fill(v.y);
497  mes_[label]["GenAllAssoc2Reco_Z"]->Fill(v.z);
498  mes_[label]["GenAllAssoc2Reco_R"]->Fill(v.r);
499  mes_[label]["GenAllAssoc2Reco_Pt2"]->Fill(v.ptsq);
500  mes_[label]["GenAllAssoc2Reco_NumTracks"]->Fill(v.nGenTrk);
501  if (v.closest_vertex_distance_z > 0.)
502  mes_[label]["GenAllAssoc2Reco_ClosestDistanceZ"]
503  ->Fill(v.closest_vertex_distance_z);
504  if (v.rec_vertices.size()) {
505  mes_[label]["GenAllAssoc2RecoMatched_X"]->Fill(v.x);
506  mes_[label]["GenAllAssoc2RecoMatched_Y"]->Fill(v.y);
507  mes_[label]["GenAllAssoc2RecoMatched_Z"]->Fill(v.z);
508  mes_[label]["GenAllAssoc2RecoMatched_R"]->Fill(v.r);
509  mes_[label]["GenAllAssoc2RecoMatched_Pt2"]->Fill(v.ptsq);
510  mes_[label]["GenAllAssoc2RecoMatched_NumTracks"]->Fill(v.nGenTrk);
511  if (v.closest_vertex_distance_z > 0.)
512  mes_[label]["GenAllAssoc2RecoMatched_ClosestDistanceZ"]
513  ->Fill(v.closest_vertex_distance_z);
514  }
515  if (v.rec_vertices.size() > 1) {
516  mes_[label]["GenAllAssoc2RecoMultiMatched_X"]->Fill(v.x);
517  mes_[label]["GenAllAssoc2RecoMultiMatched_Y"]->Fill(v.y);
518  mes_[label]["GenAllAssoc2RecoMultiMatched_Z"]->Fill(v.z);
519  mes_[label]["GenAllAssoc2RecoMultiMatched_R"]->Fill(v.r);
520  mes_[label]["GenAllAssoc2RecoMultiMatched_Pt2"]->Fill(v.ptsq);
521  mes_[label]["GenAllAssoc2RecoMultiMatched_NumTracks"]->Fill(v.nGenTrk);
522  if (v.closest_vertex_distance_z > 0.)
523  mes_[label]["GenAllAssoc2RecoMultiMatched_ClosestDistanceZ"]
524  ->Fill(v.closest_vertex_distance_z);
525  }
526 }
std::map< std::string, std::map< std::string, MonitorElement * > > mes_
std::vector< PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex > PrimaryVertexAnalyzer4PUSlimmed::getRecoPVs ( const edm::Handle< reco::VertexCollection tVC)
private

Definition at line 765 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References gather_cfg::cout, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::nRecoTrk, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::ptsq, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex::recVtx, findQualityFiles::v, and verbose_.

Referenced by analyze().

766  {
767  std::vector<PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex> recopv;
768 
769  if (verbose_) {
770  std::cout << "getRecoPVs TrackingVertexCollection " << std::endl;
771  }
772 
773  for (std::vector<reco::Vertex>::const_iterator v = tVC->begin();
774  v != tVC->end(); ++v) {
775  if (verbose_) {
776  std::cout << " Position: " << v->position() << std::endl;
777  }
778 
779  // Skip junk vertices
780  if (fabs(v->z()) > 1000) continue;
781  if (v->isFake() || !v->isValid()) continue;
782 
783  recoPrimaryVertex sv(v->position().x(), v->position().y(),
784  v->position().z());
785  sv.recVtx = &(*v);
786  // this is a new vertex, add it to the list of sim-vertices
787  recopv.push_back(sv);
789 
790  // Loop over daughter track(s)
791  for (auto iTrack = v->tracks_begin(); iTrack != v->tracks_end(); ++iTrack) {
792  auto momentum = (*(*iTrack)).innerMomentum();
793  // TODO(rovere) better handle the pixelVerticies, whose tracks
794  // do not have the innerMomentum defined. This is a temporary
795  // hack to overcome this problem.
796  if (momentum.mag2() == 0)
797  momentum = (*(*iTrack)).momentum();
798  if (verbose_) {
799  std::cout << " Daughter momentum: " << momentum;
800  std::cout << std::endl;
801  }
802  vp->ptsq += (momentum.perp2());
803  vp->nRecoTrk++;
804  } // End of for loop on daughters reconstructed tracks
805  } // End of for loop on tracking vertices
806 
807  if (verbose_) {
808  std::cout << "------- PrimaryVertexAnalyzer4PUSlimmed recoPVs from "
809  "VertexCollection "
810  "-------" << std::endl;
811  for (std::vector<recoPrimaryVertex>::iterator v0 = recopv.begin();
812  v0 != recopv.end(); v0++) {
813  std::cout << "z=" << v0->z << std::endl;
814  }
815  std::cout << "-----------------------------------------------" << std::endl;
816  } // End of for summary on reconstructed primary vertices.
817 
818  // Now compute the closest distance in z between all reconstructed vertex
819  for (std::vector<recoPrimaryVertex>::iterator vreco = recopv.begin();
820  vreco != recopv.end(); vreco++) {
821  std::vector<recoPrimaryVertex>::iterator vreco2 = vreco;
822  vreco2++;
823  for (; vreco2 != recopv.end(); vreco2++) {
824  double distance_z = fabs(vreco->z - vreco2->z);
825  // Initialize with the next-sibling in the vector: minimization
826  // is performed by the next if.
827  if (vreco->closest_vertex_distance_z < 0) {
828  vreco->closest_vertex_distance_z = distance_z;
829  continue;
830  }
831  if (distance_z < vreco->closest_vertex_distance_z)
832  vreco->closest_vertex_distance_z = distance_z;
833  }
834  }
835  return recopv;
836 }
tuple cout
Definition: gather_cfg.py:121
std::vector< PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex > PrimaryVertexAnalyzer4PUSlimmed::getSimPVs ( const edm::Handle< TrackingVertexCollection tVC)
private

Definition at line 603 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::average_match_quality, gather_cfg::cout, alignCSCRings::e, edm::AssociationMap< Tag >::end(), event(), PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::eventId, edm::AssociationMap< Tag >::find(), PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::nGenTrk, NULL, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::num_matched_reco_tracks, benchmark_cfg::pdgId, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::ptot, PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex::ptsq, s2r_, use_only_charged_tracks_, findQualityFiles::v, and verbose_.

Referenced by analyze().

604  {
605  std::vector<PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex> simpv;
606  int current_event = -1;
607 
608  if (verbose_) {
609  std::cout << "getSimPVs TrackingVertexCollection " << std::endl;
610  }
611 
612  for (TrackingVertexCollection::const_iterator v = tVC->begin();
613  v != tVC->end(); ++v) {
614  if (verbose_) {
615  std::cout << "BunchX.EventId: " << v->eventId().bunchCrossing() << "."
616  << (v->eventId()).event() << " Position: " << v->position()
617  << " G4/HepMC Vertices: " << v->g4Vertices().size() << "/"
618  << v->genVertices().size()
619  << " t = " << v->position().t() * 1.e12
620  << " == 0:" << (v->position().t() > 0) << std::endl;
621  for (TrackingVertex::g4v_iterator gv = v->g4Vertices_begin();
622  gv != v->g4Vertices_end(); gv++) {
623  std::cout << *gv << std::endl;
624  }
625  std::cout << "----------" << std::endl;
626  } // end of verbose_ session
627 
628  // I'd rather change this and select only vertices that come from
629  // BX=0. We should keep only the first vertex from all the events
630  // at BX=0.
631  if (v->eventId().bunchCrossing() != 0) continue;
632  if (v->eventId().event() != current_event) {
633  current_event = v->eventId().event();
634  } else {
635  continue;
636  }
637  // TODO(rovere) is this really necessary?
638  if (fabs(v->position().z()) > 1000) continue; // skip funny junk vertices
639 
640  // could be a new vertex, check all primaries found so far to avoid
641  // multiple entries
642  simPrimaryVertex sv(v->position().x(), v->position().y(),
643  v->position().z());
644  sv.eventId = v->eventId();
645  sv.sim_vertex = &(*v);
646 
647  for (TrackingParticleRefVector::iterator iTrack = v->daughterTracks_begin();
648  iTrack != v->daughterTracks_end(); ++iTrack) {
649  // TODO(rovere) isn't it always the case? Is it really worth
650  // checking this out?
651  // sv.eventId = (**iTrack).eventId();
652  assert((**iTrack).eventId().bunchCrossing() == 0);
653  }
654  // TODO(rovere) maybe get rid of this old logic completely ... ?
655  simPrimaryVertex* vp = NULL; // will become non-NULL if a vertex
656  // is found and then point to it
657  for (std::vector<simPrimaryVertex>::iterator v0 = simpv.begin();
658  v0 != simpv.end(); v0++) {
659  if ((sv.eventId == v0->eventId) && (fabs(sv.x - v0->x) < 1e-5) &&
660  (fabs(sv.y - v0->y) < 1e-5) && (fabs(sv.z - v0->z) < 1e-5)) {
661  vp = &(*v0);
662  break;
663  }
664  }
665  if (!vp) {
666  // this is a new vertex, add it to the list of sim-vertices
667  simpv.push_back(sv);
668  vp = &simpv.back();
669  if (verbose_) {
670  std::cout << "this is a new vertex " << sv.eventId.event() << " "
671  << sv.x << " " << sv.y << " " << sv.z << std::endl;
672  }
673  } else {
674  if (verbose_) {
675  std::cout << "this is not a new vertex" << sv.x << " " << sv.y << " "
676  << sv.z << std::endl;
677  }
678  }
679 
680  // Loop over daughter track(s) as Tracking Particles
681  for (TrackingVertex::tp_iterator iTP = v->daughterTracks_begin();
682  iTP != v->daughterTracks_end(); ++iTP) {
683  auto momentum = (*(*iTP)).momentum();
684  const reco::Track* matched_best_reco_track = nullptr;
685  double match_quality = -1;
686  if (use_only_charged_tracks_ && (**iTP).charge() == 0)
687  continue;
688  if (s2r_.find(*iTP) != s2r_.end()) {
689  matched_best_reco_track = s2r_[*iTP][0].first.get();
690  match_quality = s2r_[*iTP][0].second;
691  }
692  if (verbose_) {
693  std::cout << " Daughter momentum: " << momentum;
694  std::cout << " Daughter type " << (*(*iTP)).pdgId();
695  std::cout << " matched: " << (matched_best_reco_track != nullptr);
696  std::cout << " match-quality: " << match_quality;
697  std::cout << std::endl;
698  }
699  vp->ptot.setPx(vp->ptot.x() + momentum.x());
700  vp->ptot.setPy(vp->ptot.y() + momentum.y());
701  vp->ptot.setPz(vp->ptot.z() + momentum.z());
702  vp->ptot.setE(vp->ptot.e() + (**iTP).energy());
703  vp->ptsq += ((**iTP).pt() * (**iTP).pt());
704  // TODO(rovere) only select charged sim-particles? If so, maybe
705  // put it as a configuration parameter?
706  if (matched_best_reco_track) {
707  vp->num_matched_reco_tracks++;
708  vp->average_match_quality += match_quality;
709  }
710  // TODO(rovere) get rid of cuts on sim-tracks
711  // TODO(rovere) be consistent between simulated tracks and
712  // reconstructed tracks selection
713  // count relevant particles
714  if (((**iTP).pt() > 0.2) && (fabs((**iTP).eta()) < 2.5) &&
715  (**iTP).charge() != 0) {
716  vp->nGenTrk++;
717  }
718  } // End of for loop on daughters sim-particles
719  if (vp->num_matched_reco_tracks)
720  vp->average_match_quality /=
721  static_cast<float>(vp->num_matched_reco_tracks);
722  if (verbose_) {
723  std::cout << "average number of associated tracks: "
724  << vp->num_matched_reco_tracks / static_cast<float>(vp->nGenTrk)
725  << " with average quality: " << vp->average_match_quality
726  << std::endl;
727  }
728  } // End of for loop on tracking vertices
729 
730  if (verbose_) {
731  std::cout << "------- PrimaryVertexAnalyzer4PUSlimmed simPVs from "
732  "TrackingVertices "
733  "-------" << std::endl;
734  for (std::vector<simPrimaryVertex>::iterator v0 = simpv.begin();
735  v0 != simpv.end(); v0++) {
736  std::cout << "z=" << v0->z << " event=" << v0->eventId.event()
737  << std::endl;
738  }
739  std::cout << "-----------------------------------------------" << std::endl;
740  } // End of for summary on discovered simulated primary vertices.
741 
742  // Now compute the closest distance in z between all simulated vertex
743  for (std::vector<simPrimaryVertex>::iterator vsim = simpv.begin();
744  vsim != simpv.end(); vsim++) {
745  std::vector<simPrimaryVertex>::iterator vsim2 = vsim;
746  vsim2++;
747  for (; vsim2 != simpv.end(); vsim2++) {
748  double distance_z = fabs(vsim->z - vsim2->z);
749  // Initialize with the next-sibling in the vector: minimization
750  // is performed by the next if.
751  if (vsim->closest_vertex_distance_z < 0) {
752  vsim->closest_vertex_distance_z = distance_z;
753  continue;
754  }
755  if (distance_z < vsim->closest_vertex_distance_z)
756  vsim->closest_vertex_distance_z = distance_z;
757  }
758  }
759  return simpv;
760 }
const_iterator end() const
last iterator over the map (read only)
std::vector< SimVertex >::const_iterator g4v_iterator
const_iterator find(const key_type &k) const
find element with specified reference key
#define NULL
Definition: scimark2.h:8
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
tuple cout
Definition: gather_cfg.py:121
void PrimaryVertexAnalyzer4PUSlimmed::matchReco2SimVertices ( std::vector< recoPrimaryVertex > &  recopv,
const TrackingVertexCollection gen_vertices,
const std::vector< simPrimaryVertex > &  simpv 
)
private

Definition at line 894 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References abs_z_match_, gather_cfg::cout, sigma_z_match_, findQualityFiles::v, and verbose_.

Referenced by analyze().

897  {
898  for (std::vector<recoPrimaryVertex>::iterator vrec = recopv.begin();
899  vrec != recopv.end(); vrec++) {
900  int current_event = -1;
901  for (std::vector<TrackingVertex>::const_iterator vsim =
902  gen_vertices.begin();
903  vsim != gen_vertices.end(); vsim++) {
904  // Keep only signal events
905  if (vsim->eventId().bunchCrossing() != 0) continue;
906 
907  // Keep only the primary vertex for each PU event
908  if (vsim->eventId().event() != current_event) {
909  current_event = vsim->eventId().event();
910  } else {
911  continue;
912  }
913 
914  // if the matching criteria are fulfilled, accept all the
915  // gen-vertices that are close in z, in unit of sigma_z of the
916  // reconstructed vertex, at least of sigma_z_match_. Require
917  // also a maximum absolute distance between the 2 vertices of at
918  // most abs_z_match_ along the Z axis(in cm).
919  if (((fabs(vrec->z - vsim->position().z()) / vrec->recVtx->zError()) <
921  && (fabs(vrec->z - vsim->position().z()) < abs_z_match_)) {
922  vrec->sim_vertices.push_back(&(*vsim));
923  for (std::vector<simPrimaryVertex>::const_iterator vv = simpv.begin();
924  vv != simpv.end(); vv++) {
925  if (vv->sim_vertex == &(*vsim)) {
926  vrec->sim_vertices_internal.push_back(&(*vv));
927  }
928  }
929 
930  if (verbose_) {
931  std::cout << "Matching Reco vertex for " << vrec->z
932  << " at Sim Vertex " << vsim->position().z()
933  << " with sign: " << fabs(vsim->position().z() - vrec->z) /
934  vrec->recVtx->zError()
935  << std::endl;
936  }
937  }
938  } // end of loop on simulated vertices
939  if (verbose_) {
940  for (auto v : vrec->sim_vertices) {
941  std::cout << "Found a matching vertex for reco: " << vrec->z
942  << " at gen:" << v->position().z() << " with sign: "
943  << fabs(vrec->z - v->position().z()) / vrec->recVtx->zError()
944  << std::endl;
945  }
946  }
947  } // end for loop on reconstructed vertices
948 }
tuple cout
Definition: gather_cfg.py:121
void PrimaryVertexAnalyzer4PUSlimmed::matchSim2RecoVertices ( std::vector< simPrimaryVertex > &  simpv,
const reco::VertexCollection reco_vertices 
)
private

Definition at line 848 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References abs_z_match_, gather_cfg::cout, sigma_z_match_, findQualityFiles::v, and verbose_.

Referenced by analyze().

850  {
851  if (verbose_) {
852  std::cout << "PrimaryVertexAnalyzer4PUSlimmed::matchSim2RecoVertices "
853  << reco_vertices.size() << std::endl;
854  }
855  for (std::vector<simPrimaryVertex>::iterator vsim = simpv.begin();
856  vsim != simpv.end(); vsim++) {
857  for (std::vector<reco::Vertex>::const_iterator vrec = reco_vertices.begin();
858  vrec != reco_vertices.end(); vrec++) {
859  if (vrec->isFake() || vrec->ndof() < 0.) {
860  continue; // skip fake vertices
861  }
862  if (verbose_) {
863  std::cout << "Considering reconstructed vertex at Z:" << vrec->z()
864  << std::endl;
865  }
866  if (((fabs(vrec->z() - vsim->z) / vrec->zError()) < sigma_z_match_)
867  && (fabs(vrec->z() - vsim->z) < abs_z_match_)) {
868  vsim->rec_vertices.push_back(&(*vrec));
869  if (verbose_) {
870  std::cout << "Trying a matching vertex for " << vsim->z << " at "
871  << vrec->z() << " with sign: "
872  << fabs(vrec->z() - vsim->z) / vrec->zError() << std::endl;
873  }
874  }
875  } // end of loop on reconstructed vertices
876  if (verbose_) {
877  if (vsim->rec_vertices.size()) {
878  for (auto const& v : vsim->rec_vertices) {
879  std::cout << "Found a matching vertex for genVtx "
880  << vsim->z << " at " << v->z()
881  << " with sign: " << fabs(v->z() - vsim->z) / v->zError()
882  << std::endl;
883  }
884  } else {
885  std::cout << "No matching vertex for " << vsim->z << std::endl;
886  }
887  }
888  } // end for loop on simulated vertices
889  if (verbose_) {
890  std::cout << "Done with matching sim vertices" << std::endl;
891  }
892 }
tuple cout
Definition: gather_cfg.py:121
void PrimaryVertexAnalyzer4PUSlimmed::resetSimPVAssociation ( std::vector< simPrimaryVertex > &  simpv)
private

Definition at line 838 of file PrimaryVertexAnalyzer4PUSlimmed.cc.

References findQualityFiles::v.

Referenced by analyze().

839  {
840  for (auto & v : simpv) {
841  v.num_matched_reco_tracks = 0;
842  v.average_match_quality = 0;
843  v.rec_vertices.clear();
844  }
845 }

Member Data Documentation

double PrimaryVertexAnalyzer4PUSlimmed::abs_z_match_
private
const TrackAssociatorBase* PrimaryVertexAnalyzer4PUSlimmed::associatorByHits_
private

Definition at line 172 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze().

edm::EDGetTokenT< edm::View<reco::Track> > PrimaryVertexAnalyzer4PUSlimmed::edmView_recoTrack_Token_
private

Definition at line 178 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze().

std::map<std::string, std::map<std::string, MonitorElement*> > PrimaryVertexAnalyzer4PUSlimmed::mes_
private
reco::RecoToSimCollection PrimaryVertexAnalyzer4PUSlimmed::r2s_
private

Definition at line 167 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze().

std::vector<edm::EDGetTokenT<reco::VertexCollection> > PrimaryVertexAnalyzer4PUSlimmed::reco_vertex_collection_tokens_
private

Definition at line 175 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze(), and PrimaryVertexAnalyzer4PUSlimmed().

std::vector<edm::InputTag > PrimaryVertexAnalyzer4PUSlimmed::reco_vertex_collections_
private
edm::EDGetTokenT<reco::TrackCollection> PrimaryVertexAnalyzer4PUSlimmed::recoTrackCollectionToken_
private

Definition at line 177 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze().

std::string PrimaryVertexAnalyzer4PUSlimmed::root_folder_
private

Definition at line 164 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by bookHistograms().

reco::SimToRecoCollection PrimaryVertexAnalyzer4PUSlimmed::s2r_
private

Definition at line 168 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze(), and getSimPVs().

double PrimaryVertexAnalyzer4PUSlimmed::sigma_z_match_
private
edm::EDGetTokenT<TrackingParticleCollection> PrimaryVertexAnalyzer4PUSlimmed::trackingParticleCollectionToken_
private

Definition at line 179 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze().

edm::EDGetTokenT<TrackingVertexCollection> PrimaryVertexAnalyzer4PUSlimmed::trackingVertexCollectionToken_
private

Definition at line 180 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze().

bool PrimaryVertexAnalyzer4PUSlimmed::use_only_charged_tracks_
private

Definition at line 160 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by getSimPVs().

bool PrimaryVertexAnalyzer4PUSlimmed::use_TP_associator_
private

Definition at line 161 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze().

edm::EDGetTokenT< std::vector<PileupSummaryInfo> > PrimaryVertexAnalyzer4PUSlimmed::vecPileupSummaryInfoToken_
private

Definition at line 174 of file PrimaryVertexAnalyzer4PUSlimmed.h.

Referenced by analyze().

bool PrimaryVertexAnalyzer4PUSlimmed::verbose_
private