CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
L1ElectronRecoTreeProducer Class Reference
Inheritance diagram for L1ElectronRecoTreeProducer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1ElectronRecoTreeProducer (const edm::ParameterSet &)
 
 ~L1ElectronRecoTreeProducer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Public Attributes

L1Analysis::L1AnalysisRecoElectronelectron
 
L1Analysis::L1AnalysisRecoElectronDataFormatelectron_data
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob (void) override
 
void endJob () override
 

Private Attributes

edm::EDGetTokenT< edm::ValueMap< bool > > ElectronLooseIdMapToken_
 
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronMediumIdMapToken_
 
bool electronsMissing_
 
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronTightIdMapToken_
 
edm::EDGetTokenT< reco::GsfElectronCollectionElectronToken_
 
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronVetoIdMapToken_
 
edm::Service< TFileServicefs_
 
unsigned int maxElectron_
 
TTree * tree_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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

Definition at line 45 of file L1ElectronRecoTreeProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 86 of file L1ElectronRecoTreeProducer.cc.

References electron, electron_data, ElectronLooseIdMapToken_, ElectronMediumIdMapToken_, ElectronTightIdMapToken_, ElectronToken_, ElectronVetoIdMapToken_, fs_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), TFileService::make(), maxElectron_, and tree_.

86  :
87  electronsMissing_(false)
88 {
89 
90  maxElectron_ = iConfig.getParameter<unsigned int>("maxElectron");
91  //ElectronToken_ = mayConsume<edm::View<reco::GsfElectron> >(iConfig.getUntrackedParameter("ElectronToken",edm::InputTag("gedGsfElectrons")));
92  ElectronToken_ = consumes<reco::GsfElectronCollection>(iConfig.getUntrackedParameter("ElectronToken",edm::InputTag("gedGsfElectrons")));
93 
94  /*RhoToken_ = consumes<double>(iConfig.getUntrackedParameter("RhoToken",edm::InputTag("fixedGridRhoFastjetAllCalo")));
95  vtxToken_ = mayConsume<reco::VertexCollection>(iConfig.getUntrackedParameter("vtxToken",edm::InputTag("offlinePrimaryVertices")));
96  conversionsToken_ = mayConsume< reco::ConversionCollection >(iConfig.getUntrackedParameter("conversionsToken",edm::InputTag("conversions")));
97  beamSpotToken_ = mayConsume< reco::BeamSpot>(iConfig.getUntrackedParameter("beamSpotToken",edm::InputTag("offlineBeamSpot")));*/
98 
99  ElectronVetoIdMapToken_ = consumes<edm::ValueMap<bool> >(iConfig.getUntrackedParameter("eleVetoIdMapToken",edm::InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-veto")));
100  ElectronLooseIdMapToken_ = consumes<edm::ValueMap<bool> >(iConfig.getUntrackedParameter("eleLooseIdMapToken",edm::InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-loose")));
101  ElectronMediumIdMapToken_ = consumes<edm::ValueMap<bool> >(iConfig.getUntrackedParameter("eleMediumIdMapToken",edm::InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-medium")));
102  ElectronTightIdMapToken_ = consumes<edm::ValueMap<bool> >(iConfig.getUntrackedParameter("eleTightIdMapToken",edm::InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-tight")));
103 
105  electron_data = electron->getData();
106 
107  tree_=fs_->make<TTree>("ElectronRecoTree", "ElectronRecoTree");
108  tree_->Branch("Electron", "L1Analysis::L1AnalysisRecoElectronDataFormat", &electron_data, 32000, 3);
109 
110 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::Service< TFileService > fs_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< reco::GsfElectronCollection > ElectronToken_
L1Analysis::L1AnalysisRecoElectron * electron
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronMediumIdMapToken_
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronLooseIdMapToken_
L1Analysis::L1AnalysisRecoElectronDataFormat * electron_data
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronTightIdMapToken_
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronVetoIdMapToken_
L1ElectronRecoTreeProducer::~L1ElectronRecoTreeProducer ( )
override

Definition at line 113 of file L1ElectronRecoTreeProducer.cc.

114 {
115 
116  // do anything here that needs to be done at desctruction time
117  // (e.g. close files, deallocate resources etc.)
118 
119 }

Member Function Documentation

void L1ElectronRecoTreeProducer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 127 of file L1ElectronRecoTreeProducer.cc.

References electron, ElectronLooseIdMapToken_, ElectronMediumIdMapToken_, electronsMissing_, ElectronTightIdMapToken_, ElectronToken_, ElectronVetoIdMapToken_, edm::Event::getByToken(), edm::HandleBase::isValid(), maxElectron_, L1Analysis::L1AnalysisRecoElectron::Reset(), L1Analysis::L1AnalysisRecoElectron::SetElectron(), and tree_.

128 {
129 
130  electron->Reset();
131  //edm::Handle<edm::View<reco::GsfElectron> > recoElectrons;
132  //iEvent.getByToken(ElectronToken_, recoElectrons);
134  iEvent.getByToken(ElectronToken_, recoElectrons);
135 
136  std::vector<edm::Handle<edm::ValueMap<bool> > > eleVIDDecisionHandles(4) ;
137 
138  iEvent.getByToken (ElectronVetoIdMapToken_ , eleVIDDecisionHandles[0]) ;
139  iEvent.getByToken (ElectronLooseIdMapToken_ , eleVIDDecisionHandles[1]) ;
140  iEvent.getByToken (ElectronMediumIdMapToken_ , eleVIDDecisionHandles[2]) ;
141  iEvent.getByToken (ElectronTightIdMapToken_ , eleVIDDecisionHandles[3]) ;
142 
143  if (recoElectrons.isValid() && eleVIDDecisionHandles[0].isValid() && eleVIDDecisionHandles[1].isValid() && eleVIDDecisionHandles[2].isValid() && eleVIDDecisionHandles[3].isValid() ) {
144  electron->SetElectron(iEvent, iSetup, recoElectrons, eleVIDDecisionHandles, maxElectron_);
145  }
146  else {
147  if (!electronsMissing_) {edm::LogWarning("MissingProduct") << "CaloJets not found. Branch will not be filled" << std::endl;}
148  electronsMissing_ = true;
149  }
150 
151  tree_->Fill();
152 
153 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< reco::GsfElectronCollection > ElectronToken_
L1Analysis::L1AnalysisRecoElectron * electron
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronMediumIdMapToken_
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronLooseIdMapToken_
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronTightIdMapToken_
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronVetoIdMapToken_
void SetElectron(const edm::Event &event, const edm::EventSetup &setup, const edm::Handle< reco::GsfElectronCollection > electrons, const std::vector< edm::Handle< edm::ValueMap< bool > > > eleVIDDecisionHandles, const unsigned &maxElectron)
void L1ElectronRecoTreeProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 157 of file L1ElectronRecoTreeProducer.cc.

158 {
159 }
void L1ElectronRecoTreeProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 163 of file L1ElectronRecoTreeProducer.cc.

References DEFINE_FWK_MODULE.

163  {
164 }

Member Data Documentation

L1Analysis::L1AnalysisRecoElectron* L1ElectronRecoTreeProducer::electron

Definition at line 57 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

L1Analysis::L1AnalysisRecoElectronDataFormat* L1ElectronRecoTreeProducer::electron_data

Definition at line 59 of file L1ElectronRecoTreeProducer.cc.

Referenced by L1ElectronRecoTreeProducer().

edm::EDGetTokenT<edm::ValueMap<bool> > L1ElectronRecoTreeProducer::ElectronLooseIdMapToken_
private

Definition at line 74 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

edm::EDGetTokenT<edm::ValueMap<bool> > L1ElectronRecoTreeProducer::ElectronMediumIdMapToken_
private

Definition at line 75 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

bool L1ElectronRecoTreeProducer::electronsMissing_
private

Definition at line 79 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze().

edm::EDGetTokenT<edm::ValueMap<bool> > L1ElectronRecoTreeProducer::ElectronTightIdMapToken_
private

Definition at line 76 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

edm::EDGetTokenT<reco::GsfElectronCollection> L1ElectronRecoTreeProducer::ElectronToken_
private

Definition at line 72 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

edm::EDGetTokenT<edm::ValueMap<bool> > L1ElectronRecoTreeProducer::ElectronVetoIdMapToken_
private

Definition at line 73 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

edm::Service<TFileService> L1ElectronRecoTreeProducer::fs_
private

Definition at line 64 of file L1ElectronRecoTreeProducer.cc.

Referenced by L1ElectronRecoTreeProducer().

unsigned int L1ElectronRecoTreeProducer::maxElectron_
private

Definition at line 80 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

TTree* L1ElectronRecoTreeProducer::tree_
private

Definition at line 67 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().