CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ElectronConversionRejectionValidator Class Reference

#include <ElectronConversionRejectionValidator.h>

Inheritance diagram for ElectronConversionRejectionValidator:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &bei, edm::Run const &, edm::EventSetup const &) override
 
 ElectronConversionRejectionValidator (const edm::ParameterSet &)
 
 ~ElectronConversionRejectionValidator () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamspotToken_
 
std::string conversionCollection_
 
std::string conversionCollectionProducer_
 
edm::EDGetTokenT< reco::ConversionCollectionconvToken_
 
std::string dqmpath_
 
float eleD0Max_
 
int eleExpectedHitsInnerMax_
 
float elePtMin_
 
std::string fName_
 
edm::EDGetTokenT< reco::GsfElectronCollectiongsfElecToken_
 
std::string gsfElectronCollection_
 
std::string gsfElectronCollectionProducer_
 
MonitorElementh_convEta_
 
MonitorElementh_convLeadTrackAlgo_
 
MonitorElementh_convLeadTrackpt_
 
MonitorElementh_convLog10TrailTrackpt_
 
MonitorElementh_convPhi_
 
MonitorElementh_convProb_
 
MonitorElementh_convPt_
 
MonitorElementh_convRho_
 
MonitorElementh_convTrailTrackAlgo_
 
MonitorElementh_convTrailTrackpt_
 
MonitorElementh_convZ_
 
MonitorElementh_eleEtaAll_
 
MonitorElementh_eleEtaEff_
 
MonitorElementh_eleEtaFail_
 
MonitorElementh_eleEtaPass_
 
MonitorElementh_elePhiAll_
 
MonitorElementh_elePhiEff_
 
MonitorElementh_elePhiFail_
 
MonitorElementh_elePhiPass_
 
MonitorElementh_elePtAll_
 
MonitorElementh_elePtEff_
 
MonitorElementh_elePtFail_
 
MonitorElementh_elePtPass_
 
bool isRunCentrally_
 
int nEntry_
 
int nEvt_
 
edm::EDGetTokenT< reco::VertexCollectionoffline_pvToken_
 
edm::ParameterSet parameters_
 
int verbosity_
 

Detailed Description

$Id: ElectronConversionRejectionValidator

Author
J.Bendavid

Definition at line 43 of file ElectronConversionRejectionValidator.h.

Constructor & Destructor Documentation

ElectronConversionRejectionValidator::ElectronConversionRejectionValidator ( const edm::ParameterSet pset)
explicit

Definition at line 49 of file ElectronConversionRejectionValidator.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

50 {
51 
53  verbosity_ = pset.getUntrackedParameter<int>("Verbosity");
54  parameters_ = pset;
55 
56  gsfElectronCollectionProducer_ = pset.getParameter<std::string>("gsfElectronProducer");
57  gsfElectronCollection_ = pset.getParameter<std::string>("gsfElectronCollection");
58 
60  conversionCollection_ = pset.getParameter<std::string>("conversionCollection");
61  // conversionTrackProducer_ = pset.getParameter<std::string>("trackProducer");
62  gsfElecToken_ = consumes<reco::GsfElectronCollection>(
64  gsfElectronCollection_));
65  convToken_ = consumes<reco::ConversionCollection>(
66  edm::InputTag(conversionCollectionProducer_,
67  conversionCollection_));
68 
69  isRunCentrally_= pset.getParameter<bool>("isRunCentrally");
70 
71  elePtMin_ = pset.getParameter<double>("elePtMin");
72  eleExpectedHitsInnerMax_ = pset.getParameter<int>("eleExpectedHitsInnerMax");
73  eleD0Max_ = pset.getParameter<double>("eleD0Max");
74  offline_pvToken_ = consumes<reco::VertexCollection>(
75  pset.getUntrackedParameter<edm::InputTag> ("offlinePV",
76  edm::InputTag("offlinePrimaryVertices")));
77  beamspotToken_ = consumes<reco::BeamSpot>(
78  pset.getUntrackedParameter<edm::InputTag> ("beamspot",
79  edm::InputTag("offlineBeamSpot")));
80 
81  nEvt_=0;
82  nEntry_=0;
83 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::VertexCollection > offline_pvToken_
edm::EDGetTokenT< reco::GsfElectronCollection > gsfElecToken_
edm::EDGetTokenT< reco::ConversionCollection > convToken_
ElectronConversionRejectionValidator::~ElectronConversionRejectionValidator ( )
override

Definition at line 85 of file ElectronConversionRejectionValidator.cc.

85 {}

Member Function Documentation

void ElectronConversionRejectionValidator::analyze ( const edm::Event e,
const edm::EventSetup esup 
)
override

Definition at line 157 of file ElectronConversionRejectionValidator.cc.

References funct::abs(), reco::TrackBase::algo(), reco::Vertex::chi2(), ChiSquaredProbability(), conv, reco::Conversion::conversionVertex(), edm::Event::getByToken(), electronConversionRejectionValidator::gsfElectronCollection, edm::EventBase::id(), edm::HandleBase::isValid(), ConversionTools::matchedConversion(), reco::HitPattern::MISSING_INNER_HITS, reco::Vertex::ndof(), reco::BeamSpot::position(), reco::Vertex::position(), edm::Handle< T >::product(), reco::TrackBase::pt(), reco::Conversion::refittedPairMomentum(), and reco::Conversion::tracks().

157  {
158 
159  using namespace edm;
160 
161 
162  nEvt_++;
163  LogInfo("ElectronConversionRejectionValidator")
164  << "ElectronConversionRejectionValidator Analyzing event number: "
165  << e.id() << " Global Counter " << nEvt_ <<"\n";
166 
169  e.getByToken(convToken_, convHandle);
170  if (!convHandle.isValid()) {
171  edm::LogError("ElectronConversionRejectionValidator")
172  << "Error! Can't get the Conversion collection "<< std::endl;
173  return;
174  }
175 
177  Handle<reco::GsfElectronCollection> gsfElectronHandle;
178  e.getByToken(gsfElecToken_, gsfElectronHandle);
179  const reco::GsfElectronCollection &gsfElectronCollection = *(gsfElectronHandle.product());
180  if (!gsfElectronHandle.isValid()) {
181  edm::LogError("ElectronConversionRejectionValidator")
182  << "Error! Can't get the Electron collection "<< std::endl;
183  return;
184  }
185 
186  // offline Primary vertex
188  e.getByToken(offline_pvToken_, vertexHandle);
189  if (!vertexHandle.isValid()) {
190  edm::LogError("ElectronConversionRejectionValidator")
191  << "Error! Can't get the product primary Vertex Collection "<< "\n";
192  return;
193  }
194  const reco::Vertex &thevtx = vertexHandle->at(0);
195 
197  e.getByToken(beamspotToken_, bsHandle);
198  if (!bsHandle.isValid()) {
199  edm::LogError("ElectronConversionRejectionValidator")
200  << "Error! Can't get the product beamspot Collection "<< "\n";
201  return;
202  }
203  const reco::BeamSpot &thebs = *bsHandle.product();
204 
205 
206  //loop over electrons
207  for (reco::GsfElectronCollection::const_iterator iele = gsfElectronCollection.begin(); iele!=gsfElectronCollection.end(); ++iele) {
208  //apply basic pre-selection cuts to remove the conversions with obviously displaced tracks which will anyways be
209  //removed from the analysis by the hit pattern or impact parameter requirements
210  if (iele->pt() < elePtMin_) continue;
211  if (iele->gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) > eleExpectedHitsInnerMax_) continue;
212  if ( std::abs(iele->gsfTrack()->dxy(thevtx.position())) > eleD0Max_ ) continue;
213 
214  //fill information for all electrons
215  h_elePtAll_->Fill(iele->pt());
216  h_eleEtaAll_->Fill(iele->eta());
217  h_elePhiAll_->Fill(iele->phi());
218 
219 
220  //find matching conversion if any
221  reco::Conversion const* conv = ConversionTools::matchedConversion(*iele,*convHandle,thebs.position());
222  //fill information on passing electrons only if there is no matching conversion (electron passed the conversion rejection cut!)
223  if (conv == nullptr) {
224  h_elePtPass_->Fill(iele->pt());
225  h_eleEtaPass_->Fill(iele->eta());
226  h_elePhiPass_->Fill(iele->phi());
227  }
228  else {
229  //matching conversion, electron failed conversion rejection cut
230  //fill information on electron and matching conversion
231  //(Note that in case of multiple matching conversions passing the requirements, the conversion tools returns the one closest to the IP,
232  //which is most likely to be the conversion of the primary photon in case there was one.)
233 
234  //fill electron info
235  h_elePtFail_->Fill(iele->pt());
236  h_eleEtaFail_->Fill(iele->eta());
237  h_elePhiFail_->Fill(iele->phi());
238 
239  //fill conversion info
240  math::XYZVectorF convmom = conv->refittedPairMomentum();
241  h_convPt_->Fill(convmom.rho());
242  h_convEta_->Fill(convmom.eta());
243  h_convPhi_->Fill(convmom.phi());
244  h_convRho_->Fill(conv->conversionVertex().position().rho());
245  h_convZ_->Fill(conv->conversionVertex().position().z());
247 
248  //fill information about conversion tracks
249  if (conv->tracks().size()<2) continue;
250 
251  RefToBase<reco::Track> tk1 = conv->tracks().front();
252  RefToBase<reco::Track> tk2 = conv->tracks().back();
253 
254  RefToBase<reco::Track> tklead;
255  RefToBase<reco::Track> tktrail;
256  if (tk1->pt() >= tk2->pt()) {
257  tklead = tk1;
258  tktrail = tk2;
259  }
260  else {
261  tklead = tk2;
262  tktrail = tk1;
263  }
264  h_convLeadTrackpt_->Fill(tklead->pt());
265  h_convTrailTrackpt_->Fill(tktrail->pt());
266  h_convLog10TrailTrackpt_->Fill(log10(tktrail->pt()));
267  h_convLeadTrackAlgo_->Fill(tklead->algo());
268  h_convTrailTrackAlgo_->Fill(tktrail->algo());
269 
270  }
271  }
272 
273 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:98
static reco::Conversion const * matchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
static HepMC::IO_HEPEVT conv
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
const Point & position() const
position
Definition: Vertex.h:109
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:248
void Fill(long long x)
TrackAlgorithm algo() const
Definition: TrackBase.h:536
double pt() const
track transverse momentum
Definition: TrackBase.h:660
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double chi2() const
chi-squares
Definition: Vertex.h:98
float ChiSquaredProbability(double chiSquared, double nrDOF)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
Definition: Vector3D.h:17
edm::EDGetTokenT< reco::VertexCollection > offline_pvToken_
bool isValid() const
Definition: HandleBase.h:74
double ndof() const
Definition: Vertex.h:105
T const * product() const
Definition: Handle.h:74
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
const Point & position() const
position
Definition: BeamSpot.h:62
edm::EDGetTokenT< reco::GsfElectronCollection > gsfElecToken_
edm::EDGetTokenT< reco::ConversionCollection > convToken_
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:176
void ElectronConversionRejectionValidator::bookHistograms ( DQMStore::IBooker bei,
edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 88 of file ElectronConversionRejectionValidator.cc.

References reco::TrackBase::algoSize, DQMStore::IBooker::book1D(), conversionPostprocessing_cfi::etaBin, ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, conversionPostprocessing_cfi::phiBin, AlignmentTrackSelector_cfi::phiMax, AlignmentTrackSelector_cfi::phiMin, Pi, electronConversionRejectionValidator::ptBin, AlignmentTrackSelector_cfi::ptMax, ptMin, electronConversionRejectionValidator::rhoBin, egammaForCoreTracking_cff::rhoMax, electronConversionRejectionValidator::rhoMin, DQMStore::IBooker::setCurrentFolder(), electronConversionRejectionValidator::trackptBin, electronConversionRejectionValidator::trackptMax, electronConversionRejectionValidator::trackptMin, conversionPostprocessing_cfi::zBin, hfnoseDigiStudy_cfi::zMax, and hfnoseDigiStudy_cfi::zMin.

89  {
90 
91  double ptMin = parameters_.getParameter<double>("ptMin");
92  double ptMax = parameters_.getParameter<double>("ptMax");
93  int ptBin = parameters_.getParameter<int>("ptBin");
94 
95  double trackptMin = parameters_.getParameter<double>("trackptMin");
96  double trackptMax = parameters_.getParameter<double>("trackptMax");
97  int trackptBin = parameters_.getParameter<int>("trackptBin");
98 
99  double etaMin = parameters_.getParameter<double>("etaMin");
100  double etaMax = parameters_.getParameter<double>("etaMax");
101  int etaBin = parameters_.getParameter<int>("etaBin");
102 
103  double phiMin = -TMath::Pi();
104  double phiMax = TMath::Pi();
105  int phiBin = parameters_.getParameter<int>("phiBin");
106 
107 
108  double rhoMin = parameters_.getParameter<double>("rhoMin");
109  double rhoMax = parameters_.getParameter<double>("rhoMax");
110  int rhoBin = parameters_.getParameter<int>("rhoBin");
111 
112  double zMin = parameters_.getParameter<double>("zMin");
113  double zMax = parameters_.getParameter<double>("zMax");
114  int zBin = parameters_.getParameter<int>("zBin");
115 
117  // SC from reco photons
118 
119  //TString simfolder = TString(
120  //std::string simpath = dqmpath_ + "SimulationInfo";
121  ibooker.setCurrentFolder(dqmpath_);
122  //
123  // simulation information about conversions
124  // Histograms for efficiencies
125  h_elePtAll_ = ibooker.book1D("elePtAll", "# of Electrons", ptBin, ptMin, ptMax);
126  h_eleEtaAll_ = ibooker.book1D("eleEtaAll", "# of Electrons", etaBin, etaMin, etaMax);
127  h_elePhiAll_ = ibooker.book1D("elePhiAll", "# of Electrons", phiBin, phiMin, phiMax);
128 
129  h_elePtPass_ = ibooker.book1D("elePtPass", "# of Electrons", ptBin, ptMin, ptMax);
130  h_eleEtaPass_ = ibooker.book1D("eleEtaPass", "# of Electrons", etaBin, etaMin, etaMax);
131  h_elePhiPass_ = ibooker.book1D("elePhiPass", "# of Electrons", phiBin, phiMin, phiMax);
132 
133  h_elePtFail_ = ibooker.book1D("elePtFail", "# of Electrons", ptBin, ptMin, ptMax);
134  h_eleEtaFail_ = ibooker.book1D("eleEtaFail", "# of Electrons",etaBin, etaMin, etaMax);
135  h_elePhiFail_ = ibooker.book1D("elePhiFail", "# of Electrons", phiBin, phiMin, phiMax);
136 
137  h_convPt_ = ibooker.book1D("convPt", "# of Electrons", ptBin, ptMin, ptMax);
138  h_convEta_ = ibooker.book1D("convEta", "# of Electrons", etaBin, etaMin, etaMax);
139  h_convPhi_ = ibooker.book1D("convPhi", "# of Electrons", phiBin, phiMin, phiMax);
140  h_convRho_ = ibooker.book1D("convRho", "# of Electrons", rhoBin, rhoMin, rhoMax);
141  h_convZ_ = ibooker.book1D("convZ", "# of Electrons", zBin, zMin, zMax);
142  h_convProb_ = ibooker.book1D("convProb", "# of Electrons", 100, 0.0, 1.0);
143 
144  h_convLeadTrackpt_ = ibooker.book1D("convLeadTrackpt", "# of Electrons", trackptBin,
145  trackptMin, trackptMax);
146 
147  h_convTrailTrackpt_ = ibooker.book1D("convTrailTrackpt", "# of Electrons", trackptBin,
148  trackptMin, trackptMax);
149 
150  h_convLog10TrailTrackpt_ = ibooker.book1D("convLog10TrailTrackpt", "# of Electrons",
151  ptBin, -2.0, 3.0);
152 
153  h_convLeadTrackAlgo_ = ibooker.book1D("convLeadTrackAlgo", "# of Electrons", reco::TrackBase::algoSize, -0.5, reco::TrackBase::algoSize-0.5);
154  h_convTrailTrackAlgo_ = ibooker.book1D("convLeadTrackAlgo", "# of Electrons", reco::TrackBase::algoSize, -0.5, reco::TrackBase::algoSize-0.5);
155 }
const double Pi
T getParameter(std::string const &) const

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> ElectronConversionRejectionValidator::beamspotToken_
private

Definition at line 76 of file ElectronConversionRejectionValidator.h.

std::string ElectronConversionRejectionValidator::conversionCollection_
private

Definition at line 66 of file ElectronConversionRejectionValidator.h.

std::string ElectronConversionRejectionValidator::conversionCollectionProducer_
private

Definition at line 65 of file ElectronConversionRejectionValidator.h.

edm::EDGetTokenT<reco::ConversionCollection> ElectronConversionRejectionValidator::convToken_
private

Definition at line 74 of file ElectronConversionRejectionValidator.h.

std::string ElectronConversionRejectionValidator::dqmpath_
private

Definition at line 71 of file ElectronConversionRejectionValidator.h.

float ElectronConversionRejectionValidator::eleD0Max_
private

Definition at line 84 of file ElectronConversionRejectionValidator.h.

int ElectronConversionRejectionValidator::eleExpectedHitsInnerMax_
private

Definition at line 83 of file ElectronConversionRejectionValidator.h.

float ElectronConversionRejectionValidator::elePtMin_
private

Definition at line 82 of file ElectronConversionRejectionValidator.h.

std::string ElectronConversionRejectionValidator::fName_
private

Definition at line 57 of file ElectronConversionRejectionValidator.h.

edm::EDGetTokenT<reco::GsfElectronCollection> ElectronConversionRejectionValidator::gsfElecToken_
private

Definition at line 73 of file ElectronConversionRejectionValidator.h.

std::string ElectronConversionRejectionValidator::gsfElectronCollection_
private

Definition at line 69 of file ElectronConversionRejectionValidator.h.

std::string ElectronConversionRejectionValidator::gsfElectronCollectionProducer_
private

Definition at line 68 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convEta_
private

Definition at line 104 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convLeadTrackAlgo_
private

Definition at line 114 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convLeadTrackpt_
private

Definition at line 111 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convLog10TrailTrackpt_
private

Definition at line 113 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convPhi_
private

Definition at line 105 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convProb_
private

Definition at line 109 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convPt_
private

Definition at line 103 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convRho_
private

Definition at line 106 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convTrailTrackAlgo_
private

Definition at line 115 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convTrailTrackpt_
private

Definition at line 112 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_convZ_
private

Definition at line 107 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_eleEtaAll_
private

Definition at line 88 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_eleEtaEff_
private

Definition at line 100 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_eleEtaFail_
private

Definition at line 96 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_eleEtaPass_
private

Definition at line 92 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_elePhiAll_
private

Definition at line 89 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_elePhiEff_
private

Definition at line 101 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_elePhiFail_
private

Definition at line 97 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_elePhiPass_
private

Definition at line 93 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_elePtAll_
private

Definition at line 87 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_elePtEff_
private

Definition at line 99 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_elePtFail_
private

Definition at line 95 of file ElectronConversionRejectionValidator.h.

MonitorElement* ElectronConversionRejectionValidator::h_elePtPass_
private

Definition at line 91 of file ElectronConversionRejectionValidator.h.

bool ElectronConversionRejectionValidator::isRunCentrally_
private

Definition at line 80 of file ElectronConversionRejectionValidator.h.

int ElectronConversionRejectionValidator::nEntry_
private

Definition at line 61 of file ElectronConversionRejectionValidator.h.

int ElectronConversionRejectionValidator::nEvt_
private

Definition at line 60 of file ElectronConversionRejectionValidator.h.

edm::EDGetTokenT<reco::VertexCollection> ElectronConversionRejectionValidator::offline_pvToken_
private

Definition at line 75 of file ElectronConversionRejectionValidator.h.

edm::ParameterSet ElectronConversionRejectionValidator::parameters_
private
int ElectronConversionRejectionValidator::verbosity_
private

Definition at line 59 of file ElectronConversionRejectionValidator.h.