CMS 3D CMS Logo

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

Store electron partner track conversion-rejection quantities ("dist" and "dcot") in the TP tree. More...

Inheritance diagram for ElectronConversionRejectionVars:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronConversionRejectionVars (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~ElectronConversionRejectionVars () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< reco::GsfElectronCollectiongsfElecsToken_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
 
edm::EDGetTokenT< reco::TrackCollectiontracksToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Store electron partner track conversion-rejection quantities ("dist" and "dcot") in the TP tree.

Author
Kalanand Mishra Fermi National Accelerator Laboratory

Definition at line 31 of file ElectronConversionRejectionVars.cc.

Constructor & Destructor Documentation

◆ ElectronConversionRejectionVars()

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

Definition at line 44 of file ElectronConversionRejectionVars.cc.

46  tracksToken_(consumes<reco::TrackCollection>(edm::InputTag("generalTracks"))),
47  gsfElecsToken_(consumes<reco::GsfElectronCollection>(edm::InputTag("gsfElectrons"))) {
48  produces<edm::ValueMap<float>>("dist");
49  produces<edm::ValueMap<float>>("dcot");
50  produces<edm::ValueMap<float>>("convradius");
51  produces<edm::ValueMap<float>>("passConvRej");
52 }

◆ ~ElectronConversionRejectionVars()

ElectronConversionRejectionVars::~ElectronConversionRejectionVars ( )
override

Definition at line 54 of file ElectronConversionRejectionVars.cc.

54 {}

Member Function Documentation

◆ produce()

void ElectronConversionRejectionVars::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 56 of file ElectronConversionRejectionVars.cc.

56  {
57  using namespace edm;
58 
59  // read input
63 
64  iEvent.getByToken(probesToken_, probes);
65  iEvent.getByToken(tracksToken_, tracks_h);
66  iEvent.getByToken(gsfElecsToken_, elHandle);
67 
68  float evt_bField = 3.8;
69 
70  // prepare vector for output
71  std::vector<float> values;
72  std::vector<float> values2;
73  std::vector<float> values3;
74  std::vector<float> values4;
75 
76  // fill: use brute force
77  double dist = 0.0;
78  double dcot = 0.0;
79  double convradius = 0.0;
80  double passConvRej = 0.0;
81 
82  View<reco::Candidate>::const_iterator probe, endprobes = probes->end();
84  reco::GsfElectronCollection::const_iterator eleIt = electronCollection->begin();
85 
86  for (probe = probes->begin(); probe != endprobes; ++probe) {
87  for (eleIt = electronCollection->begin(); eleIt != electronCollection->end(); eleIt++) {
88  if (fabs(eleIt->et() - probe->et()) < 0.05 && fabs(eleIt->eta() - probe->eta()) < 0.01 &&
89  fabs(eleIt->phi() - probe->phi()) < 0.01) {
90  //we have a match
91  ConversionInfo convInfo = egammaTools::getConversionInfo(*eleIt, tracks_h, evt_bField);
92  dist = convInfo.dist;
93  dcot = convInfo.dcot;
94  convradius = convInfo.radiusOfConversion;
95  if (fabs(dist) > 0.02 && fabs(dcot) > 0.02)
96  passConvRej = 1.0;
97  break; //got our guy, so break
98  }
99  }
100  values.push_back(dist);
101  values2.push_back(dcot);
102  values3.push_back(convradius);
103  values4.push_back(passConvRej);
104  }
105 
106  // convert into ValueMap and store
107  auto valMap = std::make_unique<ValueMap<float>>();
109  filler.insert(probes, values.begin(), values.end());
110  filler.fill();
111  iEvent.put(std::move(valMap), "dist");
112 
113  // ---> same for dcot
114  auto valMap2 = std::make_unique<ValueMap<float>>();
115  ValueMap<float>::Filler filler2(*valMap2);
116  filler2.insert(probes, values2.begin(), values2.end());
117  filler2.fill();
118  iEvent.put(std::move(valMap2), "dcot");
119 
120  // ---> same for convradius
121  auto valMap3 = std::make_unique<ValueMap<float>>();
122  ValueMap<float>::Filler filler3(*valMap3);
123  filler3.insert(probes, values3.begin(), values3.end());
124  filler3.fill();
125  iEvent.put(std::move(valMap3), "convradius");
126 
127  // ---> same for passConvRej
128  auto valMap4 = std::make_unique<ValueMap<float>>();
129  ValueMap<float>::Filler filler4(*valMap4);
130  filler4.insert(probes, values4.begin(), values4.end());
131  filler4.fill();
132  iEvent.put(std::move(valMap4), "passConvRej");
133 }

References ConversionInfo::dcot, ConversionInfo::dist, pdwgLeptonRecoSkim_cfi::electronCollection, trigObjTnPSource_cfi::filler, egammaTools::getConversionInfo(), gsfElecsToken_, iEvent, eostools::move(), probesToken_, edm::Handle< T >::product(), ConversionInfo::radiusOfConversion, tracksToken_, and contentValuesCheck::values.

Member Data Documentation

◆ gsfElecsToken_

edm::EDGetTokenT<reco::GsfElectronCollection> ElectronConversionRejectionVars::gsfElecsToken_
private

Definition at line 41 of file ElectronConversionRejectionVars.cc.

Referenced by produce().

◆ probesToken_

edm::EDGetTokenT<edm::View<reco::Candidate> > ElectronConversionRejectionVars::probesToken_
private

Definition at line 39 of file ElectronConversionRejectionVars.cc.

Referenced by produce().

◆ tracksToken_

edm::EDGetTokenT<reco::TrackCollection> ElectronConversionRejectionVars::tracksToken_
private

Definition at line 40 of file ElectronConversionRejectionVars.cc.

Referenced by produce().

ConversionInfo
Definition: ConversionInfo.h:8
ElectronConversionRejectionVars::gsfElecsToken_
edm::EDGetTokenT< reco::GsfElectronCollection > gsfElecsToken_
Definition: ElectronConversionRejectionVars.cc:41
edm::Handle::product
T const * product() const
Definition: Handle.h:70
ConversionInfo::radiusOfConversion
const double radiusOfConversion
Definition: ConversionInfo.h:11
edm
HLT enums.
Definition: AlignableModifier.h:19
pdwgLeptonRecoSkim_cfi.electronCollection
electronCollection
Definition: pdwgLeptonRecoSkim_cfi.py:5
reco::GsfElectronCollection
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
Definition: GsfElectronFwd.h:14
edm::Handle
Definition: AssociativeIterator.h:50
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
ElectronConversionRejectionVars::probesToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
Definition: ElectronConversionRejectionVars.cc:39
egammaTools::getConversionInfo
ConversionInfo getConversionInfo(const reco::GsfElectronCore &, const edm::Handle< reco::TrackCollection > &ctftracks_h, const edm::Handle< reco::GsfTrackCollection > &gsftracks_h, const double bFieldAtOrigin, const double minFracSharedHits=0.45)
Definition: ConversionFinder.cc:35
edm::View
Definition: CaloClusterFwd.h:14
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
ElectronConversionRejectionVars::tracksToken_
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
Definition: ElectronConversionRejectionVars.cc:40
iEvent
int iEvent
Definition: GenABIO.cc:224
ConversionInfo::dist
const double dist
Definition: ConversionInfo.h:9
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ValueMap
Definition: ValueMap.h:107
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
edm::InputTag
Definition: InputTag.h:15
ConversionInfo::dcot
const double dcot
Definition: ConversionInfo.h:10