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);
284 constexpr
int binsPt = 30;
287 constexpr
int binsLumi = 100;
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();