CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PixelVertexCollectionTrimmer (const edm::ParameterSet &)
 
 ~PixelVertexCollectionTrimmer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

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

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 40 of file PixelVertexCollectionTrimmer.cc.

Constructor & Destructor Documentation

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

Definition at line 58 of file PixelVertexCollectionTrimmer.cc.

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

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

Definition at line 78 of file PixelVertexCollectionTrimmer.cc.

79 {
80 }

Member Function Documentation

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

Definition at line 123 of file PixelVertexCollectionTrimmer.cc.

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

123  {
124  //The following says we do not know what parameters are allowed so do no validation
125  // Please change this to state exactly what you do use, even if it is no parameters
127  desc.add<edm::InputTag> ("src", edm::InputTag(""))
128  ->setComment("input (pixel) vertex collection");
129  desc.add<unsigned int> ("maxVtx", 100)
130  ->setComment("max output collection size (number of accepted vertices)");
131  desc.add<double> ("fractionSumPt2", 0.3)
132  ->setComment("threshold on sumPt2 fraction of the leading vertex");
133  desc.add<double> ("minSumPt2", 0. )
134  ->setComment("min sumPt2");
135  edm::ParameterSetDescription PVcomparerPSet;
136  PVcomparerPSet.add<double>("track_pt_min",1.0)
137  ->setComment("min track p_T");
138  PVcomparerPSet.add<double>("track_pt_max",10.0)
139  ->setComment("max track p_T");
140  PVcomparerPSet.add<double>("track_chi2_max",99999.)
141  ->setComment("max track chi2");
142  PVcomparerPSet.add<double>("track_prob_min",-1.)
143  ->setComment("min track prob");
144  desc.add<edm::ParameterSetDescription>("PVcomparer", PVcomparerPSet)
145  ->setComment("from RecoPixelVertexing/PixelVertexFinding/python/PVClusterComparer_cfi.py");
146  descriptions.add("hltPixelVertexCollectionTrimmer",desc);
147 }
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 
)
overrideprivatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 84 of file PixelVertexCollectionTrimmer.cc.

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

85 {
86  using namespace edm;
87 
88  std::auto_ptr<reco::VertexCollection> vtxs_trim(new reco::VertexCollection);
89 
91  iEvent.getByToken(vtxToken_,vtxs);
92 
93  double sumpt2 ;
94  //double sumpt2previous = -99. ;
95 
96  // this is not the logic we want, at least for now
97  // if requires the sumpt2 for vtx_n to be > threshold * sumpt2 vtx_n-1
98  // for (reco::VertexCollection::const_iterator vtx = vtxs->begin(); vtx != vtxs->end(); ++vtx, ++counter){
99  // if (counter > maxVtx_) break ;
100  // sumpt2 = PVCluster.pTSquaredSum(*vtx) ;
101  // if (sumpt2 > sumpt2previous*fractionSumPt2_ && sumpt2 > minSumPt2_ ) vtxs_trim->push_back(*vtx) ;
102  // else if (counter == 0 ) vtxs_trim->push_back(*vtx) ;
103  // sumpt2previous = sumpt2 ;
104  // }
105 
106  double sumpt2first = pvComparer_->pTSquaredSum(*(vtxs->begin())) ;
107 
108  for (reco::VertexCollection::const_iterator vtx = vtxs->begin(), evtx=vtxs->end();
109  vtx != evtx; ++vtx) {
110  if (vtxs_trim->size() >= maxVtx_) break ;
111  sumpt2 = pvComparer_->pTSquaredSum(*vtx) ;
112  // std::cout << "sumpt2: " << sumpt2 << "[" << sumpt2first << "]" << std::endl;
113  // if (sumpt2 >= sumpt2first*fractionSumPt2_ && sumpt2 > minSumPt2_ ) vtxs_trim->push_back(*vtx) ;
114  if (sumpt2 >= sumpt2first*fractionSumPt2_ && sumpt2 > minSumPt2_ ) vtxs_trim->push_back(*vtx) ;
115  }
116  // std::cout << " ==> # vertices: " << vtxs_trim->size() << std::endl;
117  iEvent.put(vtxs_trim);
118 
119 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
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_

Member Data Documentation

double PixelVertexCollectionTrimmer::fractionSumPt2_
private

Definition at line 52 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().

unsigned int PixelVertexCollectionTrimmer::maxVtx_
private

Definition at line 51 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().

double PixelVertexCollectionTrimmer::minSumPt2_
private

Definition at line 53 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().

PVClusterComparer* PixelVertexCollectionTrimmer::pvComparer_
private

Definition at line 55 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().

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

Definition at line 50 of file PixelVertexCollectionTrimmer.cc.

Referenced by PixelVertexCollectionTrimmer(), and produce().