CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PixelVertexCollectionTrimmer Class Reference

#include <RecoPixelVertexing/PixelVertexFinding/src/PixelVertexCollectionTrimmer.cc>

Inheritance diagram for PixelVertexCollectionTrimmer:
edm::stream::EDProducer<>

Public Member Functions

 PixelVertexCollectionTrimmer (const edm::ParameterSet &)
 
 ~PixelVertexCollectionTrimmer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double fractionSumPt2_
 
unsigned int maxVtx_
 
double minSumPt2_
 
PVClusterComparerpvComparer_
 
edm::EDGetTokenT< reco::VertexCollectionvtxToken_
 

Additional Inherited Members

- 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
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 39 of file PixelVertexCollectionTrimmer.cc.

Constructor & Destructor Documentation

PixelVertexCollectionTrimmer::PixelVertexCollectionTrimmer ( const edm::ParameterSet iConfig)
explicit

Definition at line 57 of file PixelVertexCollectionTrimmer.cc.

References fractionSumPt2_, edm::ParameterSet::getParameter(), maxVtx_, minSumPt2_, pvComparer_, HLT_2018_cff::track_chi2_max, HLT_2018_cff::track_prob_min, HLT_2018_cff::track_pt_max, HLT_2018_cff::track_pt_min, L1TMuonDQMOffline_cfi::vtxInputTag, and vtxToken_.

57  {
59  vtxToken_ = consumes<reco::VertexCollection>(vtxInputTag);
60  maxVtx_ = iConfig.getParameter<unsigned int>("maxVtx");
61  fractionSumPt2_ = iConfig.getParameter<double>("fractionSumPt2");
62  minSumPt2_ = iConfig.getParameter<double>("minSumPt2");
63 
64  edm::ParameterSet PVcomparerPSet = iConfig.getParameter<edm::ParameterSet>("PVcomparer");
65  double track_pt_min = PVcomparerPSet.getParameter<double>("track_pt_min");
66  double track_pt_max = PVcomparerPSet.getParameter<double>("track_pt_max");
67  double track_chi2_max = PVcomparerPSet.getParameter<double>("track_chi2_max");
68  double track_prob_min = PVcomparerPSet.getParameter<double>("track_prob_min");
69 
70  pvComparer_ = new PVClusterComparer(track_pt_min, track_pt_max, track_chi2_max, track_prob_min);
71 
72  produces<reco::VertexCollection>();
73 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
PixelVertexCollectionTrimmer::~PixelVertexCollectionTrimmer ( )
override

Definition at line 75 of file PixelVertexCollectionTrimmer.cc.

75 {}

Member Function Documentation

void PixelVertexCollectionTrimmer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 115 of file PixelVertexCollectionTrimmer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_MODULE, HLT_2018_cff::InputTag, and edm::ParameterDescriptionNode::setComment().

115  {
116  //The following says we do not know what parameters are allowed so do no validation
117  // Please change this to state exactly what you do use, even if it is no parameters
119  desc.add<edm::InputTag>("src", edm::InputTag(""))->setComment("input (pixel) vertex collection");
120  desc.add<unsigned int>("maxVtx", 100)->setComment("max output collection size (number of accepted vertices)");
121  desc.add<double>("fractionSumPt2", 0.3)->setComment("threshold on sumPt2 fraction of the leading vertex");
122  desc.add<double>("minSumPt2", 0.)->setComment("min sumPt2");
123  edm::ParameterSetDescription PVcomparerPSet;
124  PVcomparerPSet.add<double>("track_pt_min", 1.0)->setComment("min track p_T");
125  PVcomparerPSet.add<double>("track_pt_max", 10.0)->setComment("max track p_T");
126  PVcomparerPSet.add<double>("track_chi2_max", 99999.)->setComment("max track chi2");
127  PVcomparerPSet.add<double>("track_prob_min", -1.)->setComment("min track prob");
128  desc.add<edm::ParameterSetDescription>("PVcomparer", PVcomparerPSet)
129  ->setComment("from RecoPixelVertexing/PixelVertexFinding/python/PVClusterComparer_cfi.py");
130  descriptions.add("hltPixelVertexCollectionTrimmer", desc);
131 }
void setComment(std::string const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PixelVertexCollectionTrimmer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 78 of file PixelVertexCollectionTrimmer.cc.

References fractionSumPt2_, edm::Event::getByToken(), maxVtx_, minSumPt2_, eostools::move(), PVClusterComparer::pTSquaredSum(), edm::Event::put(), pvComparer_, badGlobalMuonTaggersAOD_cff::vtx, and vtxToken_.

78  {
79  using namespace edm;
80 
81  auto vtxs_trim = std::make_unique<reco::VertexCollection>();
82 
84  iEvent.getByToken(vtxToken_, vtxs);
85 
86  double sumpt2;
87  //double sumpt2previous = -99. ;
88 
89  // this is not the logic we want, at least for now
90  // if requires the sumpt2 for vtx_n to be > threshold * sumpt2 vtx_n-1
91  // for (reco::VertexCollection::const_iterator vtx = vtxs->begin(); vtx != vtxs->end(); ++vtx, ++counter){
92  // if (counter > maxVtx_) break ;
93  // sumpt2 = PVCluster.pTSquaredSum(*vtx) ;
94  // if (sumpt2 > sumpt2previous*fractionSumPt2_ && sumpt2 > minSumPt2_ ) vtxs_trim->push_back(*vtx) ;
95  // else if (counter == 0 ) vtxs_trim->push_back(*vtx) ;
96  // sumpt2previous = sumpt2 ;
97  // }
98 
99  double sumpt2first = pvComparer_->pTSquaredSum(*(vtxs->begin()));
100 
101  for (reco::VertexCollection::const_iterator vtx = vtxs->begin(), evtx = vtxs->end(); vtx != evtx; ++vtx) {
102  if (vtxs_trim->size() >= maxVtx_)
103  break;
104  sumpt2 = pvComparer_->pTSquaredSum(*vtx);
105  // std::cout << "sumpt2: " << sumpt2 << "[" << sumpt2first << "]" << std::endl;
106  // if (sumpt2 >= sumpt2first*fractionSumPt2_ && sumpt2 > minSumPt2_ ) vtxs_trim->push_back(*vtx) ;
107  if (sumpt2 >= sumpt2first * fractionSumPt2_ && sumpt2 > minSumPt2_)
108  vtxs_trim->push_back(*vtx);
109  }
110  // std::cout << " ==> # vertices: " << vtxs_trim->size() << std::endl;
111  iEvent.put(std::move(vtxs_trim));
112 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
double pTSquaredSum(const PVCluster &v)
Calculate sum of square of the pT&#39;s of the tracks in the vertex.
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
HLT enums.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

double PixelVertexCollectionTrimmer::fractionSumPt2_
private

Definition at line 51 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().

unsigned int PixelVertexCollectionTrimmer::maxVtx_
private

Definition at line 50 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().

double PixelVertexCollectionTrimmer::minSumPt2_
private

Definition at line 52 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().

PVClusterComparer* PixelVertexCollectionTrimmer::pvComparer_
private

Definition at line 54 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().

edm::EDGetTokenT<reco::VertexCollection> PixelVertexCollectionTrimmer::vtxToken_
private

Definition at line 49 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().