62 gsfElecToken_ = consumes<reco::GsfElectronCollection>(
64 gsfElectronCollection_));
65 convToken_ = consumes<reco::ConversionCollection>(
67 conversionCollection_));
69 isRunCentrally_= pset.
getParameter<
bool>(
"isRunCentrally");
72 eleExpectedHitsInnerMax_ = pset.
getParameter<
int>(
"eleExpectedHitsInnerMax");
74 offline_pvToken_ = consumes<reco::VertexCollection>(
77 beamspotToken_ = consumes<reco::BeamSpot>(
125 double ptMin = parameters_.getParameter<
double>(
"ptMin");
126 double ptMax = parameters_.getParameter<
double>(
"ptMax");
127 int ptBin = parameters_.getParameter<
int>(
"ptBin");
129 double trackptMin = parameters_.getParameter<
double>(
"trackptMin");
130 double trackptMax = parameters_.getParameter<
double>(
"trackptMax");
131 int trackptBin = parameters_.getParameter<
int>(
"trackptBin");
133 double etaMin = parameters_.getParameter<
double>(
"etaMin");
134 double etaMax = parameters_.getParameter<
double>(
"etaMax");
135 int etaBin = parameters_.getParameter<
int>(
"etaBin");
139 int phiBin = parameters_.getParameter<
int>(
"phiBin");
142 double rhoMin = parameters_.getParameter<
double>(
"rhoMin");
143 double rhoMax = parameters_.getParameter<
double>(
"rhoMax");
144 int rhoBin = parameters_.getParameter<
int>(
"rhoBin");
146 double zMin = parameters_.getParameter<
double>(
"zMin");
147 double zMax = parameters_.getParameter<
double>(
"zMax");
148 int zBin = parameters_.getParameter<
int>(
"zBin");
160 h_elePtAll_ =
dbe_->
book1D(
"elePtAll",
"# of Electrons",ptBin,ptMin,ptMax);
161 h_eleEtaAll_ =
dbe_->
book1D(
"eleEtaAll",
"# of Electrons",etaBin,etaMin,etaMax);
162 h_elePhiAll_ =
dbe_->
book1D(
"elePhiAll",
"# of Electrons",phiBin,phiMin,phiMax);
164 h_elePtPass_ =
dbe_->
book1D(
"elePtPass",
"# of Electrons",ptBin,ptMin,ptMax);
165 h_eleEtaPass_ =
dbe_->
book1D(
"eleEtaPass",
"# of Electrons",etaBin,etaMin,etaMax);
166 h_elePhiPass_ =
dbe_->
book1D(
"elePhiPass",
"# of Electrons",phiBin,phiMin,phiMax);
168 h_elePtFail_ =
dbe_->
book1D(
"elePtFail",
"# of Electrons",ptBin,ptMin,ptMax);
169 h_eleEtaFail_ =
dbe_->
book1D(
"eleEtaFail",
"# of Electrons",etaBin,etaMin,etaMax);
170 h_elePhiFail_ =
dbe_->
book1D(
"elePhiFail",
"# of Electrons",phiBin,phiMin,phiMax);
172 h_convPt_ =
dbe_->
book1D(
"convPt",
"# of Electrons",ptBin,ptMin,ptMax);
173 h_convEta_ =
dbe_->
book1D(
"convEta",
"# of Electrons",etaBin,etaMin,etaMax);
174 h_convPhi_ =
dbe_->
book1D(
"convPhi",
"# of Electrons",phiBin,phiMin,phiMax);
175 h_convRho_ =
dbe_->
book1D(
"convRho",
"# of Electrons",rhoBin,rhoMin,rhoMax);
176 h_convZ_ =
dbe_->
book1D(
"convZ",
"# of Electrons",zBin,zMin,zMax);
177 h_convProb_ =
dbe_->
book1D(
"convProb",
"# of Electrons",100,0.0,1.0);
179 h_convLeadTrackpt_ =
dbe_->
book1D(
"convLeadTrackpt",
"# of Electrons",trackptBin,trackptMin,trackptMax);
180 h_convTrailTrackpt_ =
dbe_->
book1D(
"convTrailTrackpt",
"# of Electrons",trackptBin,trackptMin,trackptMax);
181 h_convLog10TrailTrackpt_ =
dbe_->
book1D(
"convLog10TrailTrackpt",
"# of Electrons",ptBin,-2.0,3.0);
183 h_convLeadTrackAlgo_ =
dbe_->
book1D(
"convLeadTrackAlgo",
"# of Electrons",31,-0.5,30.5);
184 h_convTrailTrackAlgo_ =
dbe_->
book1D(
"convLeadTrackAlgo",
"# of Electrons",31,-0.5,30.5);
206 LogInfo(
"ElectronConversionRejectionValidator")
207 <<
"ElectronConversionRejectionValidator Analyzing event number: "
208 << e.
id() <<
" Global Counter " << nEvt_ <<
"\n";
213 if (!convHandle.isValid()) {
215 <<
"Error! Can't get the Conversion collection "<< std::endl;
221 e.
getByToken(gsfElecToken_, gsfElectronHandle);
223 if (!gsfElectronHandle.isValid()) {
225 <<
"Error! Can't get the Electron collection "<< std::endl;
232 if (!vertexHandle.isValid()) {
234 <<
"Error! Can't get the product primary Vertex Collection "<<
"\n";
241 if (!bsHandle.isValid()) {
243 <<
"Error! Can't get the product beamspot Collection "<<
"\n";
250 for (reco::GsfElectronCollection::const_iterator iele = gsfElectronCollection.begin(); iele!=gsfElectronCollection.end(); ++iele) {
253 if (iele->pt() < elePtMin_)
continue;
254 if (iele->gsfTrack()->trackerExpectedHitsInner().numberOfHits() > eleExpectedHitsInnerMax_)
continue;
255 if (
std::abs(iele->gsfTrack()->dxy(thevtx.position())) > eleD0Max_ )
continue;
258 h_elePtAll_->Fill(iele->pt());
259 h_eleEtaAll_->Fill(iele->eta());
260 h_elePhiAll_->Fill(iele->phi());
267 h_elePtPass_->Fill(iele->pt());
268 h_eleEtaPass_->Fill(iele->eta());
269 h_elePhiPass_->Fill(iele->phi());
278 h_elePtFail_->Fill(iele->pt());
279 h_eleEtaFail_->Fill(iele->eta());
280 h_elePhiFail_->Fill(iele->phi());
284 h_convPt_->Fill(convmom.rho());
285 h_convEta_->Fill(convmom.eta());
286 h_convPhi_->Fill(convmom.phi());
287 h_convRho_->Fill(convref->conversionVertex().position().rho());
288 h_convZ_->Fill(convref->conversionVertex().position().z());
289 h_convProb_->Fill(
ChiSquaredProbability(convref->conversionVertex().chi2(),convref->conversionVertex().ndof()));
292 if (convref->tracks().size()<2)
continue;
299 if (tk1->
pt() >= tk2->
pt()) {
307 h_convLeadTrackpt_->Fill(tklead->
pt());
308 h_convTrailTrackpt_->Fill(tktrail->
pt());
309 h_convLog10TrailTrackpt_->Fill(log10(tktrail->
pt()));
310 h_convLeadTrackAlgo_->Fill(tklead->
algo());
311 h_convTrailTrackAlgo_->Fill(tktrail->
algo());
326 if ( ! isRunCentrally_ ) {
330 edm::LogInfo(
"ElectronConversionRejectionValidator") <<
"Analyzed " << nEvt_ <<
"\n";
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
virtual void analyze(const edm::Event &, const edm::EventSetup &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
ElectronConversionRejectionValidator(const edm::ParameterSet &)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
void bookHistograms(fwlite::EventContainer &eventCont)
TrackAlgorithm algo() const
bool isNull() const
Checks for null.
virtual ~ElectronConversionRejectionValidator()
double pt() const
track transverse momentum
void bookHistograms(void)
Abs< T >::type abs(const T &t)
float ChiSquaredProbability(double chiSquared, double nrDOF)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
virtual void endRun(edm::Run &r, edm::EventSetup const &es)
void setCurrentFolder(const std::string &fullpath)
virtual void beginRun(edm::Run const &r, edm::EventSetup const &theEventSetup)