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;
86 bool p2vassmap =
false;
87 bool v2passmap =
false;
93 string asstype = input_AssociationType_.label();
95 if ((asstype ==
"PFCandsToVertex") || (asstype ==
"Both")) {
96 if (
iEvent.getByToken(token_PFCandToVertexAssMap_, p2vAM)) {
101 if ((asstype ==
"VertexToPFCands") || (asstype ==
"Both")) {
102 if (
iEvent.getByToken(token_VertexToPFCandAssMap_, v2pAM)) {
107 if (!p2vassmap && !v2passmap) {
108 cout <<
"No input collection could be found" << endl;
112 int negativeQuality = 0;
113 if (input_MinQuality_ >= 2) {
114 negativeQuality = -1;
116 if (input_MinQuality_ == 1) {
117 negativeQuality = -2;
119 negativeQuality = -3;
127 for (
unsigned int pfccoll_ite = 0; pfccoll_ite < pfccoll.size(); pfccoll_ite++) {
129 int quality = pfccoll[pfccoll_ite].second;
131 if ((
quality >= input_MinQuality_) || ((quality < 0) && (quality >= negativeQuality))) {
132 p2v_firstvertex->push_back(*
pfcand);
142 iEvent.getByToken(token_VertexCollection_, input_vtxcollH);
144 VertexRef firstVertexRef(input_vtxcollH, 0);
148 for (v2p_ite = v2pAM->
begin(); v2p_ite != v2pAM->
end(); v2p_ite++) {
151 for (
unsigned v_ite = 0; v_ite < (v2p_ite->
val).size(); v_ite++) {
155 if ((vtxref == firstVertexRef) &&
157 v2p_firstvertex->push_back(*
pfcand);
175 desc.add<
int>(
"MinQuality");
T getParameter(std::string const &) const
std::vector< l1t::PFCandidate > PFCandidateCollection
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const_iterator end() const
last iterator over the map (read only)
U second(std::pair< T, U > const &p)
void addDefault(ParameterSetDescription const &psetDescription)
#define DEFINE_FWK_MODULE(type)
PFCand_NoPU_WithAM(const edm::ParameterSet &)
std::vector< PFCandQualityPair > PFCandQualityPairVector
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const_iterator begin() const
first iterator over the map (read only)
T first(std::pair< T, U > const &p)