27 template <
typename T,
size_t N>
29 const double minLog10 = std::log10(
min);
30 const double maxLog10 = std::log10(
max);
31 const double width = (maxLog10 - minLog10) /
N;
32 std::array<T, N + 1>
ret;
35 for (
size_t i = 1;
i <=
N; ++
i) {
74 :
maxResol_(iConfig.getUntrackedParameter<double>(
"maxResol")),
76 maxPull_(iConfig.getUntrackedParameter<double>(
"maxPull")),
77 binsPull_(iConfig.getUntrackedParameter<
int>(
"binsPull")) {}
87 :
minNtracks_(iConfig.getUntrackedParameter<double>(
"minNtracks")),
88 maxNtracks_(iConfig.getUntrackedParameter<double>(
"maxNtracks")),
90 minNvertices_(iConfig.getUntrackedParameter<double>(
"minNvertices")),
91 maxNvertices_(iConfig.getUntrackedParameter<double>(
"maxNvertices")),
93 maxXY_(iConfig.getUntrackedParameter<double>(
"maxXY")),
94 binsXY_(iConfig.getUntrackedParameter<
int>(
"binsXY")),
95 maxZ_(iConfig.getUntrackedParameter<double>(
"maxZ")),
96 binsZ_(iConfig.getUntrackedParameter<
int>(
"binsZ")),
97 minPt_(iConfig.getUntrackedParameter<double>(
"minPt")),
98 maxPt_(iConfig.getUntrackedParameter<double>(
"maxPt")),
99 minLumi_(iConfig.getUntrackedParameter<double>(
"minLumi")),
100 maxLumi_(iConfig.getUntrackedParameter<double>(
"maxLumi")) {}
121 const double diffx = vertex1.
x() - vertex2.
x();
122 const double diffy = vertex1.
y() - vertex2.
y();
123 const double diffz = vertex1.
z() - vertex2.
z();
128 const double invSqrt2 = 1. /
std::sqrt(2.);
129 resx_ = diffx * invSqrt2;
130 resy_ = diffy * invSqrt2;
131 resz_ = diffz * invSqrt2;
137 avgx_ = (vertex1.
x() + vertex2.
x()) / 2.;
138 avgy_ = (vertex1.
y() + vertex2.
y()) / 2.;
139 avgz_ = (vertex1.
z() + vertex2.
z()) / 2.;
170 template <
typename T>
172 book(iBooker, binArray.size() - 1, binArray.front(), binArray.back());
173 setLogX(binArray.size() - 1, binArray.data());
176 template <
typename... Args>
182 std::forward<Args>(
args)...,
188 std::forward<Args>(
args)...,
194 std::forward<Args>(
args)...,
203 std::forward<Args>(
args)...,
209 std::forward<Args>(
args)...,
215 std::forward<Args>(
args)...,
220 template <
typename... Args>
231 template <
typename T>
268 hDiffX_ = iBooker.
book1D(
"res_x",
"Resolution of X", binsResol, -maxResol, maxResol);
269 hDiffY_ = iBooker.
book1D(
"res_y",
"Resolution of Y", binsResol, -maxResol, maxResol);
270 hDiffZ_ = iBooker.
book1D(
"res_z",
"Resolution of Z", binsResol, -maxResol, maxResol);
274 hPullX_ = iBooker.
book1D(+
"pull_x",
"Pull of X", binsPull, -maxPull, maxPull);
275 hPullY_ = iBooker.
book1D(+
"pull_y",
"Pull of Y", binsPull, -maxPull, maxPull);
276 hPullZ_ = iBooker.
book1D(+
"pull_z",
"Pull of Z", binsPull, -maxPull, maxPull);
294 std::mt19937& engine,
334 forceSCAL_(iConfig.getUntrackedParameter<
bool>(
"forceSCAL")),
335 rootFolder_(iConfig.getUntrackedParameter<
std::
string>(
"rootFolder")),
338 hPV_(binningX_, binningY_),
339 hOtherV_(binningX_, binningY_) {}
349 desc.addUntracked<
bool>(
"forceSCAL",
true);
351 desc.addUntracked<
std::string>(
"transientTrackBuilder",
"TransientTrackBuilder");
354 desc.addUntracked<
double>(
"maxResol", 0.02);
355 desc.addUntracked<
int>(
"binsResol", 100);
357 desc.addUntracked<
double>(
"maxPull", 5);
358 desc.addUntracked<
int>(
"binsPull", 100);
361 desc.addUntracked<
double>(
"minNtracks", -0.5);
362 desc.addUntracked<
double>(
"maxNtracks", 119.5);
363 desc.addUntracked<
int>(
"binsNtracks", 60);
365 desc.addUntracked<
double>(
"minNvertices", -0.5);
366 desc.addUntracked<
double>(
"maxNvertices", 199.5);
367 desc.addUntracked<
int>(
"binsNvertices", 100);
369 desc.addUntracked<
double>(
"maxXY", 0.15);
370 desc.addUntracked<
int>(
"binsXY", 100);
372 desc.addUntracked<
double>(
"maxZ", 30.);
373 desc.addUntracked<
int>(
"binsZ", 100);
375 desc.addUntracked<
double>(
"minPt", 1);
376 desc.addUntracked<
double>(
"maxPt", 1
e3);
378 desc.addUntracked<
double>(
"minLumi", 200.);
379 desc.addUntracked<
double>(
"maxLumi", 20000.);
381 descriptions.
add(
"primaryVertexResolution",
desc);
405 LumiScalersCollection::const_iterator scalit =
lumiScalers->begin();
406 lumi = scalit->instantLumi();
424 const auto nvertices =
vertices.size();
432 for (
auto endPV = cend(
vertices); iPV != endPV; ++iPV) {
433 if (iPV->tracksSize() >= 4) {
443 std::vector<const reco::Track*> sortedTracks;
450 return a->pt() >
b->pt();
453 std::vector<reco::TransientTrack> ttracks;
454 ttracks.reserve(sortedTracks.size());
466 std::mt19937& engine,
470 std::vector<reco::TransientTrack> set1, set2;
471 set1.reserve(
end / 2);
472 set2.reserve(
end / 2);
474 auto dis = std::uniform_int_distribution<>(0, 1);
476 double sumpt1 = 0, sumpt2 = 0;
477 for (
size_t i = 0;
i <
end;
i += 2) {
478 const size_t set1_i = dis(engine);
479 const size_t set2_i = 1 - set1_i;
481 set1.push_back(
tracks[
i + set1_i]);
482 set2.push_back(
tracks[
i + set2_i]);
484 sumpt1 += set1.back().track().pt();
485 sumpt2 += set2.back().track().pt();
const edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > ttbToken_
BinningX(const edm::ParameterSet &iConfig)
void setLogX(Args &&... args)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
double z() const
z coordinate
virtual void setCurrentFolder(std::string const &fullpath)
void book(DQMStore::IBooker &iBooker)
ret
prodAgent to be discontinued
void calculateAndFillResolution(const std::vector< reco::TransientTrack > &tracks, size_t nvertices, float lumi, std::mt19937 &engine, AdaptiveVertexFitter &fitter)
PrimaryVertexResolution(const edm::ParameterSet &iConfig)
void book(DQMStore::IBooker &iBooker, Args &&... args)
Class to contain the online luminosity from soft FED 1022.
DiffPlots hDiff_instLumiScal_
~PrimaryVertexResolution() override
std::vector< Vertex > VertexCollection
collection of Vertex objects
const BinningY & binningY_
float instLumi() const
Return the luminosity for the current nibble.
double zError() const
error on z
void analyze(const edm::Event &, const edm::EventSetup &) override
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
std::vector< Vertex > VertexCollection
double xError() const
error on x
trackRef_iterator tracks_end() const
last iterator over tracks
size_t tracksSize() const
number of tracks
reco::TransientTrack build(const reco::Track *p) const
const BinningX & binningX_
Plots(const BinningX &binX, const BinningY &binY)
const BinningY & binningY_
void fill(const Resolution &res, const T ref)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
BinningY(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< LumiScalersCollection > lumiScalersSrc_
trackRef_iterator tracks_begin() const
first iterator over tracks
#define DEFINE_FWK_MODULE(type)
void bookLogX(DQMStore::IBooker &iBooker, const T &binArray)
double x() const
x coordinate
DiffPlots hDiff_Nvertices_
double y() const
y coordinate
edm::EDGetTokenT< reco::VertexCollection > vertexSrc_
DiffPlots(const std::string &postfix, const BinningY &binY)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::array< T, N+1 > makeLogBins(const T &min, const T &max)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
edm::EDGetTokenT< reco::BeamSpot > beamspotSrc_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< reco::TransientTrack > sortTracksByPt(const reco::Vertex &thePV, const TransientTrackBuilder &ttBuilder, const reco::BeamSpot &beamspot)
Resolution(const reco::Vertex &vertex1, const reco::Vertex &vertex2)
double yError() const
error on y
Square< F >::type sqr(const F &f)
std::vector< LumiScalers > LumiScalersCollection
AdaptiveVertexFitter fitter_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
edm::EDGetTokenT< OnlineLuminosityRecord > metaDataSrc_
Power< A, B >::type pow(const A &a, const B &b)