84 :
pvs_(consumes<
std::vector<
reco::Vertex>>(params.getParameter<
edm::InputTag>(
"pvSrc"))),
86 svs_(consumes<
edm::
View<
reco::VertexCompositePtrCandidate>>(params.getParameter<
edm::InputTag>(
"svSrc"))),
93 dlenMin_(params.getParameter<double>(
"dlenMin")),
94 dlenSigMin_(params.getParameter<double>(
"dlenSigMin")),
98 produces<nanoaod::FlatTable>(
"pv");
99 produces<nanoaod::FlatTable>(
"otherPVs");
100 produces<nanoaod::FlatTable>(
"svs");
101 produces<edm::PtrVector<reco::Candidate>>();
121 auto pvTable = std::make_unique<nanoaod::FlatTable>(1,
pvName_,
true);
122 pvTable->addColumnValue<
float>(
124 pvTable->addColumnValue<
float>(
126 pvTable->addColumnValue<
float>(
128 pvTable->addColumnValue<
float>(
130 pvTable->addColumnValue<
float>(
133 for (
const auto&
pv : *pvsIn)
136 pvTable->addColumnValue<
int>(
138 pvTable->addColumnValue<
int>(
"npvsGood",
140 "number of good reconstructed primary vertices. selection:" +
goodPvCutString_,
142 pvTable->addColumnValue<
float>(
"score",
143 (*pvsScoreIn).get(pvsIn.id(), 0),
144 "main primary vertex score, i.e. sum pt2 of clustered objects",
149 std::make_unique<nanoaod::FlatTable>((*pvsIn).size() > 4 ? 3 : (*pvsIn).size() - 1,
"Other" +
pvName_,
false);
150 std::vector<float> pvsz;
151 for (
size_t i = 1;
i < (*pvsIn).size() &&
i < 4;
i++)
152 pvsz.push_back((*pvsIn)[
i - 1].position().z());
153 otherPVsTable->addColumn<
float>(
158 auto selCandSv = std::make_unique<PtrVector<reco::Candidate>>();
159 std::vector<float> dlen, dlenSig, pAngle,
dxy, dxySig;
165 const auto& PV0 = pvsIn->front();
166 for (
const auto&
sv : *svsIn) {
171 dlen.push_back(dl.
value());
174 selCandSv->push_back(c);
175 double dx = (PV0.x() -
sv.vx()),
dy = (PV0.y() -
sv.vy()),
dz = (PV0.z() -
sv.vz());
177 pAngle.push_back(std::acos(pdotv));
180 dxy.push_back(d2d.
value());
185 for (
unsigned int id = 0;
id <
sv.numberOfDaughters(); ++
id) {
187 sum_charge += daughter->
charge();
189 charge.push_back(sum_charge);
196 auto svsTable = std::make_unique<nanoaod::FlatTable>(selCandSv->size(),
svName_,
false);
202 svsTable->addColumn<
float>(
void endStream() override
reco::Vertex::Point convertPos(const GlobalPoint &p)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvs_
const std::string pvName_
~VertexTableProducer() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
reco::Vertex::Error convertError(const GlobalError &ge)
const edm::EDGetTokenT< edm::ValueMap< float > > pvsScore_
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
const std::string goodPvCutString_
Measurement1D distance(const GlobalPoint &vtx1Position, const GlobalError &vtx1PositionError, const GlobalPoint &vtx2Position, const GlobalError &vtx2PositionError) const override
#define DEFINE_FWK_MODULE(type)
goodPVs
Good Primary Vertex Selection.
void addDefault(ParameterSetDescription const &psetDescription)
VertexTableProducer(const edm::ParameterSet &)
const edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > svs_
double significance() const
void produce(edm::Event &, const edm::EventSetup &) override
virtual int charge() const =0
electric charge
const std::string svName_
void beginStream(edm::StreamID) override
const StringCutObjectSelector< reco::Vertex > goodPvCut_
const StringCutObjectSelector< reco::Candidate > svCut_