83 : pvs_(consumes<std::
vector<
reco::Vertex>>(params.getParameter<edm::
InputTag>(
"pvSrc"))),
84 pvsScore_(consumes<edm::ValueMap<float>>(params.getParameter<edm::
InputTag>(
"pvSrc"))),
85 svs_(consumes<edm::
View<
reco::VertexCompositePtrCandidate>>(params.getParameter<edm::
InputTag>(
"svSrc"))),
86 svCut_(params.getParameter<std::
string>(
"svCut"),
true),
87 goodPvCut_(params.getParameter<std::
string>(
"goodPvCut"),
true),
88 goodPvCutString_(params.getParameter<std::
string>(
"goodPvCut")),
89 pvName_(params.getParameter<std::
string>(
"pvName")),
90 svName_(params.getParameter<std::
string>(
"svName")),
91 svDoc_(params.getParameter<std::
string>(
"svDoc")),
92 dlenMin_(params.getParameter<double>(
"dlenMin")),
93 dlenSigMin_(params.getParameter<double>(
"dlenSigMin"))
96 produces<nanoaod::FlatTable>(
"pv");
97 produces<nanoaod::FlatTable>(
"otherPVs");
98 produces<nanoaod::FlatTable>(
"svs");
99 produces<edm::PtrVector<reco::Candidate>>();
119 auto pvTable = std::make_unique<nanoaod::FlatTable>(1,
pvName_,
true);
120 pvTable->addColumnValue<
float>(
"ndof", (*pvsIn)[0].ndof(),
"main primary vertex number of degree of freedom", 8);
121 pvTable->addColumnValue<
float>(
"x", (*pvsIn)[0].position().x(),
"main primary vertex position x coordinate", 10);
122 pvTable->addColumnValue<
float>(
"y", (*pvsIn)[0].position().y(),
"main primary vertex position y coordinate", 10);
123 pvTable->addColumnValue<
float>(
"z", (*pvsIn)[0].position().z(),
"main primary vertex position z coordinate", 16);
124 pvTable->addColumnValue<
float>(
"chi2", (*pvsIn)[0].normalizedChi2(),
"main primary vertex reduced chi2", 8);
126 for (
const auto&
pv : *pvsIn)
129 pvTable->addColumnValue<
int>(
"npvs", pvsIn->size(),
"total number of reconstructed primary vertices");
130 pvTable->addColumnValue<
int>(
132 pvTable->addColumnValue<
float>(
133 "score", pvsScoreIn->get(pvsIn.id(), 0),
"main primary vertex score, i.e. sum pt2 of clustered objects", 8);
136 std::make_unique<nanoaod::FlatTable>((*pvsIn).size() > 4 ? 3 : (*pvsIn).size() - 1,
"Other" +
pvName_,
false);
137 std::vector<float> pvsz;
138 std::vector<float> pvscores;
139 for (
size_t i = 1;
i < (*pvsIn).size() &&
i < 4;
i++) {
141 pvscores.push_back((*pvsScoreIn).get(pvsIn.id(),
i));
143 otherPVsTable->addColumn<
float>(
"z", pvsz,
"Z position of other primary vertices, excluding the main PV", 8);
144 otherPVsTable->addColumn<
float>(
"score", pvscores,
"scores of other primary vertices, excluding the main PV", 8);
148 auto selCandSv = std::make_unique<PtrVector<reco::Candidate>>();
149 std::vector<float> dlen, dlenSig, pAngle,
dxy, dxySig;
155 const auto& PV0 = pvsIn->front();
156 for (
const auto& sv : *svsIn) {
161 dlen.push_back(dl.
value());
164 selCandSv->push_back(c);
165 double dx = (PV0.x() - sv.vx()),
dy = (PV0.y() - sv.vy()),
dz = (PV0.z() - sv.vz());
166 double pdotv = (dx * sv.px() +
dy * sv.py() +
dz * sv.pz()) / sv.p() /
sqrt(dx * dx +
dy *
dy +
dz *
dz);
167 pAngle.push_back(std::acos(pdotv));
174 for (
unsigned int id = 0;
id < sv.numberOfDaughters(); ++
id) {
176 sum_charge += daughter->
charge();
178 charge.push_back(sum_charge);
184 auto svsTable = std::make_unique<nanoaod::FlatTable>(selCandSv->size(),
svName_,
false);
186 svsTable->addColumn<
float>(
"dlen", dlen,
"decay length in cm", 10);
187 svsTable->addColumn<
float>(
"dlenSig", dlenSig,
"decay length significance", 10);
188 svsTable->addColumn<
float>(
"dxy",
dxy,
"2D decay length in cm", 10);
189 svsTable->addColumn<
float>(
"dxySig", dxySig,
"2D decay length significance", 10);
190 svsTable->addColumn<
float>(
"pAngle", pAngle,
"pointing angle, i.e. acos(p_SV * (SV - PV)) ", 10);
191 svsTable->addColumn<
int>(
"charge",
charge,
"sum of the charge of the SV tracks", 10);
void endStream() override
reco::Vertex::Point convertPos(const GlobalPoint &p)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
const edm::EventSetup & c
const edm::EDGetTokenT< std::vector< reco::Vertex > > pvs_
const std::string pvName_
uint16_t *__restrict__ id
~VertexTableProducer() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
reco::Vertex::Error convertError(const GlobalError &ge)
const edm::EDGetTokenT< edm::ValueMap< float > > pvsScore_
const std::string goodPvCutString_
void addDefault(ParameterSetDescription const &psetDescription)
VertexTableProducer(const edm::ParameterSet &)
const edm::EDGetTokenT< edm::View< reco::VertexCompositePtrCandidate > > svs_
virtual int charge() const =0
electric charge
double significance() const
void produce(edm::Event &, const edm::EventSetup &) override
const std::string svName_
static int position[264][3]
tuple goodPVs
Good Primary Vertex Selection.
void beginStream(edm::StreamID) override
const StringCutObjectSelector< reco::Vertex > goodPvCut_
const StringCutObjectSelector< reco::Candidate > svCut_