52 input_VertexPFCandAssociationMap_ = iConfig.
getParameter<
InputTag>(
"VertexPFCandAssociationMap");
56 input_MinQuality_ = iConfig.
getParameter<
int>(
"MinQuality");
58 if ( input_MinQuality_ >= 3) {
59 negativeQuality_ = -1;
61 if ( input_MinQuality_ >= 1) {
62 negativeQuality_ = -2;
64 negativeQuality_ = -3;
71 if ( input_AssociationType_.label() ==
"PFCandsToVertex" ) {
72 produces<PFCandidateCollection>(
"P2V");
74 if ( input_AssociationType_.label() ==
"VertexToPFCands" ) {
75 produces<PFCandidateCollection>(
"V2P");
77 if ( input_AssociationType_.label() ==
"Both" ) {
78 produces<PFCandidateCollection>(
"P2V");
79 produces<PFCandidateCollection>(
"V2P");
81 edm::LogWarning(
"FirstVertexParticles") <<
"No correct InputTag for AssociationType!" << std::endl
82 <<
"Won't produce any PFCandidateCollection!" << std::endl;
110 bool p2vassmap =
false;
111 bool v2passmap =
false;
117 string asstype = input_AssociationType_.label();
119 if ( ( asstype ==
"PFCandsToVertex" ) || ( asstype ==
"Both" ) ) {
120 if ( iEvent.
getByLabel(input_VertexPFCandAssociationMap_, p2vAM ) ) {
125 if ( ( asstype ==
"VertexToPFCands" ) || ( asstype ==
"Both" ) ) {
126 if ( iEvent.
getByLabel(input_VertexPFCandAssociationMap_, v2pAM ) ) {
131 if ( !p2vassmap && !v2passmap ) {
132 edm::LogWarning(
"FirstVertexParticles") <<
"PFCand_NoPU_WithAM:: No input collection could be found" << endl;
138 if ( p2vAM->size()==0 ) {
139 iEvent.
put( p2v_firstvertex,
"P2V" );
146 for (
unsigned int pfccoll_ite = 0; pfccoll_ite < pfccoll.size(); pfccoll_ite++ ) {
149 int quality = pfccoll[pfccoll_ite].second;
151 if ( (quality>=input_MinQuality_) || ( (quality<0) && (quality>=negativeQuality_) ) ) {
152 p2v_firstvertex->push_back( *pfcand );
157 iEvent.
put( p2v_firstvertex,
"P2V" );
165 iEvent.
getByLabel(input_VertexCollection_,input_vtxcollH);
167 VertexRef firstVertexRef(input_vtxcollH,0);
171 for(v2p_ite=v2pAM->begin(); v2p_ite!=v2pAM->end(); v2p_ite++){
175 for(
unsigned v_ite = 0; v_ite<(v2p_ite->
val).
size(); v_ite++){
178 int quality = (v2p_ite->
val)[v_ite].
second;
180 if ( (vtxref==firstVertexRef) && ( (quality>=input_MinQuality_) || ( (quality<0) && (quality>=negativeQuality_) ) ) ) {
181 v2p_firstvertex->push_back( *pfcand);
188 iEvent.
put( v2p_firstvertex,
"V2P" );
T getParameter(std::string const &) const
DEFINE_FWK_MODULE(HiMixingModule)
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
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.