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)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~ElectronConversionRejectionVars ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 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
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)
 
- 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

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

Author
Kalanand Mishra Fermi National Accelerator Laboratory

Definition at line 33 of file ElectronConversionRejectionVars.cc.

Constructor & Destructor Documentation

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

Definition at line 46 of file ElectronConversionRejectionVars.cc.

46  :
48  tracksToken_(consumes<reco::TrackCollection>(edm::InputTag("generalTracks"))) ,
49  gsfElecsToken_(consumes<reco::GsfElectronCollection>(edm::InputTag("gsfElectrons")))
50 {
51  produces<edm::ValueMap<float> >("dist");
52  produces<edm::ValueMap<float> >("dcot");
53  produces<edm::ValueMap<float> >("convradius");
54  produces<edm::ValueMap<float> >("passConvRej");
55 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
edm::EDGetTokenT< reco::GsfElectronCollection > gsfElecsToken_
ElectronConversionRejectionVars::~ElectronConversionRejectionVars ( )
virtual

Definition at line 58 of file ElectronConversionRejectionVars.cc.

59 {
60 }

Member Function Documentation

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

Definition at line 63 of file ElectronConversionRejectionVars.cc.

References ConversionInfo::dcot(), DEFINE_FWK_MODULE, ConversionInfo::dist(), ElectronMcFakeValidator_cfi::electronCollection, objects.autophobj::filler, edm::Event::getByToken(), ConversionFinder::getConversionInfo(), gsfElecsToken_, eostools::move(), probesToken_, edm::Handle< T >::product(), edm::Event::put(), ConversionInfo::radiusOfConversion(), tracksToken_, and MuonErrorMatrixValues_cff::values.

63  {
64  using namespace edm;
65 
66  // read input
70 
71  iEvent.getByToken(probesToken_, probes);
72  iEvent.getByToken(tracksToken_, tracks_h );
73  iEvent.getByToken(gsfElecsToken_, elHandle);
74 
75  float evt_bField = 3.8;
76 
77 
78  // prepare vector for output
79  std::vector<float> values;
80  std::vector<float> values2;
81  std::vector<float> values3;
82  std::vector<float> values4;
83 
84  // fill: use brute force
85  double dist = 0.0;
86  double dcot = 0.0;
87  double convradius = 0.0;
88  double passConvRej = 0.0;
89  ConversionFinder convFinder;
90 
91  View<reco::Candidate>::const_iterator probe, endprobes = probes->end();
93  reco::GsfElectronCollection::const_iterator eleIt = electronCollection->begin();
94 
95  for (probe = probes->begin(); probe != endprobes; ++probe) {
96  for (eleIt=electronCollection->begin(); eleIt!=electronCollection->end(); eleIt++) {
97  if( fabs(eleIt->et() - probe->et() ) < 0.05 && fabs(eleIt->eta() - probe->eta() ) < 0.01
98  && fabs(eleIt->phi() - probe->phi() ) < 0.01 ){
99  //we have a match
100  ConversionInfo convInfo = convFinder.getConversionInfo(*eleIt, tracks_h, evt_bField);
101  dist = convInfo.dist();
102  dcot = convInfo.dcot();
103  convradius = convInfo.radiusOfConversion();
104  if( fabs(dist)>0.02 && fabs(dcot)>0.02) passConvRej = 1.0;
105  break; //got our guy, so break
106  }
107  }
108  values.push_back(dist);
109  values2.push_back(dcot);
110  values3.push_back(convradius);
111  values4.push_back(passConvRej);
112  }
113 
114 
115  // convert into ValueMap and store
116  auto valMap = std::make_unique<ValueMap<float>>();
118  filler.insert(probes, values.begin(), values.end());
119  filler.fill();
120  iEvent.put(std::move(valMap), "dist");
121 
122 
123  // ---> same for dcot
124  auto valMap2 = std::make_unique<ValueMap<float>>();
125  ValueMap<float>::Filler filler2(*valMap2);
126  filler2.insert(probes, values2.begin(), values2.end());
127  filler2.fill();
128  iEvent.put(std::move(valMap2), "dcot");
129 
130  // ---> same for convradius
131  auto valMap3 = std::make_unique<ValueMap<float>>();
132  ValueMap<float>::Filler filler3(*valMap3);
133  filler3.insert(probes, values3.begin(), values3.end());
134  filler3.fill();
135  iEvent.put(std::move(valMap3), "convradius");
136 
137 
138  // ---> same for passConvRej
139  auto valMap4 = std::make_unique<ValueMap<float>>();
140  ValueMap<float>::Filler filler4(*valMap4);
141  filler4.insert(probes, values4.begin(), values4.end());
142  filler4.fill();
143  iEvent.put(std::move(valMap4), "passConvRej");
144 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
double radiusOfConversion() const
edm::EDGetTokenT< edm::View< reco::Candidate > > probesToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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)
double dist() const
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
edm::EDGetTokenT< reco::GsfElectronCollection > gsfElecsToken_
T const * product() const
Definition: Handle.h:81
HLT enums.
double dcot() const
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 43 of file ElectronConversionRejectionVars.cc.

Referenced by produce().

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

Definition at line 41 of file ElectronConversionRejectionVars.cc.

Referenced by produce().

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

Definition at line 42 of file ElectronConversionRejectionVars.cc.

Referenced by produce().