CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
PrimaryVertexSorter< ParticlesCollection > Class Template Reference

#include <PrimaryVertexSorter.h>

Inheritance diagram for PrimaryVertexSorter< ParticlesCollection >:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef edm::Association< reco::VertexCollectionCandToVertex
 
typedef edm::ValueMap< int > CandToVertexQuality
 
typedef ParticlesCollection PFCollection
 
typedef edm::ValueMap< float > VertexScore
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 PrimaryVertexSorter (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
std::vector< reco::VertexsortedList (const reco::VertexCollection &primaryVertex) const
 
 ~PrimaryVertexSorter () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void doConsumesForTiming (const edm::ParameterSet &iConfig)
 
template<>
void doConsumesForTiming (const edm::ParameterSet &iConfig)
 
template<>
void doConsumesForTiming (const edm::ParameterSet &iConfig)
 
bool needsProductsForTiming ()
 
template<>
bool needsProductsForTiming ()
 
template<>
bool needsProductsForTiming ()
 
std::pair< int, PrimaryVertexAssignment::QualityrunAlgo (const reco::VertexCollection &vertices, const typename ParticlesCollection::value_type &pf, const edm::ValueMap< float > *trackTimeTag, const edm::ValueMap< float > *trackTimeResoTag, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder)
 
template<>
std::pair< int, PrimaryVertexAssignment::QualityrunAlgo (const reco::VertexCollection &vertices, const reco::RecoChargedRefCandidate &pf, const edm::ValueMap< float > *trackTimeTag, const edm::ValueMap< float > *trackTimeResoTag, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder)
 
template<>
std::pair< int, PrimaryVertexAssignment::QualityrunAlgo (const reco::VertexCollection &vertices, const reco::PFCandidate &pf, const edm::ValueMap< float > *trackTimeTag, const edm::ValueMap< float > *trackTimeResoTag, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder)
 

Private Attributes

PrimaryVertexAssignment assignmentAlgo_
 
bool produceOriginalMapping_
 
bool producePFNoPileUp_
 
bool producePFPileUp_
 
bool produceSortedVertices_
 
int qualityCut_
 
PrimaryVertexSorting sortingAlgo_
 
edm::EDGetTokenT< PFCollectiontokenCandidates_
 Candidates to be analyzed. More...
 
edm::EDGetTokenT< edm::View< reco::Candidate > > tokenJets_
 
edm::EDGetTokenT< edm::ValueMap< float > > tokenTrackTimeResoTag_
 
edm::EDGetTokenT< edm::ValueMap< float > > tokenTrackTimeTag_
 
edm::EDGetTokenT< reco::VertexCollectiontokenVertices_
 vertices More...
 
bool useMET_
 
bool useTiming_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<class ParticlesCollection>
class PrimaryVertexSorter< ParticlesCollection >

Author
Andrea Rizzi

class to sort VertexCollection in decreasing order of the sum of the squared track pT's

Definition at line 31 of file PrimaryVertexSorter.h.

Member Typedef Documentation

template<class ParticlesCollection>
typedef edm::Association<reco::VertexCollection> PrimaryVertexSorter< ParticlesCollection >::CandToVertex

Definition at line 34 of file PrimaryVertexSorter.h.

template<class ParticlesCollection>
typedef edm::ValueMap<int> PrimaryVertexSorter< ParticlesCollection >::CandToVertexQuality

Definition at line 35 of file PrimaryVertexSorter.h.

template<class ParticlesCollection>
typedef ParticlesCollection PrimaryVertexSorter< ParticlesCollection >::PFCollection

Definition at line 38 of file PrimaryVertexSorter.h.

template<class ParticlesCollection>
typedef edm::ValueMap<float> PrimaryVertexSorter< ParticlesCollection >::VertexScore

Definition at line 36 of file PrimaryVertexSorter.h.

Constructor & Destructor Documentation

template<class ParticlesCollection >
PrimaryVertexSorter< ParticlesCollection >::PrimaryVertexSorter ( const edm::ParameterSet iConfig)
explicit

Definition at line 88 of file PrimaryVertexSorter.h.

References PrimaryVertexSorter< ParticlesCollection >::doConsumesForTiming(), PrimaryVertexSorter< ParticlesCollection >::produceOriginalMapping_, PrimaryVertexSorter< ParticlesCollection >::producePFNoPileUp_, PrimaryVertexSorter< ParticlesCollection >::producePFPileUp_, PrimaryVertexSorter< ParticlesCollection >::produceSortedVertices_, and PrimaryVertexSorter< ParticlesCollection >::useTiming_.

88  :
89  assignmentAlgo_(iConfig.getParameterSet("assignment")),
90  sortingAlgo_(iConfig.getParameterSet("sorting")),
91  tokenCandidates_(consumes<ParticlesCollection>(iConfig.getParameter<edm::InputTag>("particles"))),
92  tokenVertices_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertices"))),
94  produceOriginalMapping_(iConfig.getParameter<bool>("produceAssociationToOriginalVertices")),
95  produceSortedVertices_(iConfig.getParameter<bool>("produceSortedVertices")),
96  producePFPileUp_(iConfig.getParameter<bool>("producePileUpCollection")),
97  producePFNoPileUp_(iConfig.getParameter<bool>("produceNoPileUpCollection")),
98  qualityCut_(iConfig.getParameter<int>("qualityForPrimary")),
99  useMET_(iConfig.getParameter<bool>("usePVMET")),
100  useTiming_(iConfig.getParameterSet("assignment").getParameter<bool>("useTiming"))
101 {
102 
103 using namespace std;
104 using namespace edm;
105 using namespace reco;
106 
108  produces< CandToVertex> ("original");
109  produces< CandToVertexQuality> ("original");
110  produces< VertexScore> ("original");
111  }
113  produces< reco::VertexCollection> ();
114  produces< CandToVertex> ();
115  produces< CandToVertexQuality> ();
116  produces< VertexScore> ();
117  }
118 
119  if(producePFPileUp_){
121  produces< PFCollection> ("originalPileUp");
123  produces< PFCollection> ("PileUp");
124  }
125 
126  if(producePFNoPileUp_){
128  produces< PFCollection> ("originalNoPileUp");
130  produces< PFCollection> ("NoPileUp");
131  }
132 
133  if (useTiming_) doConsumesForTiming(iConfig);
134 
135 }
T getParameter(std::string const &) const
void doConsumesForTiming(const edm::ParameterSet &iConfig)
PrimaryVertexSorting sortingAlgo_
edm::EDGetTokenT< PFCollection > tokenCandidates_
Candidates to be analyzed.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
ParameterSet const & getParameterSet(std::string const &) const
PrimaryVertexAssignment assignmentAlgo_
fixed size matrix
HLT enums.
edm::EDGetTokenT< reco::VertexCollection > tokenVertices_
vertices
edm::EDGetTokenT< edm::View< reco::Candidate > > tokenJets_
template<class ParticlesCollection>
PrimaryVertexSorter< ParticlesCollection >::~PrimaryVertexSorter ( )
inlineoverride

Definition at line 42 of file PrimaryVertexSorter.h.

References PrimaryVertexSorter< ParticlesCollection >::produce().

42 {}

Member Function Documentation

template<class ParticlesCollection>
void PrimaryVertexSorter< ParticlesCollection >::doConsumesForTiming ( const edm::ParameterSet iConfig)
private
template<>
void PrimaryVertexSorter< std::vector< reco::RecoChargedRefCandidate > >::doConsumesForTiming ( const edm::ParameterSet iConfig)
private

Definition at line 323 of file PrimaryVertexSorter.h.

References edm::ParameterSet::getParameter(), PrimaryVertexSorter< ParticlesCollection >::tokenTrackTimeResoTag_, and PrimaryVertexSorter< ParticlesCollection >::tokenTrackTimeTag_.

324 {
325  tokenTrackTimeTag_ = consumes<edm::ValueMap<float> > (iConfig.getParameter<edm::InputTag>("trackTimeTag"));
326  tokenTrackTimeResoTag_ = consumes<edm::ValueMap<float> > (iConfig.getParameter<edm::InputTag>("trackTimeResoTag"));
327 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::ValueMap< float > > tokenTrackTimeTag_
edm::EDGetTokenT< edm::ValueMap< float > > tokenTrackTimeResoTag_
template<>
void PrimaryVertexSorter< std::vector< reco::PFCandidate > >::doConsumesForTiming ( const edm::ParameterSet iConfig)
private

Definition at line 330 of file PrimaryVertexSorter.h.

331 {
332 }
template<class ParticlesCollection>
bool PrimaryVertexSorter< ParticlesCollection >::needsProductsForTiming ( )
private
template<>
bool PrimaryVertexSorter< std::vector< reco::RecoChargedRefCandidate > >::needsProductsForTiming ( )
private

Definition at line 335 of file PrimaryVertexSorter.h.

336 {
337  return true;
338 }
template<>
bool PrimaryVertexSorter< std::vector< reco::PFCandidate > >::needsProductsForTiming ( )
private

Definition at line 341 of file PrimaryVertexSorter.h.

342 {
343  return false;
344 }
template<class ParticlesCollection >
void PrimaryVertexSorter< ParticlesCollection >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 142 of file PrimaryVertexSorter.h.

References edm::helper::Filler< Map >::fill(), edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, training_settings::idx, edm::helper::Filler< Map >::insert(), fwrapper::jets, eostools::move(), PrimaryVertexSorter< ParticlesCollection >::needsProductsForTiming(), lumidbDDL::newToOld(), lumidbDDL::oldToNew(), HadronAndPartonSelector_cfi::particles, packedPFCandidateRefMixer_cfi::pf, PrimaryVertexSorter< ParticlesCollection >::produceOriginalMapping_, PrimaryVertexSorter< ParticlesCollection >::producePFNoPileUp_, PrimaryVertexSorter< ParticlesCollection >::producePFPileUp_, PrimaryVertexSorter< ParticlesCollection >::produceSortedVertices_, edm::Handle< T >::product(), edm::Event::put(), MetAnalyzer::pv(), PrimaryVertexSorter< ParticlesCollection >::qualityCut_, PrimaryVertexSorter< ParticlesCollection >::runAlgo(), alignCSCRings::s, PrimaryVertexSorting::score(), PrimaryVertexSorter< ParticlesCollection >::sortingAlgo_, PrimaryVertexSorter< ParticlesCollection >::tokenCandidates_, PrimaryVertexSorter< ParticlesCollection >::tokenJets_, PrimaryVertexSorter< ParticlesCollection >::tokenTrackTimeResoTag_, PrimaryVertexSorter< ParticlesCollection >::tokenTrackTimeTag_, PrimaryVertexSorter< ParticlesCollection >::tokenVertices_, RecoVertex_cff::trackTimeResoTag, RecoVertex_cff::trackTimeTag, PrimaryVertexSorter< ParticlesCollection >::useMET_, PrimaryVertexSorter< ParticlesCollection >::useTiming_, and electrons_cff::vertices.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), HTMLExport.HTMLExportStatic::export(), and PrimaryVertexSorter< ParticlesCollection >::~PrimaryVertexSorter().

142  {
143 
144 using namespace std;
145 using namespace edm;
146 using namespace reco;
147 
149  iEvent.getByToken( tokenJets_, jets);
150 
152  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
153 
154 
156  iEvent.getByToken( tokenVertices_, vertices);
157 
158  Handle<ParticlesCollection> particlesHandle;
159  iEvent.getByToken( tokenCandidates_, particlesHandle);
160 
161  Handle<edm::ValueMap<float> > trackTimeTagHandle;
162  Handle<edm::ValueMap<float> > trackTimeResoTagHandle;
163 
164  const edm::ValueMap<float> *trackTimeTag = nullptr;
165  const edm::ValueMap<float> *trackTimeResoTag = nullptr;
167  iEvent.getByToken(tokenTrackTimeTag_, trackTimeTagHandle);
168  iEvent.getByToken(tokenTrackTimeResoTag_, trackTimeResoTagHandle);
169 
170  trackTimeTag = trackTimeTagHandle.product();
171  trackTimeResoTag = trackTimeResoTagHandle.product();
172  }
173 
174  ParticlesCollection particles = *particlesHandle.product();
175  std::vector<int> pfToPVVector;
176  std::vector<PrimaryVertexAssignment::Quality> pfToPVQualityVector;
177  //reverse mapping
178  std::vector< std::vector<int> > pvToPFVector(vertices->size());
179  std::vector< std::vector<const reco::Candidate *> > pvToCandVector(vertices->size());
180  std::vector< std::vector<PrimaryVertexAssignment::Quality> > pvToPFQualityVector(vertices->size());
181  std::vector<float> vertexScoreOriginal(vertices->size());
182  std::vector<float> vertexScore(vertices->size());
183 
184  for(auto const & pf : particles) {
185  std::pair<int,PrimaryVertexAssignment::Quality> vtxWithQuality = runAlgo(*vertices,pf,trackTimeTag,trackTimeResoTag,*jets,*builder);
186  pfToPVVector.push_back(vtxWithQuality.first);
187  pfToPVQualityVector.push_back(vtxWithQuality.second);
188  }
189 
190  //Invert the mapping
191  for(size_t i = 0; i < pfToPVVector.size();i++)
192  {
193  auto pv = pfToPVVector[i];
194  auto qual = pfToPVQualityVector[i];
195  if(pv >=0 and qual >= qualityCut_){
196  pvToPFVector[pv].push_back(i);
197 // std::cout << i << std::endl;
198 // const typename ParticlesCollection::value_type & cp = particles[i];
199 // std::cout << "CP " << &cp << std::endl;
200  pvToCandVector[pv].push_back( &particles[i] );
201  pvToPFQualityVector[pv].push_back(qual);
202  }
203  }
204 
205  //Use multimap for sorting of indices
206  std::multimap<float,int> scores;
207  for(unsigned int i=0;i<vertices->size();i++){
208  float s=sortingAlgo_.score((*vertices)[i],pvToCandVector[i],useMET_);
209  vertexScoreOriginal[i]=s;
210  scores.insert(std::pair<float,int>(-s,i));
211  }
212 
213  //create indices
214  std::vector<int> oldToNew(vertices->size()), newToOld(vertices->size());
215  size_t newIdx=0;
216  for(auto const & idx : scores)
217  {
218 // std::cout << newIdx << " score: " << idx.first << " oldidx: " << idx.second << " "<< producePFPileUp_ << std::endl;
219  vertexScore[newIdx]=-idx.first;
220  oldToNew[idx.second]=newIdx;
221  newToOld[newIdx]=idx.second;
222  newIdx++;
223  }
224 
225 
226 
227 
229  unique_ptr< CandToVertex> pfCandToOriginalVertexOutput( new CandToVertex(vertices) );
230  unique_ptr< CandToVertexQuality> pfCandToOriginalVertexQualityOutput( new CandToVertexQuality() );
231  CandToVertex::Filler cand2VertexFiller(*pfCandToOriginalVertexOutput);
232  CandToVertexQuality::Filler cand2VertexQualityFiller(*pfCandToOriginalVertexQualityOutput);
233 
234  cand2VertexFiller.insert(particlesHandle,pfToPVVector.begin(),pfToPVVector.end());
235  cand2VertexQualityFiller.insert(particlesHandle,pfToPVQualityVector.begin(),pfToPVQualityVector.end());
236 
237  cand2VertexFiller.fill();
238  cand2VertexQualityFiller.fill();
239  iEvent.put(std::move(pfCandToOriginalVertexOutput) ,"original");
240  iEvent.put(std::move(pfCandToOriginalVertexQualityOutput) ,"original");
241 
242  unique_ptr< VertexScore> vertexScoreOriginalOutput( new VertexScore );
243  VertexScore::Filler vertexScoreOriginalFiller(*vertexScoreOriginalOutput);
244  vertexScoreOriginalFiller.insert(vertices,vertexScoreOriginal.begin(),vertexScoreOriginal.end());
245  vertexScoreOriginalFiller.fill();
246  iEvent.put(std::move(vertexScoreOriginalOutput) ,"original");
247 
248  }
249 
251  std::vector<int> pfToSortedPVVector;
252 // std::vector<int> pfToSortedPVQualityVector;
253  for(size_t i=0;i<pfToPVVector.size();i++) {
254  pfToSortedPVVector.push_back(oldToNew[pfToPVVector[i]]);
255 // pfToSortedPVQualityVector.push_back(pfToPVQualityVector[i]); //same as old!
256  }
257 
258  unique_ptr< reco::VertexCollection> sortedVerticesOutput( new reco::VertexCollection );
259  for(size_t i=0;i<vertices->size();i++){
260  sortedVerticesOutput->push_back((*vertices)[newToOld[i]]);
261  }
262  edm::OrphanHandle<reco::VertexCollection> oh = iEvent.put(std::move(sortedVerticesOutput));
263  unique_ptr< CandToVertex> pfCandToVertexOutput( new CandToVertex(oh) );
264  unique_ptr< CandToVertexQuality> pfCandToVertexQualityOutput( new CandToVertexQuality() );
265  CandToVertex::Filler cand2VertexFiller(*pfCandToVertexOutput);
266  CandToVertexQuality::Filler cand2VertexQualityFiller(*pfCandToVertexQualityOutput);
267 
268  cand2VertexFiller.insert(particlesHandle,pfToSortedPVVector.begin(),pfToSortedPVVector.end());
269  cand2VertexQualityFiller.insert(particlesHandle,pfToPVQualityVector.begin(),pfToPVQualityVector.end());
270 
271  cand2VertexFiller.fill();
272  cand2VertexQualityFiller.fill();
273  iEvent.put(std::move(pfCandToVertexOutput ));
274  iEvent.put(std::move(pfCandToVertexQualityOutput ));
275 
276  unique_ptr< VertexScore> vertexScoreOutput( new VertexScore );
277  VertexScore::Filler vertexScoreFiller(*vertexScoreOutput);
278  vertexScoreFiller.insert(oh,vertexScore.begin(),vertexScore.end());
279  vertexScoreFiller.fill();
280  iEvent.put(std::move(vertexScoreOutput));
281 
282 
283  }
284 
285 
286  unique_ptr< PFCollection > pfCollectionNOPUOriginalOutput( new PFCollection );
287  unique_ptr< PFCollection > pfCollectionNOPUOutput( new PFCollection );
288  unique_ptr< PFCollection > pfCollectionPUOriginalOutput( new PFCollection );
289  unique_ptr< PFCollection > pfCollectionPUOutput( new PFCollection );
290 
291  for(size_t i=0;i<particles.size();i++) {
292  auto pv = pfToPVVector[i];
293  auto qual = pfToPVQualityVector[i];
294 
295 
297  if(pv == newToOld[0] and qual >= qualityCut_)
298  pfCollectionNOPUOutput->push_back(particles[i]);
299 
301  if(pv != newToOld[0] and qual >= qualityCut_)
302  pfCollectionPUOutput->push_back(particles[i]);
303 
305  if(pv == 0 and qual >= qualityCut_)
306  pfCollectionNOPUOriginalOutput->push_back(particles[i]);
307 
309  if(pv != 0 and qual >= qualityCut_)
310  pfCollectionPUOriginalOutput->push_back(particles[i]);
311 
312  }
313  if(producePFNoPileUp_ && produceSortedVertices_) iEvent.put(std::move(pfCollectionNOPUOutput),"NoPileUp" );
314  if(producePFPileUp_ && produceSortedVertices_) iEvent.put(std::move(pfCollectionPUOutput), "PileUp");
315  if(producePFNoPileUp_ && produceOriginalMapping_) iEvent.put(std::move(pfCollectionNOPUOriginalOutput),"originalNoPileUp" );
316  if(producePFPileUp_ && produceOriginalMapping_) iEvent.put(std::move(pfCollectionPUOriginalOutput),"originalPileUp" );
317 
318 
319 }
edm::Association< reco::VertexCollection > CandToVertex
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
PrimaryVertexSorting sortingAlgo_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< PFCollection > tokenCandidates_
Candidates to be analyzed.
ParticlesCollection PFCollection
vector< PseudoJet > jets
def oldToNew(schema)
Definition: lumidbDDL.py:399
def pv(vc)
Definition: MetAnalyzer.py:6
bool needsProductsForTiming()
edm::EDGetTokenT< edm::ValueMap< float > > tokenTrackTimeTag_
helper::Filler< ValueMap< int > > Filler
Definition: ValueMap.h:169
edm::ValueMap< float > VertexScore
T const * product() const
Definition: Handle.h:81
std::pair< int, PrimaryVertexAssignment::Quality > runAlgo(const reco::VertexCollection &vertices, const typename ParticlesCollection::value_type &pf, const edm::ValueMap< float > *trackTimeTag, const edm::ValueMap< float > *trackTimeResoTag, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder)
const T & get() const
Definition: EventSetup.h:55
float score(const reco::Vertex &pv, const std::vector< const reco::Candidate * > &candidates, bool useMet) const
edm::ValueMap< int > CandToVertexQuality
fixed size matrix
HLT enums.
edm::EDGetTokenT< edm::ValueMap< float > > tokenTrackTimeResoTag_
def newToOld(schema)
Definition: lumidbDDL.py:413
edm::EDGetTokenT< reco::VertexCollection > tokenVertices_
vertices
def move(src, dest)
Definition: eostools.py:510
edm::EDGetTokenT< edm::View< reco::Candidate > > tokenJets_
template<class ParticlesCollection>
std::pair<int,PrimaryVertexAssignment::Quality> PrimaryVertexSorter< ParticlesCollection >::runAlgo ( const reco::VertexCollection vertices,
const typename ParticlesCollection::value_type &  pf,
const edm::ValueMap< float > *  trackTimeTag,
const edm::ValueMap< float > *  trackTimeResoTag,
const edm::View< reco::Candidate > &  jets,
const TransientTrackBuilder builder 
)
private
template<>
std::pair< int, PrimaryVertexAssignment::Quality > PrimaryVertexSorter< std::vector< reco::RecoChargedRefCandidate > >::runAlgo ( const reco::VertexCollection vertices,
const reco::RecoChargedRefCandidate pf,
const edm::ValueMap< float > *  trackTimeTag,
const edm::ValueMap< float > *  trackTimeResoTag,
const edm::View< reco::Candidate > &  jets,
const TransientTrackBuilder builder 
)
private

Definition at line 348 of file PrimaryVertexSorter.h.

References PrimaryVertexSorter< ParticlesCollection >::assignmentAlgo_, and PrimaryVertexAssignment::chargedHadronVertex().

350 {
351  return assignmentAlgo_.chargedHadronVertex( vertices, pf, trackTimeTag, trackTimeResoTag, jets, builder);
352 }
std::pair< int, PrimaryVertexAssignment::Quality > chargedHadronVertex(const reco::VertexCollection &vertices, const reco::TrackRef &trackRef, const reco::Track *track, float trackTime, float trackTimeResolution, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder) const
PrimaryVertexAssignment assignmentAlgo_
template<>
std::pair< int, PrimaryVertexAssignment::Quality > PrimaryVertexSorter< std::vector< reco::PFCandidate > >::runAlgo ( const reco::VertexCollection vertices,
const reco::PFCandidate pf,
const edm::ValueMap< float > *  trackTimeTag,
const edm::ValueMap< float > *  trackTimeResoTag,
const edm::View< reco::Candidate > &  jets,
const TransientTrackBuilder builder 
)
private

Definition at line 356 of file PrimaryVertexSorter.h.

References PrimaryVertexSorter< ParticlesCollection >::assignmentAlgo_, and PrimaryVertexAssignment::chargedHadronVertex().

358 {
359  return assignmentAlgo_.chargedHadronVertex( vertices, pf, jets, builder);
360 }
std::pair< int, PrimaryVertexAssignment::Quality > chargedHadronVertex(const reco::VertexCollection &vertices, const reco::TrackRef &trackRef, const reco::Track *track, float trackTime, float trackTimeResolution, const edm::View< reco::Candidate > &jets, const TransientTrackBuilder &builder) const
PrimaryVertexAssignment assignmentAlgo_
template<class ParticlesCollection>
VertexCollection PrimaryVertexSorter< ParticlesCollection >::sortedList ( const reco::VertexCollection primaryVertex) const

Definition at line 8 of file PrimaryVertexSorter.cc.

Referenced by QualityCutsAnalyzer::LoopOverJetTracksAssociation().

9 {
10  VertexCollection pvs = unsortedPVColl;
11  sort(pvs.begin(), pvs.end(), VertexHigherPtSquared());
12  return pvs;
13 }
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9

Member Data Documentation

template<class ParticlesCollection>
PrimaryVertexAssignment PrimaryVertexSorter< ParticlesCollection >::assignmentAlgo_
private
template<class ParticlesCollection>
bool PrimaryVertexSorter< ParticlesCollection >::produceOriginalMapping_
private
template<class ParticlesCollection>
bool PrimaryVertexSorter< ParticlesCollection >::producePFNoPileUp_
private
template<class ParticlesCollection>
bool PrimaryVertexSorter< ParticlesCollection >::producePFPileUp_
private
template<class ParticlesCollection>
bool PrimaryVertexSorter< ParticlesCollection >::produceSortedVertices_
private
template<class ParticlesCollection>
int PrimaryVertexSorter< ParticlesCollection >::qualityCut_
private
template<class ParticlesCollection>
PrimaryVertexSorting PrimaryVertexSorter< ParticlesCollection >::sortingAlgo_
private
template<class ParticlesCollection>
edm::EDGetTokenT<PFCollection> PrimaryVertexSorter< ParticlesCollection >::tokenCandidates_
private

Candidates to be analyzed.

Definition at line 52 of file PrimaryVertexSorter.h.

Referenced by PrimaryVertexSorter< ParticlesCollection >::produce().

template<class ParticlesCollection>
edm::EDGetTokenT<edm::View<reco::Candidate> > PrimaryVertexSorter< ParticlesCollection >::tokenJets_
private
template<class ParticlesCollection>
edm::EDGetTokenT<edm::ValueMap<float> > PrimaryVertexSorter< ParticlesCollection >::tokenTrackTimeResoTag_
private
template<class ParticlesCollection>
edm::EDGetTokenT<edm::ValueMap<float> > PrimaryVertexSorter< ParticlesCollection >::tokenTrackTimeTag_
private
template<class ParticlesCollection>
edm::EDGetTokenT<reco::VertexCollection> PrimaryVertexSorter< ParticlesCollection >::tokenVertices_
private

vertices

Definition at line 55 of file PrimaryVertexSorter.h.

Referenced by PrimaryVertexSorter< ParticlesCollection >::produce().

template<class ParticlesCollection>
bool PrimaryVertexSorter< ParticlesCollection >::useMET_
private
template<class ParticlesCollection>
bool PrimaryVertexSorter< ParticlesCollection >::useTiming_
private