49 token_PFCandToVertexAssMap_ =
51 token_VertexToPFCandAssMap_ =
54 token_VertexCollection_ = mayConsume<VertexCollection>(iConfig.
getParameter<
InputTag>(
"VertexCollection"));
56 input_MinQuality_ = iConfig.
getParameter<
int>(
"MinQuality");
60 if (input_AssociationType_.label() ==
"PFCandsToVertex") {
61 produces<PFCandidateCollection>(
"P2V");
63 if (input_AssociationType_.label() ==
"VertexToPFCands") {
64 produces<PFCandidateCollection>(
"V2P");
66 if (input_AssociationType_.label() ==
"Both") {
67 produces<PFCandidateCollection>(
"P2V");
68 produces<PFCandidateCollection>(
"V2P");
70 cout <<
"No correct InputTag for AssociationType!" << endl;
71 cout <<
"Won't produce any PFCandiateCollection!" << endl;
91 bool p2vassmap =
false;
92 bool v2passmap =
false;
98 string asstype = input_AssociationType_.label();
100 if ((asstype ==
"PFCandsToVertex") || (asstype ==
"Both")) {
101 if (iEvent.
getByToken(token_PFCandToVertexAssMap_, p2vAM)) {
106 if ((asstype ==
"VertexToPFCands") || (asstype ==
"Both")) {
107 if (iEvent.
getByToken(token_VertexToPFCandAssMap_, v2pAM)) {
112 if (!p2vassmap && !v2passmap) {
113 cout <<
"No input collection could be found" << endl;
117 int negativeQuality = 0;
118 if (input_MinQuality_ >= 2) {
119 negativeQuality = -1;
121 if (input_MinQuality_ == 1) {
122 negativeQuality = -2;
124 negativeQuality = -3;
132 for (
unsigned int pfccoll_ite = 0; pfccoll_ite < pfccoll.size(); pfccoll_ite++) {
134 int quality = pfccoll[pfccoll_ite].second;
136 if ((quality >= input_MinQuality_) || ((quality < 0) && (quality >= negativeQuality))) {
137 p2v_firstvertex->push_back(*pfcand);
147 iEvent.
getByToken(token_VertexCollection_, input_vtxcollH);
149 VertexRef firstVertexRef(input_vtxcollH, 0);
153 for (v2p_ite = v2pAM->begin(); v2p_ite != v2pAM->end(); v2p_ite++) {
156 for (
unsigned v_ite = 0; v_ite < (v2p_ite->
val).
size(); v_ite++) {
160 if ((vtxref == firstVertexRef) &&
161 ((quality >= input_MinQuality_) || ((quality < 0) && (quality >= negativeQuality)))) {
162 v2p_firstvertex->push_back(*pfcand);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< l1t::PFCandidate > PFCandidateCollection
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
U second(std::pair< T, U > const &p)
void addDefault(ParameterSetDescription const &psetDescription)
~PFCand_NoPU_WithAM() override
void produce(edm::Event &, const edm::EventSetup &) override
PFCand_NoPU_WithAM(const edm::ParameterSet &)
std::vector< PFCandQualityPair > PFCandQualityPairVector
T getParameter(std::string const &) const
T first(std::pair< T, U > const &p)
tuple size
Write out results.