20 vz_(params.getParameter<
std::vector<double>>(
"zbins"))
22 produces<nanoaod::FlatTable>();
28 auto npuTab = std::make_unique<nanoaod::FlatTable>(1,
"Pileup",
true);
32 const double refpvz = (*pvsIn)[0].position().z();
52 for(
unsigned int ibx=0; ibx<npuProd.size(); ibx++) {
53 if(npuProd[ibx].getBunchCrossing()==0) {
55 nt = npuProd[ibx].getTrueNumInteractions();
56 npu = npuProd[ibx].getPU_NumInteractions();
58 std::vector<float> zpositions;
59 unsigned int nzpositions = npuProd[ibx].getPU_zpositions().size();
60 for (
unsigned int j=0; j<nzpositions; ++j) {
61 zpositions.push_back(npuProd[ibx].getPU_zpositions()[j]);
62 if (
std::abs(zpositions.back()- refpvz)<0.1) pudensity++;
64 if (
bin !=
vz_.end() &&
bin==zbin) gpudensity++;
66 gpudensity/=(20.0*( *(zbin) - *(zbin - 1) )) ;
69 unsigned int eoot = 0;
70 for(
unsigned int ipu=0; ipu<bx0; ipu++) {
71 eoot+=npuProd[ipu].getPU_NumInteractions();
73 unsigned int loot = 0;
74 for(
unsigned int ipu=npuProd.size()-1; ipu>bx0; ipu--) {
75 loot+=npuProd[ipu].getPU_NumInteractions();
89 desc.
add<std::vector<double>> (
"zbins", {})->setComment(
"Z bins to compute the generator-level number of PU vertices per mm");
90 descriptions.
add(
"puTable", desc);
97 const std::vector<double>
vz_;
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void produce(edm::StreamID id, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
#define DEFINE_FWK_MODULE(type)
Abs< T >::type abs(const T &t)
NPUTablesProducer(edm::ParameterSet const ¶ms)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void addColumnValue(const std::string &name, const C &value, const std::string &docString, ColumnType type=defaultColumnType< T >(), int mantissaBits=-1)
bin
set the eta bin as selection string.
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > npuTag_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~NPUTablesProducer() override
void fillNPUObjectTable(const std::vector< PileupSummaryInfo > &npuProd, nanoaod::FlatTable &out, double refpvz) const
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvTag_
const std::vector< double > vz_