22 produces<nanoaod::FlatTable>();
28 auto npuTab = std::make_unique<nanoaod::FlatTable>(1,
"Pileup",
true);
32 const double refpvz = (*pvsIn)[0].position().z();
54 for (
unsigned int ibx = 0; ibx < npuProd.size(); ibx++) {
55 if (npuProd[ibx].getBunchCrossing() == 0) {
57 nt = npuProd[ibx].getTrueNumInteractions();
58 npu = npuProd[ibx].getPU_NumInteractions();
60 std::vector<float> zpositions;
61 unsigned int nzpositions = npuProd[ibx].getPU_zpositions().size();
62 for (
unsigned int j = 0;
j < nzpositions; ++
j) {
63 zpositions.push_back(npuProd[ibx].getPU_zpositions()[
j]);
64 if (
std::abs(zpositions.back() - refpvz) < 0.1)
70 gpudensity /= (20.0 * (*(zbin) - *(zbin - 1)));
73 pthatmax = *max_element(npuProd[ibx].getPU_pT_hats().begin(), npuProd[ibx].getPU_pT_hats().
end());
77 unsigned int eoot = 0;
78 for (
unsigned int ipu = 0; ipu < bx0; ipu++) {
79 eoot += npuProd[ipu].getPU_NumInteractions();
81 unsigned int loot = 0;
82 for (
unsigned int ipu = npuProd.size() - 1; ipu > bx0; ipu--) {
83 loot += npuProd[ipu].getPU_NumInteractions();
85 out.addColumnValue<
float>(
"nTrueInt",
87 "the true mean number of the poisson distribution for this event from which the number "
88 "of interactions each bunch crossing has been sampled");
89 out.addColumnValue<
int>(
92 "the number of pileup interactions that have been added to the event in the current bunch crossing");
93 out.addColumnValue<
int>(
"sumEOOT", eoot,
"number of early out of time pileup");
94 out.addColumnValue<
int>(
"sumLOOT", loot,
"number of late out of time pileup");
95 out.addColumnValue<
float>(
"pudensity", pudensity,
"PU vertices / mm");
96 out.addColumnValue<
float>(
"gpudensity", gpudensity,
"Generator-level PU vertices / mm");
98 out.addColumnValue<
float>(
"pthatmax", pthatmax,
"Maximum pt-hat");
105 ->setComment(
"tag for the PU information (vector<PileupSummaryInfo>)");
107 desc.add<std::vector<double>>(
"zbins", {})
108 ->setComment(
"Z bins to compute the generator-level number of PU vertices per mm");
109 desc.add<
bool>(
"savePtHatMax",
false)->setComment(
"Store maximum pt-hat of PU");
110 descriptions.
add(
"puTable",
desc);
117 const std::vector<double>
vz_;