28 template <
typename T,
size_t N>
30 const double minLog10 = std::log10(
min);
31 const double maxLog10 = std::log10(
max);
32 const double width = (maxLog10 - minLog10) /
N;
33 std::array<T, N + 1>
ret;
36 for (
size_t i = 1;
i <=
N; ++
i) {
75 :
maxResol_(iConfig.getUntrackedParameter<double>(
"maxResol")),
77 maxPull_(iConfig.getUntrackedParameter<double>(
"maxPull")),
78 binsPull_(iConfig.getUntrackedParameter<
int>(
"binsPull")) {}
88 :
minNtracks_(iConfig.getUntrackedParameter<double>(
"minNtracks")),
89 maxNtracks_(iConfig.getUntrackedParameter<double>(
"maxNtracks")),
91 minNvertices_(iConfig.getUntrackedParameter<double>(
"minNvertices")),
92 maxNvertices_(iConfig.getUntrackedParameter<double>(
"maxNvertices")),
94 maxXY_(iConfig.getUntrackedParameter<double>(
"maxXY")),
95 binsXY_(iConfig.getUntrackedParameter<
int>(
"binsXY")),
96 maxZ_(iConfig.getUntrackedParameter<double>(
"maxZ")),
97 binsZ_(iConfig.getUntrackedParameter<
int>(
"binsZ")),
98 minPt_(iConfig.getUntrackedParameter<double>(
"minPt")),
99 maxPt_(iConfig.getUntrackedParameter<double>(
"maxPt")),
100 minLumi_(iConfig.getUntrackedParameter<double>(
"minLumi")),
101 maxLumi_(iConfig.getUntrackedParameter<double>(
"maxLumi")) {}
122 const double diffx = vertex1.
x() - vertex2.
x();
123 const double diffy = vertex1.
y() - vertex2.
y();
124 const double diffz = vertex1.
z() - vertex2.
z();
129 const double invSqrt2 = 1. /
std::sqrt(2.);
130 resx_ = diffx * invSqrt2;
131 resy_ = diffy * invSqrt2;
132 resz_ = diffz * invSqrt2;
138 avgx_ = (vertex1.
x() + vertex2.
x()) / 2.;
139 avgy_ = (vertex1.
y() + vertex2.
y()) / 2.;
140 avgz_ = (vertex1.
z() + vertex2.
z()) / 2.;
171 template <
typename T>
173 book(iBooker, binArray.size() - 1, binArray.front(), binArray.back());
174 setLogX(binArray.size() - 1, binArray.data());
177 template <
typename... Args>
183 std::forward<Args>(
args)...,
189 std::forward<Args>(
args)...,
195 std::forward<Args>(
args)...,
204 std::forward<Args>(
args)...,
210 std::forward<Args>(
args)...,
216 std::forward<Args>(
args)...,
221 template <
typename... Args>
232 template <
typename T>
269 hDiffX_ = iBooker.
book1D(
"res_x",
"Resolution of X", binsResol, -maxResol, maxResol);
270 hDiffY_ = iBooker.
book1D(
"res_y",
"Resolution of Y", binsResol, -maxResol, maxResol);
271 hDiffZ_ = iBooker.
book1D(
"res_z",
"Resolution of Z", binsResol, -maxResol, maxResol);
275 hPullX_ = iBooker.
book1D(+
"pull_x",
"Pull of X", binsPull, -maxPull, maxPull);
276 hPullY_ = iBooker.
book1D(+
"pull_y",
"Pull of Y", binsPull, -maxPull, maxPull);
277 hPullZ_ = iBooker.
book1D(+
"pull_z",
"Pull of Z", binsPull, -maxPull, maxPull);
285 constexpr
int binsPt = 30;
288 constexpr
int binsLumi = 100;
295 std::mt19937& engine,
334 forceSCAL_(iConfig.getUntrackedParameter<
bool>(
"forceSCAL")),
335 rootFolder_(iConfig.getUntrackedParameter<
std::
string>(
"rootFolder")),
336 transientTrackBuilder_(iConfig.getUntrackedParameter<
std::
string>(
"transientTrackBuilder")),
339 hPV_(binningX_, binningY_),
340 hOtherV_(binningX_, binningY_) {}
350 desc.addUntracked<
bool>(
"forceSCAL",
true);
352 desc.addUntracked<
std::string>(
"transientTrackBuilder",
"TransientTrackBuilder");
355 desc.addUntracked<
double>(
"maxResol", 0.02);
356 desc.addUntracked<
int>(
"binsResol", 100);
358 desc.addUntracked<
double>(
"maxPull", 5);
359 desc.addUntracked<
int>(
"binsPull", 100);
362 desc.addUntracked<
double>(
"minNtracks", -0.5);
363 desc.addUntracked<
double>(
"maxNtracks", 119.5);
364 desc.addUntracked<
int>(
"binsNtracks", 60);
366 desc.addUntracked<
double>(
"minNvertices", -0.5);
367 desc.addUntracked<
double>(
"maxNvertices", 199.5);
368 desc.addUntracked<
int>(
"binsNvertices", 100);
370 desc.addUntracked<
double>(
"maxXY", 0.15);
371 desc.addUntracked<
int>(
"binsXY", 100);
373 desc.addUntracked<
double>(
"maxZ", 30.);
374 desc.addUntracked<
int>(
"binsZ", 100);
376 desc.addUntracked<
double>(
"minPt", 1);
377 desc.addUntracked<
double>(
"maxPt", 1
e3);
379 desc.addUntracked<
double>(
"minLumi", 200.);
380 desc.addUntracked<
double>(
"maxLumi", 20000.);
382 descriptions.
add(
"primaryVertexResolution",
desc);
409 LumiScalersCollection::const_iterator scalit =
lumiScalers->begin();
410 lumi = scalit->instantLumi();
431 const auto nvertices =
vertices.size();
439 for (
auto endPV = cend(
vertices); iPV != endPV; ++iPV) {
440 if (iPV->tracksSize() >= 4) {
450 std::vector<const reco::Track*> sortedTracks;
457 return a->pt() >
b->pt();
460 std::vector<reco::TransientTrack> ttracks;
461 ttracks.reserve(sortedTracks.size());
473 std::mt19937& engine,
477 std::vector<reco::TransientTrack> set1, set2;
478 set1.reserve(
end / 2);
479 set2.reserve(
end / 2);
481 auto dis = std::uniform_int_distribution<>(0, 1);
483 double sumpt1 = 0, sumpt2 = 0;
484 for (
size_t i = 0;
i <
end;
i += 2) {
485 const size_t set1_i = dis(engine);
486 const size_t set2_i = 1 - set1_i;
488 set1.push_back(
tracks[
i + set1_i]);
489 set2.push_back(
tracks[
i + set2_i]);
491 sumpt1 += set1.back().track().pt();
492 sumpt2 += set2.back().track().pt();