50 token_PFCandToVertexAssMap_ = mayConsume<PFCandToVertexAssMap>(iConfig.
getParameter<
InputTag>(
"VertexPFCandAssociationMap"));
51 token_VertexToPFCandAssMap_ = mayConsume<VertexToPFCandAssMap>(iConfig.
getParameter<
InputTag>(
"VertexPFCandAssociationMap"));
53 token_VertexCollection_ = mayConsume<VertexCollection>(iConfig.
getParameter<
InputTag>(
"VertexCollection"));
55 input_MinQuality_ = iConfig.
getParameter<
int>(
"MinQuality");
59 if ( input_AssociationType_.label() ==
"PFCandsToVertex" ) {
60 produces<PFCandidateCollection>(
"P2V");
62 if ( input_AssociationType_.label() ==
"VertexToPFCands" ) {
63 produces<PFCandidateCollection>(
"V2P");
65 if ( input_AssociationType_.label() ==
"Both" ) {
66 produces<PFCandidateCollection>(
"P2V");
67 produces<PFCandidateCollection>(
"V2P");
69 cout <<
"No correct InputTag for AssociationType!" << endl;
70 cout <<
"Won't produce any PFCandiateCollection!" << endl;
98 bool p2vassmap =
false;
99 bool v2passmap =
false;
105 string asstype = input_AssociationType_.label();
107 if ( ( asstype ==
"PFCandsToVertex" ) || ( asstype ==
"Both" ) ) {
108 if ( iEvent.
getByToken(token_PFCandToVertexAssMap_, p2vAM ) ) {
113 if ( ( asstype ==
"VertexToPFCands" ) || ( asstype ==
"Both" ) ) {
114 if ( iEvent.
getByToken(token_VertexToPFCandAssMap_, v2pAM ) ) {
119 if ( !p2vassmap && !v2passmap ) {
120 cout <<
"No input collection could be found" << endl;
124 int negativeQuality = 0;
125 if ( input_MinQuality_ >= 2) {
126 negativeQuality = -1;
128 if ( input_MinQuality_ == 1) {
129 negativeQuality = -2;
131 negativeQuality = -3;
140 for (
unsigned int pfccoll_ite = 0; pfccoll_ite < pfccoll.size(); pfccoll_ite++){
143 int quality = pfccoll[pfccoll_ite].second;
145 if ( (quality>=input_MinQuality_) || ( (quality<0) && (quality>=negativeQuality) ) ) {
146 p2v_firstvertex->push_back(*pfcand);
152 iEvent.
put( p2v_firstvertex,
"P2V" );
160 iEvent.
getByToken(token_VertexCollection_,input_vtxcollH);
162 VertexRef firstVertexRef(input_vtxcollH,0);
166 for(v2p_ite=v2pAM->begin(); v2p_ite!=v2pAM->end(); v2p_ite++){
170 for(
unsigned v_ite = 0; v_ite<(v2p_ite->
val).
size(); v_ite++){
175 if ( (vtxref==firstVertexRef) && ( (quality>=input_MinQuality_) || ( (quality<0) && (quality>=negativeQuality) ) ) ) {
176 v2p_firstvertex->push_back(*pfcand);
183 iEvent.
put( v2p_firstvertex,
"V2P" );
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
U second(std::pair< T, U > const &p)
void addDefault(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< PFCandQualityPair > PFCandQualityPairVector
virtual void produce(edm::Event &, const edm::EventSetup &)
PFCand_NoPU_WithAM(const edm::ParameterSet &)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
T first(std::pair< T, U > const &p)
tuple size
Write out results.